ucar.unidata.idv.control
Class DrawingControl

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.idv.control.DisplayControlBase
          extended by ucar.unidata.idv.control.DisplayControlImpl
              extended by ucar.unidata.idv.control.DrawingControl
All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, ControlListener, DisplayListener
Direct Known Subclasses:
PointCloudControl, RadarEditor, TransectDrawingControl

public class DrawingControl
extends DisplayControlImpl

A MetApps Display Control for drawing lines on a navigated display.

Version:
$Revision: 1.145 $
Author:
MetApps development team

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.unidata.idv.control.DisplayControlImpl
DisplayControlImpl.SideLegendLabel
 
Field Summary
static String ATTR_EDITABLE
          Xml attribute for the editable property
static String ATTR_FRONTDISPLAY
          xgrf attribute
static String ATTR_TITLE
          Xml attribute for the title property
static String ATTR_USETIMESINANIMATION
          xgrf xml attribute
static DrawingCommand CMD_MOVE
          command
static DrawingCommand CMD_SELECT
          Select command
static DrawingCommand CMD_STRETCH
          command
protected  DrawingCommand currentCmd
          Current command
protected  JCheckBox enabledCbx
          Controls the disabled state
static PatternFileFilter FILTER_XGRF
          File filter used for the xgrf files
static int FLAG_FILLED
          Filled capable flag for the command object
static int FLAG_FULLLATLON
          Full lat/lon capable flag for the command object
static int FLAG_STRAIGHT
          flag for straight
protected  List glyphs
          List of all glyphs
protected  List selectedGlyphs
          List of selected glyphs
static String SHARE_LINES
          property for sharing lines
protected  JCheckBox straightCbx
          Filled mode
static String SUFFIX_XGRF
          File suffix used for the xgrfg files
static String TAG_EDITOR
          Xml tag for the editor settings in the import/export format
 
Fields inherited from class ucar.unidata.idv.control.DisplayControlImpl
categories, colorScaleInfo, colorScales, contourInfo, contourInfoParams, contourWidget, controlContext, ctw, dataSelection, defaultView, defaultViewManager, DISPLAY_LIST_NAME, displayListTable, displayListUsesColor, displayMasters, displayUnit, helpUrl, initNoteText, instantiatedWithNoData, noteTextArea, noteWrapper, paramName, requestProperties, selectRangeWidget, settingVisibility, sharables, showNoteText, skipSlider, version, viewManagers, ZFUDGE
 
Fields inherited from class ucar.unidata.idv.control.DisplayControlBase
CMD_BARBSIZE, CMD_COLORS, CMD_COLORTABLE, CMD_INTERVAL, CMD_LEVEL, CMD_LINEWIDTH, CMD_POPUP, CMD_REMOVE, DEFAULT_POINT_SIZE, DEFAULT_SAMPLING_MODE, FIND_ALL, FIND_CATEGORY, FIND_CLASS, FIND_SPECIAL, FIND_THIS, FIND_WITHDATA, FIND_WITHTHISDATA, FIND_WITHTHISFIELD, FIND_WITHTHISVIEW, FLAG_COLOR, FLAG_COLORTABLE, FLAG_COLORUNIT, FLAG_CONTOUR, FLAG_DATACONTROL, FLAG_DISPLAYUNIT, FLAG_LINEWIDTH, FLAG_NONE, FLAG_SELECTRANGE, FLAG_SKIPFACTOR, FLAG_SMOOTHING, FLAG_TEXTUREQUALITY, FLAG_TIMERANGE, FLAG_ZPOSITION, GRID_INSETS, ICON_LOCK, ICON_REMOVE, ICON_UNLOCK, LABEL_NONE, log_, MACRO_DATASOURCENAME, MACRO_DISPLAYNAME, MACRO_DISPLAYUNIT, MACRO_FHOUR, MACRO_LONGNAME, MACRO_POSITION, MACRO_SHORTNAME, MACRO_STATION, MACRO_TIMESTAMP, MACRO_VALUE, NEAREST_NEIGHBOR, PREF_DISPLAYLIST_TEMPLATE, PREF_EXTRALABEL_TEMPLATE, PREF_LEGENDLABEL_TEMPLATE, PROP_REMOVED, SETTINGS_GROUP_DISPLAY, SETTINGS_GROUP_FLAGS, SHARE_CHOICES, SHARE_COLOR, SHARE_COLORSCALE, SHARE_COLORTABLE, SHARE_DISPLAYUNIT, SHARE_POSITION, SHARE_SELECTRANGE, SHARE_SKIPVALUE, SHARE_TRANSECT, SHARE_VISIBILITY, WEIGHTED_AVERAGE
 
Fields inherited from interface ucar.unidata.idv.DisplayControl
BOTTOM_LEGEND, DEFAULT_PROBEFORMAT, PREF_PREFIX, PREF_PROBEFORMAT, PREF_REMOVEONWINDOWCLOSE, PREF_SAMPLING_MODE, PREF_STANDALONE_REMOVEONCLOSE, PREF_STANDALONE_REMOVEONCLOSE_ASK, PROP_LEGENDICON, RASTERMODE_SHOWALL, RASTERMODE_SHOWNONRASTER, RASTERMODE_SHOWRASTER, SIDE_LEGEND
 
Constructor Summary
DrawingControl()
          Create a new Drawing Control; set attributes.
 
Method Summary
protected  void addControlWidgets(List widgets)
          Add the widgets into the controls panel
protected  void addFileMenuItems(List items, boolean forMenuBar)
          Add to the file menu
protected  boolean addGlyph(DrawingGlyph glyph)
          Add the glyph into the list of glyphs
 void applyColorToAll()
          Apply the current color to all glyphs
 void applyZPosition(List glyphs)
          Apply the current z position to all glyphs
protected  boolean canHandleEvents()
          Should we handle display events
protected  void checkZSliderEnabled()
          Enable/disable the z slider
 void close()
          Clear the selection when we minisze the window
 DrawingGlyph closestGlyph(DisplayEvent event)
          Find the glyph that is closest to the x/y point of the given event
 DrawingGlyph closestGlyph(DisplayEvent event, boolean forMove)
          Find the glyph that is closest to the x/y point of the given event
protected  DrawingGlyph createGlyph(DisplayEvent event, boolean mousePress)
          Create a glyph
protected  void doCut()
          Remove the glyphs in the selection set
 void doFlythrough()
          Do the flythrough
protected  Container doMakeContents()
          Make the gui
protected  JComponent doMakeControlsPanel()
          Make the main tabbed pane
static JComboBox doMakeLineWidthBox(int lineWidth)
          Make a component to change the width of the lines.
protected  JComponent doMakeShapesPanel()
          Make the shapes panel
protected  JComponent doMakeStylePanel()
          Make the style panel
protected  JComponent doMakeTablePanel()
          Make the jtable panel
protected  void doneMovingGlyph(DrawingGlyph glyph)
          Done moving glyph
 void doProperties(List glyphs)
          Show the properties dialog for the glyphs in the list
 void doRemove()
          Remove this DisplayControl from the system.
 void evaluateGlyphJython(DrawingGlyph glyph, String jython)
          Evalue the given jython for the glyph
 String formatDistance(Real distance)
          Utility
 DateTime[] getAllTimes()
          Get an array of all the current times in the display
 Set getAnimationSet()
          Get the animation set
protected  long getControlChangeSleepTime()
          How long do we sleep until we act on the control changed event
 int getCoordType()
          Get the coord type (e.g., LATLON, XYZ)
 Real getCurrentTime()
          Get the current time in the animation
 Unit getDistanceUnit()
          Get the distance unit
 boolean getEditable()
          Get the Editable property.
protected  void getEditMenuItems(List items, boolean forMenuBar)
          Add the relevant edit menu items into the list
 String getEditorTitle()
          Get the Editor Title property.
 boolean getEnabled()
          Get the Enabled property.
protected  void getFileMenuItems(List items, boolean forMenuBar)
          Add to the file menu.
 boolean getFilled()
          Get the Filled property.
 Font getFont()
          Get the font from the ui widget
 boolean getFrontDisplay()
          Get the FrontDisplay property.
 double getFrontScale()
          Get the FrontScale property.
 boolean getFullLatLon()
          Get the FullLatLon property.
 String getGlyphJython()
          Get the GlyphJython property.
protected  String getGlyphNameDefault(DrawingGlyph glyph)
          Get the default name to use
 List getGlyphs()
          Get the Glyphs property.
 boolean getIgnoreTime()
          Get the IgnoreTime property.
protected  double getInitialZPosition()
          Get default z position to use
 String getJustification()
          Get the text justification value
protected  void getLegendLabels(List labels, int legendType)
          Overwrite the legend labels method to use the editor title if there is one.
 int getLineWidth()
          Get the line width
 ColorTable getRGBColorTable()
          Get the color table to use for the image glyphs
protected  List getShapeCommands()
          Get the lsit of shape commands the user can draw with.
 boolean getShowFronts()
          Get the ShowFronts property.
 boolean getStraight()
          Get the Straight property.
 Real getTimeForGlyph()
          If we are not drawing in the current time then return null.
 boolean getUseTime()
          Get the UseTime property.
 String getVerticalJustification()
          Get the vert text justification value
 void glyphChanged(DrawingGlyph glyph)
          The given glyph has changed somehow.
 void handleDisplayChanged(DisplayEvent event)
          Listen for DisplayEvents
protected  void handleWindowClosing()
          Handle the window closing.
 boolean init(DataChoice dataChoice)
          Call to help make this kind of Display Control; also calls code to made the Displayable (empty of data thus far).
protected  void initDisplayUnit()
          Initialize the display unit
 boolean isSelected(DrawingGlyph glyph)
          Is the given glyph selected
protected  JPanel makeButtonPanel(List commands, ButtonGroup bg)
          Utility to make a panel holding the icon buttons.
protected  void makeModePanel(List widgets)
          Makes the model panel.
protected  void processData(Data data)
          Process the visad data object.
 void projectionChanged()
          Respond to the projection changing event
 void receiveShareData(Sharable from, Object dataId, Object[] data)
          Method called by other classes that share the the state.
 void removeAllGlyphs()
          Remove em all.
 void removeGlyph(DrawingGlyph glyph)
          Remove the glyph from the drawing
protected  void resetData()
          respond to the reload data call
protected  void selectionChanged()
          The selection set changed.
 void setActive(boolean b)
          Deprecated.  
protected  void setCoordType(int c)
          Get the coord type (e.g., LATLON, XYZ)
protected  void setCurrentCommand(DrawingCommand command)
          Set the current active command
 void setDisplayVisibility(boolean on)
          TUrn on the visibility of this display
 void setEditable(boolean value)
          Set the Editable property.
 void setEditorTitle(String value)
          Set the editorTitle property.
 void setEnabled(boolean value)
          Set the Enabled property.
 void setFilled(boolean value)
          Set the Filled property.
 void setFrontDisplay(boolean value)
          Set the FrontDisplay property.
 void setFrontScale(double value)
          Set the FrontScale property.
 void setFullLatLon(boolean value)
          Set the FullLatLon property.
 void setGlyphJython(String value)
          Set the GlyphJython property.
 void setGlyphs(List value)
          Set the DrawingGlyphs property.
 void setIgnoreTime(boolean value)
          Set the IgnoreTime property.
 void setLines(UnionSet lines)
          Deprecated.  
 void setLineWidth(int width)
          Set the width of the lines.
 void setSelection(DrawingGlyph glyph)
          Clear the selection and add the given glyph to the selection
 void setSelection(List newSelection, boolean addTo)
          Set the selection.
 void setShowFronts(boolean value)
          Set the ShowFronts property.
 void setStraight(boolean value)
          Set the Straight property.
 void setUseTime(boolean value)
          Set the UseTime property.
protected  boolean shouldAddControlListener()
          Signal base class to add this as a control listener
protected  boolean shouldAddDisplayListener()
          Signal base class to add this as a display listener
 boolean shouldBeVisible(DrawingGlyph tg)
          Should this glyph be visible
protected  boolean showFilledCbx()
          Should we show the filled cbx
protected  boolean showLocationWidgets()
          Should we show the locatio widgets
protected  boolean showTimeWidgets()
          Should we show the time widgets
protected  void timeChanged(Real time)
          Respond to a timeChange event
 void toggleVisibilityForVectorGraphicsRendering(int rasterMode)
          Toggle the visibility for vector graphics rendering
 void viewpointChanged()
          Respond to control changed events from the view manager
 void zSliderChanged(double value)
          Handle the z position slider changed
 
Methods inherited from class ucar.unidata.idv.control.DisplayControlImpl
actionPerformed, activateDisplays, addAttributedDisplayable, addAttributedDisplayable, addAttributedDisplayable, addAttributeFlags, addCheckBoxSettings, addDataChoice, addDisplayable, addDisplayable, addDisplayable, addDisplayable, addDisplayable, addDisplayable, addDisplayMaster, addDisplaySettings, addLabelMacros, addNewData, addNoteText, addPropertiesComponents, addPropertyChangeListener, addRemovable, addSharable, addTimeModeWidget, addToControlContext, addToRangeMenu, addToRangeMenu, addToRangeMenu, addViewManager, appendDataChoices, applyAttributesToDisplayables, applyColor, applyColorScaleInfo, applyColorTable, applyColorUnit, applyContourInfo, applyDisplaySetting, applyDisplayUnit, applyLineWidth, applyPreferences, applyProperties, applyProperties, applyPropertyValues, applyRange, applySelectRange, applySkipFactor, applySmoothing, applyTextureQuality, applyTimeRange, applyZPosition, boundsClose, canBeDocked, canExportData, canSaveDataInCache, captureWindow, centerOnDisplay, changeColorUnit, changeDisplayUnit, checkFlag, checkIfDataOk, checkImageSize, clearDataInstance, clearPrototype, clearViewManagers, colorUnitChanged, controlChanged, convertColorRange, convertRange, createDisplayListDisplayable, createIdvWindow, dataChanged, deactivateDisplays, debug, displayableToFront, displayChanged, displayControlFailed, displayUnitChanged, doApplyProperties, doExport, doInitialUpdateLegendAndList, doMakeBottomLegendComponent, doMakeChangeColorMenu, doMakeChangeColorMenu, doMakeChangeParameterMenuItem, doMakeColorControl, doMakeColorControl, doMakeColorScales, doMakeDataInstance, doMakeMenuBar, doMakeMenuBarMenus, doMakePointSizeWidget, doMakeRemoveControl, doMakeSideLegendComponent, doMakeSkipFactorSlider, doMakeTextureSlider, doMakeVisibilityControl, doMakeWidgetComponent, doMakeWindow, doMakeZPositionSlider, exportDisplayedData, findDisplayInfo, findDisplays, findDisplays, firePropertyChangeEvent, firstFrameDone, formatForCursorReadout, getActive, getAnimation, getAnimation, getAnimation, getAnimation, getAnimationInfo, getAnimationWidget, getAttributeFlags, getCachedData, getCanDoRemoveAll, getCategories, getChangeParameterLabel, getCollapseLegend, getColor, getColorDimness, getColorScaleInfo, getColorTable, getColorTableForDisplayable, getColorTableToApply, getColorTableWidget, getColorUnit, getColorUnitName, getColorWidgetLabel, getComponentHolder, getContents, getContourInfo, getControlContext, getControlMenus, getControlWidgets, getCursorReadout, getCursorReadoutInner, getCursorReadoutInner, getData, getDataChoice, getDataChoices, getDataForDisplayList, getDataInstance, getDataInstance, getDataProjection, getDataProjectionForMenu, getDataProjectionLabel, getDataSelection, getDataSources, getDataTimeRange, getDataTimeRange, getDataTimeSet, getDebugDetails, getDefaultColorScaleInfo, getDefaultDisplayListTemplate, getDefaultDistanceUnit, getDefaultFastRendering, getDefaultSamplingMode, getDefaultSamplingModeValue, getDefaultView, getDefaultViewDescriptor, getDefaultViewManager, getDetailsContents, getDisplayAltitudeType, getDisplayCategory, getDisplayCenter, getDisplayConventions, getDisplayedData, getDisplayId, getDisplayInfos, getDisplayListColor, getDisplayListData, getDisplayListDisplayable, getDisplayListTemplate, getDisplayMaster, getDisplayName, getDisplayScale, getDisplayUnit, getDisplayUnit, getDisplayUnitName, getDisplayVisibility, getDoCursorReadout, getEditMenuItems, getExpandedInTabs, getExtraLabelTemplate, getExtraLegendComponent, getExtraMenus, getFileMenuItems, getGraphicsConfiguration, getGrid, getGrid, getHadDataChoices, getHaveInitialized, getHelpIds, getHelpMenuItems, getId, getIdv, getImage, getImage, getInitDataChoices, getInitialColorTable, getInitialFastRendering, getInitialRange, getInternalAnimation, getInternalAnimation, getIsRaster, getIsTimeDriver, getLabel, getLastFileMenuItems, getLegendButtons, getLegendComponent, getLegendLabel, getLegendLabelTemplate, getLegendToolTip, getLineWidthWidget, getLineWidthWidgetLabel, getLockVisibilityToggle, getLongParamName, getMacroNames, getMainPanel, getMainPanelSize, getMakeWindow, getMapDisplay, getMapViewManager, getMapViewProjection, getMenuLabel, getMyDataChoices, getNavigatedDisplay, getNoteText, getObjectStore, getOkToFireEvents, getOldColorTableOrInitialColorTable, getOriginalDataChoicesLabel, getOuterContents, getPointSize, getProperty, getProperty, getPropertyDisplayName, getRange, getRangeForColorTable, getRangeToApply, getRawDataUnit, getRequestProperties, getSamplingModeName, getSamplingModeValue, getSamplingModeValue, getSaveMenuItems, getSelectRange, getSelectRangeEnabled, getSelectRangeWidget, getSettingsPanel, getShortParamName, getShowInDisplayList, getShowInLegend, getShowInTabs, getShowNoteText, getSkipValue, getSkipWidgetLabel, getSmoothingFactor, getSmoothingType, getSomeAnimation, getStore, getTemplateName, getTextureQuality, getTextureQualityLabel, getTimeSet, getTitle, getTransientProperty, getUnitForColor, getUseFastRendering, getUsesTimeDriver, getUseTimesInAnimation, getVersion, getVerticalValue, getViewAnimation, getViewContext, getViewer, getViewManager, getViewManager, getViewManager, getViewManagerClassNames, getViewManagerForCapture, getViewManagers, getViewMenuItems, getViewMenuItems, getVisbilityAnimationPause, getWasUnPersisted, getWindow, getWindowSize, getWindowVisible, getWindowX, getWindowY, getZPosition, getZPositionSliderLabel, guiExported, guiImported, hasMapProjection, hasTimeMacro, haveDataTimes, haveParameterDefaults, hide, hyperlinkUpdate, inGlobeDisplay, init, init, init, initAfterUnPersistence, initAfterUnPersistence, initAsPrototype, initAsTemplate, initBasic, initDone, initializeWithNewData, initWindow, isDisplay3D, isDisplayUnitAlsoColorUnit, isGuiShown, isInitDone, isInTransectView, isInViewManager, itemStateChanged, makeChangeColorMenuItems, makeLegendLabel, makeLockButton, makeRemoveButton, moveTo, notifyViewManagersOfChange, parseProperties, popup, popupDataDialog, popupDataDialog, popupDataDialog, processRequestProperties, propertyChange, putTransientProperty, reallySetAttributeFlags, redoGuiLayout, reloadDataSource, reloadDataSourceInThread, removeDataChoice, removeDisplayable, removeDisplayables, removeDisplayables, removeOnWindowClose, removePropertyChangeListener, resetDimness, resetViewManager, revertToDefaultColorTable, revertToDefaultColorTable, revertToDefaultRange, revertToDefaultRange, saveAsFavorite, saveAsParameterDefaults, saveAsPrototype, saveAsTemplate, saveDataChoiceInCache, saveImage, selectDataChoices, setAnimationInfo, setAnimationSet, setAttributeFlags, setCachedData, setCanDoRemoveAll, setCategories, setCollapseLegend, setColor, setColorBrighter, setColorDimmer, setColorDimness, setColorScaleInfo, setColorScaleVisible, setColorTable, setColorTable, setColorTableName, setColorUnit, setColorUnitName, setComponentHolder, setContents, setContourInfo, setContourInfoParams, setData, setData, setDataChoices, setDataInstance, setDataInstances, setDataSelection, setDataTimeRange, setDefaultSamplingMode, setDefaultView, setDisplayableVisibility, setDisplayableVisiblity, setDisplayActive, setDisplayCategory, setDisplayId, setDisplayInactive, setDisplayListColor, setDisplayListColor, setDisplayListProperties, setDisplayListTemplate, setDisplayName, setDisplayUnit, setDisplayUnitName, setDoCursorReadout, setExpandedInTabs, setExtraLabelTemplate, setHadDataChoices, setHelpUrl, setId, setInitDataChoices, setInitialSettings, setInitialViewManager, setIsRaster, setIsTimeDriver, setLabelAsPreference, setLegendBackground, setLegendForeground, setLegendLabel, setLegendLabelTemplate, setLockVisibilityToggle, setMainPanelDimensions, setMainPanelSize, setMakeWindow, setName, setNameFromUser, setNewColorUnit, setNewDisplayUnit, setNoteText, setOkToFireEvents, setOriginalDataChoicesLabel, setParamName, setPersistedVisadData, setPointSize, setProjectionInView, setProjectionInView, setProperty, setRange, setRange, setSelectRange, setSelectRangeEnabled, setSettingsDisplayUnit, setSharedColorScaleInfo, setShowInDisplayList, setShowInLegend, setShowInTabs, setShowNoteText, setSkipValue, setSmoothingFactor, setSmoothingType, setTemplateName, setTextureQuality, setTitle, setUnitForColor, setUseFastRendering, setUsesTimeDriver, setUseTimesInAnimation, setVersion, setViewer, setViewManagerClassNames, setVisbilityAnimationPause, setWindowSize, setWindowVisible, setWindowX, setWindowY, setZPosition, setZPosition, shouldAddAnimationListener, shouldApplyFastRendering, shouldBeDocked, shouldWindowBeVisible, show, showColorControlWidget, showColorDialog, showColorDialog, showColorScaleDialog, showColorScales, showColorSwatches, showContourPropertiesDialog, showDetails, showDisplaySettingsDialog, showHelp, showLegendMenu, showNormalCursor, showProperties, showTimeRangeDialog, showWaitCursor, toFront, toggleNoteTextArea, toggleWindow, toString, transectChanged, updateAnimation, updateDataInstance, updateDataSelection, updateDisplayList, updateGridDataInstance, updateLegendAndList, updateLegendLabel, updateLockButton, useSmoothingFactor, useZPosition, viewManagerChanged, viewManagerDestroyed, writeTestArchive, xxxsetDisplayActive
 
Methods inherited from class ucar.unidata.idv.control.DisplayControlBase
boxToEarth, boxToEarth, boxToEarth, boxToEarth, boxToEarth, boxToScreen, calculateRectangle, createStationTfo, earthToBox, earthToBox, earthToBoxTuple, earthToScreen, formatLevels, getLabeledReal, getLevelReal, getScreenCenter, getSelectedStation, getTmpProperty, isLeftButtonDown, logException, logException, makeEarthLocation, putTmpProperty, removeTmpProperty, screenToBox, screenToBox, screenToEarth, setStations, setStations, toBox, toEarth, userErrorMessage, userMessage
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.unidata.idv.DisplayControl
getTmpProperty, putTmpProperty, removeTmpProperty
 
Methods inherited from interface ucar.unidata.collab.Sharable
getReceiveShareTime, getShareGroup, getSharing, getUniqueId, setReceiveShareTime
 

Field Detail

ATTR_USETIMESINANIMATION

public static final String ATTR_USETIMESINANIMATION
xgrf xml attribute

See Also:
Constant Field Values

ATTR_FRONTDISPLAY

public static final String ATTR_FRONTDISPLAY
xgrf attribute

See Also:
Constant Field Values

TAG_EDITOR

public static final String TAG_EDITOR
Xml tag for the editor settings in the import/export format

See Also:
Constant Field Values

ATTR_EDITABLE

public static final String ATTR_EDITABLE
Xml attribute for the editable property

See Also:
Constant Field Values

ATTR_TITLE

public static final String ATTR_TITLE
Xml attribute for the title property

See Also:
Constant Field Values

FILTER_XGRF

public static final PatternFileFilter FILTER_XGRF
File filter used for the xgrf files


SUFFIX_XGRF

public static final String SUFFIX_XGRF
File suffix used for the xgrfg files

See Also:
Constant Field Values

SHARE_LINES

public static final String SHARE_LINES
property for sharing lines

See Also:
Constant Field Values

FLAG_FILLED

public static final int FLAG_FILLED
Filled capable flag for the command object

See Also:
Constant Field Values

FLAG_FULLLATLON

public static final int FLAG_FULLLATLON
Full lat/lon capable flag for the command object

See Also:
Constant Field Values

FLAG_STRAIGHT

public static final int FLAG_STRAIGHT
flag for straight

See Also:
Constant Field Values

CMD_SELECT

public static final DrawingCommand CMD_SELECT
Select command


CMD_MOVE

public static final DrawingCommand CMD_MOVE
command


CMD_STRETCH

public static final DrawingCommand CMD_STRETCH
command


enabledCbx

protected JCheckBox enabledCbx
Controls the disabled state


straightCbx

protected JCheckBox straightCbx
Filled mode


glyphs

protected List glyphs
List of all glyphs


selectedGlyphs

protected List selectedGlyphs
List of selected glyphs


currentCmd

protected DrawingCommand currentCmd
Current command

Constructor Detail

DrawingControl

public DrawingControl()
Create a new Drawing Control; set attributes.

Method Detail

getControlChangeSleepTime

protected long getControlChangeSleepTime()
How long do we sleep until we act on the control changed event

Overrides:
getControlChangeSleepTime in class DisplayControlImpl
Returns:
sleep time

formatDistance

public String formatDistance(Real distance)
                      throws VisADException,
                             RemoteException
Utility

Parameters:
distance - The distance
Returns:
Formatted string
Throws:
RemoteException - On badness
VisADException - On badness

getDistanceUnit

public Unit getDistanceUnit()
Get the distance unit

Returns:
the distance unit

init

public boolean init(DataChoice dataChoice)
             throws VisADException,
                    RemoteException
Call to help make this kind of Display Control; also calls code to made the Displayable (empty of data thus far). This method is called from inside DisplayControlImpl.init(several args).

Overrides:
init in class DisplayControlImpl
Parameters:
dataChoice - the DataChoice of the moment.
Returns:
true if everything is okay
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

initDisplayUnit

protected void initDisplayUnit()
Initialize the display unit


shouldAddDisplayListener

protected boolean shouldAddDisplayListener()
Signal base class to add this as a display listener

Overrides:
shouldAddDisplayListener in class DisplayControlImpl
Returns:
Add as display listener

handleWindowClosing

protected void handleWindowClosing()
Handle the window closing.

Overrides:
handleWindowClosing in class DisplayControlImpl

close

public void close()
Clear the selection when we minisze the window

Overrides:
close in class DisplayControlImpl

shouldAddControlListener

protected boolean shouldAddControlListener()
Signal base class to add this as a control listener

Overrides:
shouldAddControlListener in class DisplayControlImpl
Returns:
Add as control listener

timeChanged

protected void timeChanged(Real time)
Respond to a timeChange event

Overrides:
timeChanged in class DisplayControlImpl
Parameters:
time - new time

processData

protected void processData(Data data)
                    throws VisADException,
                           RemoteException
Process the visad data object. For now this is a text object that holds the glyph xml

Parameters:
data - The data object
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

resetData

protected void resetData()
                  throws VisADException,
                         RemoteException
respond to the reload data call

Overrides:
resetData in class DisplayControlImpl
Throws:
RemoteException - On badness
VisADException - On badness

toggleVisibilityForVectorGraphicsRendering

public void toggleVisibilityForVectorGraphicsRendering(int rasterMode)
                                                throws Exception
Toggle the visibility for vector graphics rendering

Specified by:
toggleVisibilityForVectorGraphicsRendering in interface DisplayControl
Overrides:
toggleVisibilityForVectorGraphicsRendering in class DisplayControlImpl
Parameters:
rasterMode - the toggle mode
Throws:
Exception - problem toggling

shouldBeVisible

public boolean shouldBeVisible(DrawingGlyph tg)
Should this glyph be visible

Parameters:
tg - glyph
Returns:
should be visible

setDisplayVisibility

public void setDisplayVisibility(boolean on)
TUrn on the visibility of this display

Specified by:
setDisplayVisibility in interface DisplayControl
Overrides:
setDisplayVisibility in class DisplayControlImpl
Parameters:
on - Visible?

addGlyph

protected boolean addGlyph(DrawingGlyph glyph)
Add the glyph into the list of glyphs

Parameters:
glyph - The glyph to add
Returns:
Was this successful

glyphChanged

public void glyphChanged(DrawingGlyph glyph)
The given glyph has changed somehow. Update the JTable

Parameters:
glyph - The glyph that changed

doRemove

public void doRemove()
              throws VisADException,
                     RemoteException
Remove this DisplayControl from the system. Nulls out any objects for garbage collection

Specified by:
doRemove in interface DisplayControl
Overrides:
doRemove in class DisplayControlImpl
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

getLegendLabels

protected void getLegendLabels(List labels,
                               int legendType)
Overwrite the legend labels method to use the editor title if there is one.

Overrides:
getLegendLabels in class DisplayControlImpl
Parameters:
labels - List of labels
legendType - Side or bottom

createGlyph

protected DrawingGlyph createGlyph(DisplayEvent event,
                                   boolean mousePress)
                            throws VisADException,
                                   RemoteException
Create a glyph

Parameters:
event - The event
mousePress - Is mouse pressed or released
Returns:
The glyph or null
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

viewpointChanged

public void viewpointChanged()
Respond to control changed events from the view manager

Overrides:
viewpointChanged in class DisplayControlImpl

projectionChanged

public void projectionChanged()
Respond to the projection changing event

Specified by:
projectionChanged in interface DisplayControl
Overrides:
projectionChanged in class DisplayControlImpl

canHandleEvents

protected boolean canHandleEvents()
Should we handle display events

Returns:
Ok to handle events

doFlythrough

public void doFlythrough()
                  throws VisADException,
                         RemoteException
Do the flythrough

Throws:
RemoteException - Java RMI error
VisADException - VisAD problem

handleDisplayChanged

public void handleDisplayChanged(DisplayEvent event)
Listen for DisplayEvents

Overrides:
handleDisplayChanged in class DisplayControlImpl
Parameters:
event - The event

doneMovingGlyph

protected void doneMovingGlyph(DrawingGlyph glyph)
Done moving glyph

Parameters:
glyph - the glyph

closestGlyph

public DrawingGlyph closestGlyph(DisplayEvent event)
Find the glyph that is closest to the x/y point of the given event

Parameters:
event - The event
Returns:
The closest glyph (or null if none close).

closestGlyph

public DrawingGlyph closestGlyph(DisplayEvent event,
                                 boolean forMove)
Find the glyph that is closest to the x/y point of the given event

Parameters:
event - The event
forMove - Are we looking for a glyph to move
Returns:
The closest glyph (or null if none close).

removeGlyph

public void removeGlyph(DrawingGlyph glyph)
Remove the glyph from the drawing

Parameters:
glyph - The glyph to remove

selectionChanged

protected void selectionChanged()
The selection set changed. Update the JTable


setSelection

public void setSelection(DrawingGlyph glyph)
                  throws VisADException,
                         RemoteException
Clear the selection and add the given glyph to the selection

Parameters:
glyph - Glyph to add to the selection set
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

setSelection

public void setSelection(List newSelection,
                         boolean addTo)
                  throws VisADException,
                         RemoteException
Set the selection. Clear the old selection set if addTo is false.

Parameters:
newSelection - New set of glyphs
addTo - If true then don't clear the selection
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

isSelected

public boolean isSelected(DrawingGlyph glyph)
Is the given glyph selected

Parameters:
glyph - The glyph
Returns:
Is selected

doCut

protected void doCut()
              throws VisADException,
                     RemoteException
Remove the glyphs in the selection set

Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

doProperties

public void doProperties(List glyphs)
                  throws VisADException,
                         RemoteException
Show the properties dialog for the glyphs in the list

Parameters:
glyphs - Glyphs to set properties on
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

receiveShareData

public void receiveShareData(Sharable from,
                             Object dataId,
                             Object[] data)
Method called by other classes that share the the state.

Specified by:
receiveShareData in interface Sharable
Overrides:
receiveShareData in class DisplayControlImpl
Parameters:
from - other class.
dataId - type of sharing
data - Array of data being shared. In this case, the first (and only?) object in the array is the level

setCurrentCommand

protected void setCurrentCommand(DrawingCommand command)
Set the current active command

Parameters:
command - The command

makeButtonPanel

protected JPanel makeButtonPanel(List commands,
                                 ButtonGroup bg)
Utility to make a panel holding the icon buttons.

Parameters:
commands - Command to make buttons for.
bg - Button group to add buttons to
Returns:
The button panel

getShapeCommands

protected List getShapeCommands()
Get the lsit of shape commands the user can draw with. Derived classes can override this to control what can be drawn

Returns:
Shape commands

doMakeShapesPanel

protected JComponent doMakeShapesPanel()
Make the shapes panel

Returns:
the shapes panel

doMakeContents

protected Container doMakeContents()
                            throws VisADException,
                                   RemoteException
Make the gui

Overrides:
doMakeContents in class DisplayControlImpl
Returns:
The gui
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

zSliderChanged

public void zSliderChanged(double value)
Handle the z position slider changed

Overrides:
zSliderChanged in class DisplayControlImpl
Parameters:
value - the new z slider value

doMakeControlsPanel

protected JComponent doMakeControlsPanel()
Make the main tabbed pane

Returns:
Controls panel

addControlWidgets

protected void addControlWidgets(List widgets)
Add the widgets into the controls panel

Parameters:
widgets - List to add to. Add in pairs (label, widget)

getInitialZPosition

protected double getInitialZPosition()
Get default z position to use

Overrides:
getInitialZPosition in class DisplayControlImpl
Returns:
Default z position

makeModePanel

protected void makeModePanel(List widgets)
Makes the model panel. Can be overwritten.

Parameters:
widgets - List ot add label/widget pairs

doMakeTablePanel

protected JComponent doMakeTablePanel()
Make the jtable panel

Returns:
jtable panel

doMakeStylePanel

protected JComponent doMakeStylePanel()
Make the style panel

Returns:
Style panel

checkZSliderEnabled

protected void checkZSliderEnabled()
Enable/disable the z slider


showFilledCbx

protected boolean showFilledCbx()
Should we show the filled cbx

Returns:
Show the filled cbx

showTimeWidgets

protected boolean showTimeWidgets()
Should we show the time widgets

Returns:
show the tiem widgets

showLocationWidgets

protected boolean showLocationWidgets()
Should we show the locatio widgets

Returns:
show the locatio widgets

getRGBColorTable

public ColorTable getRGBColorTable()
Get the color table to use for the image glyphs

Returns:
The rgb color table

doMakeLineWidthBox

public static JComboBox doMakeLineWidthBox(int lineWidth)
Make a component to change the width of the lines.

Parameters:
lineWidth - The selected width
Returns:
the component.

getCoordType

public int getCoordType()
Get the coord type (e.g., LATLON, XYZ)

Returns:
The coord type

setCoordType

protected void setCoordType(int c)
Get the coord type (e.g., LATLON, XYZ)

Parameters:
c - The coord type to use

getEditMenuItems

protected void getEditMenuItems(List items,
                                boolean forMenuBar)
Add the relevant edit menu items into the list

Overrides:
getEditMenuItems in class DisplayControlImpl
Parameters:
items - List of menu items
forMenuBar - Is this for the menu in the window's menu bar or for a popup menu in the legend

getFileMenuItems

protected void getFileMenuItems(List items,
                                boolean forMenuBar)
Add to the file menu.

Overrides:
getFileMenuItems in class DisplayControlImpl
Parameters:
items - Holds the menu items
forMenuBar - Is it for the main window

addFileMenuItems

protected void addFileMenuItems(List items,
                                boolean forMenuBar)
Add to the file menu

Parameters:
items - List to add to
forMenuBar - for the menu bar

applyColorToAll

public void applyColorToAll()
Apply the current color to all glyphs


applyZPosition

public void applyZPosition(List glyphs)
                    throws VisADException,
                           RemoteException
Apply the current z position to all glyphs

Parameters:
glyphs - the list of glyphs
Throws:
RemoteException - On badness
VisADException - On badness

removeAllGlyphs

public void removeAllGlyphs()
Remove em all.


setLineWidth

public void setLineWidth(int width)
Set the width of the lines.

Overrides:
setLineWidth in class DisplayControlImpl
Parameters:
width - width of lines.

getLineWidth

public int getLineWidth()
Get the line width

Overrides:
getLineWidth in class DisplayControlImpl
Returns:
The line width

getAllTimes

public DateTime[] getAllTimes()
                       throws VisADException,
                              RemoteException
Get an array of all the current times in the display

Returns:
All the animation times
Throws:
RemoteException - When bad things happen
VisADException - When bad things happen

getCurrentTime

public Real getCurrentTime()
                    throws VisADException,
                           RemoteException
Get the current time in the animation

Returns:
The current time
Throws:
RemoteException - On Badness
VisADException - On Badness

getAnimationSet

public Set getAnimationSet()
                    throws VisADException,
                           RemoteException
Get the animation set

Returns:
animation set
Throws:
RemoteException - On badness
VisADException - On badness

getTimeForGlyph

public Real getTimeForGlyph()
                     throws VisADException,
                            RemoteException
If we are not drawing in the current time then return null. Else return the current time.

Returns:
The time to use for a glyph
Throws:
RemoteException - On Badness
VisADException - On Badness

getJustification

public String getJustification()
Get the text justification value

Returns:
h justification

getVerticalJustification

public String getVerticalJustification()
Get the vert text justification value

Returns:
The vert justification_

getFont

public Font getFont()
Get the font from the ui widget

Returns:
The font to use for new text glyphs

setLines

public void setLines(UnionSet lines)
Deprecated. 

Set the line data.

Parameters:
lines - set of lines to use

setActive

public void setActive(boolean b)
Deprecated. 

Enable/disable the drawing

Parameters:
b - true to enable

setGlyphs

public void setGlyphs(List value)
Set the DrawingGlyphs property.

Parameters:
value - The new value for DrawingGlyphs

getGlyphs

public List getGlyphs()
Get the Glyphs property.

Returns:
The Glyphs

setIgnoreTime

public void setIgnoreTime(boolean value)
Set the IgnoreTime property.

Parameters:
value - The new value for IgnoreTime

getIgnoreTime

public boolean getIgnoreTime()
Get the IgnoreTime property.

Returns:
The IgnoreTime

setUseTime

public void setUseTime(boolean value)
Set the UseTime property.

Parameters:
value - The new value for UseTime

getUseTime

public boolean getUseTime()
Get the UseTime property.

Returns:
The UseTime

setEditable

public void setEditable(boolean value)
Set the Editable property.

Parameters:
value - The new value for Editable

getEditable

public boolean getEditable()
Get the Editable property.

Returns:
The Editable

setEnabled

public void setEnabled(boolean value)
Set the Enabled property.

Parameters:
value - The new value for Enabled

getEnabled

public boolean getEnabled()
Get the Enabled property.

Returns:
The Enabled

setEditorTitle

public void setEditorTitle(String value)
Set the editorTitle property.

Parameters:
value - The new value for editorTitle

getEditorTitle

public String getEditorTitle()
Get the Editor Title property.

Returns:
The Title

setFilled

public void setFilled(boolean value)
Set the Filled property.

Parameters:
value - The new value for Filled

getFilled

public boolean getFilled()
Get the Filled property.

Returns:
The Filled

setStraight

public void setStraight(boolean value)
Set the Straight property.

Parameters:
value - The new value for Straight

getStraight

public boolean getStraight()
Get the Straight property.

Returns:
The Straight

setFullLatLon

public void setFullLatLon(boolean value)
Set the FullLatLon property.

Parameters:
value - The new value for FullLatLon

getFullLatLon

public boolean getFullLatLon()
Get the FullLatLon property.

Returns:
The FullLatLon

evaluateGlyphJython

public void evaluateGlyphJython(DrawingGlyph glyph,
                                String jython)
Evalue the given jython for the glyph

Parameters:
glyph - The glyph
jython - The jython

setGlyphJython

public void setGlyphJython(String value)
Set the GlyphJython property.

Parameters:
value - The new value for GlyphJython

getGlyphJython

public String getGlyphJython()
Get the GlyphJython property.

Returns:
The GlyphJython

getGlyphNameDefault

protected String getGlyphNameDefault(DrawingGlyph glyph)
Get the default name to use

Parameters:
glyph - the glyph
Returns:
The name

setShowFronts

public void setShowFronts(boolean value)
Set the ShowFronts property.

Parameters:
value - The new value for ShowFronts

getShowFronts

public boolean getShowFronts()
Get the ShowFronts property.

Returns:
The ShowFronts

setFrontScale

public void setFrontScale(double value)
Set the FrontScale property.

Parameters:
value - The new value for FrontScale

getFrontScale

public double getFrontScale()
Get the FrontScale property.

Returns:
The FrontScale

setFrontDisplay

public void setFrontDisplay(boolean value)
Set the FrontDisplay property.

Parameters:
value - The new value for FrontDisplay

getFrontDisplay

public boolean getFrontDisplay()
Get the FrontDisplay property.

Returns:
The FrontDisplay