public class MeasureTool extends AVListImpl implements Disposable
SHAPE_LINE
, SHAPE_PATH
, SHAPE_POLYGON
, SHAPE_CIRCLE
, SHAPE_ELLIPSE
, SHAPE_SQUARE
or SHAPE_QUAD
. In order to allow user interaction with the measuring shape, a controller must be set by
calling setController(MeasureToolController)
with a new instance of a MeasureToolController
.
The interaction sequence for drawing a shape and measuring is as follows:
MeasureTool
object by calling its setArmed(boolean)
method with an
argument of true.MeasureTool
object by
calling its setArmed(boolean)
method with an argument of false. MeasureTool
getLength()
or getArea()
method. Note that the length and
area can be queried at any time during or after the process.While entering points or after the measure tool has been disarmed, dragging the control points allow to change the initial points positions and alter the measure shape.
While the MeasureTool
is armed, pressing and immediately releasing mouse
button one while also pressing the control key (Ctl) removes the last point entered. Once the
MeasureTool
is disarmed, a measure shape of type SHAPE_POLYGON can be moved by dragging a control point
while pressing the alt/option key.
Arming and disarming the MeasureTool
does not change the
contents or attributes of the measure tool's layer. Note that the measure tool will NOT disarm itself after the
second point of a line or a regular shape has been entered - the MeasureToolController has that responsibility.
Setting the measure shape from the application
The application can set the measure shape
to an arbitrary list of positions using setPositions(java.util.ArrayList)
. If the provided list contains two
positions, the measure shape will be set to SHAPE_LINE
. If more then two positions are provided, the measure
shape will be set to SHAPE_PATH
if the last position differs from the first (open path), or SHAPE_POLYGON
if the path is closed.
The application can also set the measure shape to a predefined
regular shape by calling setMeasureShapeType(String, Position, double, double, Angle)
, providing a shape
type (one of SHAPE_CIRCLE
, SHAPE_ELLIPSE
, SHAPE_SQUARE
or SHAPE_QUAD
), a center
position, a width, a height (in meters) and a heading angle.
Finally, the application can use an existing
Polyline
or SurfaceShape
by using setMeasureShape(Polyline)
or setMeasureShape(SurfaceShape)
. The surface shape can be one of SurfacePolyline
,
SurfacePolygon
, SurfaceQuad
, SurfaceSquare
, SurfaceEllipse
or
SurfaceCircle
.
Measuring
The application can read the measured length or area
by calling the MeasureTool
getLength()
or getArea()
method. These methods will return
-1 when no value is available.
Regular shapes are defined by a center position, a width a height and a
heading angle. Those attributes can be accessed by calling the getCenterPosition()
, getWidth()
,
getHeight()
and getOrientation()
methods.
The measurements are displayed in units
specified in the measure tool's UnitsFormat
object. Access to the units format is via the method getUnitsFormat()
.
Events
The MeasureTool
will send events on several
occasions: when the position list has changed - EVENT_POSITION_ADD
, EVENT_POSITION_REMOVE
or EVENT_POSITION_REPLACE
, when metrics has changed EVENT_METRIC_CHANGED
or when the tool is armed or
disarmed EVENT_ARMED
.
Events will also be fired at the start and end of a rubber band operation
during shape creation: EVENT_RUBBERBAND_START
and EVENT_RUBBERBAND_STOP
.
See MeasureToolPanel
for some events usage.
Several instances of this class can
be used simultaneously. However, each instance should be disposed of after usage by calling the dispose()
method.
MeasureToolController
Modifier and Type | Class and Description |
---|---|
static class |
MeasureTool.ControlPoint |
protected static class |
MeasureTool.ControlPointWithLeader |
protected static class |
MeasureTool.CustomRenderableLayer |
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ACCUMULATED_LABEL |
static java.lang.String |
ANGLE_LABEL |
protected ScreenAnnotation |
annotation |
protected AnnotationAttributes |
annotationAttributes |
protected RenderableLayer |
applicationLayer |
static java.lang.String |
AREA_LABEL |
static java.lang.String |
CENTER_LATITUDE_LABEL |
static java.lang.String |
CENTER_LONGITUDE_LABEL |
static java.lang.String |
CONTROL_TYPE_LEADER_ORIGIN |
static java.lang.String |
CONTROL_TYPE_LOCATION_INDEX |
static java.lang.String |
CONTROL_TYPE_REGULAR_SHAPE |
protected MeasureToolController |
controller |
protected java.util.ArrayList<Renderable> |
controlPoints |
protected AnnotationAttributes |
controlPointsAttributes |
protected MeasureTool.CustomRenderableLayer |
controlPointsLayer |
protected AnnotationAttributes |
controlPointWithLeaderAttributes |
static java.lang.String |
EVENT_ARMED |
static java.lang.String |
EVENT_METRIC_CHANGED |
static java.lang.String |
EVENT_POSITION_ADD |
static java.lang.String |
EVENT_POSITION_REMOVE |
static java.lang.String |
EVENT_POSITION_REPLACE |
static java.lang.String |
EVENT_RUBBERBAND_START |
static java.lang.String |
EVENT_RUBBERBAND_STOP |
protected java.awt.Color |
fillColor |
protected boolean |
followTerrain |
static java.lang.String |
HEADING_LABEL |
static java.lang.String |
HEIGHT_LABEL |
static java.lang.String |
LATITUDE_LABEL |
protected MeasureTool.CustomRenderableLayer |
layer |
protected ShapeAttributes |
leaderAttributes |
static java.lang.String |
LENGTH_LABEL |
protected gov.nasa.worldwind.render.Polyline |
line |
protected java.awt.Color |
lineColor |
protected double |
lineWidth |
static java.lang.String |
LONGITUDE_LABEL |
static java.lang.String |
MAJOR_AXIS_LABEL |
protected static int |
MAX_SHAPE_MOVE_ITERATIONS |
protected java.lang.String |
measureShapeType |
static java.lang.String |
MINOR_AXIS_LABEL |
protected java.lang.String |
pathType |
static java.lang.String |
PERIMETER_LABEL |
protected java.util.ArrayList<Position> |
positions |
static java.lang.String |
RADIUS_LABEL |
static java.lang.String |
SHAPE_CIRCLE |
protected static double |
SHAPE_CONTROL_EPSILON_METERS |
static java.lang.String |
SHAPE_ELLIPSE |
static java.lang.String |
SHAPE_LINE |
protected static double |
SHAPE_MIN_HEIGHT_METERS |
protected static double |
SHAPE_MIN_WIDTH_METERS |
static java.lang.String |
SHAPE_PATH |
static java.lang.String |
SHAPE_POLYGON |
static java.lang.String |
SHAPE_QUAD |
static java.lang.String |
SHAPE_SQUARE |
protected Position |
shapeCenterPosition |
protected int |
shapeIntervals |
protected MeasureTool.CustomRenderableLayer |
shapeLayer |
protected Angle |
shapeOrientation |
protected java.awt.geom.Rectangle2D.Double |
shapeRectangle |
protected boolean |
showAnnotation |
protected boolean |
showControlPoints |
protected SurfaceShape |
surfaceShape |
protected UnitsFormat |
unitsFormat |
static java.lang.String |
WIDTH_LABEL |
protected WorldWindow |
wwd |
Constructor and Description |
---|
MeasureTool(WorldWindow wwd)
Construct a new measure tool drawing events from the specified
WorldWindow . |
MeasureTool(WorldWindow wwd,
RenderableLayer applicationLayer)
Construct a new measure tool drawing events from the specified
WorldWindow and using the given
RenderableLayer . |
Modifier and Type | Method and Description |
---|---|
Position |
addControlPoint()
Add a control point to the current measure shape at the current WorldWindow position.
|
protected void |
addControlPoint(Position position,
java.lang.String key,
java.lang.Object value) |
protected void |
addControlPointWithLeader(Position position,
java.lang.String controlKey,
java.lang.Object control,
java.lang.String leaderKey,
java.lang.Object leader) |
protected boolean |
areLocationsRedundant(LatLon locA,
LatLon locB) |
void |
clear()
Removes all positions from the shape, clear attributes.
|
protected java.lang.Double |
computeAccumulatedLength(LatLon pos) |
protected Angle |
computeAngleBetween(LatLon a,
LatLon b,
LatLon c) |
protected Angle |
computeControlPointAzimuth(java.lang.String control,
double width,
double height) |
protected Angle |
computeControlPointAzimuthInShapeCoordinates(java.lang.String control,
Angle azimuth) |
protected LatLon |
computeControlPointLocation(java.lang.String control,
Globe globe,
Angle heading,
LatLon center,
double width,
double height) |
protected Angle |
computeControlPointPathLength(java.lang.String control,
double width,
double height,
double globeRadius) |
protected java.lang.String |
computeCornerControl(Position position) |
protected static Angle |
computeNormalizedHeading(Angle heading) |
protected double |
computePathLength() |
protected LatLon |
computeQuadEdgeMidpointLocation(java.lang.String control,
Globe globe,
Angle heading,
LatLon center,
double width,
double height) |
protected Position |
computeSurfacePosition(LatLon latLon) |
protected MeasureTool.CustomRenderableLayer |
createCustomRenderableLayer() |
void |
dispose()
Disposes of any internal resources allocated by the object.
|
protected void |
doAddControlPoint(MeasureTool.ControlPoint controlPoint) |
protected java.lang.String |
formatCircleMeasurements(Position pos) |
protected java.lang.String |
formatEllipseMeasurements(Position pos) |
protected java.lang.String |
formatLineMeasurements(Position pos) |
protected java.lang.String |
formatPolygonMeasurements(Position pos) |
protected java.lang.String |
formatQuadMeasurements(Position pos) |
protected java.lang.String |
formatSquareMeasurements(Position pos) |
AnnotationAttributes |
getAnnotationAttributes()
Get the attributes associated with the tool tip annotation.
|
RenderableLayer |
getApplicationLayer()
Returns the application layer passed to the constructor.
|
double |
getArea() |
Position |
getCenterPosition() |
MeasureToolController |
getController()
Get the
MeasureToolController for this measure tool. |
MeasureTool.ControlPoint |
getControlPoint(java.lang.String control) |
java.util.ArrayList<Renderable> |
getControlPoints()
Get the list of control points associated with the current measure shape.
|
AnnotationAttributes |
getControlPointsAttributes()
Get the attributes associated with the control points.
|
protected java.lang.String |
getDisplayString(Position pos) |
java.awt.Color |
getFillColor() |
double |
getHeight() |
java.lang.String |
getLabel(java.lang.String labelName) |
RenderableLayer |
getLayer()
Returns the measure tool layer.
|
double |
getLength() |
gov.nasa.worldwind.render.Polyline |
getLine()
Returns the polyline currently used to display lines and path.
|
java.awt.Color |
getLineColor() |
double |
getLineWidth() |
java.lang.String |
getMeasureShapeType()
Get the measure shape type.
|
protected MeasureTool.ControlPoint |
getOppositeControl(java.lang.String control) |
Angle |
getOrientation() |
java.lang.String |
getPathType() |
protected java.lang.String |
getPathType(java.util.List<? extends Position> positions) |
java.util.ArrayList<? extends Position> |
getPositions()
Get the list of positions that define the current measure shape.
|
java.lang.String |
getShapeInitialControl(Position position) |
protected Angle |
getShapeInitialHeading() |
SurfaceShape |
getSurfaceShape()
Returns the surface shape currently used to display polygons.
|
UnitsFormat |
getUnitsFormat()
Return the
UnitsFormat instance governing the measurement value display units and format. |
double |
getWidth() |
WorldWindow |
getWwd() |
boolean |
isArmed()
Identifies whether the measure tool controller is armed.
|
boolean |
isCenterControl(MeasureTool.ControlPoint controlPoint) |
boolean |
isCornerControl(MeasureTool.ControlPoint controlPoint) |
boolean |
isFollowTerrain() |
boolean |
isMeasureShape(java.lang.Object o) |
boolean |
isRegularShape() |
protected boolean |
isRegularShape(java.lang.String shape) |
boolean |
isShowAnnotation() |
boolean |
isShowControlPoints() |
boolean |
isSideControl(MeasureTool.ControlPoint controlPoint) |
protected static java.lang.String |
keyFromPolylinePathType(int type) |
protected boolean |
lengthsEssentiallyEqual(java.lang.Double l1,
java.lang.Double l2) |
void |
moveControlPoint(MeasureTool.ControlPoint point)
Update the current measure shape according to a given control point position.
|
void |
moveControlPoint(MeasureTool.ControlPoint point,
java.lang.String mode)
Update the current measure shape according to a given control point position and shape edition mode.
|
void |
moveMeasureShape(Angle azimuth,
Angle distance)
Move the current measure shape along a great circle arc at a given azimuth
Angle for a given
distance Angle . |
protected LatLon |
moveShapeByControlPoint(MeasureTool.ControlPoint controlPoint,
Globe globe,
Angle heading,
LatLon center,
double width,
double height) |
protected static int |
polylinePathTypeFromKey(java.lang.String type) |
void |
removeControlPoint()
Remove the last control point from the current measure shape.
|
void |
setArmed(boolean state)
Arms and disarms the measure tool controller.
|
void |
setController(MeasureToolController controller)
Set the controller object for this measure tool - can be null.
|
void |
setFillColor(java.awt.Color color) |
void |
setFollowTerrain(boolean followTerrain) |
protected void |
setInitialLabels() |
void |
setLabel(java.lang.String labelName,
java.lang.String label) |
void |
setLineColor(java.awt.Color color) |
void |
setLineWidth(double width) |
void |
setMeasureShape(gov.nasa.worldwind.render.Polyline line)
Set the measure shape to an existing
Polyline . |
void |
setMeasureShape(SurfaceShape surfaceShape)
Set the measure shape to an existing
SurfaceShape . |
void |
setMeasureShapeType(java.lang.String shape)
Set the measure shape type.
|
void |
setMeasureShapeType(java.lang.String shapeType,
Position centerPosition,
double radius)
Set and initialize the measure shape to one of the regular shapes
SHAPE_CIRCLE , SHAPE_ELLIPSE ,
SHAPE_SQUARE or SHAPE_QUAD . |
void |
setMeasureShapeType(java.lang.String shapeType,
Position centerPosition,
double width,
double height,
Angle orientation)
Set and initialize the measure shape to one of the regular shapes
SHAPE_CIRCLE , SHAPE_ELLIPSE ,
SHAPE_SQUARE or SHAPE_QUAD . |
void |
setPathType(java.lang.String type) |
void |
setPositions(java.util.ArrayList<? extends Position> newPositions)
Set the measure shape to an arbitrary list of positions.
|
void |
setShowAnnotation(boolean state) |
void |
setShowControlPoints(boolean state) |
void |
setUnitsFormat(UnitsFormat unitsFormat)
Set the measure tool's @{link UnitsFormat} instance that governs measurement value display units and format.
|
protected void |
swapCornerControls(java.lang.String control,
Position position) |
protected void |
swapEdgeControls(java.lang.String control,
Position position) |
void |
updateAnnotation(Position pos) |
protected void |
updateControlPointWithLeader(MeasureTool.ControlPointWithLeader cp,
LatLon controlLocation) |
protected void |
updateMeasureShape() |
protected void |
updatePositionsFromShape() |
protected void |
updateShapeCenter(java.lang.String control,
Position newPosition) |
protected void |
updateShapeControlPoints() |
protected void |
updateShapeOrientation(java.lang.String control,
Position newPosition) |
protected void |
updateShapeProperties(java.lang.String control,
Position newPosition,
java.lang.String mode) |
protected void |
updateShapeSize(java.lang.String control,
Position newPosition) |
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
public static final java.lang.String ACCUMULATED_LABEL
public static final java.lang.String ANGLE_LABEL
protected ScreenAnnotation annotation
protected AnnotationAttributes annotationAttributes
protected RenderableLayer applicationLayer
public static final java.lang.String AREA_LABEL
public static final java.lang.String CENTER_LATITUDE_LABEL
public static final java.lang.String CENTER_LONGITUDE_LABEL
public static final java.lang.String CONTROL_TYPE_LEADER_ORIGIN
public static final java.lang.String CONTROL_TYPE_LOCATION_INDEX
public static final java.lang.String CONTROL_TYPE_REGULAR_SHAPE
protected MeasureToolController controller
protected java.util.ArrayList<Renderable> controlPoints
protected AnnotationAttributes controlPointsAttributes
protected MeasureTool.CustomRenderableLayer controlPointsLayer
protected AnnotationAttributes controlPointWithLeaderAttributes
public static final java.lang.String EVENT_ARMED
public static final java.lang.String EVENT_METRIC_CHANGED
public static final java.lang.String EVENT_POSITION_ADD
public static final java.lang.String EVENT_POSITION_REMOVE
public static final java.lang.String EVENT_POSITION_REPLACE
public static final java.lang.String EVENT_RUBBERBAND_START
public static final java.lang.String EVENT_RUBBERBAND_STOP
protected java.awt.Color fillColor
protected boolean followTerrain
public static final java.lang.String HEADING_LABEL
public static final java.lang.String HEIGHT_LABEL
public static final java.lang.String LATITUDE_LABEL
protected MeasureTool.CustomRenderableLayer layer
protected ShapeAttributes leaderAttributes
public static final java.lang.String LENGTH_LABEL
protected gov.nasa.worldwind.render.Polyline line
protected java.awt.Color lineColor
protected double lineWidth
public static final java.lang.String LONGITUDE_LABEL
public static final java.lang.String MAJOR_AXIS_LABEL
protected static final int MAX_SHAPE_MOVE_ITERATIONS
protected java.lang.String measureShapeType
public static final java.lang.String MINOR_AXIS_LABEL
protected java.lang.String pathType
public static final java.lang.String PERIMETER_LABEL
protected java.util.ArrayList<Position> positions
public static final java.lang.String RADIUS_LABEL
public static final java.lang.String SHAPE_CIRCLE
protected static final double SHAPE_CONTROL_EPSILON_METERS
public static final java.lang.String SHAPE_ELLIPSE
public static final java.lang.String SHAPE_LINE
protected static final double SHAPE_MIN_HEIGHT_METERS
protected static final double SHAPE_MIN_WIDTH_METERS
public static final java.lang.String SHAPE_PATH
public static final java.lang.String SHAPE_POLYGON
public static final java.lang.String SHAPE_QUAD
public static final java.lang.String SHAPE_SQUARE
protected Position shapeCenterPosition
protected int shapeIntervals
protected MeasureTool.CustomRenderableLayer shapeLayer
protected Angle shapeOrientation
protected java.awt.geom.Rectangle2D.Double shapeRectangle
protected boolean showAnnotation
protected boolean showControlPoints
protected SurfaceShape surfaceShape
protected UnitsFormat unitsFormat
public static final java.lang.String WIDTH_LABEL
protected final WorldWindow wwd
public MeasureTool(WorldWindow wwd)
WorldWindow
.wwd
- the WorldWindow
to draw events from.public MeasureTool(WorldWindow wwd, RenderableLayer applicationLayer)
WorldWindow
and using the given
RenderableLayer
.wwd
- the WorldWindow
to draw events from.applicationLayer
- the RenderableLayer
to use. May be null. If specified, the caller is
responsible for adding the layer to the model and enabling it.public Position addControlPoint()
protected void addControlPoint(Position position, java.lang.String key, java.lang.Object value)
protected void addControlPointWithLeader(Position position, java.lang.String controlKey, java.lang.Object control, java.lang.String leaderKey, java.lang.Object leader)
public void clear()
protected java.lang.Double computeAccumulatedLength(LatLon pos)
protected Angle computeControlPointAzimuth(java.lang.String control, double width, double height)
protected Angle computeControlPointAzimuthInShapeCoordinates(java.lang.String control, Angle azimuth)
protected LatLon computeControlPointLocation(java.lang.String control, Globe globe, Angle heading, LatLon center, double width, double height)
protected Angle computeControlPointPathLength(java.lang.String control, double width, double height, double globeRadius)
protected java.lang.String computeCornerControl(Position position)
protected double computePathLength()
protected LatLon computeQuadEdgeMidpointLocation(java.lang.String control, Globe globe, Angle heading, LatLon center, double width, double height)
protected MeasureTool.CustomRenderableLayer createCustomRenderableLayer()
public void dispose()
Disposable
dispose
in interface Disposable
protected void doAddControlPoint(MeasureTool.ControlPoint controlPoint)
protected java.lang.String formatCircleMeasurements(Position pos)
protected java.lang.String formatEllipseMeasurements(Position pos)
protected java.lang.String formatLineMeasurements(Position pos)
protected java.lang.String formatPolygonMeasurements(Position pos)
protected java.lang.String formatQuadMeasurements(Position pos)
protected java.lang.String formatSquareMeasurements(Position pos)
public AnnotationAttributes getAnnotationAttributes()
public RenderableLayer getApplicationLayer()
public double getArea()
public Position getCenterPosition()
public MeasureToolController getController()
MeasureToolController
for this measure tool.MeasureToolController
for this measure tool.public MeasureTool.ControlPoint getControlPoint(java.lang.String control)
public java.util.ArrayList<Renderable> getControlPoints()
public AnnotationAttributes getControlPointsAttributes()
protected java.lang.String getDisplayString(Position pos)
public java.awt.Color getFillColor()
public double getHeight()
public java.lang.String getLabel(java.lang.String labelName)
public RenderableLayer getLayer()
public double getLength()
public gov.nasa.worldwind.render.Polyline getLine()
public java.awt.Color getLineColor()
public double getLineWidth()
public java.lang.String getMeasureShapeType()
SHAPE_LINE
, SHAPE_PATH
, SHAPE_POLYGON
,
SHAPE_CIRCLE
, SHAPE_ELLIPSE
, SHAPE_SQUARE
or SHAPE_QUAD
.protected MeasureTool.ControlPoint getOppositeControl(java.lang.String control)
public Angle getOrientation()
public java.lang.String getPathType()
protected java.lang.String getPathType(java.util.List<? extends Position> positions)
public java.util.ArrayList<? extends Position> getPositions()
public java.lang.String getShapeInitialControl(Position position)
protected Angle getShapeInitialHeading()
public SurfaceShape getSurfaceShape()
public UnitsFormat getUnitsFormat()
UnitsFormat
instance governing the measurement value display units and format.public double getWidth()
public WorldWindow getWwd()
public boolean isArmed()
public boolean isCenterControl(MeasureTool.ControlPoint controlPoint)
public boolean isCornerControl(MeasureTool.ControlPoint controlPoint)
public boolean isFollowTerrain()
public boolean isMeasureShape(java.lang.Object o)
public boolean isRegularShape()
protected boolean isRegularShape(java.lang.String shape)
public boolean isShowAnnotation()
public boolean isShowControlPoints()
public boolean isSideControl(MeasureTool.ControlPoint controlPoint)
protected static java.lang.String keyFromPolylinePathType(int type)
protected boolean lengthsEssentiallyEqual(java.lang.Double l1, java.lang.Double l2)
public void moveControlPoint(MeasureTool.ControlPoint point)
point
- one of the shape control points.public void moveControlPoint(MeasureTool.ControlPoint point, java.lang.String mode)
point
- one of the shape control points.mode
- the shape edition mode.public void moveMeasureShape(Angle azimuth, Angle distance)
Angle
for a given
distance Angle
.azimuth
- the azimuth Angle
.distance
- the distance Angle
.protected LatLon moveShapeByControlPoint(MeasureTool.ControlPoint controlPoint, Globe globe, Angle heading, LatLon center, double width, double height)
protected static int polylinePathTypeFromKey(java.lang.String type)
public void removeControlPoint()
public void setArmed(boolean state)
state
- true to arm the controller, false to disarm it.public void setController(MeasureToolController controller)
controller
- the controller object for this measure tool.public void setFillColor(java.awt.Color color)
public void setFollowTerrain(boolean followTerrain)
protected void setInitialLabels()
public void setLabel(java.lang.String labelName, java.lang.String label)
public void setLineColor(java.awt.Color color)
public void setLineWidth(double width)
public void setMeasureShape(gov.nasa.worldwind.render.Polyline line)
Polyline
.line
- a Polyline
instance.public void setMeasureShape(SurfaceShape surfaceShape)
SurfaceShape
. Can be one of SurfacePolygon
,
SurfaceQuad
, SurfaceSquare
, SurfaceEllipse
or SurfaceCircle
.surfaceShape
- a SurfaceShape
instance.public void setMeasureShapeType(java.lang.String shape)
SHAPE_LINE
, SHAPE_PATH
, SHAPE_POLYGON
,
SHAPE_CIRCLE
, SHAPE_ELLIPSE
, SHAPE_SQUARE
or SHAPE_QUAD
. This will reset the
measure tool and clear the current measure shape.shape
- the measure shape type.public void setMeasureShapeType(java.lang.String shapeType, Position centerPosition, double radius)
SHAPE_CIRCLE
, SHAPE_ELLIPSE
,
SHAPE_SQUARE
or SHAPE_QUAD
.shapeType
- the shape type.centerPosition
- the shape center position.radius
- the shape radius of half width/height.public void setMeasureShapeType(java.lang.String shapeType, Position centerPosition, double width, double height, Angle orientation)
SHAPE_CIRCLE
, SHAPE_ELLIPSE
,
SHAPE_SQUARE
or SHAPE_QUAD
.shapeType
- the shape type.centerPosition
- the shape center position.width
- the shape width.height
- the shape height.orientation
- the shape orientation or azimuth angle - clockwise from north.public void setPathType(java.lang.String type)
public void setPositions(java.util.ArrayList<? extends Position> newPositions)
SHAPE_LINE
. If more then two positions are provided, the measure shape will be set
to SHAPE_PATH
if the last position differs from the first (open path), or SHAPE_POLYGON
if the path is closed.newPositions
- the shape position list.public void setShowAnnotation(boolean state)
public void setShowControlPoints(boolean state)
public void setUnitsFormat(UnitsFormat unitsFormat)
unitsFormat
- the units format instance.java.lang.IllegalArgumentException
- if the units format instance is null.protected void swapCornerControls(java.lang.String control, Position position)
protected void swapEdgeControls(java.lang.String control, Position position)
public void updateAnnotation(Position pos)
protected void updateControlPointWithLeader(MeasureTool.ControlPointWithLeader cp, LatLon controlLocation)
protected void updateMeasureShape()
protected void updatePositionsFromShape()
protected void updateShapeCenter(java.lang.String control, Position newPosition)
protected void updateShapeControlPoints()
protected void updateShapeOrientation(java.lang.String control, Position newPosition)
protected void updateShapeProperties(java.lang.String control, Position newPosition, java.lang.String mode)
protected void updateShapeSize(java.lang.String control, Position newPosition)