public class LocationType extends java.lang.Object implements XmlOutputMethods, java.io.Serializable, java.lang.Comparable<LocationType>, java.lang.Cloneable
XmlOutputMethods
and the
variable DEFAULT_ROOT_ELEMENT
. If not the root element of the output
XML will be the one of the parent class.load(String)
to
perfect results. It can be something like this:
public boolean load (String xml)
{
try
{
boolean res = super.load(xml);
if (!res)
throw new DocumentException();
...
} catch (DocumentException e)
{
NeptusLog.pub().error(e.getMessage(), e);
return false;
}
return true;
}
Modifier and Type | Field and Description |
---|---|
static LocationType |
ABSOLUTE_ZERO |
protected double |
azimuth |
protected static java.lang.String |
DEFAULT_ROOT_ELEMENT |
static LocationType |
FEUP |
protected java.lang.String |
id |
protected double |
latitudeRads |
protected double |
longitudeRads |
protected java.lang.String |
name |
protected double |
offsetDistance |
static double |
ONE_LAT_DEGREE |
protected double |
zenith |
Constructor and Description |
---|
LocationType() |
LocationType(double latitudeDegrees,
double longitudeDegrees) |
LocationType(LocationType anotherLocation) |
LocationType(java.lang.String xml) |
Modifier and Type | Method and Description |
---|---|
org.dom4j.Document |
asDocument() |
org.dom4j.Document |
asDocument(java.lang.String rootElementName) |
org.dom4j.Element |
asElement() |
org.dom4j.Element |
asElement(java.lang.String rootElementName) |
org.dom4j.Element |
asGPXRoutePoint() |
org.dom4j.Element |
asGPXWaypointElement(java.lang.String wptName) |
org.dom4j.Element |
asGPXWaypointElement(java.lang.String wptName,
java.lang.String symbol,
java.lang.String desc) |
java.lang.String |
asXML()
Este problema foi resolvido com a versão 1.6.1 do DOM4J.
|
java.lang.String |
asXML(java.lang.String rootElementName)
Este problema foi resolvido com a versão 1.6.1 do DOM4J.
|
static LocationType |
clipboardLocation() |
protected java.lang.Object |
clone() |
int |
compareTo(LocationType o) |
<L extends LocationType> |
convertToAbsoluteLatLonDepth()
Converts this Location to absolute (Lat/Lon/Depth without offsets).
|
boolean |
equals(java.lang.Object obj) |
boolean |
fromClipboardText(java.lang.String text) |
double[] |
getAbsoluteLatLonDepth() |
double[] |
getAbsoluteNEDInMeters() |
double |
getAllZ()
Combines absolute z and additional offset values and returns the result
|
double |
getAzimuth() |
java.lang.String |
getClipboardText() |
java.lang.String |
getDebugString() |
double |
getDepth() |
double |
getDistanceInMeters(LocationType anotherLocation)
Returns the distance relative to other location, in meters
|
double[] |
getDistanceInPixelTo(LocationType target,
int levelOfDetail)
Get distance in pixels to the target point in the given level
|
double |
getHeight() |
double |
getHorizontalDistanceInMeters(LocationType anotherLocation)
Returns the distance relative to other location, in meters
|
java.lang.String |
getId() |
java.lang.String |
getLatitudeAsPrettyString() |
java.lang.String |
getLatitudeAsPrettyString(LatLonFormatEnum format) |
double |
getLatitudeDegs() |
double |
getLatitudeRads() |
java.lang.String |
getLatitudeStr() |
java.lang.String |
getLongitudeAsPrettyString() |
java.lang.String |
getLongitudeAsPrettyString(LatLonFormatEnum format) |
double |
getLongitudeDegs() |
double |
getLongitudeRads() |
java.lang.String |
getLongitudeStr() |
java.lang.String |
getName() |
<L extends LocationType> |
getNewAbsoluteLatLonDepth()
Converts a copy of this Location to absolute (Lat/Lon/Depth without offsets).
|
double |
getOffsetDistance() |
double |
getOffsetDown() |
double |
getOffsetEast() |
double[] |
getOffsetFrom(LocationType otherLocation)
This method gives a vector from otherLocation to this location
|
double |
getOffsetNorth() |
double |
getOffsetSouth() |
double |
getOffsetUp() |
double |
getOffsetWest() |
double |
getPixelDistanceTo(LocationType target,
int levelOfDetail)
Get distance in pixels to the target point in the given level
|
java.awt.geom.Point2D |
getPointInPixel(int levelOfDetail)
Get global x y coordinates of this location in a given level of details (map size)
|
double |
getXYAngle(LocationType anotherLocation) |
double |
getXYDistanceToLine(LocationType pt1,
LocationType pt2) |
double |
getZenith() |
boolean |
isLocationEqual(LocationType location)
Compares 2 locations
|
boolean |
isOffsetEastUsed() |
boolean |
isOffsetNorthUsed() |
boolean |
isOffsetUpUsed() |
boolean |
load(org.dom4j.Document doc) |
boolean |
load(org.dom4j.Element elem) |
boolean |
load(java.lang.String xml) |
static void |
LocationTypeTest() |
static void |
main(java.lang.String[] args) |
protected void |
makeTotalDepthZero()
Sets both z and down offsets to zero.
|
void |
setAbsoluteDepth(double z)
Calls
makeTotalDepthZero() and then sets the value of depth to the given value |
void |
setAzimuth(double azimuth) |
void |
setDepth(double depth) |
void |
setHeight(double height) |
void |
setId(java.lang.String id) |
void |
setLatitudeDegs(double latitude) |
void |
setLatitudeRads(double latitudeRads) |
void |
setLatitudeStr(java.lang.String latitude) |
void |
setLocation(LocationType anotherPoint)
Copies the given location to this one.
|
void |
setLocationByPixel(double x,
double y,
int levelOfDetail) |
void |
setLongitudeDegs(double longitude) |
void |
setLongitudeRads(double longitudeRads) |
void |
setLongitudeStr(java.lang.String longitude) |
void |
setName(java.lang.String name) |
void |
setOffsetDistance(double offsetDistance) |
void |
setOffsetDown(double offsetDown) |
void |
setOffsetDown(double offsetDown,
boolean useOffsetDownInXMLOutput) |
void |
setOffsetEast(double offsetEast) |
void |
setOffsetEast(double offsetEast,
boolean useOffsetEastInXMLOutput) |
void |
setOffsetEastUsed(boolean isOffsetEastUsed) |
void |
setOffsetNorth(double offsetNorth) |
void |
setOffsetNorth(double offsetNorth,
boolean useOffsetNorthInXMLOutput) |
void |
setOffsetNorthUsed(boolean isOffsetNorthUsed) |
void |
setOffsetSouth(double offsetSouth) |
void |
setOffsetSouth(double offsetSouth,
boolean useOffsetSouthInXMLOutput) |
void |
setOffsetUp(double offsetUp) |
void |
setOffsetUp(double offsetUp,
boolean useOffsetUpInXMLOutput) |
void |
setOffsetUpUsed(boolean isOffsetUpUsed) |
void |
setOffsetWest(double offsetWest) |
void |
setOffsetWest(double offsetWest,
boolean useOffsetWestInXMLOutput) |
void |
setZenith(double zenith) |
java.lang.String |
toString() |
void |
translateInPixel(double deltaX,
double deltaY,
int levelOfDetail)
Translate a location by pixels
|
<L extends LocationType> |
translatePosition(double[] nedOffsets)
This calls
translatePosition(double, double, double) . |
<L extends LocationType> |
translatePosition(double offsetNorth,
double offsetEast,
double offsetDown)
Translate this location by the offsets.
|
static LocationType |
valueOf(java.lang.String value) |
protected static final java.lang.String DEFAULT_ROOT_ELEMENT
public static final LocationType ABSOLUTE_ZERO
public static final LocationType FEUP
public static double ONE_LAT_DEGREE
protected java.lang.String id
protected java.lang.String name
protected double latitudeRads
protected double longitudeRads
protected double offsetDistance
protected double azimuth
protected double zenith
public LocationType()
public LocationType(java.lang.String xml)
xml
- public LocationType(LocationType anotherLocation)
anotherLocation
- public LocationType(double latitudeDegrees, double longitudeDegrees)
public boolean load(org.dom4j.Element elem)
public boolean load(java.lang.String xml)
public boolean load(org.dom4j.Document doc)
xml
- public java.lang.String getId()
public void setId(java.lang.String id)
label
- The id to set.public java.lang.String getName()
public void setName(java.lang.String name)
name
- The name to set.public java.lang.String getLatitudeStr()
public double getLatitudeDegs()
public double getLatitudeRads()
public void setLatitudeStr(java.lang.String latitude)
latitude
- The latitude to set.public void setLatitudeDegs(double latitude)
latitude
- The latitude to set in decimal degrees.public void setLatitudeRads(double latitudeRads)
latitudeRads
- The latitude to set in radians.public java.lang.String getLongitudeStr()
public double getLongitudeDegs()
public double getLongitudeRads()
public void setLongitudeStr(java.lang.String longitude)
longitude
- The longitude to set.public void setLongitudeDegs(double longitude)
longitude
- The longitude to set in decimal degrees.public void setLongitudeRads(double longitudeRads)
longitudeRads
- The longitude to set in radians.public double getDepth()
#getZUnits()
public void setDepth(double depth)
depth
- The value for depthpublic double getHeight()
public void setHeight(double height)
height
- The height to set.public double getOffsetDistance()
public void setOffsetDistance(double offsetDistance)
offsetDistance
- The offsetDistance to set.public double getAzimuth()
public void setAzimuth(double azimuth)
azimuth
- The azimuth to set.public double getZenith()
public void setZenith(double zenith)
zenith
- The zenith to set.public double getOffsetNorth()
public void setOffsetNorth(double offsetNorth)
offsetNorth
- The offsetNorth to set.public void setOffsetNorth(double offsetNorth, boolean useOffsetNorthInXMLOutput)
offsetNorth
- The offsetNorth to set.useOffsetNorthInXMLOutput
- updates the isOffsetNorthUsed()
.public double getOffsetSouth()
public void setOffsetSouth(double offsetSouth)
offsetSouth
- The offsetSouth to set.public void setOffsetSouth(double offsetSouth, boolean useOffsetSouthInXMLOutput)
offsetNorth
- The offsetNorth to set.useOffsetSouthInXMLOutput
- updates the isOffsetNorthUsed()
.public double getOffsetEast()
public void setOffsetEast(double offsetEast)
offsetEast
- The offsetEast to set.public void setOffsetEast(double offsetEast, boolean useOffsetEastInXMLOutput)
offsetEast
- The offsetEast to set.useOffsetEastInXMLOutput
- updates the isOffsetEastUsed()
.public double getOffsetWest()
public void setOffsetWest(double offsetWest)
offsetWest
- The offsetWest to set.public void setOffsetWest(double offsetWest, boolean useOffsetWestInXMLOutput)
offsetWest
- The offsetWest to set.useOffsetWestInXMLOutput
- updates the isOffsetEastUsed()
.public double getOffsetUp()
public void setOffsetUp(double offsetUp)
offsetUp
- The offsetUp to set.public void setOffsetUp(double offsetUp, boolean useOffsetUpInXMLOutput)
offsetUp
- The offsetUp to set.useOffsetUpInXMLOutput
- updates the isOffsetUpUsed()
.public double getOffsetDown()
public void setOffsetDown(double offsetDown)
offsetDown
- The offsetDown to set.public void setOffsetDown(double offsetDown, boolean useOffsetDownInXMLOutput)
offsetDown
- The offsetDown to set.useOffsetDownInXMLOutput
- updates the isOffsetUpUsed()
.public boolean isOffsetEastUsed()
public void setOffsetEastUsed(boolean isOffsetEastUsed)
isOffsetEastUsed
- The isOffsetEastUsed to set.public boolean isOffsetNorthUsed()
public void setOffsetNorthUsed(boolean isOffsetNorthUsed)
isOffsetNorthUsed
- The isOffsetNorthUsed to set.public boolean isOffsetUpUsed()
public void setOffsetUpUsed(boolean isOffsetUpUsed)
isOffsetUpUsed
- The isOffsetUpUsed to set.public java.lang.String toString()
toString
in class java.lang.Object
public static LocationType valueOf(java.lang.String value)
public java.lang.String asXML()
XmlOutputMethods
FileUtil.saveToFile(String, String)
e afins. Isto porque ao gravar como UTF-8
os caracteres são adulterados guardando por exemplo "é" em 2 caracteres (ou seja pega nos dois caracteres UTF-8 e
transforma-os em 2 UTF-8s).asXML
in interface XmlOutputMethods
public java.lang.String asXML(java.lang.String rootElementName)
XmlOutputMethods
FileUtil.saveToFile(String, String)
e afins. Isto porque ao gravar como UTF-8
os caracteres são adulterados guardando por exemplo "é" em 2 caracteres (ou seja pega nos dois caracteres UTF-8 e
transforma-os em 2 UTF-8s).asXML
in interface XmlOutputMethods
public org.dom4j.Element asElement()
asElement
in interface XmlOutputMethods
public org.dom4j.Element asElement(java.lang.String rootElementName)
asElement
in interface XmlOutputMethods
public org.dom4j.Document asDocument()
asDocument
in interface XmlOutputMethods
public org.dom4j.Document asDocument(java.lang.String rootElementName)
asDocument
in interface XmlOutputMethods
public double[] getOffsetFrom(LocationType otherLocation)
otherLocation
- public double getDistanceInMeters(LocationType anotherLocation)
anotherLocation
- Another Locationpublic double getHorizontalDistanceInMeters(LocationType anotherLocation)
anotherLocation
- Another Locationpublic double getXYAngle(LocationType anotherLocation)
anotherLocation
- public void setLocation(LocationType anotherPoint)
anotherPoint
- public <L extends LocationType> L translatePosition(double offsetNorth, double offsetEast, double offsetDown)
offsetNorth
- offsetEast
- offsetDown
- public <L extends LocationType> L translatePosition(double[] nedOffsets)
translatePosition(double, double, double)
.nedOffsets
- public double[] getAbsoluteLatLonDepth()
public java.lang.String getLatitudeAsPrettyString()
public java.lang.String getLatitudeAsPrettyString(LatLonFormatEnum format)
public java.lang.String getLongitudeAsPrettyString()
public java.lang.String getLongitudeAsPrettyString(LatLonFormatEnum format)
public <L extends LocationType> L convertToAbsoluteLatLonDepth()
public <L extends LocationType> L getNewAbsoluteLatLonDepth()
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public double[] getAbsoluteNEDInMeters()
public java.lang.String getClipboardText()
public boolean fromClipboardText(java.lang.String text)
text
- public org.dom4j.Element asGPXWaypointElement(java.lang.String wptName)
public org.dom4j.Element asGPXWaypointElement(java.lang.String wptName, java.lang.String symbol, java.lang.String desc)
public org.dom4j.Element asGPXRoutePoint()
public double getAllZ()
protected void makeTotalDepthZero()
public void setAbsoluteDepth(double z)
makeTotalDepthZero()
and then sets the value of depth to the given valuedepth
- public double getXYDistanceToLine(LocationType pt1, LocationType pt2)
pt1
- pt2
- public java.awt.geom.Point2D getPointInPixel(int levelOfDetail)
levelOfDetail
- public double[] getDistanceInPixelTo(LocationType target, int levelOfDetail)
target
- level
- public double getPixelDistanceTo(LocationType target, int levelOfDetail)
target
- level
- public static LocationType clipboardLocation()
public void translateInPixel(double deltaX, double deltaY, int levelOfDetail)
deltaX
- deltaY
- level
- public void setLocationByPixel(double x, double y, int levelOfDetail)
public boolean isLocationEqual(LocationType location)
location
- public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int compareTo(LocationType o)
compareTo
in interface java.lang.Comparable<LocationType>
public java.lang.String getDebugString()
public static void LocationTypeTest()
public static void main(java.lang.String[] args)
Copyright © 2004-2020 FEUP-LSTS and Neptus developers. All Rights Reserved.