ucar.unidata.idv.control
Class CrossSectionControl

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.GridDisplayControl
                  extended by ucar.unidata.idv.control.CrossSectionControl
All Implemented Interfaces:
ActionListener, ItemListener, PropertyChangeListener, EventListener, HyperlinkListener, Sharable, DataChangeListener, DisplayControl, Prototypable, DisplayableData.DragAdapter, ControlListener, DisplayListener
Direct Known Subclasses:
ColorCrossSectionControl, ContourCrossSectionControl, DataTransectControl, FlowCrossSectionControl

public abstract class CrossSectionControl
extends GridDisplayControl
implements DisplayableData.DragAdapter

TODO: We need to be able to persist/unpersist the ViewManager so its state is saved. Class to make one vertical cross section display and its contents and controls. Also makes a JFrame with buttons used for control of the vertical cross section of one parameter in another display. Also includes contents of a CrossSectionViewManager, a local small vertical cross section display in its own window in this control frame.

Version:
$Revision: 1.173 $
Author:
IDV development team

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.unidata.idv.control.DisplayControlImpl
DisplayControlImpl.SideLegendLabel
 
Field Summary
protected  CoordinateSystem coordTrans
          transform to altitude
protected  CrossSectionViewManager crossSectionView
          the control window's view manager
protected  CrossSectionSelector csSelector
          the cross section selector
protected  boolean dataIs3D
          flag for 3D data
protected  boolean displayIs3D
          flag for 3D display
protected  Coord endCoord
          ending coordinate for the cross section selector
protected  EarthLocation endLocation
          ending location in earth coordinates
static String SHARE_XSLINE
          Identifier for sharing cross-section position
protected  int sizeX
          X and Y size
protected  int sizeY
          X and Y size
protected  Coord startCoord
          starting coordinate for the cross section selector
protected  EarthLocation startLocation
          starting location in earth coordinates
protected  DisplayableData vcsDisplay
          Displayable for depicting cross section in the control window
protected  DisplayableData xsDisplay
          Displayable for depicting cross section in the main window
 
Fields inherited from class ucar.unidata.idv.control.GridDisplayControl
CMD_CONTOURDIALOG, CMD_SETLEVELS, gridDataInstance, INITIAL_PROBE_EARTHLOCATION, log_, settingLevel
 
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, 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
CrossSectionControl()
          Default constructor.
 
Method Summary
protected  void addDisplaySettings(DisplaySettingsDialog dsd)
          Add display settings for cross section controls
protected  void addLabelMacros(String template, List patterns, List values)
          Add any macro name/value pairs.
 void addPropertiesComponents(JTabbedPane jtp)
          Add tabs to the properties dialog.
protected  void addTopographyMap()
          Wrapper around GridDisplayControl.addTopographyMap(int) to allow subclasses to set their own index.
 void applyPreferences()
          Apply preferences to this control.
protected  void applySmoothing()
          Use the value of the smoothing type and weight to subset the data.
protected  void applyZPosition()
          Apply the Z position.
 EarthLocation boxToEarth(RealTuple tuple)
          Transform VisAD box coordinates to and EarthLocation
 boolean canExportData()
          Can this display control write out data.
 boolean constrainDragPoint(float[] position)
          Constrain the drag point
 Coord convertToDisplay(Coord from)
          Convert a Coord (x, y, z) in grid index values to a Coord in VisAD internal values; -1.0 to 1.0 in VisAD box.
protected  void createCrossSectionSelector()
          Make a Selector line which shows and controls where cross section is
protected  void createCrossSectionSelector(EarthLocation loc1, EarthLocation loc2)
          Create the cross section selector
protected abstract  DisplayableData createVCSDisplay()
          Create the DisplayableData that will be used to depict the data in the control's display.
protected  float[] createXFromLatLon(float[][] latlon, int numNeeded, int lonIndex)
          From an array of latitudes and longitudes, calculate an array of distance (in km) that corresponds to the distance from the first point to the numNeeded point.
protected abstract  DisplayableData createXSDisplay()
          Create the DisplayableData that will be used to depict the data in the main display.
 void crossSectionChanged()
          Load or reload data for a cross section.
 boolean doApplyProperties()
          Apply the properties
 void doExport(String what, String filename)
          Called by ISL.
 Container doMakeContents()
          Called by doMakeWindow in DisplayControlImpl, which then calls its doMakeMainButtonPanel(), which makes more buttons.
 void doRemove()
          Remove the cross section view component from the gui to fix the funny lock up problem on linux
 boolean getAllowAutoScale()
          Get the AutoScale property.
 AnimationInfo getAnimationInfo()
          Get the AnimationInfo property.
 boolean getAutoScaleYAxis()
          Get the AutoScale property.
 boolean getAutoUpdate()
          Get the AutoUpdate property.
 void getControlWidgets(List controlWidgets)
          Get the control widgets specific to this control
 CrossSectionSelector getCrossSectionSelector()
          Get the selector used to position the cross section.
 CrossSectionViewManager getCrossSectionView()
          Get the CrossSectionView property.
protected  String getCrossSectionViewLabel()
          Get the label for the CrossSectionView
protected  CrossSectionViewManager getCrossSectionViewManager()
          Get the view manager for the control window.
 List getCursorReadoutInner(EarthLocation el, Real animationValue, int animationStep, List<ReadoutInfo> samples)
          Get the cursor readout info
 MapProjection getDataProjection()
          Get the projection of the data.
protected  Data getDisplayedData()
          Get the DisplayedData
protected  JComponent getDisplayTabComponent()
          Create the component that goes into the 'Display' tab
protected  void getEditMenuItems(List items, boolean forMenuBar)
          Get edit menu item
 RealTuple getEndPoint()
          Set the probe position property; used by XML persistence.
 GridDisplayable getGridDisplayable()
          Get the GridDisplayable used for setting the data.
protected  double getInitialZPosition()
          Get the initial Z position
protected  EarthLocation[] getLineCoords()
          Get the line coordinates as an array of EarthLocations
 boolean getLineVisible()
          Get the LineVisible property.
protected  void getMacroNames(List names, List labels)
          Add any macro name/label pairs
 double getSelectorAltitude()
          Get the selector altitude from the Z position
protected  int getSelectorAttributeFlags()
          Return the attribute flags to apply to the cross section selector.
 RealTuple getStartPoint()
          Set the probe position property; used by XML persistence.
 Range getVerticalAxisRange()
          Get the range on the vertical Axis of the cross section
 DisplayableData getVerticalCSDisplay()
          Get the DisplayableData used for depicting data in the control's display.
 ViewManager getViewManagerForCapture(String what)
          Get the view manager for capture
protected  void getViewMenuItems(List menus, boolean forMenuBar)
          Add the relevant view menu items into the list
 DisplayableData getXSDisplay()
          Get the DisplayableData used for depicting data in the main display.
protected  String getZPositionSliderLabel()
          Get the label for the Z position slider.
 boolean handleAddPoint(float[] x)
          Handle adding a point
 boolean handleDragDirect(VisADRay ray, boolean first, int mouseModifiers)
          Implementation of the DisplayableData.DragAdapter
 boolean init(DataChoice dataChoice)
          Initialize the control using the data choice
 void initAfterUnPersistence(ControlContext vc, Hashtable properties, List preSelectedDataChoices)
          Called by the IntegratedDataViewer to initialize after this control has been unpersisted
 void initDone()
          Called after all initialization is finished.
protected  void load2DData(FieldImpl twoDData)
          Load the 2D data into the appropriate display(s)
protected  void loadData(FieldImpl fieldImpl)
          Load the external display and the local display with this data of a vertical cross section.
protected  void loadDataFromLine()
          Create and loads a 2D FieldImpl from the existing getGridDataInstance() at the position indicated by the controlling Selector line end points;
protected  FieldImpl make2DData(FieldImpl xsectSequence)
          Make a FieldImpl suitable for the plain 2D vert cross section display; of form (time -> ((x) -> parm)); new x axis positions are in distance along cross section from one end.
protected  GriddedSet make2DDomainSet(GriddedSet domainSet)
          Make the domain for the 2D grid
 void projectionChanged()
          Respond to a change in the display's projection.
 void propertyChange(PropertyChangeEvent evt)
          Handle property change
 void receiveShareData(Sharable from, Object dataId, Object[] data)
          Called when shared data is received.
protected  void reScale()
          Call to reScale the display.
 void setAllowAutoScale(boolean value)
          Set the AutoScale property.
 void setAnimationInfo(AnimationInfo value)
          Set the AnimationInfo property.
 void setAutoScaleYAxis(boolean value)
          Set the AutoScale property.
 void setAutoUpdate(boolean value)
          Set the AutoUpdate property.
 void setBackground(Color color)
          Deprecated. Keep this around for old bundles
 void setCrossSectionView(CrossSectionViewManager value)
          Set the CrossSectionView property.
protected  boolean setData(DataChoice dataChoice)
          Called when the user asked for a new kind of parameter to be displayed in a pre-existing display of this class, with other kind of data already displayed there.
 void setDisplayMatrix(double[] value)
          Deprecated. Keep this around for old bundles
 void setEndCoord(Coord c)
          Set the ending coordinate of the cross section selector.
 void setEndPoint(RealTuple p)
          Set the probe position property; used by XML persistence.
 void setForeground(Color color)
          Deprecated. Keep this around for old bundles
 void setInitAlt(double value)
          _more_
 void setInitLat1(double value)
          Set the InitLat1 property.
 void setInitLat2(double value)
          Set the Lat2 property.
 void setInitLon1(double value)
          Set the Lon1 property.
 void setInitLon2(double value)
          Set the Lon2 property.
 void setLineVisible(boolean value)
          Set the LineVisible property.
protected  void setPosition(EarthLocation startLoc, EarthLocation endLoc)
          Set the position of the selector
 void setStartCoord(Coord c)
          Set the starting coordinate of the cross section selector.
 void setStartPoint(RealTuple p)
          Set the probe position property; used by XML persistence.
 void setVerticalAxisRange(Range range)
          Set the range on the Y Axis of the cross section
protected  void setYAxisRange(XSDisplay display, Range range)
          Methods to do the things that need to be done when the data range changes.
protected  boolean shouldAddControlListener()
          A hook to allow derived classes to tell us to add this as a control listener
 void transectChanged()
          Method called when a transect changes.
protected  void updateLocationLabel()
          Called when a change in position occurs
protected  void updateViewParameters()
          This method is used to update anything that needs to be updated in the CrossSectionViewManager.
 void viewpointChanged()
          Noop for the ControlListener interface
 
Methods inherited from class ucar.unidata.idv.control.GridDisplayControl
actionPerformed, addTopographyMap, convertColorRange, doMakeContourLevelControl, doMakeDataInstance, doMakeLevelControl, doMakeLevelControl, exportDisplayedData, getColorParamName, getColorRangeFromData, getColorRangeIndex, getColorUnit, getContourInfo, getCursorReadoutData, getDataRangeInColorUnits, getDefaultContourInfo, getDisplayUnit, getGridDataInstance, getInitialColorTable, getInitialRange, getRawDataUnit, haveMultipleFields, initializeDefaultContourInfo, isDisplayUnitAlsoColorUnit, setLevel, setLevel, setLevelFromUser
 
Methods inherited from class ucar.unidata.idv.control.DisplayControlImpl
activateDisplays, addAttributedDisplayable, addAttributedDisplayable, addAttributedDisplayable, addAttributeFlags, addCheckBoxSettings, addDataChoice, addDisplayable, addDisplayable, addDisplayable, addDisplayable, addDisplayable, addDisplayable, addDisplayMaster, addNewData, addNoteText, addPropertyChangeListener, addRemovable, addSharable, addTimeModeWidget, addToControlContext, addToRangeMenu, addToRangeMenu, addToRangeMenu, addViewManager, appendDataChoices, applyAttributesToDisplayables, applyColor, applyColorScaleInfo, applyColorTable, applyColorUnit, applyContourInfo, applyDisplaySetting, applyDisplayUnit, applyLineWidth, applyProperties, applyProperties, applyPropertyValues, applyRange, applySelectRange, applySkipFactor, applyTextureQuality, applyTimeRange, boundsClose, canBeDocked, canSaveDataInCache, captureWindow, centerOnDisplay, changeColorUnit, changeDisplayUnit, checkFlag, checkIfDataOk, checkImageSize, clearDataInstance, clearPrototype, clearViewManagers, close, colorUnitChanged, controlChanged, convertColorRange, convertRange, createDisplayListDisplayable, createIdvWindow, dataChanged, deactivateDisplays, debug, displayableToFront, displayChanged, displayControlFailed, displayUnitChanged, doInitialUpdateLegendAndList, doMakeBottomLegendComponent, doMakeChangeColorMenu, doMakeChangeColorMenu, doMakeChangeParameterMenuItem, doMakeColorControl, doMakeColorControl, doMakeColorScales, doMakeMenuBar, doMakeMenuBarMenus, doMakePointSizeWidget, doMakeRemoveControl, doMakeSideLegendComponent, doMakeSkipFactorSlider, doMakeTextureSlider, doMakeVisibilityControl, doMakeWidgetComponent, doMakeWindow, doMakeZPositionSlider, findDisplayInfo, findDisplays, findDisplays, firePropertyChangeEvent, firstFrameDone, formatForCursorReadout, getActive, getAnimation, getAnimation, getAnimation, getAnimation, getAnimationWidget, getAttributeFlags, getCachedData, getCanDoRemoveAll, getCategories, getChangeParameterLabel, getCollapseLegend, getColor, getColorDimness, getColorScaleInfo, getColorTable, getColorTableForDisplayable, getColorTableToApply, getColorTableWidget, getColorUnitName, getColorWidgetLabel, getComponentHolder, getContents, getControlChangeSleepTime, getControlContext, getControlMenus, getCursorReadout, getCursorReadoutInner, getData, getDataChoice, getDataChoices, getDataForDisplayList, getDataInstance, getDataInstance, getDataProjectionForMenu, getDataProjectionLabel, getDataSelection, getDataSources, getDataTimeRange, getDataTimeRange, getDataTimeSet, getDebugDetails, getDefaultColorScaleInfo, getDefaultDisplayListTemplate, getDefaultDistanceUnit, getDefaultFastRendering, getDefaultSamplingMode, getDefaultSamplingModeValue, getDefaultView, getDefaultViewDescriptor, getDefaultViewManager, getDetailsContents, getDisplayAltitudeType, getDisplayCategory, getDisplayCenter, getDisplayConventions, getDisplayId, getDisplayInfos, getDisplayListColor, getDisplayListData, getDisplayListDisplayable, getDisplayListTemplate, getDisplayMaster, getDisplayName, getDisplayScale, getDisplayUnit, getDisplayUnitName, getDisplayVisibility, getDoCursorReadout, getEditMenuItems, getExpandedInTabs, getExtraLabelTemplate, getExtraLegendComponent, getExtraMenus, getFileMenuItems, getFileMenuItems, getGraphicsConfiguration, getGrid, getGrid, getHadDataChoices, getHaveInitialized, getHelpIds, getHelpMenuItems, getId, getIdv, getImage, getImage, getInitDataChoices, getInitialFastRendering, getInternalAnimation, getInternalAnimation, getIsRaster, getIsTimeDriver, getLabel, getLastFileMenuItems, getLegendButtons, getLegendComponent, getLegendLabel, getLegendLabels, getLegendLabelTemplate, getLegendToolTip, getLineWidth, getLineWidthWidget, getLineWidthWidgetLabel, getLockVisibilityToggle, getLongParamName, getMainPanel, getMainPanelSize, getMakeWindow, getMapDisplay, getMapViewManager, getMapViewProjection, getMenuLabel, getMyDataChoices, getNavigatedDisplay, getNoteText, getObjectStore, getOkToFireEvents, getOldColorTableOrInitialColorTable, getOriginalDataChoicesLabel, getOuterContents, getPointSize, getProperty, getProperty, getPropertyDisplayName, getRange, getRangeForColorTable, getRangeToApply, 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, getViewManagers, getViewMenuItems, getVisbilityAnimationPause, getWasUnPersisted, getWindow, getWindowSize, getWindowVisible, getWindowX, getWindowY, getZPosition, guiExported, guiImported, handleDisplayChanged, handleWindowClosing, hasMapProjection, hasTimeMacro, haveDataTimes, haveParameterDefaults, hide, hyperlinkUpdate, inGlobeDisplay, init, init, init, initAfterUnPersistence, initAsPrototype, initAsTemplate, initBasic, initializeWithNewData, initWindow, isDisplay3D, isGuiShown, isInitDone, isInTransectView, isInViewManager, itemStateChanged, makeChangeColorMenuItems, makeLegendLabel, makeLockButton, makeRemoveButton, moveTo, notifyViewManagersOfChange, parseProperties, popup, popupDataDialog, popupDataDialog, popupDataDialog, processRequestProperties, putTransientProperty, reallySetAttributeFlags, redoGuiLayout, reloadDataSource, reloadDataSourceInThread, removeDataChoice, removeDisplayable, removeDisplayables, removeDisplayables, removeOnWindowClose, removePropertyChangeListener, resetData, resetDimness, resetViewManager, revertToDefaultColorTable, revertToDefaultColorTable, revertToDefaultRange, revertToDefaultRange, saveAsFavorite, saveAsParameterDefaults, saveAsPrototype, saveAsTemplate, saveDataChoiceInCache, saveImage, selectDataChoices, setAnimationSet, setAttributeFlags, setCachedData, setCanDoRemoveAll, setCategories, setCollapseLegend, setColor, setColorBrighter, setColorDimmer, setColorDimness, setColorScaleInfo, setColorScaleVisible, setColorTable, setColorTable, setColorTableName, setColorUnit, setColorUnitName, setComponentHolder, setContents, setContourInfo, setContourInfoParams, setData, setDataChoices, setDataInstance, setDataInstances, setDataSelection, setDataTimeRange, setDefaultSamplingMode, setDefaultView, setDisplayableVisibility, setDisplayableVisiblity, setDisplayActive, setDisplayCategory, setDisplayId, setDisplayInactive, setDisplayListColor, setDisplayListColor, setDisplayListProperties, setDisplayListTemplate, setDisplayName, setDisplayUnit, setDisplayUnitName, setDisplayVisibility, setDoCursorReadout, setExpandedInTabs, setExtraLabelTemplate, setHadDataChoices, setHelpUrl, setId, setInitDataChoices, setInitialSettings, setInitialViewManager, setIsRaster, setIsTimeDriver, setLabelAsPreference, setLegendBackground, setLegendForeground, setLegendLabel, setLegendLabelTemplate, setLineWidth, 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, shouldAddDisplayListener, shouldApplyFastRendering, shouldBeDocked, shouldWindowBeVisible, show, showColorControlWidget, showColorDialog, showColorDialog, showColorScaleDialog, showColorScales, showColorSwatches, showContourPropertiesDialog, showDetails, showDisplaySettingsDialog, showHelp, showLegendMenu, showNormalCursor, showProperties, showTimeRangeDialog, showWaitCursor, timeChanged, toFront, toggleNoteTextArea, toggleVisibilityForVectorGraphicsRendering, toggleWindow, toString, updateAnimation, updateDataInstance, updateDataSelection, updateDisplayList, updateGridDataInstance, updateLegendAndList, updateLegendLabel, updateLockButton, useSmoothingFactor, useZPosition, viewManagerChanged, viewManagerDestroyed, 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, 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

SHARE_XSLINE

public static final String SHARE_XSLINE
Identifier for sharing cross-section position

See Also:
Constant Field Values

vcsDisplay

protected DisplayableData vcsDisplay
Displayable for depicting cross section in the control window


xsDisplay

protected DisplayableData xsDisplay
Displayable for depicting cross section in the main window


csSelector

protected CrossSectionSelector csSelector
the cross section selector


crossSectionView

protected CrossSectionViewManager crossSectionView
the control window's view manager


coordTrans

protected CoordinateSystem coordTrans
transform to altitude


sizeX

protected int sizeX
X and Y size


sizeY

protected int sizeY
X and Y size


displayIs3D

protected boolean displayIs3D
flag for 3D display


dataIs3D

protected boolean dataIs3D
flag for 3D data


startCoord

protected Coord startCoord
starting coordinate for the cross section selector


endCoord

protected Coord endCoord
ending coordinate for the cross section selector


startLocation

protected EarthLocation startLocation
starting location in earth coordinates


endLocation

protected EarthLocation endLocation
ending location in earth coordinates

Constructor Detail

CrossSectionControl

public CrossSectionControl()
Default constructor. Sets the appropriate attribute flags.

Method Detail

createXSDisplay

protected abstract DisplayableData createXSDisplay()
                                            throws VisADException,
                                                   RemoteException
Create the DisplayableData that will be used to depict the data in the main display.

Returns:
depictor for data in main display
Throws:
VisADException - unable to create depictor
RemoteException - unable to create depictor (shouldn't happen)

createVCSDisplay

protected abstract DisplayableData createVCSDisplay()
                                             throws VisADException,
                                                    RemoteException
Create the DisplayableData that will be used to depict the data in the control's display.

Returns:
depictor for data in main display
Throws:
VisADException - unable to create depictor
RemoteException - unable to create depictor (shouldn't happen)

getGridDisplayable

public GridDisplayable getGridDisplayable()
Get the GridDisplayable used for setting the data.

Returns:
data's GridDisplayable

getVerticalCSDisplay

public DisplayableData getVerticalCSDisplay()
Get the DisplayableData used for depicting data in the control's display.

Returns:
control's display depictor

getXSDisplay

public DisplayableData getXSDisplay()
Get the DisplayableData used for depicting data in the main display.

Returns:
main display depictor

getCrossSectionSelector

public CrossSectionSelector getCrossSectionSelector()
Get the selector used to position the cross section.

Returns:
this controls selector

initAfterUnPersistence

public void initAfterUnPersistence(ControlContext vc,
                                   Hashtable properties,
                                   List preSelectedDataChoices)
Called by the IntegratedDataViewer to initialize after this control has been unpersisted

Specified by:
initAfterUnPersistence in interface DisplayControl
Overrides:
initAfterUnPersistence in class DisplayControlImpl
Parameters:
vc - The context in which this control exists
properties - Properties that may hold things
preSelectedDataChoices - set of preselected data choices

getCrossSectionViewManager

protected CrossSectionViewManager getCrossSectionViewManager()
Get the view manager for the control window.

Returns:
control window's view manager

getViewManagerForCapture

public ViewManager getViewManagerForCapture(String what)
                                     throws Exception
Get the view manager for capture

Overrides:
getViewManagerForCapture in class DisplayControlImpl
Parameters:
what - the name
Returns:
the ViewManager to use
Throws:
Exception - problem getting the view manager

init

public boolean init(DataChoice dataChoice)
             throws VisADException,
                    RemoteException
Initialize the control using the data choice

Overrides:
init in class DisplayControlImpl
Parameters:
dataChoice - choice specifying the data
Returns:
true if successful
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

addDisplaySettings

protected void addDisplaySettings(DisplaySettingsDialog dsd)
Add display settings for cross section controls

Overrides:
addDisplaySettings in class DisplayControlImpl
Parameters:
dsd - the dialog to add to

getCursorReadoutInner

public List getCursorReadoutInner(EarthLocation el,
                                  Real animationValue,
                                  int animationStep,
                                  List<ReadoutInfo> samples)
                           throws Exception
Get the cursor readout info

Overrides:
getCursorReadoutInner in class GridDisplayControl
Parameters:
el - earth location
animationValue - animation value
animationStep - animation step
samples - the list of samples
Returns:
the list of items
Throws:
Exception - problem reading the data

getSelectorAttributeFlags

protected int getSelectorAttributeFlags()
Return the attribute flags to apply to the cross section selector. This allows derived classes to set their own, e.g., use z position.

Returns:
Flags to use

getDataProjection

public MapProjection getDataProjection()
Get the projection of the data.

Specified by:
getDataProjection in interface DisplayControl
Overrides:
getDataProjection in class GridDisplayControl
Returns:
data projection or null

initDone

public void initDone()
Called after all initialization is finished. This sets the end points of the csSelector to the correct position and adds this as a property change listener to the csSelector.

Overrides:
initDone in class DisplayControlImpl

handleDragDirect

public boolean handleDragDirect(VisADRay ray,
                                boolean first,
                                int mouseModifiers)
Implementation of the DisplayableData.DragAdapter

Specified by:
handleDragDirect in interface DisplayableData.DragAdapter
Parameters:
ray - the view ray
first - if this is the first time
mouseModifiers - the mouse modifiers
Returns:
true

handleAddPoint

public boolean handleAddPoint(float[] x)
Handle adding a point

Specified by:
handleAddPoint in interface DisplayableData.DragAdapter
Parameters:
x - the coords
Returns:
true

doExport

public void doExport(String what,
                     String filename)
              throws Exception
Called by ISL. Write out some data defined by the what parameter to the given file.

Overrides:
doExport in class DisplayControlImpl
Parameters:
what - What is to be written out
filename - To what file
Throws:
Exception - _more_

boxToEarth

public EarthLocation boxToEarth(RealTuple tuple)
                         throws RemoteException,
                                VisADException
Transform VisAD box coordinates to and EarthLocation

Parameters:
tuple - the tuple of VisAD coordinates
Returns:
the corresponding EarthLocation
Throws:
RemoteException - Java RMI Exception
VisADException - VisAD Exception

constrainDragPoint

public boolean constrainDragPoint(float[] position)
Constrain the drag point

Specified by:
constrainDragPoint in interface DisplayableData.DragAdapter
Parameters:
position - the position
Returns:
true

getMacroNames

protected void getMacroNames(List names,
                             List labels)
Add any macro name/label pairs

Overrides:
getMacroNames in class DisplayControlImpl
Parameters:
names - List of macro names
labels - List of macro labels

addLabelMacros

protected void addLabelMacros(String template,
                              List patterns,
                              List values)
Add any macro name/value pairs.

Overrides:
addLabelMacros in class DisplayControlImpl
Parameters:
template - The template to use
patterns - The macro names
values - The macro values

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Handle property change

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

doRemove

public void doRemove()
              throws RemoteException,
                     VisADException
Remove the cross section view component from the gui to fix the funny lock up problem on linux

Specified by:
doRemove in interface DisplayControl
Overrides:
doRemove in class DisplayControlImpl
Throws:
RemoteException - On badness
VisADException - On badness

addPropertiesComponents

public void addPropertiesComponents(JTabbedPane jtp)
Add tabs to the properties dialog.

Overrides:
addPropertiesComponents in class DisplayControlImpl
Parameters:
jtp - the JTabbedPane to add to

doApplyProperties

public boolean doApplyProperties()
Apply the properties

Overrides:
doApplyProperties in class DisplayControlImpl
Returns:
true if successful

doMakeContents

public Container doMakeContents()
Called by doMakeWindow in DisplayControlImpl, which then calls its doMakeMainButtonPanel(), which makes more buttons.

Overrides:
doMakeContents in class DisplayControlImpl
Returns:
container of contents

getEditMenuItems

protected void getEditMenuItems(List items,
                                boolean forMenuBar)
Get edit menu item

Overrides:
getEditMenuItems in class DisplayControlImpl
Parameters:
items - list of items to add to
forMenuBar - for the menu bar

getDisplayTabComponent

protected JComponent getDisplayTabComponent()
Create the component that goes into the 'Display' tab

Returns:
Display tab component

getControlWidgets

public void getControlWidgets(List controlWidgets)
                       throws VisADException,
                              RemoteException
Get the control widgets specific to this control

Overrides:
getControlWidgets in class DisplayControlImpl
Parameters:
controlWidgets - list of widgets to add to.
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

setData

protected boolean setData(DataChoice dataChoice)
                   throws VisADException,
                          RemoteException
Called when the user asked for a new kind of parameter to be displayed in a pre-existing display of this class, with other kind of data already displayed there. Reset new parameter choice's data into the displayables. Do over everything necessary to load in a new kind of data.

Overrides:
setData in class DisplayControlImpl
Parameters:
dataChoice - specification of the data
Returns:
true if successful
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

updateViewParameters

protected void updateViewParameters()
                             throws VisADException,
                                    RemoteException
This method is used to update anything that needs to be updated in the CrossSectionViewManager. Subclasses should override this if they need to do anything special.

Throws:
RemoteException - Java RMI error
VisADException - VisAD error

setStartCoord

public void setStartCoord(Coord c)
Set the starting coordinate of the cross section selector. Used by XML persistence.

Parameters:
c - starting coordinate

setEndCoord

public void setEndCoord(Coord c)
Set the ending coordinate of the cross section selector. Used by XML persistence.

Parameters:
c - ending coordinate

createCrossSectionSelector

protected void createCrossSectionSelector()
                                   throws VisADException,
                                          RemoteException
Make a Selector line which shows and controls where cross section is

Throws:
RemoteException - Java RMI error
VisADException - VisAD error

createCrossSectionSelector

protected void createCrossSectionSelector(EarthLocation loc1,
                                          EarthLocation loc2)
                                   throws VisADException,
                                          RemoteException
Create the cross section selector

Parameters:
loc1 - the starting location
loc2 - the ending location
Throws:
RemoteException - Java RMI Exception
VisADException - VisAD Exception

convertToDisplay

public Coord convertToDisplay(Coord from)
                       throws VisADException,
                              RemoteException
Convert a Coord (x, y, z) in grid index values to a Coord in VisAD internal values; -1.0 to 1.0 in VisAD box. Goes via intermediate lat,long,altitude position.

Parameters:
from - a Coord (x, y, z) in grid index values.
Returns:
converted coordinates
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

receiveShareData

public void receiveShareData(Sharable from,
                             Object dataId,
                             Object[] data)
Called when shared data is received.

Specified by:
receiveShareData in interface Sharable
Overrides:
receiveShareData in class DisplayControlImpl
Parameters:
from - object sharing data
dataId - type of data being shared
data - the sharable data

applyZPosition

protected void applyZPosition()
                       throws VisADException,
                              RemoteException
Apply the Z position. If the selector is in lat/lon/alt space, we need to transform from XYZ

Overrides:
applyZPosition in class DisplayControlImpl
Throws:
RemoteException - Java RMI Exception
VisADException - VisADException

setPosition

protected void setPosition(EarthLocation startLoc,
                           EarthLocation endLoc)
                    throws VisADException,
                           RemoteException
Set the position of the selector

Parameters:
startLoc - Start location
endLoc - End location
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

getSelectorAltitude

public double getSelectorAltitude()
Get the selector altitude from the Z position

Returns:
the altitude

crossSectionChanged

public void crossSectionChanged()
Load or reload data for a cross section.


projectionChanged

public void projectionChanged()
Respond to a change in the display's projection. In this case we resample at the new location.

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

viewpointChanged

public void viewpointChanged()
Noop for the ControlListener interface

Overrides:
viewpointChanged in class DisplayControlImpl

getViewMenuItems

protected void getViewMenuItems(List menus,
                                boolean forMenuBar)
Add the relevant view menu items into the list

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

getCrossSectionViewLabel

protected String getCrossSectionViewLabel()
Get the label for the CrossSectionView

Returns:
return the name of the cross section view

shouldAddControlListener

protected boolean shouldAddControlListener()
A hook to allow derived classes to tell us to add this as a control listener

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

transectChanged

public void transectChanged()
Method called when a transect changes.

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

getLineCoords

protected EarthLocation[] getLineCoords()
                                 throws VisADException,
                                        RemoteException
Get the line coordinates as an array of EarthLocations

Returns:
the locations
Throws:
RemoteException - Java RMI Exception
VisADException - Problem creating EarthLocations

loadDataFromLine

protected void loadDataFromLine()
                         throws VisADException,
                                RemoteException
Create and loads a 2D FieldImpl from the existing getGridDataInstance() at the position indicated by the controlling Selector line end points;

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

loadData

protected void loadData(FieldImpl fieldImpl)
                 throws VisADException,
                        RemoteException
Load the external display and the local display with this data of a vertical cross section.

Parameters:
fieldImpl - the data for the depiction
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

load2DData

protected void load2DData(FieldImpl twoDData)
                   throws VisADException,
                          RemoteException
Load the 2D data into the appropriate display(s)

Parameters:
twoDData - cross section slice converted to 2D
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

applySmoothing

protected void applySmoothing()
                       throws VisADException,
                              RemoteException
Use the value of the smoothing type and weight to subset the data.

Overrides:
applySmoothing in class DisplayControlImpl
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

reScale

protected void reScale()
                throws VisADException,
                       RemoteException
Call to reScale the display. Does the right thing depending on the value of autoScaleYAxis.

Throws:
RemoteException - Java RMI error
VisADException - VisAD error

setVerticalAxisRange

public void setVerticalAxisRange(Range range)
Set the range on the Y Axis of the cross section

Parameters:
range - Range of values in units of Y Axis. May be null

getVerticalAxisRange

public Range getVerticalAxisRange()
Get the range on the vertical Axis of the cross section

Returns:
range of values in units of Y Axis. May be null

setYAxisRange

protected void setYAxisRange(XSDisplay display,
                             Range range)
                      throws VisADException,
                             RemoteException
Methods to do the things that need to be done when the data range changes.

Parameters:
display - the display to modify
range - Range of values in units of Y Axis. May be null
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

make2DData

protected FieldImpl make2DData(FieldImpl xsectSequence)
                        throws VisADException,
                               RemoteException
Make a FieldImpl suitable for the plain 2D vert cross section display; of form (time -> ((x) -> parm)); new x axis positions are in distance along cross section from one end. override from superclass since we are dealing only with 2D data.

Parameters:
xsectSequence - the time sequence of cross section data
Returns:
xsectSequence transformed to 2D
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

make2DDomainSet

protected GriddedSet make2DDomainSet(GriddedSet domainSet)
                              throws VisADException,
                                     RemoteException
Make the domain for the 2D grid

Parameters:
domainSet - the domain to be 2D'ized
Returns:
the 2D ized grid
Throws:
RemoteException - Java RMI error
VisADException - VisAD error

getZPositionSliderLabel

protected String getZPositionSliderLabel()
Get the label for the Z position slider.

Overrides:
getZPositionSliderLabel in class DisplayControlImpl
Returns:
label

setAnimationInfo

public void setAnimationInfo(AnimationInfo value)
Set the AnimationInfo property.

Overrides:
setAnimationInfo in class DisplayControlImpl
Parameters:
value - The new value for AnimationInfo

getAnimationInfo

public AnimationInfo getAnimationInfo()
Get the AnimationInfo property.

Overrides:
getAnimationInfo in class DisplayControlImpl
Returns:
The AnimationInfo

createXFromLatLon

protected float[] createXFromLatLon(float[][] latlon,
                                    int numNeeded,
                                    int lonIndex)
From an array of latitudes and longitudes, calculate an array of distance (in km) that corresponds to the distance from the first point to the numNeeded point. NB: In this implementation, the distance from the origin is calculated as the sum of the distances between each point in between.

Parameters:
latlon - array of lat lon values in degrees (order doesn't matter)
numNeeded - number of distances to calculate
lonIndex - which of the indices in latlon is longitude
Returns:
array of distances each lat/lon point is from the origin.

applyPreferences

public void applyPreferences()
Apply preferences to this control. Subclasses should override if needed. This is a noop in this class.

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

addTopographyMap

protected void addTopographyMap()
                         throws VisADException,
                                RemoteException
Wrapper around GridDisplayControl.addTopographyMap(int) to allow subclasses to set their own index.

Throws:
RemoteException - Java RMI error
VisADException - VisAD error

updateLocationLabel

protected void updateLocationLabel()
Called when a change in position occurs


setAllowAutoScale

public void setAllowAutoScale(boolean value)
Set the AutoScale property.

Parameters:
value - The new value for AutoScale

getAllowAutoScale

public boolean getAllowAutoScale()
Get the AutoScale property.

Returns:
The AutoScale

setAutoScaleYAxis

public void setAutoScaleYAxis(boolean value)
Set the AutoScale property.

Parameters:
value - The new value for AutoScale

getAutoScaleYAxis

public boolean getAutoScaleYAxis()
Get the AutoScale property.

Returns:
The AutoScale

setAutoUpdate

public void setAutoUpdate(boolean value)
Set the AutoUpdate property.

Parameters:
value - The new value for AutoUpdate

getAutoUpdate

public boolean getAutoUpdate()
Get the AutoUpdate property.

Returns:
The AutoUpdate

setCrossSectionView

public void setCrossSectionView(CrossSectionViewManager value)
Set the CrossSectionView property.

Parameters:
value - The new value for CrossSectionView

getCrossSectionView

public CrossSectionViewManager getCrossSectionView()
Get the CrossSectionView property.

Returns:
The CrossSectionView

setForeground

public void setForeground(Color color)
Deprecated. Keep this around for old bundles

Set the foreground color

Parameters:
color - new color

setBackground

public void setBackground(Color color)
Deprecated. Keep this around for old bundles

Set the background color

Parameters:
color - new color

setDisplayMatrix

public void setDisplayMatrix(double[] value)
Deprecated. Keep this around for old bundles

Set the DisplayMatrix property.

Parameters:
value - The new value for DisplayMatrix

canExportData

public boolean canExportData()
Can this display control write out data.

Overrides:
canExportData in class DisplayControlImpl
Returns:
true if it can

getDisplayedData

protected Data getDisplayedData()
                         throws VisADException,
                                RemoteException
Get the DisplayedData

Overrides:
getDisplayedData in class DisplayControlImpl
Returns:
the data or null
Throws:
RemoteException - problem reading remote data
VisADException - problem gettting data

getInitialZPosition

protected double getInitialZPosition()
Get the initial Z position

Overrides:
getInitialZPosition in class DisplayControlImpl
Returns:
the position in Z space

setStartPoint

public void setStartPoint(RealTuple p)
Set the probe position property; used by XML persistence.

Parameters:
p - probe position

getStartPoint

public RealTuple getStartPoint()
                        throws VisADException,
                               RemoteException
Set the probe position property; used by XML persistence.

Returns:
probe position - may be null.
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

setEndPoint

public void setEndPoint(RealTuple p)
Set the probe position property; used by XML persistence.

Parameters:
p - probe position

getEndPoint

public RealTuple getEndPoint()
                      throws VisADException,
                             RemoteException
Set the probe position property; used by XML persistence.

Returns:
probe position - may be null.
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

setLineVisible

public void setLineVisible(boolean value)
Set the LineVisible property.

Parameters:
value - The new value for LineVisible

getLineVisible

public boolean getLineVisible()
Get the LineVisible property.

Returns:
The LineVisible

setInitAlt

public void setInitAlt(double value)
_more_

Parameters:
value - _more_

setInitLat2

public void setInitLat2(double value)
Set the Lat2 property.

Parameters:
value - The new value for Lat2

setInitLon2

public void setInitLon2(double value)
Set the Lon2 property.

Parameters:
value - The new value for Lon2

setInitLat1

public void setInitLat1(double value)
Set the InitLat1 property.

Parameters:
value - The new value for InitLat1

setInitLon1

public void setInitLon1(double value)
Set the Lon1 property.

Parameters:
value - The new value for Lon1