Package edu.cnu.mdi.mapping.container
Class MapContainer
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
edu.cnu.mdi.container.BaseContainer
edu.cnu.mdi.mapping.container.MapContainer
- All Implemented Interfaces:
IContainer,HoverListener,ItemChangeListener,ImageObserver,MenuContainer,Serializable,EventListener
Map-specific container supporting projection-aware recentering, geographic
coordinate conversion, country-name hover popups, and drag-and-drop placement
of military symbols.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class edu.cnu.mdi.container.BaseContainer
_afterDraw, _annotationLayer, _beforeDraw, _connectionLayer, _defaultLayer, _defaultWorldSystem, _feedbackControl, _feedbackPane, _layers, _previousWorldSystem, _toolBar, _view, _worldSystem, hoverWindow, localToWorld, toolHandler, worldToLocalFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface edu.cnu.mdi.container.IContainer
FIXED_ZOOM_FACTORFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionMapContainer(Rectangle2D.Double worldSystem) Creates a map container with the given initial world coordinate system. -
Method Summary
Modifier and TypeMethodDescriptionprotected BaseToolHandlerFactory method that creates theBaseToolHandlerappropriate for this container.voidfeedbackTrigger(MouseEvent mouseEvent, boolean dragging) Convenience method to update the location string in the toolbar.static StringformatElevationStatus(double elevationMeters, boolean onLand) Formats the elevation status string for display in the toolbar.voidlatLonToLocal(Point pp, Point2D.Double ll) Converts geographic lon/lat in radians to screen-space coordinates.voidlocalToLatLon(Point pp, Point2D.Double ll) Converts a screen-space point to geographic lon/lat in radians.voidRecenters the active projection on the geographic location beneath a screen-space point.voidupdateStatusText(Point pp, Point2D.Double wp) Update the toolbar status text with the current mouse location.voidConverts projection world coordinates to geographic lon/lat.voidzoomLatLon(double minLat, double maxLat, double minLon, double maxLon) Zooms to a geographic bounding box expressed in decimal degrees.Methods inherited from class edu.cnu.mdi.container.BaseContainer
addLayer, anySelectedItems, approximateZoomFactor, clipBounds, deleteSelectedItems, getAfterDraw, getAllLayers, getAllLayersForHitTesting, getAnnotationLayer, getBeforeDraw, getComponent, getConnectionLayer, getDefaultLayer, getEnclosedItems, getFeedbackControl, getFeedbackPane, getHoverWindow, getImage, getItemAtPoint, getItemsAtPoint, getLayerByName, getLocation, getSelectedItems, getToolBar, getView, getWorldSystem, hoverDown, hoverUp, isProtectedLayer, itemChanged, localToWorld, localToWorld, localToWorld, onFilesDropped, paintComponent, pan, prepareForExit, prepareToZoom, refresh, resetWorldSystem, restoreDefaultWorld, rubberBanded, scale, selectAllItems, setAffineTransforms, setAfterDraw, setBeforeDraw, setDirty, setFeedbackPane, setToolBar, setToolBarState, setView, setWorldSystem, shareModel, undoLastZoom, worldToLocal, worldToLocal, worldToLocal, worldToLocal, zoomMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUIMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
MapContainer
Creates a map container with the given initial world coordinate system.- Parameters:
worldSystem- the initial world coordinate rectangle
-
-
Method Details
-
zoomLatLon
public void zoomLatLon(double minLat, double maxLat, double minLon, double maxLon) Zooms to a geographic bounding box expressed in decimal degrees.The corner coordinates are projected with the active map projection and used to replace the container's world-coordinate bounds.
- Parameters:
minLat- minimum latitude in degreesmaxLat- maximum latitude in degreesminLon- minimum longitude in degreesmaxLon- maximum longitude in degrees
-
recenter
Recenters the active projection on the geographic location beneath a screen-space point.Clicks that cannot be converted to finite geographic coordinates, or projections that do not support recentering, are ignored.
- Specified by:
recenterin interfaceIContainer- Overrides:
recenterin classBaseContainer- Parameters:
pp- point in container coordinates; may benull
-
localToLatLon
Converts a screen-space point to geographic lon/lat in radians.- Parameters:
pp- screen-space pointll- A geographic point is represented as aPoint2D.Doublewherex = λ(longitude) andy = φ(latitude).
-
latLonToLocal
Converts geographic lon/lat in radians to screen-space coordinates.- Parameters:
pp- output screen-space pointll- A geographic point is represented as aPoint2D.Doublewherex = λ(longitude) andy = φ(latitude) in radians.
-
worldToLatLon
Converts projection world coordinates to geographic lon/lat.- Parameters:
ll- A geographic point is represented as aPoint2D.Doublewherex = λ(longitude) andy = φ(latitude).wp- input world point
-
updateStatusText
Update the toolbar status text with the current mouse location.- Specified by:
updateStatusTextin interfaceIContainer- Overrides:
updateStatusTextin classBaseContainer- Parameters:
pp- the current mouse location in local (screen) coordinateswp- the current mouse location in world coordinates
-
formatElevationStatus
Formats the elevation status string for display in the toolbar.- Parameters:
elevationMeters- the elevation in metersonLand-trueif the point is on land,falseif over water- Returns:
- a formatted string representing the elevation or depth
-
feedbackTrigger
Convenience method to update the location string in the toolbar.Updates the toolbar status text (if present) and feedback control (if present) with the current mouse location in both local and world coordinates.
- Specified by:
feedbackTriggerin interfaceIContainer- Overrides:
feedbackTriggerin classBaseContainer- Parameters:
mouseEvent- the causal event.dragging-trueif we are dragging
-
createToolHandler
Factory method that creates theBaseToolHandlerappropriate for this container.The default implementation returns a plain
BaseToolHandler. Subclasses that require specialised tool behaviour (e.g.MapContainer) should override this method to return their own handler rather than relying on aninstanceofcheck inBaseContainer.setToolBar(edu.cnu.mdi.graphics.toolbar.AToolBar).- Overrides:
createToolHandlerin classBaseContainer- Returns:
- a new tool handler bound to this container; never
null
-