Package org.ka2ddo.yaac.osm
Class GenericTaggedNode<T extends GenericTaggedNode<T>>
java.lang.Object
org.ka2ddo.yaac.osm.GenericTaggedNode<T>
Abstract class describing common attributes of a OSM dataset object.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
This enumeration identifies all the extended attributes that can be associated with a GenericTaggedNode. -
Field Summary
Modifier and TypeFieldDescriptionObject[]
An array containing tags of rendering-useful values (indexed by key ordinal) extracted from the XML OSM representation.Optional List of additional AmenityTypes if this GenericTaggedNode has more than one amenity associated with it.static final short
Flag bit
indicating Node or Way is defective and needs correcting in the OpenStreetMap database.static final Short
Short Object form of FIXME flag (used to avoid inefficient autoboxing).short
Bitmask of flags representing important boolean conditions about this dataset object.int
Bitmask of extended flags representing less-important boolean conditions about this dataset object.static final int
Extended flags bit indicating this is a bogus map element used to control map rendering (such as the artificial line at 85 degrees 3 minutes South latitude to prevent broken rendering of Antarctica in Mercator projection).static final Integer
Integer object form ofFLAGS2_BOGUS
for efficiency in passing fromSupportedTagKeys
.static final int
ExtendedFlag bit
indicating Node or Way has artificial illumination.static final Integer
Integer Object form ofFLAGS2_IS_LIT
flag (used to avoid inefficient autoboxing).static final int
Extended flags bit indicating this map element is underground.static final int
Extended flags bit indicating this map element is wheelchair-accessible (US ADA compliant).static final Integer
Integer object form ofFLAGS2_WHEELCHAIR_ACCESSIBLE
for efficiency in passing fromSupportedTagKeys
.static final int
Non-standard flag bit used to indicate that AmenityType flagged with this has a '*' in the image file name that should be replaced with the enum name of itsOSMLayerEnum.color
value (if any).static final short
Flag bit
indicating Node or Way has an ID number (should always be set).static final short
Flag bit
indicating Node has a 64-bit-long ID number.static final short
Flag bit
indicating the Node or Way provides public Internet service.static final Short
Short Object form of HAS_INTERNET_ACCESS flag (used to avoid inefficient autoboxing).static final short
Flag bit
indicating toll is charged to travel the Way.static final Short
Short Object form of HAS_TOLLflag bit
(used to avoid inefficient autoboxing).static final short
Flag bit
indicating Way is an enclosed area,static final Short
Short Object form of IS_AREA flag (used to avoid inefficient autoboxing).static final short
Flag bit
indicating Way is a bridge above other features.static final Short
Short object form of IS_BRIDGEflag bit
(used to avoid inefficient autoboxing).static final short
Flag bit
indicating Way is a building, not open area.static final Short
Short Object form of IS_BUILDING_flag (used to avoid inefficient autoboxing).static final short
Flag bit
indicating associated amenity is no longer in use or is abandoned.static final Short
Short Object form of IS_DISUSED flag (used to avoid inefficient autoboxing).static final short
Flags bit
indicating this map element is a hole in another closed area Way, typically used for an inner Way in a Relation with inner and outer Ways.static final short
Flag bit
indicating Way is missing vertices because of data cropping (either at import time or when obtaining a partial OSM data file).static final short
Flag bit
indicating Way is the coastline of an island.static final Short
Short Object form of IS_ISLAND flag (used to avoid inefficient autoboxing).static final short
Flag bit
indicating Way only permits traffic in one direction.static final short
Flag bit
indicating Way only permits traffic in one direction, but the vertices are in reverse order.static final Short
Short Object form of IS_ONEWAY_BACKWARDS flag (used to avoid inefficient autoboxing).static final short
Short Object form of IS_ONEWAYflag bit
(used to avoid inefficient autoboxing).static final short
Flag bit
indicating Way is a tunnel underneath other features.static final Short
Short Object form of IS_TUNNELflag bit
(used to avoid inefficient autoboxing).static final short
Flag bit
indicating Way is a water object.static final int
Non-standard flag bit used to indicate that AmenityType flagged with this should use marine zoom scales instead of landside.static final short
Bitmask of flags where if any of these bits are set, the Way or Node is renderable, even without a waytype. -
Constructor Summary
ModifierConstructorDescriptionprotected
Create a GenericTaggedNode (openStreetMap data) object. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addAmenityType
(AmenityType amenityType) Add (possibly another) AmenityType to this GenericTaggedNode.static int
compareGTNAttributes
(GenericTaggedNode<?> gtn1, GenericTaggedNode<?> gtn2) Compare the attributes of 2 GenericTaggedNodes to see if one appears to be a more detailed version of the other (assuming their other type-specific attributes are identical).Stringify the tags attached to this GenericTaggedNode.abstract T
dup()
Create a deep copy of this Node.void
Ensure that this GenericTaggedNode has a decodedtagArray element in it.abstract Number
getId()
Return the ID of this OSM record as a sub-class of Number.final boolean
Report whether this GenericTaggedNode has decoded tag values.final boolean
hasThisAmenity
(AmenityType amenityType) Test if this GenericTaggedNode provides the specifiedAmenityType
.void
putTag
(OSMLayerEnum key, Object value) Store a key-value pair in the tag map.protected final void
Helper method for reading tags and flags in a common format from an input stream.protected final void
Helper method for reading tags and flags in a common format from an input stream.void
Go through all the AmenityTypes this GenericTaggedNode has and remove the ones that are more generic than other AmenityTypes associated with this object.final boolean
replaceAmenityType
(AmenityType oldAmenityType, AmenityType newAmenityType) Replace a specified AmenityType with the new (more specific) AmenityType in this GenericTaggedNode.abstract void
writeGPX
(PrintStream ps) Write this GenericTaggedNode to the specified stream as the XML tags one element in GPX schema format.protected abstract void
writeId
(DataOutput dos) Handle writing the ID field to the binary data stream (handles larger ID ranges in varying subclasses).protected final void
writeTags
(DataOutput dos) Helper method for writing tags and flags in a common format to an output stream.
-
Field Details
-
decodedtagArray
An array containing tags of rendering-useful values (indexed by key ordinal) extracted from the XML OSM representation. May be null if no relevant tags existed for the OSM dataset object. -
flags
public short flagsBitmask of flags representing important boolean conditions about this dataset object. -
flags2
public int flags2Bitmask of extended flags representing less-important boolean conditions about this dataset object. -
extraAmenities
Optional List of additional AmenityTypes if this GenericTaggedNode has more than one amenity associated with it. -
IS_AREA
public static final short IS_AREAFlag bit
indicating Way is an enclosed area,- See Also:
-
IS_AREA_OBJ
Short Object form of IS_AREA flag (used to avoid inefficient autoboxing).- See Also:
-
IS_BUILDING
public static final short IS_BUILDINGFlag bit
indicating Way is a building, not open area.- See Also:
-
IS_BUILDING_OBJ
Short Object form of IS_BUILDING_flag (used to avoid inefficient autoboxing).- See Also:
-
IS_WATER
public static final short IS_WATERFlag bit
indicating Way is a water object.- See Also:
-
HAS_TOLL
public static final short HAS_TOLLFlag bit
indicating toll is charged to travel the Way.- See Also:
-
HAS_TOLL_OBJ
Short Object form of HAS_TOLLflag bit
(used to avoid inefficient autoboxing).- See Also:
-
IS_BRIDGE
public static final short IS_BRIDGEFlag bit
indicating Way is a bridge above other features.- See Also:
-
IS_BRIDGE_OBJ
Short object form of IS_BRIDGEflag bit
(used to avoid inefficient autoboxing).- See Also:
-
IS_TUNNEL
public static final short IS_TUNNELFlag bit
indicating Way is a tunnel underneath other features.- See Also:
-
IS_TUNNEL_OBJ
Short Object form of IS_TUNNELflag bit
(used to avoid inefficient autoboxing).- See Also:
-
IS_ONEWAY
public static final short IS_ONEWAYFlag bit
indicating Way only permits traffic in one direction.- See Also:
-
IS_ONEWAY_OBJ
public static final short IS_ONEWAY_OBJShort Object form of IS_ONEWAYflag bit
(used to avoid inefficient autoboxing).- See Also:
-
IS_ONEWAY_BACKWARDS
public static final short IS_ONEWAY_BACKWARDSFlag bit
indicating Way only permits traffic in one direction, but the vertices are in reverse order.- See Also:
-
IS_ONEWAY_BACKWARDS_OBJ
Short Object form of IS_ONEWAY_BACKWARDS flag (used to avoid inefficient autoboxing).- See Also:
-
HAS_INTERNET_ACCESS
public static final short HAS_INTERNET_ACCESSFlag bit
indicating the Node or Way provides public Internet service.- See Also:
-
HAS_INTERNET_ACCESS_OBJ
Short Object form of HAS_INTERNET_ACCESS flag (used to avoid inefficient autoboxing).- See Also:
-
IS_ISLAND
public static final short IS_ISLANDFlag bit
indicating Way is the coastline of an island.- See Also:
-
IS_ISLAND_OBJ
Short Object form of IS_ISLAND flag (used to avoid inefficient autoboxing).- See Also:
-
IS_DISUSED
public static final short IS_DISUSEDFlag bit
indicating associated amenity is no longer in use or is abandoned.- See Also:
-
IS_DISUSED_OBJ
Short Object form of IS_DISUSED flag (used to avoid inefficient autoboxing).- See Also:
-
IS_HOLE
public static final short IS_HOLEFlags bit
indicating this map element is a hole in another closed area Way, typically used for an inner Way in a Relation with inner and outer Ways.- See Also:
-
HAS_ID
public static final short HAS_IDFlag bit
indicating Node or Way has an ID number (should always be set).- See Also:
-
IS_INCOMPLETE
public static final short IS_INCOMPLETEFlag bit
indicating Way is missing vertices because of data cropping (either at import time or when obtaining a partial OSM data file).- See Also:
-
HAS_ID64
public static final short HAS_ID64Flag bit
indicating Node has a 64-bit-long ID number.- See Also:
-
FIXME
public static final short FIXMEFlag bit
indicating Node or Way is defective and needs correcting in the OpenStreetMap database.- See Also:
-
FIXME_OBJ
Short Object form of FIXME flag (used to avoid inefficient autoboxing). -
MARINE
public static final int MARINENon-standard flag bit used to indicate that AmenityType flagged with this should use marine zoom scales instead of landside.- See Also:
-
HAS_COLOR
public static final int HAS_COLORNon-standard flag bit used to indicate that AmenityType flagged with this has a '*' in the image file name that should be replaced with the enum name of itsOSMLayerEnum.color
value (if any).- See Also:
-
FLAGS2_BOGUS
public static final int FLAGS2_BOGUSExtended flags bit indicating this is a bogus map element used to control map rendering (such as the artificial line at 85 degrees 3 minutes South latitude to prevent broken rendering of Antarctica in Mercator projection).- See Also:
-
FLAGS2_BOGUS_OBJ
Integer object form ofFLAGS2_BOGUS
for efficiency in passing fromSupportedTagKeys
. -
FLAGS2_UNDERGROUND
public static final int FLAGS2_UNDERGROUNDExtended flags bit indicating this map element is underground.- See Also:
-
FLAGS2_WHEELCHAIR_ACCESSIBLE
public static final int FLAGS2_WHEELCHAIR_ACCESSIBLEExtended flags bit indicating this map element is wheelchair-accessible (US ADA compliant).- See Also:
-
FLAGS2_WHEELCHAIR_ACCESSIBLE_OBJ
Integer object form ofFLAGS2_WHEELCHAIR_ACCESSIBLE
for efficiency in passing fromSupportedTagKeys
. -
FLAGS2_IS_LIT
public static final int FLAGS2_IS_LITExtendedFlag bit
indicating Node or Way has artificial illumination.- See Also:
-
FLAGS2_IS_LIT_OBJ
Integer Object form ofFLAGS2_IS_LIT
flag (used to avoid inefficient autoboxing). -
RENDERABLE_FLAGS
public static final short RENDERABLE_FLAGSBitmask of flags where if any of these bits are set, the Way or Node is renderable, even without a waytype.- See Also:
-
-
Constructor Details
-
GenericTaggedNode
protected GenericTaggedNode()Create a GenericTaggedNode (openStreetMap data) object.
-
-
Method Details
-
writeId
Handle writing the ID field to the binary data stream (handles larger ID ranges in varying subclasses).- Parameters:
dos
- DataOutput to use to append the binary ID value- Throws:
IOException
- if write fails for any reason
-
getId
Return the ID of this OSM record as a sub-class of Number.- Returns:
- Number subclass instance
-
writeTags
Helper method for writing tags and flags in a common format to an output stream.- Parameters:
dos
- DataOutput implementing object to write the tags and flags to- Throws:
IOException
- if the write failed for any reason
-
readTags
Helper method for reading tags and flags in a common format from an input stream.- Parameters:
dis
- DataInput implementing object to read the tags and flags from- Throws:
IOException
- if the read failed for any reason
-
putTag
Store a key-value pair in the tag map.- Parameters:
key
- OSMLayerEnum identifying the tag attributevalue
- value of the attribute
-
hasDecodedTags
public final boolean hasDecodedTags()Report whether this GenericTaggedNode has decoded tag values.- Returns:
- boolean true if there are non-null values in the decodedTagArray
-
decodedTagArrayToString
Stringify the tags attached to this GenericTaggedNode.- Returns:
- String formatting of decodedtagArray
-
ensureElementHasTagArray
public void ensureElementHasTagArray()Ensure that this GenericTaggedNode has a decodedtagArray element in it. -
addAmenityType
Add (possibly another) AmenityType to this GenericTaggedNode.- Parameters:
amenityType
- AmenityType to add to the amenities provided by this GenericTaggedNode
-
replaceAmenityType
Replace a specified AmenityType with the new (more specific) AmenityType in this GenericTaggedNode.- Parameters:
oldAmenityType
- AmenityType to overwrite with the newAmenityTypenewAmenityType
- AmenityType to add to the amenities provided by this GenericTaggedNode- Returns:
- boolean true if AmenityType was newly added, false if already on the GenericTaggedNode
-
hasThisAmenity
Test if this GenericTaggedNode provides the specifiedAmenityType
.- Parameters:
amenityType
- AmenityType to test for- Returns:
- boolean true if this provides this AmenityType
-
removeRedundantAmenityTypes
public void removeRedundantAmenityTypes()Go through all the AmenityTypes this GenericTaggedNode has and remove the ones that are more generic than other AmenityTypes associated with this object. -
compareGTNAttributes
Compare the attributes of 2 GenericTaggedNodes to see if one appears to be a more detailed version of the other (assuming their other type-specific attributes are identical).- Parameters:
gtn1
- first GenericTaggedNode to testgtn2
- second GenericTaggedNode to test- Returns:
- -1 if gtn1 is a subset of gtn2, 0 if gtn1 and gtn2 have identical attributes, +1 if gtn1 is a superset of gtn2, and +2 if gtn1 and gtn2 are divergent
-
dup
Create a deep copy of this Node. Similar to the Object method clone(), but without the exceptions and casting.- Returns:
- copy of this GenericTaggedNode
-
writeGPX
Write this GenericTaggedNode to the specified stream as the XML tags one element in GPX schema format.- Parameters:
ps
- PrintStream to write to
-