public abstract class Rectangle extends AssociationSet implements AnchoredMapItem, ParentMapItem, android.content.SharedPreferences.OnSharedPreferenceChangeListener, MapItem.OnGroupChangedListener, PointMapItem.OnPointChangedListener
DrawingRectangle
for the default drawing shape implementationModifier and Type | Class and Description |
---|---|
static class |
Rectangle.Builder
Allows the creation of a Rectangle.
|
protected static class |
Rectangle.MovePointAction
UNDO ACTIONS
|
static interface |
Rectangle.OnMoveListener |
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 MutableGeoBounds |
_bounds |
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
Modifier | Constructor and Description |
---|---|
|
Rectangle(MapGroup childGroup,
GeoPointMetaData[] points,
java.lang.String uid)
Creates a Rectangle with the points in counter-clockwise direction.
|
|
Rectangle(MapGroup childGroup,
GeoPointMetaData p0,
GeoPointMetaData p1,
GeoPointMetaData p2,
GeoPointMetaData p3,
java.lang.String uid)
Creates a Rectangle with the points in counter-clockwise direction.
|
protected |
Rectangle(MapGroup mapGroup,
java.lang.String uid)
CONSTRUCTORS
|
|
Rectangle(MapGroup childGroup,
java.lang.String uid,
GeoPointMetaData p0,
GeoPointMetaData p1,
GeoPointMetaData p2,
GeoPointMetaData p3)
Creates a Rectangle with the points in counter-clockwise direction.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnMovedListener(Rectangle.OnMoveListener l) |
static GeoPointMetaData[] |
computeCorners(GeoPoint center,
double width,
double height,
double angle)
Convienence method for constructing a rectangle based on a center, width, height and angle.
|
PointMapItem |
getAnchorItem()
Get the anchor marker for this item
|
java.util.List<PointMapItem> |
getAnchorMarkers()
Get all the anchor markers this rectangle uses
|
double |
getArea()
Returns the Area of the shape in meters
|
int |
getAssociationMarkerIndex(PointMapItem m) |
protected abstract java.lang.String |
getAssocType() |
double |
getAvgAltitude() |
GeoBounds |
getBounds(MutableGeoBounds bnds)
The bounds of the shape
|
GeoPointMetaData |
getCenter()
Provides the center point for the Shape, or null if an error has occurred.
|
Marker |
getCenterMarker() |
protected abstract java.lang.String |
getCenterMarkerType() |
MapGroup |
getChildMapGroup()
Get this item's child map group
|
int |
getColor()
Same method as
getStrokeColor() |
abstract java.lang.String |
getCornerPointType()
SubClasses should override this function so that corner points have a specialized type, (e.g.
|
protected abstract java.lang.String |
getCotType() |
boolean |
getEditable() |
int |
getFillColor()
Get the fillColor property value
|
boolean |
getFilled() |
GeoPointMetaData[] |
getGeoPoints() |
int |
getIndexOfPoint(PointMapItem p) |
double |
getLength() |
int |
getLineStyle() |
protected abstract java.lang.String |
getMenuPath() |
GeoPointMetaData[] |
getMetaDataPoints()
The array of points that make up the shape with the corresponding metadata.
|
boolean |
getMirrorWidth() |
int |
getNumPoints() |
double |
getPerimeterOrLength()
Returns the perimeter of a shape if closed otherwise will return the length of
of the open shape from start to end.
|
PointMapItem |
getPointAt(int index) |
GeoPoint[] |
getPoints()
The array of points without any metadata
|
protected abstract java.lang.String |
getSideMarkerType()
SubClasses should override this function so that side points have a specialized type, (e.g.
|
int |
getStrokeColor()
Get the strokeColor property value
|
java.lang.String |
getTitle()
Get the title of this map item (display name)
|
protected abstract java.lang.String |
getUIDKey()
SubClasses should override this function in order to mark each corner point with a
specialized parent UID Key, (e.g.
|
double |
getWidth() |
boolean |
hasPoint(PointMapItem point) |
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
|
void |
move(GeoPointMetaData oldPoint,
GeoPointMetaData newPoint) |
void |
move(GeoPointMetaData oldPoint,
GeoPointMetaData newPoint,
boolean manualEntry)
Move a rectangle by its center anchor
|
protected void |
onGroupChanged(boolean added,
MapGroup group) |
void |
onItemAdded(MapItem item,
MapGroup group) |
void |
onItemRemoved(MapItem item,
MapGroup group) |
protected void |
onMoved(GeoPointMetaData[] oldPoints,
GeoPointMetaData[] newPoints) |
void |
onPointChanged(PointMapItem item) |
protected void |
onPointsChanged() |
void |
onSharedPreferenceChanged(android.content.SharedPreferences sp,
java.lang.String key) |
protected void |
onVisibleChanged()
Invokes when the visible property changes
|
void |
removeOnMovedListener(Rectangle.OnMoveListener l) |
void |
setBasicLineStyle(int basicLineStyle)
Change the basic line style for the shape from either SOLID, DASHED or DOTTED
|
void |
setCenterMarker(Marker marker)
Set the center marker for this rectangle
|
void |
setCenterPoint(GeoPointMetaData point)
Set the center point of this circle
This will move the anchor marker as well
|
void |
setClickable(boolean state)
Set the clickable property value.
|
void |
setEditable(boolean editable) |
void |
setFillColor(int fillColor)
Set the fillColor property value
|
void |
setFilled(boolean filled) |
void |
setHeight(double height)
Set the height of this item
|
void |
setLabelVisibility(boolean visible)
LISTENERS
|
void |
setLength(double length)
Set the length of this rectangle
|
void |
setLineStyle(int style)
STYLE_SOLID = 0, STYLE_DOTTED = 1, STYLE_DASHED = 2 and STYLE_OUTLINED
|
void |
setMovable(boolean movable) |
void |
setPoint(PointMapItem pmi,
GeoPointMetaData gp)
Set rectangle point while maintaining user-entered altitude
|
protected void |
setPointNoRecalc(PointMapItem pmi,
GeoPointMetaData gp)
Method for setting a point without triggering the side/corner listeners
Should only be called internally
|
void |
setPoints(GeoPointMetaData p0,
GeoPointMetaData p1,
GeoPointMetaData p2,
GeoPointMetaData p3)
NOTE: Should only be set when the points have been calculated to be in a rectangular shape,
or if coming from a CotEvent (which is the same thing).
|
void |
setStrokeColor(int strokeColor)
Set the strokeColor property value
|
void |
setStrokeWeight(double weight)
Set the stroke weight of this shape's lines
Minimum = 1.0, maximum = 6.0
|
void |
setTitle(java.lang.String title)
Set the title of this map item (display name)
|
void |
setWidth(double width)
Set the width of this rectangle
|
void |
setZOrder(double zOrder)
Set the ascending order of the MapItem.
|
boolean |
showLines() |
void |
showLines(boolean showLines)
Toggle the lines of the rectangle
|
boolean |
showTacticalOverlay() |
void |
showTacticalOverlay(boolean show)
Toggle tactical overlay colors on each side of the rectangle
White = front, Red = left, Green = right, Black = back
|
void |
toggleMetaData(java.lang.String key,
boolean on) |
getAssociationAt, getAssociations, setAssociations
addOnBasicLineStyleChangedListener, addOnFillColorChangedListener, addOnPointsChangedListener, addOnStrokeColorChangedListener, addOnStrokeWeightChangedListener, addOnStyleChangedListener, addStyleBits, drawCanvas, findTouchPoint, getBasicLineStyle, getClickPoint, getGeoPointMetaData, getIconColor, getStrokeStyle, getStrokeWeight, getStyle, onBasicLineStyleChanged, onFillColorChanged, onStrokeColorChanged, onStrokeStyleChanged, onStrokeWeightChanged, onStyleChanged, preDrawCanvas, removeOnBasicLineStyleChangedListener, removeOnFillColorChangedListener, removeOnPointsChangedListener, removeOnStrokeColorChangedListener, removeOnStrokeWeightChangedListener, removeOnStyleChangedListener, removeStyleBits, setColor, setColor, setFillAlpha, setStrokeStyle, setStyle, setTouchPoint, wrap180
addOnAltitudeModeChangedListener, addOnClickableChangedListener, addOnGroupChangedListener, addOnHeightChangedListener, addOnMetadataChangedListener, addOnMetadataChangedListener, addOnTypeChangedListener, addOnVisibleChangedListener, addOnZOrderChangedListener, computeDistance, copyMetaData, createSerialId, dispose, getAltitudeMode, getClickable, 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, removeMetaData, removeOnAltitudeModeChangedListener, removeOnClickableChangedListener, removeOnGroupChangedListener, removeOnHeightChangedListener, removeOnMetadataChangedListener, removeOnMetadataChangedListener, removeOnTypeChangedListener, removeOnVisibleChangedListener, removeOnZOrderChangedListener, setAltitudeMode, setClickPoint, setHashtags, setMetaBoolean, setMetaData, setMetaDouble, setMetaIntArray, setMetaInteger, setMetaLong, setMetaMap, setMetaParcelable, setMetaSerializable, setMetaString, setMetaStringArrayList, setRadialMenu, setRemarks, setTag, setTouchable, setType, setVisible, setVisible, testOrthoHit, toString
get, getMetaData, getMetaDouble, getMetaIntArray, getMetaInteger, getMetaLong, getMetaMap, getMetaParcelable, getMetaSerializable, getMetaStringArrayList, hasMetaValue, setMetaDataImpl
protected Rectangle(MapGroup mapGroup, java.lang.String uid)
public Rectangle(MapGroup childGroup, GeoPointMetaData p0, GeoPointMetaData p1, GeoPointMetaData p2, GeoPointMetaData p3, java.lang.String uid)
childGroup
- Child MapGroup for the Rectangle
p0
- First corner, in counter-clockwise direction.p1
- Second corner, in counter-clockwise direction.p2
- Third corner, in counter-clockwise direction.p3
- Fourth corner, in counter-clockwise direction.public Rectangle(MapGroup childGroup, java.lang.String uid, GeoPointMetaData p0, GeoPointMetaData p1, GeoPointMetaData p2, GeoPointMetaData p3)
childGroup
- Child MapGroup for the Rectangle
uid
- UID for this Rectanglep0
- First corner, in counter-clockwise direction.p1
- Second corner, in counter-clockwise direction.p2
- Third corner, in counter-clockwise direction.p3
- Fourth corner, in counter-clockwise direction.public Rectangle(MapGroup childGroup, GeoPointMetaData[] points, java.lang.String uid)
public void setPoint(PointMapItem pmi, GeoPointMetaData gp)
pmi
- Point map item to changegp
- New pointprotected void setPointNoRecalc(PointMapItem pmi, GeoPointMetaData gp)
pmi
- Rectangle markergp
- New pointpublic void move(GeoPointMetaData oldPoint, GeoPointMetaData newPoint, boolean manualEntry)
oldPoint
- Old center pointnewPoint
- New center pointmanualEntry
- True if this change was triggered by manual
coordinate entry. If so then the center elevation
will be modified regardless of source.public void move(GeoPointMetaData oldPoint, GeoPointMetaData newPoint)
public GeoPointMetaData getCenter()
Shape
public MapGroup getChildMapGroup()
ParentMapItem
getChildMapGroup
in interface ParentMapItem
MapGroup
that contains the Markers, Polyline, and Associations of this
Rectangle
public GeoPointMetaData[] getMetaDataPoints()
Shape
getMetaDataPoints
in class AssociationSet
public GeoPoint[] getPoints()
Shape
getPoints
in class AssociationSet
public static GeoPointMetaData[] computeCorners(GeoPoint center, double width, double height, double angle)
center
- the center point to use for all of the calculationswidth
- the width of the rectangle (must be 0 or greater)height
- the height (depth really) of the rectangle (must be 0 or greater)angle
- the angle of rotation around the centerpublic void setPoints(GeoPointMetaData p0, GeoPointMetaData p1, GeoPointMetaData p2, GeoPointMetaData p3)
p0
- p1
- p2
- p3
- public void setLength(double length)
length
- Length in meterspublic void setWidth(double width)
width
- Width in meterspublic PointMapItem getAnchorItem()
AnchoredMapItem
getAnchorItem
in interface AnchoredMapItem
public boolean isCenterShapeMarker()
public void setCenterMarker(Marker marker)
marker
- Center marker or null to use the generic shape markerpublic Marker getCenterMarker()
public void setCenterPoint(GeoPointMetaData point)
point
- Center pointpublic void setZOrder(double zOrder)
MapItem
public GeoPointMetaData[] getGeoPoints()
public int getNumPoints()
public double getAvgAltitude()
Rectangle
public void setTitle(java.lang.String title)
MapItem
public java.lang.String getTitle()
MapItem
getTitle
in interface URIContent
getTitle
in class Shape
public PointMapItem getPointAt(int index)
index
- public java.util.List<PointMapItem> getAnchorMarkers()
public int getIndexOfPoint(PointMapItem p)
p
- PointMapItemRectangle
does not contain p, returns -1.public boolean hasPoint(PointMapItem point)
public int getStrokeColor()
Shape
getStrokeColor
in class Shape
Color
public void setStrokeColor(int strokeColor)
Shape
setStrokeColor
in class Shape
strokeColor
- An argb packed Color
public void setBasicLineStyle(int basicLineStyle)
Shape
setBasicLineStyle
in class Shape
basicLineStyle
- one of Shape.SOLID, Shape.DASHED or Shape.DOTTEDpublic int getColor()
getStrokeColor()
public void setStrokeWeight(double weight)
Shape
setStrokeWeight
in class Shape
weight
- New stroke weight for the Rectangle
's linespublic void setLineStyle(int style)
public int getLineStyle()
Rectangle
public void setFilled(boolean filled)
filled
- Remove or set a filled area for this Rectangle
public boolean getFilled()
public void setFillColor(int fillColor)
Shape
setFillColor
in class Shape
fillColor
- An argb packed Color
public int getFillColor()
Shape
getFillColor
in class Shape
Color
public boolean getMirrorWidth()
protected void onVisibleChanged()
MapItem
onVisibleChanged
in class MapItem
public void setClickable(boolean state)
MapItem
setClickable
in class MapItem
public int getAssociationMarkerIndex(PointMapItem m)
public boolean getEditable()
getEditable
in class MapItem
Rectangle
is in edit mode.public void setMovable(boolean movable)
setMovable
in class MapItem
public void setEditable(boolean editable)
setEditable
in class MapItem
protected void onGroupChanged(boolean added, MapGroup group)
onGroupChanged
in class MapItem
public void onSharedPreferenceChanged(android.content.SharedPreferences sp, java.lang.String key)
onSharedPreferenceChanged
in interface android.content.SharedPreferences.OnSharedPreferenceChangeListener
public 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 showTacticalOverlay(boolean show)
show
- public boolean showTacticalOverlay()
public void showLines(boolean showLines)
showLines
- True to show the lines that make up the rectanglepublic boolean showLines()
protected abstract java.lang.String getUIDKey()
return "airfieldUID";
Rectangle
protected abstract java.lang.String getAssocType()
protected abstract java.lang.String getCenterMarkerType()
protected abstract java.lang.String getMenuPath()
protected abstract java.lang.String getCotType()
public abstract java.lang.String getCornerPointType()
return "airfield_corner";
Rectangle
protected abstract java.lang.String getSideMarkerType()
return "airfield_side";
Rectangle
protected void onPointsChanged()
onPointsChanged
in class Shape
protected void onMoved(GeoPointMetaData[] oldPoints, GeoPointMetaData[] newPoints)
public void addOnMovedListener(Rectangle.OnMoveListener l)
public void removeOnMovedListener(Rectangle.OnMoveListener l)
public GeoBounds getBounds(MutableGeoBounds bnds)
Shape
getBounds
in class AssociationSet
bnds
- a preallocated bounds objectpublic void setLabelVisibility(boolean visible)
public void toggleMetaData(java.lang.String key, boolean on)
toggleMetaData
in class FilterMetaDataHolder
public double getWidth()
public double getLength()
public void setHeight(double height)
MapItem
setHeight
in class AssociationSet
height
- the height in meters or Double.NaN if unknown.public double getArea()
Shape
public double getPerimeterOrLength()
Shape
getPerimeterOrLength
in class Shape