ucar.unidata.idv.control
Class MapDisplayControl

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

public class MapDisplayControl
extends DisplayControlImpl

A control for displaying map lines.

Version:
$Revision: 1.95 $
Author:
IDV Development Team

Nested Class Summary
static class MapDisplayControl.LatLonState
          This class holds the state associated with a given lat/lon
static class MapDisplayControl.MapState
          This class holds the state associated with a given map
 
Nested classes/interfaces inherited from class ucar.unidata.idv.control.DisplayControlImpl
DisplayControlImpl.SideLegendLabel
 
Field Summary
 
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
MapDisplayControl()
          Default Constructor.
MapDisplayControl(MapData mapData)
          Special constructor for creating a map display for a particular MapData
MapDisplayControl(MapViewManager mapViewManager, MapInfo mapInfo)
          Special constructor for creating a map display for a particular MapViewManager
 
Method Summary
 Container doMakeContents()
          Make the UI contents for this control.
 void doRemove()
          Clear out any lingering references
protected  boolean getDefaultFastRendering()
          What is the default fast rendering value
protected  void getEditMenuItems(List items, boolean forMenuBar)
          Add the relevant edit menu items into the list
protected  void getFileMenuItems(List items, boolean forMenuBar)
          Add the relevant file menu items into the list
 String getInitialMap()
          Get the InitialMap property.
 String getInitialMapDescription()
          Get the InitialMapDescription property.
 boolean getIsDefaultMap()
          Get the IsDefaultMap property.
 MapDisplayControl.LatLonState getLatState()
          Get the object that holds the latitude state
 void getLegendLabels(List labels, int legendType)
          Append any label information to the list of labels.
 MapDisplayControl.LatLonState getLonState()
          Get the object that holds the longitude state
 double getMapPosition()
          Get the MapPosition property.
 List getMapStates()
          Get the MapStates property.
protected  void getSaveMenuItems(List items, boolean forMenuBar)
          Add the relevant File->Save menu items into the list
 boolean getShowInDisplayList()
          Get the ShowInDisplayList property.
protected  void getViewMenuItems(List items, boolean forMenuBar)
          Add the relevant view menu items into the list
 boolean init(DataChoice dataChoice)
          Called to make this kind of Display Control; also calls code to made its Displayable.
 void loadNewMap(MapDisplayControl newMap)
          Clear the current state and copy the state held by the given newMap
 void merge(MapDisplayControl that)
          Merge the maps contained by that into this
 void projectionChanged()
          Method to call if projection changes.
 void saveToPlugin()
          Turn the map state held by this object into xml and write it out as the user's map preference.
protected  boolean selectMap()
          Ask the user to choose a map file and try to add it.
 void setDisplayVisibility(boolean on)
          Overwrite base class method so we can apply the visibility changes to the maps.
 void setInitializeAsDefault(boolean value)
          Set the initializeAsDefault property.
 void setInitialMap(String value)
          Set the InitialMap property.
 void setInitialMapDescription(String value)
          Set the InitialMapDescription property.
 void setIsDefaultMap(boolean value)
          Set the IsDefaultMap property.
 void setLatState(MapDisplayControl.LatLonState value)
          Set the object that holds the latitude state
 void setLonState(MapDisplayControl.LatLonState value)
          Set the object that holds the longitude state
 void setMapPosition(double value)
          Set the MapPosition property.
 void setMapStates(List value)
          Set the MapStates property.
 void setShowInDisplayList(boolean value)
          Set the ShowInDisplayList property.
protected  boolean shouldApplyFastRendering()
          This method can be overwritten by the derived classes that do not want the general application of the fast rendering flag.
 
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, 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, 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, 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, getSelectRange, getSelectRangeEnabled, getSelectRangeWidget, getSettingsPanel, getShortParamName, getShowInLegend, getShowInTabs, getShowNoteText, getSkipValue, getSkipWidgetLabel, getStore, getTemplateName, getTimeSet, getTitle, getTransientProperty, getUnitForColor, getUseFastRendering, getUseTimesInAnimation, getVersion, getVerticalValue, getViewContext, getViewer, getViewManager, getViewManager, getViewManager, getViewManagerClassNames, getViewManagers, 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, propertyChange, putTransientProperty, receiveShareData, 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, setLineWidth, setLockVisibilityToggle, setMainPanelDimensions, setMainPanelSize, setMakeWindow, setName, setNameFromUser, setNewColorUnit, setNewDisplayUnit, setNoteText, setOkToFireEvents, setOriginalDataChoicesLabel, setParamName, setPersistedVisadData, setProjectionInView, setProjectionInView, setProperty, setRange, setRange, setSelectRange, setSelectRangeEnabled, setSettingsDisplayUnit, setSharedColorScaleInfo, setShowInLegend, setShowInTabs, setShowNoteText, setSkipValue, setTemplateName, setTitle, setUnitForColor, setUseFastRendering, setUseTimesInAnimation, setVersion, setViewer, setViewManagerClassNames, setWindowSize, setWindowVisible, setWindowX, setWindowY, setZPosition, shouldAddAnimationListener, shouldAddControlListener, shouldAddDisplayListener, 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
 

Constructor Detail

MapDisplayControl

public MapDisplayControl()
Default Constructor.


MapDisplayControl

public MapDisplayControl(MapViewManager mapViewManager,
                         MapInfo mapInfo)
Special constructor for creating a map display for a particular MapViewManager

Parameters:
mapViewManager - The map view manager this map display is the default map for
mapInfo - Holds the map info

MapDisplayControl

public MapDisplayControl(MapData mapData)
Special constructor for creating a map display for a particular MapData

Parameters:
mapData - The mapData may be null. If null, then the user is prompted to choose a map.
Method Detail

getLegendLabels

public void getLegendLabels(List labels,
                            int legendType)
Append any label information to the list of labels.

Overrides:
getLegendLabels in class DisplayControlImpl
Parameters:
labels - in/out list of labels
legendType - The type of legend, BOTTOM_LEGEND or SIDE_LEGEND

loadNewMap

public void loadNewMap(MapDisplayControl newMap)
Clear the current state and copy the state held by the given newMap

Parameters:
newMap - The map display we copy from

init

public boolean init(DataChoice dataChoice)
             throws VisADException,
                    RemoteException
Called to make this kind of Display Control; also calls code to made its Displayable.

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

merge

public void merge(MapDisplayControl that)
Merge the maps contained by that into this

Parameters:
that - The other display control to merge its maps

setDisplayVisibility

public void setDisplayVisibility(boolean on)
Overwrite base class method so we can apply the visibility changes to the maps.

Specified by:
setDisplayVisibility in interface DisplayControl
Overrides:
setDisplayVisibility in class DisplayControlImpl
Parameters:
on - Is visible

getViewMenuItems

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

Overrides:
getViewMenuItems 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

getEditMenuItems

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

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

getFileMenuItems

protected void getFileMenuItems(List items,
                                boolean forMenuBar)
Add the relevant file menu items into the list

Overrides:
getFileMenuItems 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

getSaveMenuItems

protected void getSaveMenuItems(List items,
                                boolean forMenuBar)
Add the relevant File->Save menu items into the list

Overrides:
getSaveMenuItems 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

selectMap

protected boolean selectMap()
Ask the user to choose a map file and try to add it.

Returns:
true if a map was selected and added

saveToPlugin

public void saveToPlugin()
Turn the map state held by this object into xml and write it out as the user's map preference.


doMakeContents

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

Overrides:
doMakeContents in class DisplayControlImpl
Returns:
UI container

projectionChanged

public void projectionChanged()
Method to call if projection changes. Override superclass method to set vertical position ConstantMaps for new projection.

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

setInitialMap

public void setInitialMap(String value)
Set the InitialMap property. This is the property that is set from the controls.xml file that defines the initial, default map to use.

Parameters:
value - The new value for InitialMap

getInitialMap

public String getInitialMap()
Get the InitialMap property.

Returns:
The InitialMap

setInitialMapDescription

public void setInitialMapDescription(String value)
Set the InitialMapDescription property. This is the property that is set from the controls.xml file that defines the initial, default map to use.

Parameters:
value - The new value for InitialMapDescription

getInitialMapDescription

public String getInitialMapDescription()
Get the InitialMapDescription property.

Returns:
The InitialMapDescription

shouldApplyFastRendering

protected boolean shouldApplyFastRendering()
This method can be overwritten by the derived classes that do not want the general application of the fast rendering flag.

Overrides:
shouldApplyFastRendering in class DisplayControlImpl
Returns:
Don't use fast rendering

getDefaultFastRendering

protected boolean getDefaultFastRendering()
What is the default fast rendering value

Overrides:
getDefaultFastRendering in class DisplayControlImpl
Returns:
false

setMapStates

public void setMapStates(List value)
Set the MapStates property.

Parameters:
value - The new value for MapStates

getMapStates

public List getMapStates()
Get the MapStates property.

Returns:
The MapStates

getLatState

public MapDisplayControl.LatLonState getLatState()
Get the object that holds the latitude state

Returns:
The latitude state

setLatState

public void setLatState(MapDisplayControl.LatLonState value)
Set the object that holds the latitude state

Parameters:
value - The new latitude state

getLonState

public MapDisplayControl.LatLonState getLonState()
Get the object that holds the longitude state

Returns:
The long. state

setLonState

public void setLonState(MapDisplayControl.LatLonState value)
Set the object that holds the longitude state

Parameters:
value - The new long. state

setIsDefaultMap

public void setIsDefaultMap(boolean value)
Set the IsDefaultMap property.

Parameters:
value - The new value for IsDefaultMap

doRemove

public void doRemove()
              throws RemoteException,
                     VisADException
Clear out any lingering references

Specified by:
doRemove in interface DisplayControl
Overrides:
doRemove in class DisplayControlImpl
Throws:
RemoteException - remote display problem
VisADException - local display problem

setInitializeAsDefault

public void setInitializeAsDefault(boolean value)
Set the initializeAsDefault property. This is used when we do an addDefaultMap

Parameters:
value - The value

getIsDefaultMap

public boolean getIsDefaultMap()
Get the IsDefaultMap property.

Returns:
The IsDefaultMap

setMapPosition

public void setMapPosition(double value)
Set the MapPosition property.

Parameters:
value - The new value for MapPosition

getMapPosition

public double getMapPosition()
Get the MapPosition property.

Returns:
The MapPosition

setShowInDisplayList

public void setShowInDisplayList(boolean value)
Set the ShowInDisplayList property.

Overrides:
setShowInDisplayList in class DisplayControlImpl
Parameters:
value - The new value for ShowInDisplayList

getShowInDisplayList

public boolean getShowInDisplayList()
Get the ShowInDisplayList property.

Specified by:
getShowInDisplayList in interface DisplayControl
Overrides:
getShowInDisplayList in class DisplayControlImpl
Returns:
The ShowInDisplayList