public class DrawingCircle extends Shape implements Exportable, AnchoredMapItem, ParentMapItem, MapItem.OnGroupChangedListener, PointMapItem.OnPointChangedListener, android.content.SharedPreferences.OnSharedPreferenceChangeListener
Modifier and Type | Class and Description |
---|---|
static interface |
DrawingCircle.OnRadiusChangedListener
Listeners
|
Shape.OnBasicLineStyleChangedListener, Shape.OnFillColorChangedListener, Shape.OnPointsChangedListener, Shape.OnStrokeColorChangedListener, Shape.OnStrokeWeightChangedListener, Shape.OnStyleChangedListener
MapItem.OnAltitudeModeChangedListener, MapItem.OnClickableChangedListener, MapItem.OnGroupChangedListener, MapItem.OnHeightChangedListener, MapItem.OnMetadataChangedListener, MapItem.OnTypeChangedListener, MapItem.OnVisibleChangedListener, MapItem.OnZOrderChangedListener
Modifier and Type | Field and Description |
---|---|
protected GeoPointMetaData |
_center |
protected Marker |
_centerMarker |
protected MapGroup |
_childGroup |
protected MapView |
_mapView |
protected UnitPreferences |
_prefs |
protected double |
_radius |
protected java.util.Set<DrawingCircle.OnRadiusChangedListener> |
_radiusListeners |
protected Marker |
_radiusMarker |
protected java.util.List<Circle> |
_rings |
static java.lang.String |
COT_TYPE |
static int |
DEFAULT_STYLE |
static int |
MAX_RINGS |
protected static java.util.Set<java.lang.String> |
MENU_METADATA |
BASIC_LINE_STYLE_DASHED, BASIC_LINE_STYLE_DOTTED, BASIC_LINE_STYLE_OUTLINED, BASIC_LINE_STYLE_SOLID, STYLE_FILLED_MASK, STYLE_STROKE_MASK
CLICKABLE_DEFAULT, EDITABLE_DEFAULT, EMPTY_TYPE, HIT_RATIO_DEFAULT, MOVABLE_DEFAULT, VISIBLE_DEFAULT, ZORDER_DEFAULT, ZORDER_HITTEST_COMPARATOR, ZORDER_RENDER_COMPARATOR
metadata
Constructor and Description |
---|
DrawingCircle(MapView mapView) |
DrawingCircle(MapView mapView,
java.lang.String uid) |
DrawingCircle(MapView mapView,
java.lang.String uid,
java.lang.String type) |
DrawingCircle(MapView mapView,
java.lang.String uid,
java.lang.String type,
MapGroup childGroup)
Create a new drawing circle
|
Modifier and Type | Method and Description |
---|---|
void |
addOnRadiusChangedListener(DrawingCircle.OnRadiusChangedListener l) |
protected Circle |
createRing(double radius)
Create a new ring for this circle
|
void |
drawCanvas(CapturePP cap,
android.os.Bundle data)
Draw the item to the canvas
|
PointMapItem |
getAnchorItem()
The center marker acts as the anchor for this circle
|
double |
getArea()
Returns the Area of the shape in meters
|
GeoBounds |
getBounds(MutableGeoBounds bounds)
Bounds is equivalent to the bonds of the outermost circle
|
GeoPointMetaData |
getCenter()
Provides the center point for the Shape, or null if an error has occurred.
|
Marker |
getCenterMarker()
Get the center marker for this circle
|
GeoPoint |
getCenterPoint() |
MapGroup |
getChildMapGroup()
Get this item's child map group
|
GeoPointMetaData[] |
getMetaDataPoints()
The array of points that make up the shape with the corresponding metadata.
|
int |
getNumRings()
Get the number of rings in this circle
|
Circle |
getOutermostRing()
Get the outermost ring
|
double |
getPerimeterOrLength()
Returns the perimeter of a shape if closed otherwise will return the length of
of the open shape from start to end.
|
GeoPoint[] |
getPoints()
Get all points of the outermost ring
|
double |
getRadius()
Get the radius of the base circle (first ring)
|
Marker |
getRadiusMarker()
Get the radius marker for this center
|
Circle |
getRing(int index)
Get the ring at the specified index
|
double |
getRingRadius(int index)
Get the radius of a specific ring in this circle
|
java.util.List<Circle> |
getRings()
Get the list of rings
|
boolean |
isCenterShapeMarker()
Helper method to check if the center marker is a generic shape marker
as opposed to a marker explicitly set by the user
|
boolean |
isSupported(java.lang.Class<?> target)
Check if this instance supports the specified target class type
|
protected void |
onGroupChanged(boolean added,
MapGroup group)
Keep the child map group with whichever group this circle is moved to
|
void |
onItemAdded(MapItem item,
MapGroup group) |
void |
onItemRemoved(MapItem item,
MapGroup group) |
void |
onPointChanged(PointMapItem item) |
protected void |
onRadiusChanged(double oldRadius) |
void |
onSharedPreferenceChanged(android.content.SharedPreferences sp,
java.lang.String key) |
protected void |
onStrokeStyleChanged()
The line/stroke style for this shape has been changed
|
protected void |
onVisibleChanged()
Invokes when the visible property changes
|
android.os.Bundle |
preDrawCanvas(CapturePP capture)
Export
|
void |
refresh()
Refresh all child item states including rings and center marker
|
void |
removeMetaData(java.lang.String key)
Removes the metadata associated with the specified key.
|
void |
removeOnRadiusChangedListener(DrawingCircle.OnRadiusChangedListener l) |
void |
setAltitudeMode(AltitudeMode altitudeMode)
Set the altitude mode for this item
See
AltitudeMode for possible values |
void |
setCenterMarker(Marker marker)
Set the center marker
|
void |
setCenterPoint(GeoPointMetaData point)
Set the center point of this circle
This will move the anchor marker as well
|
void |
setFillColor(int fillColor)
Apply fill color to the outermost ring only
|
void |
setHeight(double height)
Set the height of this item
|
void |
setMetaBoolean(java.lang.String key,
boolean value)
Inserts a Boolean value into the mapping of this Bundle, replacing
any existing value for the given key.
|
void |
setMetaString(java.lang.String key,
java.lang.String value)
Inserts a String value into the mapping of this Bundle, replacing
any existing value for the given key.
|
int |
setNumRings(int numRings) |
boolean |
setRadius(double radius)
Set the radius of the base circle (first ring)
|
void |
setRadiusMarker(Marker marker)
Set the radius marker
|
void |
setRadiusPoint(GeoPoint point)
Set the radius using a point from the center
|
void |
setStrokeColor(int strokeColor)
Apply stroke color to all rings
|
void |
setStrokeWeight(double weight)
Set the stroke weight of this shape's lines
Minimum = 1.0, maximum = 6.0
|
void |
setStyle(int style)
Set the style property value
|
void |
setTitle(java.lang.String title)
Set the title of the circle, including the name of its center marker
|
void |
setZOrder(double zOrder)
Keep the rings at the same z-order
|
protected CotEvent |
toCot()
Generate a CoT event for this circle
|
protected GPXExportWrapper |
toGpx() |
Folder |
toKml() |
protected KMZFolder |
toKmz() |
java.lang.Object |
toObjectOf(java.lang.Class<?> target,
ExportFilters filters)
Export to the specified target class type
|
protected OGRFeatureExportWrapper |
toOgrGeomtry() |
addOnBasicLineStyleChangedListener, addOnFillColorChangedListener, addOnPointsChangedListener, addOnStrokeColorChangedListener, addOnStrokeWeightChangedListener, addOnStyleChangedListener, addStyleBits, findTouchPoint, getBasicLineStyle, getClickPoint, getFillColor, getGeoPointMetaData, getIconColor, getStrokeColor, getStrokeStyle, getStrokeWeight, getStyle, getTitle, onBasicLineStyleChanged, onFillColorChanged, onPointsChanged, onStrokeColorChanged, onStrokeWeightChanged, onStyleChanged, removeOnBasicLineStyleChangedListener, removeOnFillColorChangedListener, removeOnPointsChangedListener, removeOnStrokeColorChangedListener, removeOnStrokeWeightChangedListener, removeOnStyleChangedListener, removeStyleBits, setBasicLineStyle, setColor, setColor, setFillAlpha, setStrokeStyle, setTouchPoint, wrap180
addOnAltitudeModeChangedListener, addOnClickableChangedListener, addOnGroupChangedListener, addOnHeightChangedListener, addOnMetadataChangedListener, addOnMetadataChangedListener, addOnTypeChangedListener, addOnVisibleChangedListener, addOnZOrderChangedListener, computeDistance, copyMetaData, createSerialId, dispose, getAltitudeMode, getClickable, getEditable, getGroup, getHashtags, getHeight, getHitRadius, getIconDrawable, getMetaBoolean, getMetaString, getMovable, getRadialMenuPath, getRemarks, getRemarksKey, getSerialId, getTag, getType, getUID, getUniqueMapItemName, getURI, getVisible, getVisible, getZOrder, isTouchable, notifyMetadataChanged, onAdded, onAltitudeModeChanged, onClickableChanged, onHeightChanged, onMetadataChanged, onRemoved, onTypeChanged, onVisibilityConditions, onZOrderChanged, persist, refresh, removeFromGroup, removeOnAltitudeModeChangedListener, removeOnClickableChangedListener, removeOnGroupChangedListener, removeOnHeightChangedListener, removeOnMetadataChangedListener, removeOnMetadataChangedListener, removeOnTypeChangedListener, removeOnVisibleChangedListener, removeOnZOrderChangedListener, setClickable, setClickPoint, setEditable, setHashtags, setMetaData, setMetaDouble, setMetaIntArray, setMetaInteger, setMetaLong, setMetaMap, setMetaParcelable, setMetaSerializable, setMetaStringArrayList, setMovable, setRadialMenu, setRemarks, setTag, setTouchable, setType, setVisible, setVisible, testOrthoHit, toString
get, getMetaData, getMetaDouble, getMetaIntArray, getMetaInteger, getMetaLong, getMetaMap, getMetaParcelable, getMetaSerializable, getMetaStringArrayList, hasMetaValue, setMetaDataImpl, toggleMetaData
public static final java.lang.String COT_TYPE
public static final int MAX_RINGS
public static final int DEFAULT_STYLE
protected static final java.util.Set<java.lang.String> MENU_METADATA
protected final MapView _mapView
protected final UnitPreferences _prefs
protected final MapGroup _childGroup
protected final java.util.List<Circle> _rings
protected double _radius
protected GeoPointMetaData _center
protected Marker _centerMarker
protected Marker _radiusMarker
protected final java.util.Set<DrawingCircle.OnRadiusChangedListener> _radiusListeners
public DrawingCircle(MapView mapView, java.lang.String uid, java.lang.String type, MapGroup childGroup)
mapView
- Map view instanceuid
- UIDtype
- Circle typechildGroup
- The child map grouppublic DrawingCircle(MapView mapView, java.lang.String uid, java.lang.String type)
public DrawingCircle(MapView mapView, java.lang.String uid)
public DrawingCircle(MapView mapView)
public boolean setRadius(double radius)
radius
- Radius in meterspublic double getRadius()
public double getRingRadius(int index)
index
- Ring index (starting at 0)public int getNumRings()
public java.util.List<Circle> getRings()
public Circle getRing(int index)
index
- Index (starting at 0)public Circle getOutermostRing()
public int setNumRings(int numRings)
protected Circle createRing(double radius)
radius
- The radius of the new circlepublic void refresh()
public void setTitle(java.lang.String title)
public void setStyle(int style)
Shape
protected void onVisibleChanged()
MapItem
onVisibleChanged
in class MapItem
public void setMetaString(java.lang.String key, java.lang.String value)
MetaDataHolder
setMetaString
in interface MetaDataHolder
setMetaString
in class MapItem
key
- a String, or nullvalue
- a String, or nullpublic void setMetaBoolean(java.lang.String key, boolean value)
MetaDataHolder
setMetaBoolean
in interface MetaDataHolder
setMetaBoolean
in class MapItem
key
- a String, or nullvalue
- a booleanpublic void removeMetaData(java.lang.String key)
MetaDataHolder
removeMetaData
in interface MetaDataHolder
removeMetaData
in class MapItem
public void setCenterPoint(GeoPointMetaData point)
point
- Center pointpublic GeoPointMetaData getCenter()
Shape
public GeoPoint getCenterPoint()
public void setCenterMarker(Marker marker)
marker
- Center markerpublic Marker getCenterMarker()
public boolean isCenterShapeMarker()
public void setRadiusPoint(GeoPoint point)
point
- Pointpublic void setRadiusMarker(Marker marker)
marker
- Radius markerpublic Marker getRadiusMarker()
public PointMapItem getAnchorItem()
getAnchorItem
in interface AnchoredMapItem
public GeoPoint[] getPoints()
public GeoPointMetaData[] getMetaDataPoints()
Shape
getMetaDataPoints
in class Shape
public GeoBounds getBounds(MutableGeoBounds bounds)
public void setZOrder(double zOrder)
public void setHeight(double height)
MapItem
public void setAltitudeMode(AltitudeMode altitudeMode)
MapItem
AltitudeMode
for possible valuessetAltitudeMode
in class MapItem
altitudeMode
- Altitude modepublic void setFillColor(int fillColor)
setFillColor
in class Shape
fillColor
- An argb packed by Color
public void setStrokeColor(int strokeColor)
setStrokeColor
in class Shape
strokeColor
- An argb packed by Color
public void setStrokeWeight(double weight)
Shape
setStrokeWeight
in class Shape
weight
- a stroke line widthprotected void onStrokeStyleChanged()
Shape
onStrokeStyleChanged
in class Shape
public MapGroup getChildMapGroup()
ParentMapItem
getChildMapGroup
in interface ParentMapItem
protected void onGroupChanged(boolean added, MapGroup group)
onGroupChanged
in class MapItem
added
- True if circle added to groupgroup
- Map group it was added topublic void onItemAdded(MapItem item, MapGroup group)
onItemAdded
in interface MapItem.OnGroupChangedListener
public void onItemRemoved(MapItem item, MapGroup group)
onItemRemoved
in interface MapItem.OnGroupChangedListener
public void onPointChanged(PointMapItem item)
onPointChanged
in interface PointMapItem.OnPointChangedListener
public void onSharedPreferenceChanged(android.content.SharedPreferences sp, java.lang.String key)
onSharedPreferenceChanged
in interface android.content.SharedPreferences.OnSharedPreferenceChangeListener
public void addOnRadiusChangedListener(DrawingCircle.OnRadiusChangedListener l)
public void removeOnRadiusChangedListener(DrawingCircle.OnRadiusChangedListener l)
protected void onRadiusChanged(double oldRadius)
public android.os.Bundle preDrawCanvas(CapturePP capture)
preDrawCanvas
in interface Capturable
preDrawCanvas
in class Shape
capture
- Capture instance (use forward() to convert)public void drawCanvas(CapturePP cap, android.os.Bundle data)
Capturable
drawCanvas
in interface Capturable
drawCanvas
in class Shape
cap
- Canvas to draw to (use getCanvas())data
- Point data saved in preDrawCanvaspublic boolean isSupported(java.lang.Class<?> target)
Exportable
isSupported
in interface Exportable
target
- the target classpublic java.lang.Object toObjectOf(java.lang.Class<?> target, ExportFilters filters)
Exportable
toObjectOf
in interface Exportable
target
- the target classfilters
- Allows ExportMarshal
instances to filter e.g. based
on geographic region or other criteriaprotected CotEvent toCot()
public Folder toKml()
protected KMZFolder toKmz()
protected GPXExportWrapper toGpx()
protected OGRFeatureExportWrapper toOgrGeomtry()
public double getArea()
Shape
public double getPerimeterOrLength()
Shape
getPerimeterOrLength
in class Shape