public class Polyline extends AbstractDrawable
Constructor and Description |
---|
Polyline()
Create an empty Polyline.
|
Modifier and Type | Method and Description |
---|---|
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,
com.bbn.openmap.proj.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,
com.bbn.openmap.proj.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.
|
getLineColor, getName, getStroke, getStrokeType, paramString, setLineColor, setName, setStroke
public void addVertex(double lat, double lon)
lat
- latitude of this vertex in degrees Northlon
- longitude of this vertex in degrees Eastpublic void addVertex(java.awt.geom.Point2D pt)
pt
- Point2D containing a position in decimal degrees North and Eastpublic int size()
public void removeVertex(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- zero-based index of the vertex to removejava.lang.ArrayIndexOutOfBoundsException
- if the index is not in range to represent a vertex in ths polylinepublic double getVertexLat(int index)
index
- zero-based index of the vertexpublic double getVertexLon(int index)
index
- zero-based index of the vertexpublic void paintDrawable(java.awt.Graphics2D g, com.bbn.openmap.proj.Projection proj)
paintDrawable
in class AbstractDrawable
g
- Graphics2D object for rendering the drawableproj
- Projection for translating geographic coordinates of the drawablepublic float distance(int x, int y, com.bbn.openmap.proj.Projection proj)
distance
in class AbstractDrawable
x
- int pixel X-coordinatey
- int pixel Y-coordinateproj
- Projection to translate drawable into screen spacepublic java.lang.String toString()
toString
in class java.lang.Object