|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gwt.maps.client.overlay.Overlay
com.google.gwt.maps.client.overlay.Overlay.ConcreteOverlay
com.google.gwt.maps.client.overlay.Polyline
public final class Polyline
This is a map overlay that draws a polyline on the map, using the vector drawing facilities of the browser if they are available, or an image overlay from Google servers otherwise.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.google.gwt.maps.client.overlay.Overlay |
---|
Overlay.ConcreteOverlay |
Field Summary |
---|
Fields inherited from class com.google.gwt.maps.client.overlay.Overlay |
---|
jsoPeer |
Constructor Summary | |
---|---|
Polyline(LatLng[] points)
Create a new polyline. |
|
Polyline(LatLng[] points,
java.lang.String color)
Create a new polyline. |
|
Polyline(LatLng[] points,
java.lang.String color,
int weight)
Create a new polyline. |
|
Polyline(LatLng[] points,
java.lang.String color,
int weight,
double opacity)
Create a new polyline. |
|
Polyline(LatLng[] points,
java.lang.String color,
int weight,
double opacity,
PolylineOptions options)
Create a new polyline. |
Method Summary | |
---|---|
void |
addPolylineCancelLineHandler(PolylineCancelLineHandler handler)
This event is fired when the polyline is being edited and the edit is canceled. |
void |
addPolylineClickHandler(PolylineClickHandler handler)
This event is fired when the polyline is clicked. |
void |
addPolylineEndLineHandler(PolylineEndLineHandler handler)
This event is fired when the polyline is being edited and the edit is completed. |
void |
addPolylineLineUpdatedHandler(PolylineLineUpdatedHandler handler)
This event is fired when the polyline has a vertex inserted. |
void |
addPolylineMouseOutHandler(PolylineMouseOutHandler handler)
This event is fired when the mouse moves out of a polyline. |
void |
addPolylineMouseOverHandler(PolylineMouseOverHandler handler)
This event is fired when the mouse moves over a polyline. |
void |
addPolylineRemoveHandler(PolylineRemoveHandler handler)
This event is fired when the polyline is removed from the map, using MapWidget.removeOverlay(com.google.gwt.maps.client.overlay.Overlay) or
MapWidget.clearOverlays() . |
void |
addPolylineVisibilityChangedHandler(PolylineVisibilityChangedHandler handler)
This event is fired when the polyline is clicked. |
void |
deleteVertex(int index)
Removes the vertex with the given index in the polyline and updates the shape of the polyline accordingly. |
static Polyline |
fromEncoded(EncodedPolyline polyline)
Create a polyline from an encoded string. |
static Polyline |
fromEncoded(java.lang.String color,
int weight,
double opacity,
java.lang.String encodedPoints,
int zoomFactor,
java.lang.String encodedLevels,
int numLevels)
Create a polyline from an encoded string. |
static Polyline |
fromEncoded(java.lang.String encodedPoints,
int zoomFactor,
java.lang.String encodedLevels,
int numLevels)
Create a polyline from an encoded string. |
LatLngBounds |
getBounds()
Returns the bounds for this polyline. |
double |
getLength()
Returns the length (in meters) of the polyline along the surface of a spherical Earth. |
LatLng |
getVertex(int index)
Returns the vertex with the given index in the polyline. |
int |
getVertexCount()
Returns the number of vertices in the polyline. |
void |
insertVertex(int index,
LatLng latlng)
Inserts a new point at the given index in the polyline and updates its shape. |
boolean |
isVisible()
Returns true if the polyline is visible on the map. |
void |
removePolylineCancelLineHandler(PolylineCancelLineHandler handler)
Removes a single handler of this map previously added with addPolylineCancelLineHandler(PolylineCancelLineHandler) . |
void |
removePolylineClickHandler(PolylineClickHandler handler)
Removes a single handler of this map previously added with addPolylineClickHandler(PolylineClickHandler) . |
void |
removePolylineEndLineHandler(PolylineEndLineHandler handler)
Removes a single handler of this map previously added with addPolylineEndLineHandler(PolylineEndLineHandler) . |
void |
removePolylineLineUpdatedHandler(PolylineLineUpdatedHandler handler)
Removes a single handler of this map previously added with addPolylineLineUpdatedHandler(PolylineLineUpdatedHandler) . |
void |
removePolylineMouseOutHandler(PolylineMouseOutHandler handler)
Removes a single handler of this map previously added with addPolylineMouseOutHandler(PolylineMouseOutHandler) . |
void |
removePolylineMouseOverHandler(PolylineMouseOverHandler handler)
Removes a single handler of this map previously added with addPolylineMouseOverHandler(PolylineMouseOverHandler) . |
void |
removePolylineRemoveHandler(PolylineRemoveHandler handler)
Removes a single handler of this map previously added with addPolylineRemoveHandler(PolylineRemoveHandler) . |
void |
removePolylineVisibilityChangedHandler(PolylineVisibilityChangedHandler handler)
Removes a single handler of this map previously added with addPolylineVisibilityChangedHandler(PolylineVisibilityChangedHandler)
. |
void |
setDrawingEnabled()
Allows a user to construct (or modify) a GPolyline object by clicking on additional points on the map. |
void |
setDrawingEnabled(PolyEditingOptions opts)
Enable drawing as in setDrawingEnabled() but with control
over the polyline drawing parameters. |
void |
setEditingEnabled(boolean enabled)
Allows modification of an existing Polyline chain of points. |
void |
setEditingEnabled(PolyEditingOptions opts)
Enable editing as in setEditingEnabled(boolean) , but with
control over the polyline drawing parameters. |
void |
setStrokeStyle(PolyStyleOptions style)
Changes the style of the polyline. |
void |
setVisible(boolean visible)
Show or hide the polyline. |
boolean |
supportsHide()
Returns true if this environment supports the
setVisible(boolean) method. |
Methods inherited from class com.google.gwt.maps.client.overlay.Overlay.ConcreteOverlay |
---|
copy, initialize, redraw, remove |
Methods inherited from class com.google.gwt.maps.client.overlay.Overlay |
---|
getZIndex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Polyline(LatLng[] points)
points
- An array of points to use as verticies for the Polyline.public Polyline(LatLng[] points, java.lang.String color)
points
- An array of points to use as verticies for the Polyline.color
- color a string that contains a hexadecimal numeric HTML style,
i.e. #RRGGBBpublic Polyline(LatLng[] points, java.lang.String color, int weight)
points
- An array of points to use as verticies for the Polyline.color
- a string that contains a hexadecimal numeric HTML style, i.e.
#RRGGBBweight
- the width of the line in pixels. opacity is a number between
0 and 1.public Polyline(LatLng[] points, java.lang.String color, int weight, double opacity)
points
- An array of points to use as verticies for the Polyline.color
- a string that contains a hexadecimal numeric HTML style, i.e.
#RRGGBBweight
- the width of the line in pixels. opacity is a number between
0 and 1.opacity
- a number between 0 and 1.0 where 1.0 is totally opaque.public Polyline(LatLng[] points, java.lang.String color, int weight, double opacity, PolylineOptions options)
points
- An array of points to use as verticies for the Polyline.color
- a string that contains a hexadecimal numeric HTML style, i.e.
#RRGGBBweight
- the width of the line in pixels. opacity is a number between
0 and 1.opacity
- a number between 0 and 1.0 where 1.0 is totally opaque.Method Detail |
---|
public static Polyline fromEncoded(EncodedPolyline polyline)
polyline
- An object containing all the information for the new
polyline.
public static Polyline fromEncoded(java.lang.String color, int weight, double opacity, java.lang.String encodedPoints, int zoomFactor, java.lang.String encodedLevels, int numLevels)
color
- See EncodedPolyline.setColor(String)
weight
- See EncodedPolyline.setWeight(int)
opacity
- See EncodedPolyline.setOpacity(double)
encodedPoints
- See EncodedPolyline.setPoints(String)
zoomFactor
- See EncodedPolyline.setZoomFactor(int)
encodedLevels
- See EncodedPolyline.setLevels(String)
numLevels
- See EncodedPolyline.setNumLevels(int)
public static Polyline fromEncoded(java.lang.String encodedPoints, int zoomFactor, java.lang.String encodedLevels, int numLevels)
encodedPoints
- See EncodedPolyline.setPoints(String)
zoomFactor
- See EncodedPolyline.setZoomFactor(int)
encodedLevels
- See EncodedPolyline.setLevels(String)
numLevels
- See EncodedPolyline.setNumLevels(int)
public void addPolylineCancelLineHandler(PolylineCancelLineHandler handler)
setEditingEnabled(boolean)
handler
- the handler to call when this event fires.public void addPolylineClickHandler(PolylineClickHandler handler)
handler
- the handler to call when this event fires.public void addPolylineEndLineHandler(PolylineEndLineHandler handler)
setEditingEnabled(boolean)
handler
- the handler to call when this event fires.public void addPolylineLineUpdatedHandler(PolylineLineUpdatedHandler handler)
insertVertex(int,LatLng)
handler
- the handler to call when this event fires.public void addPolylineMouseOutHandler(PolylineMouseOutHandler handler)
handler
- the handler to call when this event fires.public void addPolylineMouseOverHandler(PolylineMouseOverHandler handler)
handler
- the handler to call when this event fires.public void addPolylineRemoveHandler(PolylineRemoveHandler handler)
MapWidget.removeOverlay(com.google.gwt.maps.client.overlay.Overlay)
or
MapWidget.clearOverlays()
.
handler
- the handler to call when this event fires.public void addPolylineVisibilityChangedHandler(PolylineVisibilityChangedHandler handler)
handler
- the handler to call when this event fires.public void deleteVertex(int index)
Polyline
must already be
added to the map via
MapWidget.addOverlay(Overlay)
.
public LatLngBounds getBounds()
public double getLength()
public LatLng getVertex(int index)
index
- the index in the polyline to query.
public int getVertexCount()
public void insertVertex(int index, LatLng latlng)
Polyline
must already be added to the map via
MapWidget.addOverlay(Overlay)
.
index
- the index into the polyline at which to insert this point.latlng
- the value of the point to add.public boolean isVisible()
public void removePolylineCancelLineHandler(PolylineCancelLineHandler handler)
addPolylineCancelLineHandler(PolylineCancelLineHandler)
.
handler
- the handler to removepublic void removePolylineClickHandler(PolylineClickHandler handler)
addPolylineClickHandler(PolylineClickHandler)
.
handler
- the handler to remove.public void removePolylineEndLineHandler(PolylineEndLineHandler handler)
addPolylineEndLineHandler(PolylineEndLineHandler)
.
handler
- the handler to removepublic void removePolylineLineUpdatedHandler(PolylineLineUpdatedHandler handler)
addPolylineLineUpdatedHandler(PolylineLineUpdatedHandler)
.
handler
- the handler to removepublic void removePolylineMouseOutHandler(PolylineMouseOutHandler handler)
addPolylineMouseOutHandler(PolylineMouseOutHandler)
.
handler
- the handler to removepublic void removePolylineMouseOverHandler(PolylineMouseOverHandler handler)
addPolylineMouseOverHandler(PolylineMouseOverHandler)
.
handler
- the handler to removepublic void removePolylineRemoveHandler(PolylineRemoveHandler handler)
addPolylineRemoveHandler(PolylineRemoveHandler)
.
handler
- the handler to removepublic void removePolylineVisibilityChangedHandler(PolylineVisibilityChangedHandler handler)
addPolylineVisibilityChangedHandler(PolylineVisibilityChangedHandler)
.
handler
- the handler to removepublic void setDrawingEnabled()
Polyline
must already be added to
the map via
MapWidget.addOverlay(Overlay)
, even if
the polyline is initially unpopulated and contains no vertices. Each click
adds an additional vertex to the polyline chain, and drawing may be
terminated through either a double-click or clicking again on the last
point added, at which point an PolylineEndLineHandler.PolylineEndLineEvent
event will be
triggered if the polyline was successfully completed; otherwise, a
PolylineCancelLineHandler.PolylineCancelLineEvent
event will be triggered, but the polyline
will not be removed from the map. If modifying an existing Polyline
, vertices are connected from either the starting or ending points of the
existing polyline, specified in the optional {link
PolyEditingOptions.setFromStart(boolean)
.
public void setDrawingEnabled(PolyEditingOptions opts)
setDrawingEnabled()
but with control
over the polyline drawing parameters.
opts
- parameters for the polyline editing session.public void setEditingEnabled(boolean enabled)
Polyline
chain of points. When
enabled, users may select and drag existing vertices. Unless a vertex limit
less than current number of vertices is specified by
PolyEditingOptions.setMaxVertices(int)
, "ghost" points will also be
added at the midpoints of polyline sections, allowing users to interpolate
new vertices by clicking and dragging these additional vertices. A
PolylineLineUpdatedHandler.PolylineLineUpdatedEvent
event will be triggered whenever vertex is
added or moved.
Note, you must add the polyline to the map before enabling editing.
enabled
- true
to turn on editing of this polyline.public void setEditingEnabled(PolyEditingOptions opts)
setEditingEnabled(boolean)
, but with
control over the polyline drawing parameters.
Note, you must add the polyline to the map before enabling editing.
opts
- parameters for the polyline editing session.public void setStrokeStyle(PolyStyleOptions style)
Polyline
must already be
added to the map via
MapWidget.addOverlay(Overlay)
style
- options for drawing the polyline.public void setVisible(boolean visible)
visible
- true to show the polyline.public boolean supportsHide()
true
if this environment supports the
setVisible(boolean)
method.
true
if setVisible(false) is supported in the current
environment.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |