public class Polygon extends PolyOverlayWithIW
InfoWindow
(a bubble).
Mimics the Polygon class from Google Maps Android API v2 as much as possible. Main differences:Modifier and Type | Class and Description |
---|---|
static interface |
Polygon.OnClickListener |
Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
protected Polygon.OnClickListener |
mOnClickListener |
mDensity, mFillPaint, mHoles, mOriginalPoints, mOutline, mOutlinePaint, mPath
mId, mInfoWindow, mRelatedObject, mSnippet, mSubDescription, mTitle
mBounds, SHADOW_X_SKEW, SHADOW_Y_SCALE
DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Modifier and Type | Method and Description |
---|---|
void |
addPoint(GeoPoint p)
Add the point at the end of the polygon outline.
|
boolean |
contains(MotionEvent event)
Important note: this function returns correct results only if the Polygon has been drawn before,
and if the MapView positioning has not changed.
|
int |
getFillColor()
Deprecated.
Use
getFillPaint() instead |
Paint |
getFillPaint() |
List<List<GeoPoint>> |
getHoles()
returns a copy of the holes this polygon contains
|
List<GeoPoint> |
getPoints() |
int |
getStrokeColor()
Deprecated.
Use
PolyOverlayWithIW.getOutlinePaint() instead |
float |
getStrokeWidth()
Deprecated.
Use
PolyOverlayWithIW.getOutlinePaint() instead |
boolean |
onClickDefault(Polygon polygon,
MapView mapView,
GeoPoint eventPos)
default behaviour when no click listener is set
|
void |
onDetach(MapView mapView)
Override to perform clean up of resources before shutdown.
|
boolean |
onSingleTapConfirmed(MotionEvent event,
MapView mapView)
Default listener for a single tap event on a Polygon:
set the infowindow at the tapped position, and open the infowindow (if any).
|
static ArrayList<GeoPoint> |
pointsAsCircle(GeoPoint center,
double radiusInMeters)
Build a list of GeoPoint as a circle.
|
static ArrayList<IGeoPoint> |
pointsAsRect(BoundingBox rectangle)
Build a list of GeoPoint as a rectangle.
|
static ArrayList<IGeoPoint> |
pointsAsRect(GeoPoint center,
double lengthInMeters,
double widthInMeters)
Build a list of GeoPoint as a rectangle.
|
void |
setFillColor(int fillColor)
Deprecated.
Use
getFillPaint() instead |
void |
setHoles(List<? extends List<GeoPoint>> holes) |
void |
setOnClickListener(Polygon.OnClickListener listener) |
void |
setPoints(List<GeoPoint> points)
Set the points of the polygon outline.
|
void |
setStrokeColor(int color)
Deprecated.
Use
PolyOverlayWithIW.getOutlinePaint() instead |
void |
setStrokeWidth(float width)
Deprecated.
Use
PolyOverlayWithIW.getOutlinePaint() instead |
draw, getDistance, getInfoWindowLocation, getOutlinePaint, isGeodesic, isVisible, setDefaultInfoWindowLocation, setGeodesic, setInfoWindow, setInfoWindowLocation, setMilestoneManagers, setVisible, showInfoWindow
closeInfoWindow, getId, getInfoWindow, getRelatedObject, getSnippet, getSubDescription, getTitle, isInfoWindowOpen, onDestroy, setId, setRelatedObject, setSnippet, setSubDescription, setTitle
draw, drawAt, getBounds, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onPause, onResume, onScroll, onShowPress, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled
protected Polygon.OnClickListener mOnClickListener
public Polygon()
public Polygon(MapView mapView)
@Deprecated public int getFillColor()
getFillPaint()
instead@Deprecated public int getStrokeColor()
PolyOverlayWithIW.getOutlinePaint()
instead@Deprecated public float getStrokeWidth()
PolyOverlayWithIW.getOutlinePaint()
insteadpublic Paint getFillPaint()
getFillPaint
in class PolyOverlayWithIW
public List<GeoPoint> getPoints()
@Deprecated public void setFillColor(int fillColor)
getFillPaint()
instead@Deprecated public void setStrokeColor(int color)
PolyOverlayWithIW.getOutlinePaint()
instead@Deprecated public void setStrokeWidth(float width)
PolyOverlayWithIW.getOutlinePaint()
insteadpublic void setPoints(List<GeoPoint> points)
public void addPoint(GeoPoint p)
public List<List<GeoPoint>> getHoles()
public static ArrayList<GeoPoint> pointsAsCircle(GeoPoint center, double radiusInMeters)
center
- center of the circleradiusInMeters
- public static ArrayList<IGeoPoint> pointsAsRect(BoundingBox rectangle)
rectangle
- defined as a BoundingBoxpublic static ArrayList<IGeoPoint> pointsAsRect(GeoPoint center, double lengthInMeters, double widthInMeters)
center
- of the rectanglelengthInMeters
- on longitudewidthInMeters
- on latitudepublic boolean contains(MotionEvent event)
event
- public boolean onSingleTapConfirmed(MotionEvent event, MapView mapView)
onSingleTapConfirmed
in class Overlay
event
- mapView
- public void onDetach(MapView mapView)
Overlay
onDetach
in class PolyOverlayWithIW
public boolean onClickDefault(Polygon polygon, MapView mapView, GeoPoint eventPos)
public void setOnClickListener(Polygon.OnClickListener listener)
listener
-