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.gui.drawlayer
Class Polyline

    java.lang.Object
      org.ka2ddo.yaac.gui.drawlayer.AbstractDrawable
          org.ka2ddo.yaac.gui.drawlayer.Polyline

    public class Polyline

extends AbstractDrawable

This class defines a drawable polyline.

Constructor Summary
`Polyline()` Create an empty Polyline.

Method Summary
`void` | `addVertex(double lat, double lon)` Add another vertex to this polyline.
`void` | `addVertex(java.awt.geom.Point2D pt)` Add another vertex to this polyline
`float` | `distance(int x, int y, Projection proj)` This computes the nearest distance from this drawable to the specified pixel coordinates.
`double` | `getVertexLat(int index)` Gets the latitude of the index-specified vertex in the polyline.
`double` | `getVertexLon(int index)` Gets the longitude of the index-specified vertex in the polyline.
`void` | `paintDrawable(java.awt.Graphics2D g, Projection proj)` Render this drawable upon a canvas using the specified Graphics and Projection.
`void` | `removeVertex(int index)` Remove the specified vertex from the ordered list of vertices.
`int` | `size()` Get the number of vertices in this polyline.
`java.lang.String` | `toString()` Returns a string representation of the object.

Methods inherited from class org.ka2ddo.yaac.gui.drawlayer.AbstractDrawable
`getLineColor, getName, getStroke, getStrokeType, paramString, setLineColor, setName, setStroke`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Polyline

    public Polyline()

  Create an empty Polyline.

Method Detail

### addVertex

    public void addVertex(double lat,
                          double lon)

  Add another vertex to this polyline.

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

### addVertex

    public void addVertex(java.awt.geom.Point2D pt)

  Add another vertex to this polyline

  Parameters:
    `pt` - Point2D containing a position in decimal degrees North and East

### size

    public int size()

  Get the number of vertices in this polyline.

  Returns:
    vertex count

### removeVertex

    public void removeVertex(int index)
                      throws java.lang.ArrayIndexOutOfBoundsException

  Remove the specified vertex from the ordered list of vertices.

  Parameters:
    `index` - zero-based index of the vertex to remove
  Throws:
    `java.lang.ArrayIndexOutOfBoundsException` - if the index is not in range to represent a vertex in ths polyline

### getVertexLat

    public double getVertexLat(int index)

  Gets the latitude of the index-specified vertex in the polyline.

  Parameters:
    `index` - zero-based index of the vertex
  Returns:
    degrees North

### getVertexLon

    public double getVertexLon(int index)

  Gets the longitude of the index-specified vertex in the polyline.

  Parameters:
    `index` - zero-based index of the vertex
  Returns:
    degrees East

### paintDrawable

    public void paintDrawable(java.awt.Graphics2D g,
                              Projection proj)

  Render this drawable upon a canvas using the specified Graphics and Projection.

  Specified by:
    `paintDrawable` in class `AbstractDrawable`
  Parameters:
    `g` - Graphics2D object for rendering the drawable
    `proj` - Projection for translating geographic coordinates of the drawable

### distance

    public float distance(int x,
                          int y,
                          Projection proj)

  This computes the nearest distance from this drawable to the specified pixel coordinates.

  Specified by:
    `distance` in class `AbstractDrawable`
  Parameters:
    `x` - int pixel X-coordinate
    `y` - int pixel Y-coordinate
    `proj` - Projection to translate drawable into screen space
  Returns:
    distance in pixels

### 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.

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