|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.ka2ddo.yaac.osm.GenericTaggedNode<Way>
org.ka2ddo.yaac.osm.Way
public final class Way
This class implements a Way element of an OSM file.
Field Summary | |
---|---|
int |
id
The OpenStreetMap assigned ID number for this 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. |
Fields inherited from class org.ka2ddo.yaac.osm.GenericTaggedNode |
---|
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 Summary | |
---|---|
Way()
Create an empty Way object with the default preallocation for the node lat/lon list. |
Method Summary | |
---|---|
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. |
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. |
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). |
Methods inherited from class org.ka2ddo.yaac.osm.GenericTaggedNode |
---|
decodedTagArrayToString, ensureElementHasTagArray, getDecodedTagCount, hasDecodedTags, putTag, readTags, writeTags |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public 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
Constructor Detail |
---|
public Way()
Method Detail |
---|
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 to
public void reverseWay()
public void write(java.io.DataOutput os) throws java.io.IOException
os
- DataOutput to write the Way to
java.io.IOException
- if Way could not be written
java.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 value
java.io.IOException
- if write fails for any reasonpublic static Way read(java.io.DataInput is) throws java.io.IOException
is
- DataInput to read the next Way from
java.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 from
java.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 East
public java.lang.String toString()
toString
in class java.lang.Object
public 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.Object
obj
- 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.Object
equals(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 output
java.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
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |