Package org.ka2ddo.yaac.osm
Class Node
- All Implemented Interfaces:
Serializable
,Comparable<Node>
This class represents a Node element of an OSM file.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ka2ddo.yaac.osm.GenericTaggedNode
GenericTaggedNode.ExtendedGTNAttr
-
Field Summary
Modifier and TypeFieldDescriptionlong
OpenStreetMap assigned ID number for this Node.int
Latitude in millionths of degrees North.int
Longitude in millionths of degrees East.Fields inherited from class org.ka2ddo.yaac.osm.GenericTaggedNode
decodedtagArray, extraAmenities, FIXME, FIXME_OBJ, flags, flags2, FLAGS2_BOGUS, FLAGS2_BOGUS_OBJ, FLAGS2_IS_LIT, FLAGS2_IS_LIT_OBJ, FLAGS2_UNDERGROUND, FLAGS2_WHEELCHAIR_ACCESSIBLE, FLAGS2_WHEELCHAIR_ACCESSIBLE_OBJ, HAS_COLOR, HAS_ID, HAS_ID64, HAS_INTERNET_ACCESS, HAS_INTERNET_ACCESS_OBJ, HAS_TOLL, HAS_TOLL_OBJ, IS_AREA, IS_AREA_OBJ, IS_BRIDGE, IS_BRIDGE_OBJ, IS_BUILDING, IS_BUILDING_OBJ, IS_DISUSED, IS_DISUSED_OBJ, IS_HOLE, IS_INCOMPLETE, IS_ISLAND, IS_ISLAND_OBJ, IS_ONEWAY, IS_ONEWAY_BACKWARDS, IS_ONEWAY_BACKWARDS_OBJ, IS_ONEWAY_OBJ, IS_TUNNEL, IS_TUNNEL_OBJ, IS_WATER, MARINE, RENDERABLE_FLAGS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Compares this Node with the specified Node for order.dup()
Create a deep copy of this Node.boolean
Indicates whether some other object is "equal to" this one.getId()
Return the ID of this OSM record as a sub-class of Number.int
hashCode()
Returns a hash code value for the object.boolean
intersects
(int lLat, int hLat, int lLon, int hLon) Test if this Node intersects the specified axis-aligned bounding box.static void
For unit testing of Node class only.static Node
Read the next Node from the input stream.void
Replace the contents of this Node object with the next Node in the input stream.void
Replace the contents of this Node object with the next Node in the input stream.toString()
Generate a String describing this Node.void
write
(DataOutput os) Writes the Node to the specified DataOutput implementing file access object in the YAAC compressed binary map data format.void
writeGPX
(PrintStream ps) Write this Node to the specified stream as the XML tags one element in GPX schema format.protected void
writeId
(DataOutput dos) Append the ID number of this Node to the written binary save stream.Methods inherited from class org.ka2ddo.yaac.osm.GenericTaggedNode
addAmenityType, compareGTNAttributes, decodedTagArrayToString, ensureElementHasTagArray, hasDecodedTags, hasThisAmenity, putTag, readTags, readTags, removeRedundantAmenityTypes, replaceAmenityType, writeTags
-
Field Details
-
id
public long idOpenStreetMap assigned ID number for this Node. -
latitude
public int latitudeLatitude in millionths of degrees North. -
longitude
public int longitudeLongitude in millionths of degrees East.
-
-
Constructor Details
-
Node
public Node()
-
-
Method Details
-
write
Writes the Node to the specified DataOutput implementing file access object in the YAAC compressed binary map data format.- Parameters:
os
- DataOutput object to write to- Throws:
IOException
- if write failed for any reason
-
writeId
Append the ID number of this Node to the written binary save stream.- Specified by:
writeId
in classGenericTaggedNode<Node>
- Parameters:
dos
- DataOutput to use to append the binary ID value- Throws:
IOException
- if ID write fails
-
getId
Return the ID of this OSM record as a sub-class of Number.- Specified by:
getId
in classGenericTaggedNode<Node>
- Returns:
- Number subclass instance
-
read
Read the next Node from the input stream.- Parameters:
is
- DataInput to read the Node from- Returns:
- newly created Node object read from the stream
- Throws:
IOException
- if read fails
-
reread
Replace the contents of this Node object with the next Node in the input stream.- Parameters:
is
- DataInput to read the next Node from- Throws:
IOException
- if read fails
-
intersects
public boolean intersects(int lLat, int hLat, int lLon, int hLon) Test if this Node intersects the specified axis-aligned bounding box.- Parameters:
lLat
- minimum latitude in millionths of degrees NorthhLat
- maximum latitude in millionths of degrees NorthlLon
- minimum longitude in millionths of degrees EasthLon
- maximum longitude in millionths of degrees East- Returns:
- boolean true if this Node is contained entirely inside the bounding box
-
toString
Generate a String describing this Node. -
compareTo
Compares this Node with the specified Node for order.- Specified by:
compareTo
in interfaceComparable<Node>
- Parameters:
o2
- the Node to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
NullPointerException
- if the specified object is nullClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
Indicates whether some other object is "equal to" this one. -
hashCode
public int hashCode()Returns a hash code value for the object. -
dup
Create a deep copy of this Node. Similar to the Object method clone(), but without the exceptions and casting.- Specified by:
dup
in classGenericTaggedNode<Node>
- Returns:
- copy of this Node
-
writeGPX
Write this Node to the specified stream as the XML tags one element in GPX schema format.- Specified by:
writeGPX
in classGenericTaggedNode<Node>
- Parameters:
ps
- PrintStream to write to
-
main
For unit testing of Node class only.- Parameters:
args
- String array of parameters. [0] is path of node file to read, [1] is optional -quiet flag to suppress most printed output- Throws:
IOException
- if node file cannot be read for any reason
-