public final class Way extends GenericTaggedNode<Way> implements java.lang.Comparable<Way>
| Modifier and Type | Field and Description |
|---|---|
int |
id
The OpenStreetMap assigned ID number for this Way.
|
boolean |
isSegment
Flag used only by OSM importer to note whether this is a full Way or a tile segment of a Way.
|
static int |
MAX_VERTICES_IN_WAY
The maximum number of vertices that can be stored to disk in a Way (due to storage
field size).
|
int |
maxLat
The furthest North of any vertex of this Way.
|
int |
maxLon
The furthest East of any vertex of this Way.
|
int |
minLat
The furthest South of any vertex of this Way.
|
int |
minLon
The furthest West of any vertex of this Way.
|
int[] |
nodeLatLonList
Array of latitude/longitude pairs in millionths of degrees North/East.
|
int |
numLatLonPairs
Number of vertices in the Way.
|
decodedtagArray, FIXME, flags, HAS_ID, HAS_ID64, HAS_INTERNET_ACCESS, HAS_TOLL, IS_AREA, IS_BRIDGE, IS_BUILDING, IS_DISUSED, IS_INFERRED_AREA, IS_ISLAND, IS_LIT, IS_ONEWAY, IS_ONEWAY_BACKWARDS, IS_TUNNEL, IS_WATER, RENDERABLE_FLAGS| Constructor and Description |
|---|
Way()
Create an empty Way object with the default preallocation for the node lat/lon list.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addLatLon(int lat,
int lon)
Add another vertex to the Way, updating the Way's bounding box.
|
boolean |
canDoDelta()
Report if this Way can be stored using 16-bit signed deltas for the vertices instead
of 32-bit absolute values.
|
int |
compareTo(Way o2)
Compares this object with the specified object for order.
|
Way |
dup()
Make a deep copy of this Way.
|
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
|
java.lang.Number |
getId()
Return the ID of this OSM record as a sub-class of Number.
|
Way[] |
getTileWays(int minTileLat,
int minTileLon,
int maxTileLat,
int maxTileLon,
java.io.PrintStream out)
Find all the pieces of this Way that are contained inside the specified axis-aligned bounding box
|
int |
hashCode()
Returns a hash code value for the object.
|
boolean |
intersects(int lLat,
int hLat,
int lLon,
int hLon)
Test if this Way intersects the specified axis-aligned bounding box.
|
static void |
main(java.lang.String[] args)
For unit testing of Way class only.
|
static Way |
read(java.io.DataInput is)
Instantiate a new Way read from
the input stream.
|
int |
removeRedundantWayVertices()
Squeeze down the vertices in the Way to remove duplicate adjacent vertices, and vertices in the middle of a
straight line segment (as opposed to at the ending joints of a line segment).
|
void |
reread(java.io.DataInput is)
Clear the contents of this Way object and load it with another Way's data read from
the input stream.
|
void |
reverseWay()
Swap the order of the vertices in the Way (last to first and first to last).
|
java.lang.String |
toString()
Returns a string representation of the object.
|
void |
write(java.io.DataOutput os)
Encode this Way into a file using the DataOutput storage formats.
|
void |
writeGPX(java.io.PrintStream ps)
Write this Way to the specified stream as the XML tags one element in GPX schema format.
|
protected void |
writeId(java.io.DataOutput dos)
Handle writing the ID field to the binary data stream (handles larger ID ranges in
varying subclasses).
|
decodedTagArrayToString, ensureElementHasTagArray, getDecodedTagCount, hasDecodedTags, putTag, readTags, writeTagspublic static final int MAX_VERTICES_IN_WAY
public int id
public int[] nodeLatLonList
public int numLatLonPairs
public int minLat
public int maxLat
public int minLon
public int maxLon
public transient boolean isSegment
public Way()
public final void addLatLon(int lat,
int lon)
lat - latitude in millionths of degrees Northlon - longitude in millionths of degrees Eastpublic final Way[] getTileWays(int minTileLat, int minTileLon, int maxTileLat, int maxTileLon, java.io.PrintStream out)
minTileLat - southernmost edge in millionths of degrees NorthminTileLon - westernmost edge in millionths of degrees EastmaxTileLat - northernmost edge in millionths of degrees NorthmaxTileLon - easternmost edge in millionths of degrees Eastout - PrintStream to write any error messages topublic void reverseWay()
public void write(java.io.DataOutput os)
throws java.io.IOException
os - DataOutput to write the Way tojava.io.IOException - if Way could not be writtenjava.lang.IllegalArgumentException - if Way has too many vertices to fit in file encoding formatprotected void writeId(java.io.DataOutput dos)
throws java.io.IOException
writeId in class GenericTaggedNode<Way>dos - DataOutput to use to append the binary ID valuejava.io.IOException - if write fails for any reasonpublic java.lang.Number getId()
getId in class GenericTaggedNode<Way>public static Way read(java.io.DataInput is) throws java.io.IOException
is - DataInput to read the next Way fromjava.io.IOException - if Way could not be successfully read from the DataInputpublic final void reread(java.io.DataInput is)
throws java.io.IOException
is - DataInput to read the next Way fromjava.io.IOException - if Way could not be successfully read from the DataInputpublic final boolean intersects(int lLat,
int hLat,
int lLon,
int hLon)
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 Eastpublic int removeRedundantWayVertices()
public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Way o2)
compareTo in interface java.lang.Comparable<Way>o2 - the object to be compared.java.lang.ClassCastException - if the specified object's type prevents it
from being compared to this object.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the reference object with which to compare.true if this object is the same as the obj
argument; false otherwise.hashCode()public int hashCode()
hashCode in class java.lang.Objectequals(Object)public static void main(java.lang.String[] args)
throws java.io.IOException
args - String array of parameters. [0] is path of way file to read, [1] is optional -quiet flag to suppress most printed outputjava.io.IOException - if node file cannot be read for any reasonpublic Way dup()
dup in class GenericTaggedNode<Way>public final boolean canDoDelta()
public void writeGPX(java.io.PrintStream ps)
writeGPX in class GenericTaggedNode<Way>ps - PrintStream to write to