Package org.ka2ddo.yaac.osm
Class Relation
This class represents a Relation element of an OSM file.
- Author:
- Andrew Pavlin, KA2DDO
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ka2ddo.yaac.osm.GenericTaggedNode
GenericTaggedNode.ExtendedGTNAttr
-
Field Summary
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 TypeMethodDescriptiondup()
Create a deep copy of this Relation.getId()
Return the ID of this OSM record as a sub-class of Number.boolean
Test if this Relation contains only Ways.static void
for unit testing only of Relation class.static Relation
Read a new Relation object from the specified input stream.toString()
Returns a string representation of the Relation object.void
write
(DataOutput dos) Write this Relation to the specified stream in a compact binary format.void
writeGPX
(PrintStream ps) Write this Relation to the specified stream as the XML tags one element in GPX schema format.protected void
writeId
(DataOutput dos) Handle writing the ID field to the binary data stream (handles larger ID ranges in varying subclasses).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 int idOpenStreetMap database ID key for this Relation.
-
-
Constructor Details
-
Relation
public Relation()
-
-
Method Details
-
writeId
Handle writing the ID field to the binary data stream (handles larger ID ranges in varying subclasses).- Specified by:
writeId
in classGenericTaggedNode<Relation>
- 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.- Specified by:
getId
in classGenericTaggedNode<Relation>
- Returns:
- Number subclass instance
-
write
Write this Relation to the specified stream in a compact binary format.- Parameters:
dos
- DataOutput to write to- Throws:
IOException
- if write failed for any reason
-
read
Read a new Relation object from the specified input stream.- Parameters:
is
- DataInput to read the Relation from- Returns:
- new Relation object with all sub-elements
- Throws:
IOException
- if read failed for any reason
-
toString
Returns a string representation of the Relation object. -
dup
Create a deep copy of this Relation. Similar to the Object method clone(), but without the exceptions and casting.- Specified by:
dup
in classGenericTaggedNode<Relation>
- Returns:
- copy of this Relation
-
writeGPX
Write this Relation to the specified stream as the XML tags one element in GPX schema format.- Specified by:
writeGPX
in classGenericTaggedNode<Relation>
- Parameters:
ps
- PrintStream to write to
-
main
for unit testing only of Relation class.- Parameters:
args
- String array of command-line parameters, [0]: Relation file to read, [1]: numeric Relation ID to check for (-1 means all), [2]: optional "-short" to reduce printed debug output- Throws:
IOException
- if file can't be read for some reason
-
isOnlyWays
public boolean isOnlyWays()Test if this Relation contains only Ways.- Returns:
- boolean true if all members are Ways (except for label Nodes), false otherwise
-