public class ShapeEditor extends Object implements SelectListener, PropertyChangeListener
| Modifier and Type | Class and Description | 
|---|---|
| protected static class  | ShapeEditor.ControlPointMarkerRepresents editor control points. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected RenderableLayer | accessoryLayerThe layer holding the rotation line and perhaps other affordances. | 
| protected boolean | activeIndicates whether the editor is in the midst of an editing operation. | 
| protected int | activeOperationIndicates the current editing operation, one of NONE, MOVING or SIZING. | 
| protected MarkerAttributes | angleControlPointAttributesAttributes used to represent shape rotation and other angular features. | 
| protected EditorAnnotation | annotationThe control point annotation. | 
| protected static String | ANNOTATIONIndicates that a control point is associated with annotation. | 
| protected RenderableLayer | annotationLayerThe layer holding the control point's annotation. | 
| protected boolean | armedIndicates whether the editor is ready for editing. | 
| protected MarkerLayer | controlPointLayerThe layer holding the editor's control points. | 
| protected SelectEvent | currentEventThe event most recently recieved by the selection method. | 
| protected Angle | currentHeadingFor shapes without an inherent heading, the current heading established by the editor for the shape. | 
| protected ShapeEditor.ControlPointMarker | currentSizingMarkerThe control point associated with the current sizing operation. | 
| protected boolean | extensionEnabledIndicates whether shapes with sub-segments such as Route and Track may be edited to add and remove legs. | 
| protected static String | HEIGHTIndicates that a control point is associated with height change. | 
| protected static String | INNER_MAJOR_RADIUSIndicates that a control point is associated with the inner major radius of a shape. | 
| protected static String | INNER_MINOR_RADIUSIndicates that a control point is associated with the inner minor radius of a shape. | 
| protected static String | INNER_RADIUSIndicates that a control point is associated with the inner radius of a shape. | 
| protected static String | LEFT_AZIMUTHIndicates that a control point is associated with the left azimuth of a shape. | 
| protected static String | LEFT_WIDTHIndicates that a control point is associated with the left width of a shape. | 
| protected static String | LOCATIONIndicates a control point is associated with a location. | 
| protected MarkerAttributes | locationControlPointAttributesAttributes used to represent shape vertices. | 
| protected static int | MOVINGEditor state indicating that the shape is being moved. | 
| protected static int | NONEEditor state indicating that the shape is not being resized or moved. | 
| protected ShapeAttributes | originalAttributesThe attributes associated with the shape when the editor is constructed. | 
| protected ShapeAttributes | originalHighlightAttributesThe highlight attributes associated with the shape when the editor is constructed. | 
| protected static String | OUTER_MAJOR_RADIUSIndicates that a control point is associated with the outer major radius of a shape. | 
| protected static String | OUTER_MINOR_RADIUSIndicates that a control point is associated with the outer minor radius of a shape. | 
| protected static String | OUTER_RADIUSIndicates that a control point is associated with the outer radius of a shape. | 
| protected Position | previousPositionThe terrain position associated with the cursor during the just previous drag event. | 
| protected static String | RIGHT_AZIMUTHIndicates that a control point is associated with the right azimuth of a shape. | 
| protected static String | RIGHT_WIDTHIndicates that a control point is associated with the right width of a shape. | 
| protected static String | ROTATIONIndicates that a control point is associated with whole-shape rotation. | 
| protected RenderableLayer | shadowLayerThe layer holding a shadow copy of the shape while the shape is being moved or sized. | 
| protected Renderable | shapeThe shape associated with the editor. | 
| protected MarkerAttributes | sizeControlPointAttributesAttributes used to represent shape size. | 
| protected static int | SIZINGEditor state indicating that the shape is being sized or otherwise respecified. | 
| protected List<Box> | trackAdjacencyListIndicates track legs that are adjacent to their previous leg in the track. | 
| protected UnitsFormat | unitsFormatThe units formatter to use when creating control point annotations. | 
| protected static String | WIDTHIndicates that a control point is associated with width change. | 
| protected WorldWindow | wwdThe  WorldWindowassociated with the shape. | 
| Constructor and Description | 
|---|
| ShapeEditor(WorldWindow wwd,
           Renderable originalShape)Constructs an editor for a specified shape. | 
| Modifier and Type | Method and Description | 
|---|---|
| protected int | addNearestLocation(Position terrainPosition,
                  double altitude,
                  List<LatLon> locations)Inserts the location nearest to a specified position on an edge of a specified list of locations into the
 appropriate place in that list. | 
| protected void | adjustShape()Performs shape-specific minor modifications to shapes after editing operation are performed. | 
| protected void | adjustTrackShape()Restores adjacency of  TrackAirspaceshapes. | 
| protected void | appendLocation(ShapeEditor.ControlPointMarker controlPoint,
              List<LatLon> locations)Adds a location to either the beginning or the end of a specified list of locations. | 
| protected Vec4 | computeControlPointDelta(LatLon previousLocation,
                        LatLon currentLocation)Computes the Cartesian difference between two control points. | 
| protected Position | computeEdgeLocation(LatLon center,
                   LatLon location,
                   double length)Computes a control point location at the edge of a shape. | 
| protected Position | computeRectangularEdgeLocation(LatLon begin,
                              LatLon end,
                              double width)Computes a control point location at the edge of a rectangular shape. | 
| protected void | determineTrackAdjacency()Determines and stores internally the adjacency of successive track legs. | 
| protected void | disable()Called by  setArmed(boolean)to remove resources no longer needed after editing. | 
| protected double | doGetControlPointAltitude(LatLon location,
                         Renderable shape) | 
| protected Renderable | doMakeShadowShape()Creates and returns the stationary shape displayed during editing operations. | 
| protected void | doReshapeShape(ShapeEditor.ControlPointMarker controlPoint,
              Position terrainPosition)Called by  reshapeShape(ShapeEditor.ControlPointMarker)to perform the actual shape modification. | 
| protected void | dragWholeShape(DragSelectEvent dragEvent)Moves the entire shape according to a specified drag event. | 
| protected void | enable()Called by  setArmed(boolean)to initialize this editor. | 
| RenderableLayer | getAccessoryLayer()Indicates the accessory layer used by this editor. | 
| int | getActiveOperation()Indicates the current operation being performed, either SIZING, MOVING or NONE. | 
| MarkerAttributes | getAngleControlPointAttributes()Indicates the attributes associated with angle control points. | 
| EditorAnnotation | getAnnotation()Indicates the annotation used to show locations and  measurements. | 
| RenderableLayer | getAnnotationLayer()Indicates the annotation layer used by this editor. | 
| protected double | getControlPointAltitude(LatLon location)Computes the appropriate absolute altitude at which to place a control point at a specified location. | 
| MarkerLayer | getControlPointLayer()Indicates the control point layer used by this editor. | 
| SelectEvent | getCurrentEvent()Indicates the event most recently passed to the select handler. | 
| Angle | getCurrentHeading()Indicates the current rotation heading. | 
| ShapeEditor.ControlPointMarker | getCurrentSizingMarker()Indicates the control point currently used in the operation underway. | 
| MarkerAttributes | getLocationControlPointAttributes()Indicates the attributes associated with location control points. | 
| ShapeAttributes | getOriginalAttributes()Indicates the attributes associated with the shape when the editor was created. | 
| ShapeAttributes | getOriginalHighlightAttributes()Indicates the highlight attributes associated with the shape prior to their being changed to achieve shape
 transparency. | 
| Position | getPreviousPosition()Returns the geographic position associated with the previous select event. | 
| RenderableLayer | getShadowLayer()Indicates the shadow layer used by this editor. | 
| Renderable | getShape()Indicates the shape associated with this editor. | 
| protected int | getShapeAltitudeMode()Indicates the current shape's altitude mode if the shape has one. | 
| protected LatLon | getShapeCenter()Returns the shape's center location, or null if it has no designated center. | 
| MarkerAttributes | getSizeControlPointAttributes()Indicates the attributes associated with size control points. | 
| UnitsFormat | getUnitsFormat()Indicates the units formatter associated with this editor. | 
| WorldWindow | getWwd()Indicates the World Window associated with this editor. | 
| boolean | isActive()Indicates whether an editing operation is currently underway. | 
| boolean | isArmed()Indicates whether this editor is armed. | 
| boolean | isExtensionEnabled()Indicates whether multi-segment shapes such as Route and Track may be edited to add or remove segments. | 
| protected static boolean | isRadiiValid(double innerRadius,
            double outerRadius) | 
| protected ShapeEditor.ControlPointMarker | makeControlPoint(Position position,
                MarkerAttributes attributes,
                int id,
                int leg,
                String purpose)Creates a control point. | 
| protected ShapeEditor.ControlPointMarker | makeControlPoint(Position position,
                MarkerAttributes attributes,
                int id,
                String purpose)Creates a control point. | 
| protected void | makeControlPointAttributes() | 
| protected void | makeShadowShape()Creates the shape that will remain at the same location and is the same size as the shape to be edited. | 
| protected void | moveLocation(ShapeEditor.ControlPointMarker controlPoint,
            Position terrainPosition,
            List<LatLon> locations)Moves a control point location. | 
| protected Vec4 | nearestPointOnSegment(Vec4 p1,
                     Vec4 p2,
                     Vec4 point)Computes the point on a specified line segment that is nearest a specified point. | 
| protected Angle | normalizedHeading(Angle originalHeading,
                 Angle deltaHeading)Add a specified increment to an angle and normalize the result to be between 0 and 360 degrees. | 
| void | propertyChange(PropertyChangeEvent event)The property change listener, the method called when a property of the Scene Controller changes
 (vertical exaggeration, etc.). | 
| protected void | removeShadowShape()Remove the shadow shape. | 
| protected void | reshapeCappedCylinder(Position terrainPosition,
                     ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  CappedCylindershapes. | 
| protected void | reshapeCappedEllipticalCylinder(Position terrainPosition,
                               ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  CappedCylindershapes. | 
| protected void | reshapeOrbit(Position terrainPosition,
            ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  Orbitshapes. | 
| protected void | reshapePolygonAirspace(Position terrainPosition,
                      ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  Polygonshapes. | 
| protected void | reshapeRoute(Position terrainPosition,
            ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  Routeshapes. | 
| protected void | reshapeShape(ShapeEditor.ControlPointMarker controlPoint)Modifies the shape's locations, size or rotation. | 
| protected void | reshapeSphere(Position terrainPosition,
             ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  SphereAirspaceshapes. | 
| protected void | reshapeSurfaceCircle(Position terrainPosition,
                    ShapeEditor.ControlPointMarker controlPoint) | 
| protected void | reshapeSurfaceEllipse(Position terrainPosition,
                     ShapeEditor.ControlPointMarker controlPoint) | 
| protected void | reshapeSurfacePolygon(Position terrainPosition,
                     ShapeEditor.ControlPointMarker controlPoint) | 
| protected void | reshapeSurfaceQuad(Position terrainPosition,
                  ShapeEditor.ControlPointMarker controlPoint) | 
| protected void | reshapeSurfaceSquare(Position terrainPosition,
                    ShapeEditor.ControlPointMarker controlPoint) | 
| protected void | reshapeTrack(Position terrainPosition,
            ShapeEditor.ControlPointMarker controlPoint)Performs an edit for  TrackAirspaceshapes. | 
| protected void | rotateLocations(Position terrainPosition,
               List<LatLon> locations)Rotates a shape's locations. | 
| void | selected(SelectEvent event)The select handler, the method called when the user selects (rolls over, left clicks, etc.) the shape or a
 control point. | 
| void | setArmed(boolean armed)Arms or disarms the editor. | 
| void | setExtensionEnabled(boolean extensionEnabled)Specifies whether multi-segment shapes such as Route and Track may be edited to add or remove segments. | 
| void | setUnitsFormat(UnitsFormat unitsFormat)Specifies the units formatter to use when creating editor annotations. | 
| protected void | updateAnnotation(ShapeEditor.ControlPointMarker controlPoint)Updates the annotation associated with a specified control point. | 
| protected void | updateCappedCylinderControlPoints()Updates the control points and affordances for  CappedCylindershapes. | 
| protected void | updateCappedEllipticalCylinderControlPoints()Updates the control points and affordances for  CappedCylindershapes. | 
| protected void | updateControlPoints()Updates the control points to the locations of the currently edited shape. | 
| protected void | updateOrbitControlPoints()Updates the control points and affordances for  Orbitshapes. | 
| protected void | updateOrientationLine(Position centerPosition,
                     Position controlPoint)Updates the line designating the shape's central axis. | 
| protected void | updatePartialCappedCylinderControlPoints()Updates the control points and affordances for  PartialCappedCylindershapes. | 
| protected void | updatePolygonAirspaceControlPoints()Updates the control points and affordances for  Polygonshapes. | 
| protected void | updateRouteControlPoints()Updates the control points and affordances for  Routeshapes. | 
| protected void | updateShapeAnnotation()Updates the annotation indicating the edited shape's center. | 
| protected void | updateSphereControlPoints()Updates the control points and affordances for  SphereAirspaceshapes. | 
| protected void | updateSurfaceCircleControlPoints() | 
| protected void | updateSurfaceEllipseControlPoints() | 
| protected void | updateSurfacePolygonControlPoints() | 
| protected void | updateSurfaceQuadControlPoints() | 
| protected void | updateSurfaceSquareControlPoints() | 
| protected void | updateTrackControlPoints()Updates the control points and affordances for  TrackAirspaceshapes. | 
protected RenderableLayer accessoryLayer
protected boolean active
protected int activeOperation
protected MarkerAttributes angleControlPointAttributes
protected EditorAnnotation annotation
protected static String ANNOTATION
protected RenderableLayer annotationLayer
protected boolean armed
protected MarkerLayer controlPointLayer
protected SelectEvent currentEvent
protected Angle currentHeading
protected ShapeEditor.ControlPointMarker currentSizingMarker
protected boolean extensionEnabled
protected static String HEIGHT
protected static String INNER_MAJOR_RADIUS
protected static String INNER_MINOR_RADIUS
protected static String INNER_RADIUS
protected static String LEFT_AZIMUTH
protected static String LEFT_WIDTH
protected static String LOCATION
protected MarkerAttributes locationControlPointAttributes
protected static final int MOVING
protected static final int NONE
protected ShapeAttributes originalAttributes
protected ShapeAttributes originalHighlightAttributes
protected static String OUTER_MAJOR_RADIUS
protected static String OUTER_MINOR_RADIUS
protected static String OUTER_RADIUS
protected Position previousPosition
protected static String RIGHT_AZIMUTH
protected static String RIGHT_WIDTH
protected static String ROTATION
protected RenderableLayer shadowLayer
protected Renderable shape
protected MarkerAttributes sizeControlPointAttributes
protected static final int SIZING
protected List<Box> trackAdjacencyList
protected UnitsFormat unitsFormat
protected static String WIDTH
protected final WorldWindow wwd
WorldWindow associated with the shape.public ShapeEditor(WorldWindow wwd, Renderable originalShape)
setArmed(boolean).wwd - the WorldWindow associated with the specified shape.originalShape - the shape to edit.IllegalArgumentException - if either the specified world window or shape is null.protected int addNearestLocation(Position terrainPosition, double altitude, List<LatLon> locations)
terrainPosition - the position to find a nearest point for.altitude - the altitude to use when determining the nearest point. Can be approximate and is not
                        necessarily the altitude of the terrain position.locations - the list of locations. This list is modified by this method to contain the new location on
                        an edge nearest the specified terrain position.protected void adjustShape()
protected void adjustTrackShape()
TrackAirspace shapes. Called by adjustShape().protected void appendLocation(ShapeEditor.ControlPointMarker controlPoint, List<LatLon> locations)
controlPoint - the control point of the shape's end. If the control point's ID is 0 the new location is
                     inserted to the beginning of the list. If the control point ID corresponds to the last
                     location in the list then the new location is appended to the list. Otherwise no operation
                     occurs.locations - the shape's locations. This list is modified upon return to include the new location.protected Vec4 computeControlPointDelta(LatLon previousLocation, LatLon currentLocation)
previousLocation - the location nof the previous control point.currentLocation - the location of the current control point.protected Position computeEdgeLocation(LatLon center, LatLon location, double length)
center - the shape's center.location - a location that forms a line from the shape's center along the shape's axis. The returned
                 location is on the edge indicated by the cross product of a vector normal to the surface at the
                 specified center and a vector from the center to this location.length - the distance of the edge from the shape's center.protected Position computeRectangularEdgeLocation(LatLon begin, LatLon end, double width)
begin - the beginning of the shape's center.end - the end of the shape's center.width - the distance of the edge from the great circle arc between begin and end.protected void determineTrackAdjacency()
protected void disable()
setArmed(boolean) to remove resources no longer needed after editing.protected double doGetControlPointAltitude(LatLon location, Renderable shape)
protected Renderable doMakeShadowShape()
protected void doReshapeShape(ShapeEditor.ControlPointMarker controlPoint, Position terrainPosition)
reshapeShape(ShapeEditor.ControlPointMarker) to perform the actual shape modification.
 Subclasses should override this method if they provide editing for shapes other than those supported by the basic
 editor.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void dragWholeShape(DragSelectEvent dragEvent)
dragEvent - the event initiating the move.protected void enable()
setArmed(boolean) to initialize this editor.public RenderableLayer getAccessoryLayer()
public int getActiveOperation()
public MarkerAttributes getAngleControlPointAttributes()
public EditorAnnotation getAnnotation()
public RenderableLayer getAnnotationLayer()
protected double getControlPointAltitude(LatLon location)
location - the location of the control point.public MarkerLayer getControlPointLayer()
public SelectEvent getCurrentEvent()
public Angle getCurrentHeading()
public ShapeEditor.ControlPointMarker getCurrentSizingMarker()
public MarkerAttributes getLocationControlPointAttributes()
public ShapeAttributes getOriginalAttributes()
public ShapeAttributes getOriginalHighlightAttributes()
public Position getPreviousPosition()
public RenderableLayer getShadowLayer()
public Renderable getShape()
protected int getShapeAltitudeMode()
WorldWind.ABSOLUTE.protected LatLon getShapeCenter()
public MarkerAttributes getSizeControlPointAttributes()
public UnitsFormat getUnitsFormat()
public WorldWindow getWwd()
public boolean isActive()
public boolean isArmed()
true if the editor is armed, otherwise false.public boolean isExtensionEnabled()
protected static boolean isRadiiValid(double innerRadius,
                                      double outerRadius)
protected ShapeEditor.ControlPointMarker makeControlPoint(Position position, MarkerAttributes attributes, int id, int leg, String purpose)
position - the control point position.attributes - the control point attributes.id - the control point ID.leg - the control point leg.purpose - the control point purpose.protected ShapeEditor.ControlPointMarker makeControlPoint(Position position, MarkerAttributes attributes, int id, String purpose)
position - the control point position.attributes - the control point attributes.id - the control point ID.purpose - the control point purpose.protected void makeControlPointAttributes()
protected void makeShadowShape()
protected void moveLocation(ShapeEditor.ControlPointMarker controlPoint, Position terrainPosition, List<LatLon> locations)
controlPoint - the control point being moved.terrainPosition - the position selected by the user.locations - the list of locations for the shape.protected Vec4 nearestPointOnSegment(Vec4 p1, Vec4 p2, Vec4 point)
p1 - the line's first point.p2 - the line's second point.point - the point for which to determine a nearest point on the line segment.protected Angle normalizedHeading(Angle originalHeading, Angle deltaHeading)
originalHeading - the base angle.deltaHeading - the increment to add prior to normalizing.public void propertyChange(PropertyChangeEvent event)
propertyChange in interface PropertyChangeListenerevent - the property change event indicating the property name and its associated value.protected void removeShadowShape()
protected void reshapeCappedCylinder(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
CappedCylinder shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void reshapeCappedEllipticalCylinder(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
CappedCylinder shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void reshapeOrbit(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
Orbit shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void reshapePolygonAirspace(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
Polygon shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void reshapeRoute(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
Route shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void reshapeShape(ShapeEditor.ControlPointMarker controlPoint)
controlPoint - the control point selected.protected void reshapeSphere(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
SphereAirspace shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void reshapeSurfaceCircle(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
protected void reshapeSurfaceEllipse(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
protected void reshapeSurfacePolygon(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
protected void reshapeSurfaceQuad(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
protected void reshapeSurfaceSquare(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
protected void reshapeTrack(Position terrainPosition, ShapeEditor.ControlPointMarker controlPoint)
TrackAirspace shapes.controlPoint - the control point selected.terrainPosition - the terrain position under the cursor.protected void rotateLocations(Position terrainPosition, List<LatLon> locations)
terrainPosition - the position selected by the user.locations - the list of locations for the shape.public void selected(SelectEvent event)
selected in interface SelectListenerevent - the select event indicating what was selected and the geographic location under the cursor.public void setArmed(boolean armed)
armed - true to arm the editor, false to disarm it and remove the control points
              and other affordances. This method must be called when the editor is no longer needed so that the
              editor may remove the resources it created when it was armed.public void setExtensionEnabled(boolean extensionEnabled)
extensionEnabled - true to allow segment addition and removal, otherwise false.public void setUnitsFormat(UnitsFormat unitsFormat)
unitsFormat - the units formatter to use. A default is created if null is specified.protected void updateAnnotation(ShapeEditor.ControlPointMarker controlPoint)
controlPoint - the control point.protected void updateCappedCylinderControlPoints()
CappedCylinder
 shapes.protected void updateCappedEllipticalCylinderControlPoints()
CappedCylinder
 shapes.protected void updateControlPoints()
protected void updateOrbitControlPoints()
Orbit shapes.protected void updateOrientationLine(Position centerPosition, Position controlPoint)
centerPosition - the shape's center location and altitude at which to place one of the line's end points.controlPoint - the shape orientation control point.protected void updatePartialCappedCylinderControlPoints()
PartialCappedCylinder
 shapes.protected void updatePolygonAirspaceControlPoints()
Polygon shapes.protected void updateRouteControlPoints()
Route shapes.protected void updateShapeAnnotation()
protected void updateSphereControlPoints()
SphereAirspace
 shapes.protected void updateSurfaceCircleControlPoints()
protected void updateSurfaceEllipseControlPoints()
protected void updateSurfacePolygonControlPoints()
protected void updateSurfaceQuadControlPoints()
protected void updateSurfaceSquareControlPoints()
protected void updateTrackControlPoints()
TrackAirspace shapes.