|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mapquest.android.maps.Overlay
com.mapquest.android.maps.PolygonOverlay
public class PolygonOverlay
PolygonOverlay is an extension of a map Overlay intended for drawing a polygon
on a MapView
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.mapquest.android.maps.Overlay |
|---|
Overlay.OverlayTapListener, Overlay.OverlayTouchEventListener, Overlay.OverlayTrackballEventListener, Overlay.Snappable |
| Field Summary |
|---|
| Fields inherited from class com.mapquest.android.maps.Overlay |
|---|
BOTTOM, CENTER, CENTER_HORIZONTAL, CENTER_VERTICAL, LEFT, RIGHT, SHADOW_X_SKEW, SHADOW_Y_SCALE, tapListener, TOP, touchListener, trackballListener |
| Constructor Summary | |
|---|---|
PolygonOverlay()
Initializes a new PolygonOverlay Requires the caller to set the line data using one of the methods: setData(List)
setData(List, boolean)
setData(List, BoundingBox) |
|
PolygonOverlay(android.graphics.Paint linePaint)
Initializes a new PolygonOverlay with a Paint object
used for the polygon's color, alpha, and stroke width (as defined by
Paint.getColor(), Paint.getAlpha(), and Paint.getStrokeWidth())
Requires the caller to set the line data using one of the methods:
setData(List)
setData(List, boolean)
setData(List, BoundingBox) |
|
| Method Summary | |
|---|---|
void |
destroy()
Cleans up internal objects used in this overlay by setting them to null |
void |
draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow)
Contains operations to draw the polygon. This method performs some checks to only draw the points that are within the map bounds, however, it does not do any optimization of the points. |
boolean |
onTap(GeoPoint gp,
MapView mapView)
If the overlay has an OverlayTapListener and the tapped point
is near the line, pass the event to the Overlay.tapListener |
boolean |
onTouchEvent(android.view.MotionEvent evt,
MapView mapView)
If the overlay has an OverlayTouchEventListener and the tapped point
is within the polygon, pass the event to the Overlay.touchListener |
boolean |
onTrackballEvent(android.view.MotionEvent evt,
MapView mapView)
If the overlay has an OverlayTrackballEventListener and the trackball point
is within the polygon, pass the event to the Overlay.trackballListener |
void |
setBoundingBox(BoundingBox boundingBox)
Sets the line's BoundingBox to be used for clipping within the draw command |
void |
setData(java.util.List<GeoPoint> data)
Sets the data to be used to draw as a polygon as provided by a List of GeoPoint objects. |
void |
setData(java.util.List<GeoPoint> data,
boolean recomputeBoundingBox)
Sets the data to be used to draw as a polygon as provided by a List of GeoPoint objects. |
void |
setData(java.util.List<GeoPoint> data,
BoundingBox bbox)
Sets the data to be used to draw as a polygon as provided by a List of GeoPoint objects and BoundingBox that
acts as a clipping region for the overlay. |
void |
setLinePaint(android.graphics.Paint paint)
Sets a Paint object used for this PolygonOverlay's color, alpha,
and stroke width (as defined by Paint.getColor(),
Paint.getAlpha(), and Paint.getStrokeWidth()) |
void |
setPointPaint(android.graphics.Paint paint)
Sets a Paint object to be used to draw defined points
along the PolygonOverlay that correspond to the line's
#data points |
void |
setShowPoints(boolean showPoints,
android.graphics.Paint pointPaint)
Sets whether the polygon overlay should show extra definition around the line's #data points |
| Methods inherited from class com.mapquest.android.maps.Overlay |
|---|
draw, drawAt, getKey, getZIndex, onKeyDown, onKeyUp, setAlignment, setKey, setTapListener, setTouchEventListener, setTrackballEventListener, setZIndex |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PolygonOverlay()
public PolygonOverlay(android.graphics.Paint linePaint)
Paint object
used for the polygon's color, alpha, and stroke width (as defined by
Paint.getColor(), Paint.getAlpha(), and Paint.getStrokeWidth())
Requires the caller to set the line data using one of the methods:
linePaint - object reference for PolygonOverlay's color,
alpha, and stroke width| Method Detail |
|---|
public void setData(java.util.List<GeoPoint> data,
BoundingBox bbox)
GeoPoint objects and BoundingBox that
acts as a clipping region for the overlay. If the data provided is
not a closed polygon, the last point will be set to the first point
in order to close the polygon.
data - list of GeoPoint objects used as drawing coordinates to draw the linebbox - used to clip the drawing of the polygon
public void setData(java.util.List<GeoPoint> data,
boolean recomputeBoundingBox)
GeoPoint objects. If the data provided is not a
closed polygon, the last point will be set to the first point in order
to close the polygon.
data - list of GeoPoint objects used as drawing
coordinates to draw the linerecomputeBoundingBox - true is the overlay should automatically
recalculate the entire bounding box necessary to draw the overlay,public void setData(java.util.List<GeoPoint> data)
GeoPoint objects. If the data provided is not
a closed polygon, the last pont will be set to the first point in
order to close the polygon.
data - list of GeoPoint objects used as drawing
coordinates to draw the overlaypublic void setLinePaint(android.graphics.Paint paint)
Paint object used for this PolygonOverlay's color, alpha,
and stroke width (as defined by Paint.getColor(),
Paint.getAlpha(), and Paint.getStrokeWidth())
paint - object reference for PolygonOverlay's color,
alpha, and stroke width
public void setShowPoints(boolean showPoints,
android.graphics.Paint pointPaint)
#data points
showPoints - true if the polygon's points should be shown,
false if the polygon should be a consistent colorpaint - object reference for PolygonOverlay's stroke widthpublic void setPointPaint(android.graphics.Paint paint)
Paint object to be used to draw defined points
along the PolygonOverlay that correspond to the line's
#data points
paint - object reference for PolygonOverlay's stroke widthpublic void setBoundingBox(BoundingBox boundingBox)
boundingBox - the boundingBox to be used for clipping
public void draw(android.graphics.Canvas canvas,
MapView mapView,
boolean shadow)
setData(List) to optimize performance)
draw in class Overlaycanvas - drawing canvas of the mapViewmapView - mapView where this request was startedshadow - draw the shadow or not on the current pass
public boolean onTap(GeoPoint gp,
MapView mapView)
OverlayTapListener and the tapped point
is near the line, pass the event to the Overlay.tapListener
onTap in class Overlaygp - the tapped pointmapView - the host MapView object
public boolean onTouchEvent(android.view.MotionEvent evt,
MapView mapView)
OverlayTouchEventListener and the tapped point
is within the polygon, pass the event to the Overlay.touchListener
onTouchEvent in class Overlayevt - the touch eventmapView - the host MapView object
public boolean onTrackballEvent(android.view.MotionEvent evt,
MapView mapView)
OverlayTrackballEventListener and the trackball point
is within the polygon, pass the event to the Overlay.trackballListener
onTrackballEvent in class Overlayevt - the Trackball eventmapView - the host MapView object
public void destroy()
destroy in class Overlay
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||