public class Polygon extends OverlayWithIW
InfoWindow
(a bubble).
Mimics the Polygon class from Google Maps Android API v2 as much as possible. Main differences:Overlay.Snappable
Modifier and Type | Field and Description |
---|---|
protected static InfoWindow |
mDefaultInfoWindow |
mInfoWindow, mRelatedObject, mSnippet, mSubDescription, mTitle
mBounds, SHADOW_X_SKEW, SHADOW_Y_SCALE
DEFAULT_ZOOMLEVEL_MINIMAP_DIFFERENCE, NOT_SET
Modifier and Type | Method and Description |
---|---|
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.
|
void |
draw(Canvas canvas,
MapView mapView,
boolean shadow)
Draw the overlay over the map.
|
int |
getFillColor() |
List<List<GeoPoint>> |
getHoles()
returns a copy of the holes this polygon contains
|
String |
getId() |
GeoPoint |
getInfoWindowAnchorPoint(GeoPoint eventPos)
returns a point that the info window cartoon bubble will point at.
|
Paint |
getOutlinePaint() |
List<GeoPoint> |
getPoints() |
int |
getStrokeColor() |
float |
getStrokeWidth() |
boolean |
isVisible() |
void |
onDetach(MapView mapView)
Override to perform clean up of resources before shutdown.
|
boolean |
onSingleTapConfirmed(MotionEvent event,
MapView mapView)
By default does nothing (
return false ). |
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) |
void |
setHoles(List<? extends List<GeoPoint>> holes) |
void |
setId(String id) |
void |
setInfoWindow(InfoWindow infoWindow)
Set the InfoWindow to be used.
|
void |
setInfoWindowLocation(GeoPoint location)
Sets the info window's cartoon bubble point to this location
|
void |
setMilestoneManagers(List<MilestoneManager> pMilestoneManagers) |
void |
setPoints(List<GeoPoint> points)
This method will take a copy of the points.
|
void |
setStrokeColor(int color) |
void |
setStrokeWidth(float width) |
void |
setVisible(boolean visible) |
void |
showInfoWindow(GeoPoint position) |
closeInfoWindow, getInfoWindow, getRelatedObject, getSnippet, getSubDescription, getTitle, isInfoWindowOpen, onDestroy, setRelatedObject, setSnippet, setSubDescription, setTitle
drawAt, getBounds, getSafeMenuId, getSafeMenuIdSequence, isEnabled, onDoubleTap, onDoubleTapEvent, onDown, onFling, onKeyDown, onKeyUp, onLongPress, onPause, onResume, onScroll, onShowPress, onSingleTapUp, onTouchEvent, onTrackballEvent, setEnabled
protected static InfoWindow mDefaultInfoWindow
public Polygon()
public Polygon(MapView mapView)
public int getFillColor()
public int getStrokeColor()
public float getStrokeWidth()
public Paint getOutlinePaint()
public boolean isVisible()
public void setFillColor(int fillColor)
public void setStrokeColor(int color)
public void setStrokeWidth(float width)
public void setVisible(boolean visible)
public void setInfoWindow(InfoWindow infoWindow)
setInfoWindow
in class OverlayWithIW
infoWindow
- the InfoWindow to be opened when tapping the overlay.
This InfoWindow MUST be able to handle an OverlayWithIW (as BasicInfoWindow does).
Set it to null to remove an existing InfoWindow.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 void draw(Canvas canvas, MapView mapView, boolean shadow)
Overlay
public void showInfoWindow(GeoPoint position)
public boolean contains(MotionEvent event)
event
- public boolean onSingleTapConfirmed(MotionEvent event, MapView mapView)
Overlay
return false
). If you handled the Event, return true
, otherwise return false
. If you returned true
none of the following Overlays
or the underlying MapView
has the chance to handle this event.onSingleTapConfirmed
in class Overlay
public GeoPoint getInfoWindowAnchorPoint(GeoPoint eventPos)
eventPos
- public void setInfoWindowLocation(GeoPoint location)
location
- public void onDetach(MapView mapView)
Overlay
public String getId()
public void setId(String id)
id
- public void setMilestoneManagers(List<MilestoneManager> pMilestoneManagers)