|
|||||||||
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.Polygon
public class Polygon
This is a map overlay that draws a polygon on the map, using the vector
drawing facilities of the browser if they are available, or an image overlay
from Google servers otherwise. This is very similar to a
Polyline
, except that you can
additionally specify a fill color and opacity.
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 | |
---|---|
protected |
Polygon(com.google.gwt.core.client.JavaScriptObject jsoPeer)
Create this polygon from an existing JavaScriptObject instance. |
|
Polygon(LatLng[] points)
Create a Polygon from an array of points. |
|
Polygon(LatLng[] points,
java.lang.String strokeColor,
int strokeWeight,
double strokeOpacity,
java.lang.String fillColor,
double fillOpacity)
Create a polygon from an array of points, specifying optional parameters. |
|
Polygon(LatLng[] points,
java.lang.String strokeColor,
int strokeWeight,
double strokeOpacity,
java.lang.String fillColor,
double fillOpacity,
PolygonOptions options)
Create a polygon from an array of points, specifying optional parameters. |
Method Summary | |
---|---|
void |
addPolygonCancelLineHandler(PolygonCancelLineHandler handler)
This event is fired when the polygon is being edited and the edit is canceled. |
void |
addPolygonClickHandler(PolygonClickHandler handler)
This event is fired when the polygon is clicked. |
void |
addPolygonEndLineHandler(PolygonEndLineHandler handler)
This event is fired when the polygon is being edited and the edit is completed. |
void |
addPolygonLineUpdatedHandler(PolygonLineUpdatedHandler handler)
This event is fired when the polygon has a vertex inserted. |
void |
addPolygonMouseOutHandler(PolygonMouseOutHandler handler)
This event is fired when the mouse moves out of a polygon. |
void |
addPolygonMouseOverHandler(PolygonMouseOverHandler handler)
This event is fired when the mouse moves over a polygon. |
void |
addPolygonRemoveHandler(PolygonRemoveHandler handler)
This event is fired when the polygon is removed from the map, using MapWidget.removeOverlay(com.google.gwt.maps.client.overlay.Overlay) or
MapWidget.clearOverlays() . |
void |
addPolygonVisibilityChangedHandler(PolygonVisibilityChangedHandler handler)
This event is fired when the polygon is clicked. |
static Polygon |
createPeer(com.google.gwt.core.client.JavaScriptObject jsoPeer)
Used to create a new Polygon by wrapping an existing GPolygon object. |
void |
deleteVertex(int index)
Removes with the given index in the polygon and updates the shape of the polygon accordingly. |
static Polygon |
fromEncoded(EncodedPolyline[] polylines)
Create a polygon from an array of polylines. |
static Polygon |
fromEncoded(EncodedPolyline[] polylines,
boolean fill,
java.lang.String color,
double opacity,
boolean outline)
Create a polygon from an array of polylines. |
double |
getArea()
Returns the area (in square meters) of the polygon, assuming a spherical Earth. |
LatLngBounds |
getBounds()
Returns the bounds for this polygon. |
LatLng |
getVertex(int index)
Returns the position of the specified vertex in the polygon. |
int |
getVertexCount()
Returns the number of vertices in the polygon. |
void |
insertVertex(int index,
LatLng latlng)
Inserts a new point at the given index in the polygon. |
boolean |
isVisible()
Returns true if the polygon is visible on the map. |
void |
removePolygonCancelLineHandler(PolygonCancelLineHandler handler)
Removes a single handler of this map previously added with addPolygonCancelLineHandler(PolygonCancelLineHandler) . |
void |
removePolygonClickHandler(PolygonClickHandler handler)
Removes a single handler of this map previously added with addPolygonClickHandler(PolygonClickHandler) . |
void |
removePolygonEndLineHandler(PolygonEndLineHandler handler)
Removes a single handler of this map previously added with addPolygonEndLineHandler(PolygonEndLineHandler) . |
void |
removePolygonLineUpdatedHandler(PolygonLineUpdatedHandler handler)
Removes a single handler of this map previously added with addPolygonLineUpdatedHandler(PolygonLineUpdatedHandler) . |
void |
removePolygonMouseOutHandler(PolygonMouseOutHandler handler)
Removes a single handler of this map previously added with addPolygonMouseOutHandler(PolygonMouseOutHandler) . |
void |
removePolygonMouseOverHandler(PolygonMouseOverHandler handler)
Removes a single handler of this map previously added with addPolygonMouseOverHandler(PolygonMouseOverHandler) . |
void |
removePolygonRemoveHandler(PolygonRemoveHandler handler)
Removes a single handler of this map previously added with addPolygonRemoveHandler(PolygonRemoveHandler) . |
void |
removePolygonVisibilityChangedHandler(PolygonVisibilityChangedHandler handler)
Removes a single handler of this map previously added with addPolygonVisibilityChangedHandler(PolygonVisibilityChangedHandler)
. |
void |
setDrawingEnabled()
Allows a user to construct (or modify) a Polygon object by clicking
on additional points on the map. |
void |
setDrawingEnabled(PolyEditingOptions opts)
Enable drawing as in setDrawingEnabled() but with control
over the polygon drawing parameters. |
void |
setEditingEnabled(boolean enabled)
Allows modification of an existing Polygon chain of points. |
void |
setEditingEnabled(PolyEditingOptions opts)
Enable editing as in setEditingEnabled(boolean) , but with
control over the drawing parameters. |
void |
setFillStyle(PolyStyleOptions style)
Changes the style of the polygon fill. |
void |
setStrokeStyle(PolyStyleOptions style)
Changes the style of the polylgon outline. |
void |
setVisible(boolean visible)
Show or hide the polygon. |
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 Polygon(LatLng[] points)
points
- the points to construct the polygon.public Polygon(LatLng[] points, java.lang.String strokeColor, int strokeWeight, double strokeOpacity, java.lang.String fillColor, double fillOpacity)
points
- the points to construct the polygon.strokeColor
- The line color, a string that contains the color in
hexadecimal numeric HTML style, i.e. #RRGGBB.strokeWeight
- The width of the line in pixels.strokeOpacity
- The opacity of the line - a value between 0.0 and 1.0.fillColor
- The fill color, a string that contains the color in
hexadecimal numeric HTML style, i.e. #RRGGBB.fillOpacity
- The opacity of the fill - a value between 0.0 and 1.0.public Polygon(LatLng[] points, java.lang.String strokeColor, int strokeWeight, double strokeOpacity, java.lang.String fillColor, double fillOpacity, PolygonOptions options)
points
- the points to construct the polygon.strokeColor
- The line color, a string that contains the color in
hexadecimal numeric HTML style, i.e. #RRGGBB.strokeWeight
- The width of the line in pixels.strokeOpacity
- The opacity of the line - a value between 0.0 and 1.0.fillColor
- The fill color, a string that contains the color in
hexadecimal numeric HTML style, i.e. #RRGGBB.fillOpacity
- The opacity of the fill - a value between 0.0 and 1.0.options
- additional optionsprotected Polygon(com.google.gwt.core.client.JavaScriptObject jsoPeer)
jsoPeer
- an existing JavaScriptObject instance.Method Detail |
---|
public static Polygon createPeer(com.google.gwt.core.client.JavaScriptObject jsoPeer)
jsoPeer
- GPolygon object to wrap.
public static Polygon fromEncoded(EncodedPolyline[] polylines)
polylines
- array of polylines to use as the outline for the polygon.
public static Polygon fromEncoded(EncodedPolyline[] polylines, boolean fill, java.lang.String color, double opacity, boolean outline)
polylines
- array of polylines to use as the outline for the polygon.fill
- whether to fill in the polygon with the specified color.color
- the color to use for the fill.opacity
- Opacity to use for the fill.outline
- true
public void addPolygonCancelLineHandler(PolygonCancelLineHandler handler)
setEditingEnabled(boolean)
handler
- the handler to call when this event fires.public void addPolygonClickHandler(PolygonClickHandler handler)
handler
- the handler to call when this event fires.public void addPolygonEndLineHandler(PolygonEndLineHandler handler)
setEditingEnabled(boolean)
handler
- the handler to call when this event fires.public void addPolygonLineUpdatedHandler(PolygonLineUpdatedHandler handler)
insertVertex(int,LatLng)
handler
- the handler to call when this event fires.public void addPolygonMouseOutHandler(PolygonMouseOutHandler handler)
handler
- the handler to call when this event fires.public void addPolygonMouseOverHandler(PolygonMouseOverHandler handler)
handler
- the handler to call when this event fires.public void addPolygonRemoveHandler(PolygonRemoveHandler handler)
MapWidget.removeOverlay(com.google.gwt.maps.client.overlay.Overlay)
or
MapWidget.clearOverlays()
.
handler
- the handler to call when this event fires.public void addPolygonVisibilityChangedHandler(PolygonVisibilityChangedHandler handler)
handler
- the handler to call when this event fires.public void deleteVertex(int index)
MapWidget.addOverlay(Overlay)
.
index
- the index of the vertex to remove.public double getArea()
public LatLngBounds getBounds()
public LatLng getVertex(int index)
index
- the vertex to return.
public int getVertexCount()
public void insertVertex(int index, LatLng latlng)
Polygon
must already be added to the map via
MapWidget.addOverlay(Overlay)
index
- position in the polygon to insert the new point.latlng
- point to insert into the polygon.public boolean isVisible()
public void removePolygonCancelLineHandler(PolygonCancelLineHandler handler)
addPolygonCancelLineHandler(PolygonCancelLineHandler)
.
handler
- the handler to removepublic void removePolygonClickHandler(PolygonClickHandler handler)
addPolygonClickHandler(PolygonClickHandler)
.
handler
- the handler to removepublic void removePolygonEndLineHandler(PolygonEndLineHandler handler)
addPolygonEndLineHandler(PolygonEndLineHandler)
.
handler
- the handler to removepublic void removePolygonLineUpdatedHandler(PolygonLineUpdatedHandler handler)
addPolygonLineUpdatedHandler(PolygonLineUpdatedHandler)
.
handler
- the handler to removepublic void removePolygonMouseOutHandler(PolygonMouseOutHandler handler)
addPolygonMouseOutHandler(PolygonMouseOutHandler)
.
handler
- the handler to removepublic void removePolygonMouseOverHandler(PolygonMouseOverHandler handler)
addPolygonMouseOverHandler(PolygonMouseOverHandler)
.
handler
- the handler to removepublic void removePolygonRemoveHandler(PolygonRemoveHandler handler)
addPolygonRemoveHandler(PolygonRemoveHandler)
.
handler
- the handler to removepublic void removePolygonVisibilityChangedHandler(PolygonVisibilityChangedHandler handler)
addPolygonVisibilityChangedHandler(PolygonVisibilityChangedHandler)
.
handler
- the handler to removepublic void setDrawingEnabled()
Polygon
object by clicking
on additional points on the map. The Polygon
must already be added
to the map via
MapWidget.addOverlay(Overlay)
, even if
the polygon is initially unpopulated and contains no vertices. Each click
adds an additional vertex to the chain, and drawing may be terminated
through either a double-click or clicking again on the last point added, at
which point an PolygonEndLineHandler.PolygonEndLineEvent
event will be triggered if the
polygon was successfully completed; otherwise, a
PolygonCancelLineHandler.PolygonCancelLineEvent
event will be triggered, but the polygon
will not be removed from the map. If modifying an existing Polygon
,
vertices are connected from either the starting or ending points of the
existing polygon, specified in the optional {link
PolyEditingOptions.setFromStart(boolean)
.
public void setDrawingEnabled(PolyEditingOptions opts)
setDrawingEnabled()
but with control
over the polygon drawing parameters.
opts
- parameters for the polygon editing session.public void setEditingEnabled(boolean enabled)
Polygon
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
PolygonLineUpdatedHandler.PolygonLineUpdatedEvent
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 drawing parameters.
Note, you must add the polyline to the map before enabling editing.
opts
- parameters for the editing session.public void setFillStyle(PolyStyleOptions style)
Polygon
must already be
added to the map via
MapWidget.addOverlay(Overlay)
style
- options for drawing the polygon fill.public void setStrokeStyle(PolyStyleOptions style)
Polygon
must already
be added to the map via
MapWidget.addOverlay(Overlay)
style
- options for drawing the polygon outline.public void setVisible(boolean visible)
visible
- true to show the polygon.public boolean supportsHide()
true
if this environment supports the
setVisible(boolean)
method.
false
) is supported.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |