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:
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_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
protected  List glyphs
          List of all glyphs
protected  List selectedGlyphs
          List of selected glyphs
static String SHARE_LINES
          property for sharing lines
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, controlContext, ctw, cw, dataSelection, defaultView, defaultViewManager, DISPLAY_LIST_NAME, displayListTable, displayMasters, displayUnit, helpUrl, initNoteText, instantiatedWithNoData, noteTextArea, noteWrapper, paramName, requestProperties, settingVisibility, sharables, showNoteText, skipSlider, srw, version, viewManagers
 
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_TIMERANGE, FLAG_ZPOSITION, GRID_INSETS, ICON_LOCK, ICON_REMOVE, ICON_UNLOCK, LABEL_NONE, log_, MACRO_DATASOURCENAME, MACRO_DISPLAYNAME, MACRO_DISPLAYUNIT, MACRO_LONGNAME, MACRO_POSITION, MACRO_SHORTNAME, 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, 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
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 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
 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 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.
 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).
 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.
 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 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 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 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 viewpointChanged()
          Respond to control changed events from the view manager
 void zSliderChanged(int 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, addSharable, addToRangeMenu, addToRangeMenu, addToRangeMenu, addViewManager, appendDataChoices, applyAttributesToDisplayables, applyColor, applyColorScaleInfo, applyColorTable, applyColorUnit, applyContourInfo, applyDisplaySetting, applyDisplayUnit, applyLineWidth, applyPreferences, applyProperties, applyProperties, applyPropertyValues, applyRange, applySelectRange, applySkipFactor, applyTimeRange, applyZPosition, boundsClose, canBeDocked, canExportData, canSaveDataInCache, captureWindow, changeColorUnit, changeDisplayUnit, checkFlag, checkIfDataOk, checkImageSize, clearDataInstance, clearPrototype, clearViewManagers, colorUnitChanged, controlChanged, convertColorRange, convertRange, createDisplayListDisplayable, createIdvWindow, dataChanged, deactivateDisplays, debug, displayableToFront, displayChanged, displayControlFailed, displayUnitChanged, doApplyProperties, doMakeBottomLegendComponent, doMakeChangeColorMenu, doMakeChangeColorMenu, doMakeChangeParameterMenuItem, doMakeColorControl, doMakeColorControl, doMakeColorScales, doMakeDataInstance, doMakeMenuBar, doMakeMenuBarMenus, doMakeRemoveControl, doMakeSideLegendComponent, doMakeSkipFactorSlider, 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, getControlWidgets, getCursorReadout, getCursorReadoutInner, getDataChoice, getDataChoices, getDataInstance, getDataInstance, getDataProjection, getDataProjectionForMenu, getDataProjectionLabel, getDataSelection, getDataSources, getDataTimeRange, getDataTimeRange, getDataTimeSet, getDebugDetails, getDefaultColorScaleInfo, 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, getHadDataChoices, getHaveInitialized, getHelpIds, getHelpMenuItems, getId, getIdv, getImage, getImage, getInitDataChoices, getInitialColorTable, getInitialRange, 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, getProperty, getProperty, getPropertyDisplayName, getRange, getRangeForColorTable, getRangeToApply, getRawDataUnit, getRequestProperties, getSamplingModeName, getSamplingModeValue, getSaveMenuItems, getSelectRange, getSelectRangeEnabled, getSelectRangeWidget, getSettingsPanel, getShortParamName, getShowInDisplayList, getShowInLegend, getShowInTabs, getShowNoteText, getSkipValue, getSkipWidgetLabel, getStore, getTemplateName, getTimeSet, getTitle, getTransientProperty, getUnitForColor, getUseFastRendering, getUseTimesInAnimation, getVersion, getVerticalValue, getViewContext, getViewer, getViewManager, getViewManager, getViewManager, getViewManagerClassNames, getViewManagers, getViewMenuItems, getViewMenuItems, getWasUnPersisted, getWindow, getWindowSize, getWindowVisible, getWindowX, getWindowY, getZPosition, getZPositionSliderLabel, guiExported, guiImported, hasMapProjection, haveDataTimes, haveParameterDefaults, hide, hyperlinkUpdate, 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, redoGuiLayout, reloadDataSource, reloadDataSourceInThread, removeDataChoice, removeDisplayable, removeDisplayables, removeOnWindowClose, removePropertyChangeListener, resetData, resetDimness, resetViewManager, revertToDefaultColorTable, revertToDefaultColorTable, revertToDefaultRange, revertToDefaultRange, saveAsFavorite, saveAsParameterDefaults, saveAsPrototype, saveAsTemplate, saveDataChoiceInCache, saveImage, 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, setDisplayListProperties, setDisplayListTemplate, setDisplayName, setDisplayUnit, setDisplayUnitName, setDoCursorReadout, setExpandedInTabs, setExtraLabelTemplate, setHadDataChoices, setHelpUrl, setId, setInitDataChoices, setInitialSettings, setLabelAsPreference, setLegendBackground, setLegendForeground, setLegendLabel, setLegendLabelTemplate, setLockVisibilityToggle, setMainPanelDimensions, setMainPanelSize, setMakeWindow, setName, setNameFromUser, setNewColorUnit, setNewDisplayUnit, setNoteText, setOkToFireEvents, setOriginalDataChoicesLabel, setParamName, setPersistedVisadData, setProjectionInView, setProjectionInView, setProperty, setRange, setRange, setSelectRange, setSelectRangeEnabled, setSettingsDisplayUnit, setSharedColorScaleInfo, setShowInDisplayList, setShowInLegend, setShowInTabs, setShowNoteText, setSkipValue, setTemplateName, setTitle, setUnitForColor, setUseFastRendering, setUseTimesInAnimation, setVersion, setViewer, setViewManagerClassNames, setWindowSize, setWindowVisible, setWindowX, setWindowY, 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, updateDisplayList, updateLegendAndList, updateLegendLabel, updateLockButton, 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, getScreenCenter, <