NASA World Wind

gov.nasa.worldwind.examples.shapebuilder
Class AbstractShapeEditor

java.lang.Object
  extended by gov.nasa.worldwind.avlist.AVListImpl
      extended by gov.nasa.worldwind.WWObjectImpl
          extended by gov.nasa.worldwind.layers.AbstractLayer
              extended by gov.nasa.worldwind.examples.shapebuilder.AbstractShapeEditor
All Implemented Interfaces:
AVList, Disposable, MessageListener, Layer, Restorable, WWObject, MouseListener, MouseMotionListener, PropertyChangeListener, EventListener
Direct Known Subclasses:
ExtrudedPolygonEditor, RigidShapeEditor

public abstract class AbstractShapeEditor
extends AbstractLayer
implements MouseListener, MouseMotionListener

An abstract class defining common functionality and fields for editors used in the RigidShapeBuilder example. These include field variables and getters and setters for the shape's annotations that are displayed during editing (and related labels), references to the current WorldWindow and mouse location, flags indicating whether the editor is currently armed and whether annotations should be shown, as well as fields indicating the current action being performed, the current editMode, and the current altitudeMode.

In addition, the class contains several helper functions related to displaying annotations, which all editors should be able to do.


Field Summary
protected  boolean aboveGround
           
static String ACCUMULATED_LABEL
           
protected  String activeAction
           
static String ALTITUDE_LABEL
           
protected  int altitudeMode
           
static String ANGLE_LABEL
          Labels used in the annotations which are displayed during editing to show the current value of various shape parameters.
protected  ScreenAnnotation annotation
           
protected  AnnotationAttributes annotationAttributes
           
static String AREA_LABEL
           
protected  boolean armed
           
static String CENTER_ALTITUDE_LABEL
           
static String CENTER_LATITUDE_LABEL
           
static String CENTER_LONGITUDE_LABEL
           
static String EAST_SKEW_LABEL
           
protected  String editMode
           
protected  long frameTimestamp
           
static String HEADING_LABEL
           
static String HEIGHT_LABEL
           
static String LATITUDE_LABEL
           
static String LENGTH_LABEL
           
static String LONGITUDE_LABEL
           
static String MAJOR_AXIS_LABEL
           
static String MINOR_AXIS_LABEL
           
protected  Point mousePoint
           
static String NORTH_SKEW_LABEL
           
static String PERIMETER_LABEL
           
static String RADIUS_LABEL
           
static String ROLL_LABEL
           
protected  boolean showAnnotation
           
static String TILT_LABEL
           
protected  UnitsFormat unitsFormat
           
static String WIDTH_LABEL
           
protected  WorldWindow wwd
           
 
Constructor Summary
AbstractShapeEditor()
           
 
Method Summary
protected  boolean arePositionsRedundant(Position posA, Position posB)
           
 int getAltitudeMode()
           
protected  AnnotationAttributes getAnnotationAttributes()
           
abstract  String getEditMode()
           
 String getLabel(String labelName)
           
 WorldWindow getWorldWindow()
           
protected  void initializeAnnotation()
           
 boolean isAboveGround()
           
 boolean isArmed()
           
 boolean isShowAnnotation()
           
 void setAboveGround(boolean state)
           
 void setAltitudeMode(int altitudeMode)
           
protected  void setAnnotationAttributes(AnnotationAttributes attributes)
           
 void setArmed(boolean armed)
           
abstract  void setEditMode(String editMode)
           
protected  void setInitialLabels()
           
 void setLabel(String labelName, String label)
           
abstract  void setShape(AbstractShape shape)
           
 void setShowAnnotation(boolean state)
           
 void setWorldWindow(WorldWindow wwd)
           
abstract  void updateAnnotation(Position pos)
           
 
Methods inherited from class gov.nasa.worldwind.layers.AbstractLayer
createLayerConfigElements, dispose, doPick, doPreRender, doRender, getDataFileStore, getExpiryTime, getLayerConfigParams, getMaxActiveAltitude, getMaxEffectiveAltitude, getMinActiveAltitude, getMinEffectiveAltitude, getName, getOpacity, getRestorableState, getScale, getScreenCredit, isAtMaxResolution, isEnabled, isLayerActive, isLayerConfigDocument, isLayerInView, isMultiResolution, isNetworkRetrievalEnabled, isPickEnabled, pick, preRender, render, restoreState, setDataFileStore, setEnabled, setExpiryTime, setMaxActiveAltitude, setMinActiveAltitude, setName, setNetworkRetrievalEnabled, setOpacity, setPickEnabled, setScreenCredit, toString
 
Methods inherited from class gov.nasa.worldwind.WWObjectImpl
onMessage, propertyChange
 
Methods inherited from class gov.nasa.worldwind.avlist.AVListImpl
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
 
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
 
Methods inherited from interface gov.nasa.worldwind.avlist.AVList
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getEntries, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
 
Methods inherited from interface java.beans.PropertyChangeListener
propertyChange
 
Methods inherited from interface gov.nasa.worldwind.event.MessageListener
onMessage
 

Field Detail

aboveGround

protected boolean aboveGround

ACCUMULATED_LABEL

public static final String ACCUMULATED_LABEL
See Also:
Constant Field Values

activeAction

protected String activeAction

ALTITUDE_LABEL

public static final String ALTITUDE_LABEL
See Also:
Constant Field Values

altitudeMode

protected int altitudeMode

ANGLE_LABEL

public static final String ANGLE_LABEL
Labels used in the annotations which are displayed during editing to show the current value of various shape parameters. Actual label values are retrieved from the World Wind message resource bundle.

See Also:
Constant Field Values

annotation

protected ScreenAnnotation annotation

annotationAttributes

protected AnnotationAttributes annotationAttributes

AREA_LABEL

public static final String AREA_LABEL
See Also:
Constant Field Values

armed

protected boolean armed

CENTER_ALTITUDE_LABEL

public static final String CENTER_ALTITUDE_LABEL
See Also:
Constant Field Values

CENTER_LATITUDE_LABEL

public static final String CENTER_LATITUDE_LABEL
See Also:
Constant Field Values

CENTER_LONGITUDE_LABEL

public static final String CENTER_LONGITUDE_LABEL
See Also:
Constant Field Values

EAST_SKEW_LABEL

public static final String EAST_SKEW_LABEL
See Also:
Constant Field Values

editMode

protected String editMode

frameTimestamp

protected long frameTimestamp

HEADING_LABEL

public static final String HEADING_LABEL
See Also:
Constant Field Values

HEIGHT_LABEL

public static final String HEIGHT_LABEL
See Also:
Constant Field Values

LATITUDE_LABEL

public static final String LATITUDE_LABEL
See Also:
Constant Field Values

LENGTH_LABEL

public static final String LENGTH_LABEL
See Also:
Constant Field Values

LONGITUDE_LABEL

public static final String LONGITUDE_LABEL
See Also:
Constant Field Values

MAJOR_AXIS_LABEL

public static final String MAJOR_AXIS_LABEL
See Also:
Constant Field Values

MINOR_AXIS_LABEL

public static final String MINOR_AXIS_LABEL
See Also:
Constant Field Values

mousePoint

protected Point mousePoint

NORTH_SKEW_LABEL

public static final String NORTH_SKEW_LABEL
See Also:
Constant Field Values

PERIMETER_LABEL

public static final String PERIMETER_LABEL
See Also:
Constant Field Values

RADIUS_LABEL

public static final String RADIUS_LABEL
See Also:
Constant Field Values

ROLL_LABEL

public static final String ROLL_LABEL
See Also:
Constant Field Values

showAnnotation

protected boolean showAnnotation

TILT_LABEL

public static final String TILT_LABEL
See Also:
Constant Field Values

unitsFormat

protected UnitsFormat unitsFormat

WIDTH_LABEL

public static final String WIDTH_LABEL
See Also:
Constant Field Values

wwd

protected WorldWindow wwd
Constructor Detail

AbstractShapeEditor

public AbstractShapeEditor()
Method Detail

arePositionsRedundant

protected boolean arePositionsRedundant(Position posA,
                                        Position posB)

getAltitudeMode

public int getAltitudeMode()

getAnnotationAttributes

protected AnnotationAttributes getAnnotationAttributes()

getEditMode

public abstract String getEditMode()

getLabel

public String getLabel(String labelName)

getWorldWindow

public WorldWindow getWorldWindow()

initializeAnnotation

protected void initializeAnnotation()

isAboveGround

public boolean isAboveGround()

isArmed

public boolean isArmed()

isShowAnnotation

public boolean isShowAnnotation()

setAboveGround

public void setAboveGround(boolean state)

setAltitudeMode

public void setAltitudeMode(int altitudeMode)

setAnnotationAttributes

protected void setAnnotationAttributes(AnnotationAttributes attributes)

setArmed

public void setArmed(boolean armed)

setEditMode

public abstract void setEditMode(String editMode)

setInitialLabels

protected void setInitialLabels()

setLabel

public void setLabel(String labelName,
                     String label)

setShape

public abstract void setShape(AbstractShape shape)

setShowAnnotation

public void setShowAnnotation(boolean state)

setWorldWindow

public void setWorldWindow(WorldWindow wwd)

updateAnnotation

public abstract void updateAnnotation(Position pos)

NASA World Wind