Class EarthDataViewPanel
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,DelayedRenderingComponent
,TransformableImageComponent
The EarthDataViewPanel
class displays an onscreen
version of an EarthDataView
object. The panel has
enhanced functionality over the RenderablePanel
class
with resizing behaviour and mouse events. The panel also supplies
a tracking bar that may be used to display the mouse cursor
position within the panel.
Changes to the view should be performed using panel methods
wherever possible rather than the corresponding view methods, since
a rendering loop may be active in the panel. When the view must be
modified directly, users should call the panel
stopRendering()
method before making the change.
The panel signals a change in rendering status by firing a
RENDERING_PROPERTY
change event with value true
when rendering is in progress or false if not. This can help
with progress monitors.
- Since:
- 3.1.2
- Author:
- Peter Hollemans
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
class
The track bar class supplies mouse position tracking for an Earth data view panel.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The rendering status property for property change events.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
ConstructorDescriptionCreates a new earth data view panel using the specified view. -
Method Summary
Modifier and TypeMethodDescriptionvoid
fitReset()
Resets the view panel so that one dimension of the data grid fits, centered within the panel.Gets the affine transform that translates view panel coordinates to data location coordinates.Gets the default cursor.Gets the image affine transform in the view.getView()
Gets the earth data view.boolean
Returns true if the view panel is being rendered, or false if not.void
magnify
(double factor) Magnifies the view around the current center location.void
Magnifies the specified rectangle to occupy the entire view.void
void
reset()
Resets the view panel so that the entire data grid fits, centered within the panel.void
void
Sets the view center to a new data location.void
setDefaultCursor
(Cursor cursor) Sets the default cursor.void
setImageAffine
(AffineTransform affine) Sets the image affine transform in the view.void
setStaticView
(boolean flag) Sets the static view mode flag.void
setView
(EarthDataView view) Sets the earth data view.void
Stops the current rendering thread if it is active.Translates the specified panel-relative point to a view-relative point.void
Sets the magnification of the view around the current center location so that the data:screen pixel magnification is 1:1.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, 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
Methods 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, validateTree
Methods 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, 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, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
RENDERING_PROPERTY
The rendering status property for property change events.- See Also:
-
-
Constructor Details
-
EarthDataViewPanel
Creates a new earth data view panel using the specified view.- Parameters:
view
- the earth data view to display.
-
-
Method Details
-
isRendering
public boolean isRendering()Returns true if the view panel is being rendered, or false if not.- Specified by:
isRendering
in interfaceDelayedRenderingComponent
- Returns:
- true if the component is in a rendering state, or false if not.
-
stopRendering
public void stopRendering()Stops the current rendering thread if it is active. If there is no active rendering taking place, no operation is performed.- Specified by:
stopRendering
in interfaceDelayedRenderingComponent
-
getView
Gets the earth data view.- Returns:
- the data view.
-
setView
Sets the earth data view.- Parameters:
view
- the new data view.
-
unityMagnify
public void unityMagnify()Sets the magnification of the view around the current center location so that the data:screen pixel magnification is 1:1. This method should be used rather than manipulating theEarthDataView()
object directly.- See Also:
-
magnify
public void magnify(double factor) Magnifies the view around the current center location. This method should be used for magnification of the view rather than calling theEarthDataView.magnify()
method directly on the view itself.- Parameters:
factor
- the factor by which to magnify. Factors greater than 1 increase the magnification and factors less than 1 decrease the magnification.- See Also:
-
magnify
Magnifies the specified rectangle to occupy the entire view. The center data location is changed to match the center of the specified rectangle. The scaling factor is changed so that the maximum dimension of the rectangle fits within the view dimensions. This method should be used for magnification of the view rather than calling theEarthDataView.magnify()
method directly on the view itself.- Parameters:
rect
- the magnification rectangle in panel-relative coordinates.- See Also:
-
setCenter
Sets the view center to a new data location. The image dimensions and image scaling factor are unaffected. This method should be used for recentering of the view rather than calling theEarthDataView.setCenter()
method directly on the view itself.- Parameters:
center
- the new center data location in panel-relative coordinates.- See Also:
-
setStaticView
public void setStaticView(boolean flag) Sets the static view mode flag. In this mode, any resizing of the panel window or calls to magnify, recenter, or reset the view panel keep the view image size the same. When off, these operations dyamically change the view size based on the size of the panel window. The "on" mode is more appropriate when the view panel is being used to display exactly the same width and height in pixels of data area every time the view panel is modified. The "off" mode is better for maximizing the use of the view panel window to show as much data as possible. By default, static view mode is off.- Parameters:
flag
- the static view flag, true for static view mode.
-
paintComponent
- Overrides:
paintComponent
in classJComponent
-
getDefaultCursor
Gets the default cursor.- Returns:
- the default cursor.
-
setDefaultCursor
Sets the default cursor.- Parameters:
cursor
- the new default cursor to use.
-
setBounds
-
fitReset
public void fitReset()Resets the view panel so that one dimension of the data grid fits, centered within the panel. This method should be used to maximize the use of the view area so that no data edges are visible.- Throws:
UnsupportedOperationException
- if the static view mode flag is on.- See Also:
-
reset
public void reset()Resets the view panel so that the entire data grid fits, centered within the panel. This method should be used for resetting the view rather than calling theEarthDataView.reset()
method directly on the view itself. -
getImageAffine
Gets the image affine transform in the view.- Specified by:
getImageAffine
in interfaceTransformableImageComponent
- Returns:
- the image affine transform or null for no transform.
- See Also:
-
setImageAffine
Sets the image affine transform in the view. This method should be used for modifying the view rather than calling theEarthDataView.setImageAffine()
method directly on the view itself.- Specified by:
setImageAffine
in interfaceTransformableImageComponent
- Parameters:
affine
- the image affine transform, or null for no transform.- See Also:
-
translate
Translates the specified panel-relative point to a view-relative point. Depending on the view dimensions, the view may be offset from (0,0) inside the panel.- Parameters:
point
- the point for translation.- Returns:
- the translated point.
-
getAffine
Gets the affine transform that translates view panel coordinates to data location coordinates.- Returns:
- the affine transform.
-
createTrackBar
- Since:
- 3.8.1
-