Class GenericTaggedNode<T extends GenericTaggedNode<T>>

java.lang.Object
org.ka2ddo.yaac.osm.GenericTaggedNode<T>
Direct Known Subclasses:
ChangeSet, Node, Relation, Way

public abstract class GenericTaggedNode<T extends GenericTaggedNode<T>> extends Object
Abstract class describing common attributes of a OSM dataset object.
Author:
Andrew Pavlin, KA2DDO
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    This enumeration identifies all the extended attributes that can be associated with a GenericTaggedNode.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    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 of FLAGS2_BOGUS for efficiency in passing from SupportedTagKeys.
    static final int
    Extended Flag bit indicating Node or Way has artificial illumination.
    static final Integer
    Integer Object form of FLAGS2_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 of FLAGS2_WHEELCHAIR_ACCESSIBLE for efficiency in passing from SupportedTagKeys.
    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 its OSMLayerEnum.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_TOLL flag 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_BRIDGE flag 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_ONEWAY flag 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_TUNNEL flag 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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Create a GenericTaggedNode (openStreetMap data) object.
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    Add (possibly another) AmenityType to this GenericTaggedNode.
    static int
    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
    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
    Test if this GenericTaggedNode provides the specified AmenityType.
    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
    Write this GenericTaggedNode to the specified stream as the XML tags one element in GPX schema format.
    protected abstract void
    Handle writing the ID field to the binary data stream (handles larger ID ranges in varying subclasses).
    protected final void
    Helper method for writing tags and flags in a common format to an output stream.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • decodedtagArray

      public Object[] 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 flags
      Bitmask of flags representing important boolean conditions about this dataset object.
      See Also:
    • flags2

      public int flags2
      Bitmask of extended flags representing less-important boolean conditions about this dataset object.
      See Also:
    • extraAmenities

      public List<AmenityType> extraAmenities
      Optional List of additional AmenityTypes if this GenericTaggedNode has more than one amenity associated with it.
      See Also:
    • IS_AREA

      public static final short IS_AREA
      Flag bit indicating Way is an enclosed area,
      See Also:
    • IS_AREA_OBJ

      public static final Short IS_AREA_OBJ
      Short Object form of IS_AREA flag (used to avoid inefficient autoboxing).
      See Also:
    • IS_BUILDING

      public static final short IS_BUILDING
      Flag bit indicating Way is a building, not open area.
      See Also:
    • IS_BUILDING_OBJ

      public static final Short IS_BUILDING_OBJ
      Short Object form of IS_BUILDING_flag (used to avoid inefficient autoboxing).
      See Also:
    • IS_WATER

      public static final short IS_WATER
      Flag bit indicating Way is a water object.
      See Also:
    • HAS_TOLL

      public static final short HAS_TOLL
      Flag bit indicating toll is charged to travel the Way.
      See Also:
    • HAS_TOLL_OBJ

      public static final Short HAS_TOLL_OBJ
      Short Object form of HAS_TOLL flag bit (used to avoid inefficient autoboxing).
      See Also:
    • IS_BRIDGE

      public static final short IS_BRIDGE
      Flag bit indicating Way is a bridge above other features.
      See Also:
    • IS_BRIDGE_OBJ

      public static final Short IS_BRIDGE_OBJ
      Short object form of IS_BRIDGE flag bit (used to avoid inefficient autoboxing).
      See Also:
    • IS_TUNNEL

      public static final short IS_TUNNEL
      Flag bit indicating Way is a tunnel underneath other features.
      See Also:
    • IS_TUNNEL_OBJ

      public static final Short IS_TUNNEL_OBJ
      Short Object form of IS_TUNNEL flag bit (used to avoid inefficient autoboxing).
      See Also:
    • IS_ONEWAY

      public static final short IS_ONEWAY
      Flag bit indicating Way only permits traffic in one direction.
      See Also:
    • IS_ONEWAY_OBJ

      public static final short IS_ONEWAY_OBJ
      Short Object form of IS_ONEWAY flag bit (used to avoid inefficient autoboxing).
      See Also:
    • IS_ONEWAY_BACKWARDS

      public static final short IS_ONEWAY_BACKWARDS
      Flag bit indicating Way only permits traffic in one direction, but the vertices are in reverse order.
      See Also:
    • IS_ONEWAY_BACKWARDS_OBJ

      public static final Short 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_ACCESS
      Flag bit indicating the Node or Way provides public Internet service.
      See Also:
    • HAS_INTERNET_ACCESS_OBJ

      public static final Short 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_ISLAND
      Flag bit indicating Way is the coastline of an island.
      See Also:
    • IS_ISLAND_OBJ

      public static final Short IS_ISLAND_OBJ
      Short Object form of IS_ISLAND flag (used to avoid inefficient autoboxing).
      See Also:
    • IS_DISUSED

      public static final short IS_DISUSED
      Flag bit indicating associated amenity is no longer in use or is abandoned.
      See Also:
    • IS_DISUSED_OBJ

      public static final Short IS_DISUSED_OBJ
      Short Object form of IS_DISUSED flag (used to avoid inefficient autoboxing).
      See Also:
    • IS_HOLE

      public static final short IS_HOLE
      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.
      See Also:
    • HAS_ID

      public static final short HAS_ID
      Flag bit indicating Node or Way has an ID number (should always be set).
      See Also:
    • IS_INCOMPLETE

      public static final short IS_INCOMPLETE
      Flag 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_ID64
      Flag bit indicating Node has a 64-bit-long ID number.
      See Also:
    • FIXME

      public static final short FIXME
      Flag bit indicating Node or Way is defective and needs correcting in the OpenStreetMap database.
      See Also:
    • FIXME_OBJ

      public static final Short FIXME_OBJ
      Short Object form of FIXME flag (used to avoid inefficient autoboxing).
    • MARINE

      public static final int MARINE
      Non-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_COLOR
      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 its OSMLayerEnum.color value (if any).
      See Also:
    • FLAGS2_BOGUS

      public static final int FLAGS2_BOGUS
      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).
      See Also:
    • FLAGS2_BOGUS_OBJ

      public static final Integer FLAGS2_BOGUS_OBJ
      Integer object form of FLAGS2_BOGUS for efficiency in passing from SupportedTagKeys.
    • FLAGS2_UNDERGROUND

      public static final int FLAGS2_UNDERGROUND
      Extended flags bit indicating this map element is underground.
      See Also:
    • FLAGS2_WHEELCHAIR_ACCESSIBLE

      public static final int FLAGS2_WHEELCHAIR_ACCESSIBLE
      Extended flags bit indicating this map element is wheelchair-accessible (US ADA compliant).
      See Also:
    • FLAGS2_WHEELCHAIR_ACCESSIBLE_OBJ

      public static final Integer FLAGS2_WHEELCHAIR_ACCESSIBLE_OBJ
      Integer object form of FLAGS2_WHEELCHAIR_ACCESSIBLE for efficiency in passing from SupportedTagKeys.
    • FLAGS2_IS_LIT

      public static final int FLAGS2_IS_LIT
      Extended Flag bit indicating Node or Way has artificial illumination.
      See Also:
    • FLAGS2_IS_LIT_OBJ

      public static final Integer FLAGS2_IS_LIT_OBJ
      Integer Object form of FLAGS2_IS_LIT flag (used to avoid inefficient autoboxing).
    • RENDERABLE_FLAGS

      public static final short RENDERABLE_FLAGS
      Bitmask 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

      protected abstract void writeId(DataOutput dos) throws IOException
      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

      public abstract Number getId()
      Return the ID of this OSM record as a sub-class of Number.
      Returns:
      Number subclass instance
    • writeTags

      protected final void writeTags(DataOutput dos) throws IOException
      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

      protected final void readTags(DataInput dis) throws IOException
      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
    • readTags

      protected final void readTags(NonshareableBufferedDataInputStream dis) throws IOException
      Helper method for reading tags and flags in a common format from an input stream.
      Parameters:
      dis - NonshareableBufferedDataInputStream implementing object to read the tags and flags from
      Throws:
      IOException - if the read failed for any reason
    • putTag

      public void putTag(OSMLayerEnum key, Object value)
      Store a key-value pair in the tag map.
      Parameters:
      key - OSMLayerEnum identifying the tag attribute
      value - 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

      public String 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

      public final void addAmenityType(AmenityType amenityType)
      Add (possibly another) AmenityType to this GenericTaggedNode.
      Parameters:
      amenityType - AmenityType to add to the amenities provided by this GenericTaggedNode
    • replaceAmenityType

      public final boolean replaceAmenityType(AmenityType oldAmenityType, AmenityType newAmenityType)
      Replace a specified AmenityType with the new (more specific) AmenityType in this GenericTaggedNode.
      Parameters:
      oldAmenityType - AmenityType to overwrite with the newAmenityType
      newAmenityType - 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

      public final boolean hasThisAmenity(AmenityType amenityType)
      Test if this GenericTaggedNode provides the specified AmenityType.
      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

      public 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).
      Parameters:
      gtn1 - first GenericTaggedNode to test
      gtn2 - 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

      public abstract T 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

      public abstract void writeGPX(PrintStream ps)
      Write this GenericTaggedNode to the specified stream as the XML tags one element in GPX schema format.
      Parameters:
      ps - PrintStream to write to