ucar.unidata.idv.control
Class RangeAndBearingControl

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.RangeAndBearingControl
All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, ControlListener, DisplayListener

public class RangeAndBearingControl
extends DisplayControlImpl
implements ActionListener, PropertyChangeListener

Class to make a dragable line with end points which computes the range and bearing between the end points. Also makes a JFrame with text display of range and bearing values, and control buttoms to remove the whole thing etc.

Version:
$Revision: 1.87 $
Author:
Jeff McWhirter

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.unidata.idv.control.DisplayControlImpl
DisplayControlImpl.SideLegendLabel
 
Field Summary
static String CMD_FLD_END
          Command property for the text field end point
static String CMD_FLD_START
          Command property for the text field start point
static String CMD_STATION_END
          Command property for the station end point
static String CMD_STATION_START
          Command property for the station start point
static int POINT_END
          End point identifier
static int POINT_START
          Start point identifier
static String PROP_DECLINATION
          Declination property
static String SHARE_LOCATION_END
          property for sharing location end point
static String SHARE_LOCATION_START
          property for sharing location start point
static String SHARE_RBCLINE
          property for sharing transect location
static String SHARE_STATION_END
          property for sharing station end point
static String SHARE_STATION_START
          property for sharing station start point
 
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
RangeAndBearingControl()
          Default Constructor.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Deal with action events from the gui controls made by this class.
 Container doMakeContents()
          Make the UI contents for this control.
 void doRemove()
          Remove the display control
 CrossSectionSelector getCrossSectionSelector()
          Return the selector line with end points.
protected  void getEditMenuItems(List items, boolean forMenuBar)
          Add the relevant edit menu items into the list
 float getEndLat()
          Get the ending latitude property.
 float getEndLon()
          Get the ending longitude property.
 NamedStationImpl getEndStation()
          Get the ending station property.
 void getLegendLabels(List labels, int legendType)
          Get the extra label used for the legend.
 RealTuple getPointOfSelector(int which)
          Return the x/y location of the given end point of the CrossSectionSelector
 float getStartLat()
          Get the starting latitude property.
 float getStartLon()
          Set the starting longitude property.
 NamedStationImpl getStartStation()
          Get the starting station property.
 String getStationTableName()
          Get the StationTableName property.
 boolean init(DataChoice dataChoice)
          Called to make this kind of Display Control; also calls code to made its Displayable, the line.
static RealTuple[] makeDefaultLinePosition(NavigatedDisplay mapDisplay)
          A utility method to create the initial line position
 void propertyChange(PropertyChangeEvent evt)
          Handle property change
 void receiveShareData(Sharable from, Object dataId, Object[] data)
          Accept and check sharable data.
 void setEndLat(float value)
          Set the ending latitude property.
 void setEndLon(float value)
          Set the ending longitude property.
 void setEndPoint(RealTuple rt)
          Set the ending point
 void setEndStation(NamedStationImpl n)
          Set the ending station property.
protected  boolean setNewDisplayUnit(Unit newUnit, boolean applyToDisplayable)
          Override base class method toact when the display unit has changed
 void setStartLat(float value)
          Set the starting latitude property.
 void setStartLon(float value)
          Set the starting longitude property.
 void setStartPoint(RealTuple rt)
          Set the starting point
 void setStartStation(NamedStationImpl n)
          Set the starting station property.
 void setStationTableName(String value)
          Set the StationTableName property.
 void transectPositionChanged(boolean fromSelector)
          Method to perform what needs to be done when transect position changes.
 
Methods inherited from class ucar.unidata.idv.control.DisplayControlImpl
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, close, 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, getControlChangeSleepTime, 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, getFileMenuItems, getGraphicsConfiguration, getHadDataChoices, getHaveInitialized, getHelpIds, getHelpMenuItems, getId, getIdv, getImage, getImage, getInitDataChoices, getInitialColorTable, getInitialRange, getInitialZPosition, getLabel, getLastFileMenuItems, getLegendButtons, getLegendComponent, getLegendLabel, getLegendLabelTemplate, getLegendToolTip, getLineWidth, 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, handleDisplayChanged, handleWindowClosing, 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, projectionChanged, 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, setDisplayVisibility, setDoCursorReadout, setExpandedInTabs, setExtraLabelTemplate, setHadDataChoices, setHelpUrl, setId, setInitDataChoices, setInitialSettings, setLabelAsPreference, setLegendBackground, setLegendForeground, setLegendLabel, setLegendLabelTemplate, setLineWidth, setLockVisibilityToggle, setMainPanelDimensions, setMainPanelSize, setMakeWindow, setName, setNameFromUser, setNewColorUnit, 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, shouldAddControlListener, shouldAddDisplayListener, shouldApplyFastRendering, shouldBeDocked, shouldWindowBeVisible, show, showColorControlWidget, showColorDialog, showColorDialog, showColorScaleDialog, showColorScales, showColorSwatches, showContourPropertiesDialog, showDetails, showDisplaySettingsDialog, showHelp, showLegendMenu, showNormalCursor, showProperties, showTimeRangeDialog, showWaitCursor, timeChanged, toFront, toggleNoteTextArea, toggleWindow, toString, transectChanged, updateAnimation, updateDisplayList, updateLegendAndList, updateLegendLabel, updateLockButton, useZPosition, viewManagerChanged, viewManagerDestroyed, viewpointChanged, writeTestArchive, xxxsetDisplayActive, zSliderChanged
 
Methods inherited from class ucar.unidata.idv.control.DisplayControlBase
boxToEarth, boxToEarth, boxToEarth, boxToEarth, boxToEarth, boxToScreen, calculateRectangle, createStationTfo, earthToBox, earthToBox, earthToBoxTuple, earthToScreen, formatLevels, getScreenCenter, getSelectedStation, isLeftButtonDown, logException, logException, makeEarthLocation, screenToBox, screenToBox, screenToEarth, setStations, setStations, toBox, toEarth, userErrorMessage, userMessage
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, removeSharable, 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.collab.Sharable
getShareGroup, getSharing, getUniqueId
 

Field Detail

POINT_START

public static final int POINT_START
Start point identifier

See Also:
Constant Field Values

POINT_END

public static final int POINT_END
End point identifier

See Also:
Constant Field Values

PROP_DECLINATION

public static final String PROP_DECLINATION
Declination property

See Also:
Constant Field Values

CMD_STATION_START

public static final String CMD_STATION_START
Command property for the station start point

See Also:
Constant Field Values

CMD_STATION_END

public static final String CMD_STATION_END
Command property for the station end point

See Also:
Constant Field Values

CMD_FLD_START

public static final String CMD_FLD_START
Command property for the text field start point

See Also:
Constant Field Values

CMD_FLD_END

public static final String CMD_FLD_END
Command property for the text field end point

See Also:
Constant Field Values

SHARE_RBCLINE

public static final String SHARE_RBCLINE
property for sharing transect location

See Also:
Constant Field Values

SHARE_STATION_START

public static final String SHARE_STATION_START
property for sharing station start point

See Also:
Constant Field Values

SHARE_STATION_END

public static final String SHARE_STATION_END
property for sharing station end point

See Also:
Constant Field Values

SHARE_LOCATION_START

public static final String SHARE_LOCATION_START
property for sharing location start point

See Also:
Constant Field Values

SHARE_LOCATION_END

public static final String SHARE_LOCATION_END
property for sharing location end point

See Also:
Constant Field Values
Constructor Detail

RangeAndBearingControl

public RangeAndBearingControl()
Default Constructor. Set the flags to tell that this display control wants a color widget.

Method Detail

getCrossSectionSelector

public CrossSectionSelector getCrossSectionSelector()
Return the selector line with end points.

Returns:
a CrossSectionSelector the selector line with end points.

init

public boolean init(DataChoice dataChoice)
             throws VisADException,
                    RemoteException
Called to make this kind of Display Control; also calls code to made its Displayable, the line. This method is called from inside DisplayControlImpl.init(several args).

Overrides:
init in class DisplayControlImpl
Parameters:
dataChoice - the DataChoice of the moment - not used yet; can be null.
Returns:
true if successful
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

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

doRemove

public void doRemove()
              throws VisADException,
                     RemoteException
Remove the display control

Specified by:
doRemove in interface DisplayControl
Overrides:
doRemove in class DisplayControlImpl
Throws:
RemoteException - Bad things
VisADException - Bad things

doMakeContents

public Container doMakeContents()
Make the UI contents for this control.

Overrides:
doMakeContents in class DisplayControlImpl
Returns:
UI container

makeDefaultLinePosition

public static RealTuple[] makeDefaultLinePosition(NavigatedDisplay mapDisplay)
                                           throws VisADException,
                                                  RemoteException
A utility method to create the initial line position

Parameters:
mapDisplay - The display
Returns:
An array of size 2 that holds the start and end position
Throws:
RemoteException - On badness
VisADException - On badness

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Handle property change

Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class DisplayControlImpl
Parameters:
evt - The event

transectPositionChanged

public void transectPositionChanged(boolean fromSelector)
Method to perform what needs to be done when transect position changes.

Parameters:
fromSelector - true if from the selector

receiveShareData

public void receiveShareData(Sharable from,
                             Object dataId,
                             Object[] data)
Accept and check sharable data.

Specified by:
receiveShareData in interface Sharable
Overrides:
receiveShareData in class DisplayControlImpl
Parameters:
from - object sending shared data
dataId - id for sharable data
data - the data

setNewDisplayUnit

protected boolean setNewDisplayUnit(Unit newUnit,
                                    boolean applyToDisplayable)
Override base class method toact when the display unit has changed

Overrides:
setNewDisplayUnit in class DisplayControlImpl
Parameters:
newUnit - The new unit
applyToDisplayable - Some parameter
Returns:
Was successful

getLegendLabels

public void getLegendLabels(List labels,
                            int legendType)
Get the extra label used for the legend.

Overrides:
getLegendLabels in class DisplayControlImpl
Parameters:
labels - labels to append to
legendType - The type of legend, BOTTOM_LEGEND or SIDE_LEGEND

actionPerformed

public void actionPerformed(ActionEvent event)
Deal with action events from the gui controls made by this class.

Specified by:
actionPerformed in interface ActionListener
Overrides:
actionPerformed in class DisplayControlImpl
Parameters:
event - action event to check

getPointOfSelector

public RealTuple getPointOfSelector(int which)
                             throws VisADException,
                                    RemoteException
Return the x/y location of the given end point of the CrossSectionSelector

Parameters:
which - which end (start or end)
Returns:
position
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

setStartLat

public void setStartLat(float value)
Set the starting latitude property. Used by XML persistence.

Parameters:
value - starting latitude

getStartLat

public float getStartLat()
Get the starting latitude property. Use by XML persistence.

Returns:
starting latitude

setStartLon

public void setStartLon(float value)
Set the starting longitude property. Used by XML persistence.

Parameters:
value - starting longitude

getStartLon

public float getStartLon()
Set the starting longitude property. Used by XML persiste