Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.osm
Class Way

    java.lang.Object
      org.ka2ddo.yaac.osm.GenericTaggedNode<Way>
          org.ka2ddo.yaac.osm.Way

All Implemented Interfaces:
  java.lang.Comparable<Way>

    public final class Way

extends GenericTaggedNode<Way>
implements java.lang.Comparable<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

### MAX_VERTICES_IN_WAY

    public static final int MAX_VERTICES_IN_WAY

  The maximum number of vertices that can be stored to disk in a Way (due to storage field size).

  See Also:
    Constant Field Values

### id

    public int id

  The OpenStreetMap assigned ID number for this Way. Negative values may be used for YAAC-created Ways.

### nodeLatLonList

    public int[] nodeLatLonList

  Array of latitude/longitude pairs in millionths of degrees North/East.

### numLatLonPairs

    public int numLatLonPairs

  Number of vertices in the Way.

### minLat

    public int minLat

  The furthest South of any vertex of this Way.

### maxLat

    public int maxLat

  The furthest North of any vertex of this Way.

### minLon

    public int minLon

  The furthest West of any vertex of this Way.

### maxLon

    public int maxLon

  The furthest East of any vertex of this Way.

Constructor Detail

### Way

    public Way()

  Create an empty Way object with the default preallocation for the node lat/lon list.

Method Detail

### addLatLon

    public final void addLatLon(int lat,
                                int lon)

  Add another vertex to the Way, updating the Way's bounding box.

  Parameters:
    `lat` - latitude in millionths of degrees North
    `lon` - longitude in millionths of degrees East

### getTileWays

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

  Parameters:
    `minTileLat` - southernmost edge in millionths of degrees North
    `minTileLon` - westernmost edge in millionths of degrees East
    `maxTileLat` - northernmost edge in millionths of degrees North
    `maxTileLon` - easternmost edge in millionths of degrees East
    `out` - PrintStream to write any error messages to
  Returns:
    null if no intersection, or array of Ways corresponding to pieces of this Way inside the box

### reverseWay

    public void reverseWay()

  Swap the order of the vertices in the Way (last to first and first to last).

### write

    public void write(java.io.DataOutput os)
               throws java.io.IOException

  Encode this Way into a file using the DataOutput storage formats.

  Parameters:
    `os` - DataOutput to write the Way to
  Throws:
    `java.io.IOException` - if Way could not be written
    `java.lang.IllegalArgumentException` - if Way has too many vertices to fit in file encoding format

### writeId

    protected void writeId(java.io.DataOutput dos)
                    throws java.io.IOException

  Handle writing the ID field to the binary data stream (handles larger ID ranges in varying subclasses).

  Specified by:
    `writeId` in class `GenericTaggedNode<Way>`
  Parameters:
    `dos` - DataOutput to use to append the binary ID value
  Throws:
    `java.io.IOException` - if write fails for any reason

### read

    public static Way read(java.io.DataInput is)
                    throws java.io.IOException

  Instantiate a new Way read from the input stream.

  Parameters:
    `is` - DataInput to read the next Way from
  Returns:
    Way read from the input
  Throws:
    `java.io.IOException` - if Way could not be successfully read from the DataInput

### reread

    public final void reread(java.io.DataInput is)
                      throws java.io.IOException

  Clear the contents of this Way object and load it with another Way's data read from the input stream. Used to reduce heap thrashing by reusing the same Way object without running it through the garbage collector.

  Parameters:
    `is` - DataInput to read the next Way from
  Throws:
    `java.io.IOException` - if Way could not be successfully read from the DataInput

### intersects

    public final boolean intersects(int lLat,
                                    int hLat,
                                    int lLon,
                                    int hLon)

  Test if this Way intersects the specified axis-aligned bounding box.

  Parameters:
    `lLat` - minimum latitude in millionths of degrees North
    `hLat` - maximum latitude in millionths of degrees North
    `lLon` - minimum longitude in millionths of degrees East
    `hLon` - maximum longitude in millionths of degrees East
  Returns:
    boolean true if this Way intersects the bounding box or is contained entirely inside it

### toString

    public java.lang.String toString()

  Returns a string representation of the object.

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation of the object.

### compareTo

    public int compareTo(Way o2)

  Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

  Specified by:
    `compareTo` in interface `java.lang.Comparable<Way>`
  Parameters:
    `o2` - the object to be compared.
  Returns:
    a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
  Throws:
    `java.lang.ClassCastException` - if the specified object's type prevents it from being compared to this object.

### equals

    public boolean equals(java.lang.Object obj)

  Indicates whether some other object is "equal to" this one.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the reference object with which to compare.
  Returns:
    `true` if this object is the same as the obj argument; `false` otherwise.
  See Also:
    `hashCode()`

### hashCode

    public int hashCode()

  Returns a hash code value for the object.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    a hash code value for this object.
  See Also:
    `equals(Object)`

### main

    public static void main(java.lang.String[] args)
                     throws java.io.IOException

  For unit testing of Way class only.

  Parameters:
    `args` - String array of parameters. [0] is path of way file to read, [1] is optional -quiet flag to suppress most printed output
  Throws:
    `java.io.IOException` - if node file cannot be read for any reason

### dup

    public Way dup()

  Make a deep copy of this Way.

  Specified by:
    `dup` in class `GenericTaggedNode<Way>`
  Returns:
    unique copy of this Way object

### canDoDelta

    public final boolean canDoDelta()

  Report if this Way can be stored using 16-bit signed deltas for the vertices instead of 32-bit absolute values.

  Returns:
    boolean true if 16-deltas will work

### writeGPX

    public void writeGPX(java.io.PrintStream ps)

  Write this Way to the specified stream as the XML tags one element in GPX schema format.

  Specified by:
    `writeGPX` in class `GenericTaggedNode<Way>`
  Parameters:
    `ps` - PrintStream to write to

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD