Class LayerViewPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.locationtech.jts.jump.workbench.ui.LayerViewPanel
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,LayerListener
,LayerManagerProxy
,SelectionManagerProxy
public class LayerViewPanel extends JPanel implements LayerListener, LayerManagerProxy, SelectionManagerProxy
Be sure to call #dispose() when the LayerViewPanel is no longer needed.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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
-
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
Constructors Constructor Description LayerViewPanel(LayerManager layerManager, LayerViewPanelContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(LayerViewPanelListener listener)
void
categoryChanged(CategoryEvent e)
static List
components(org.locationtech.jts.geom.Geometry g)
Image
createBlankPanelImage()
Returns an image with the dimensions of this panel.void
dispose()
void
erase(Graphics2D g)
void
featuresChanged(FeatureEvent e)
Fired when a feature is added to or removed from a layer, or when a feature is edited (using an EditTransaction).Collection
featuresWithVertex(Point2D viewPoint, double viewTolerance, Collection features)
void
fill(Graphics2D g, Color color)
void
fireSelectionChanged()
void
flash(Shape shape, Color color, Stroke stroke, int millisecondDelay)
void
flash(org.locationtech.jts.geom.GeometryCollection geometryCollection)
String
format(double d)
protected String
format(double d, double pixelWidthInModelUnits)
Blackboard
getBlackboard()
LayerViewPanelContext
getContext()
CursorTool
getCurrentCursorTool()
org.locationtech.jts.geom.Geometry
getFence()
Java2DConverter
getJava2DConverter()
Point
getLastClickedPoint()
Note: the popup menu is shown only if the user right-clicks the panel.LayerManager
getLayerManager()
RenderingManager
getRenderingManager()
SelectionManager
getSelectionManager()
String
getToolTipText(MouseEvent event)
ToolTipWriter
getToolTipWriter()
Viewport
getViewport()
static boolean
intersects(org.locationtech.jts.geom.Geometry a, org.locationtech.jts.geom.Geometry b)
Workaround for the fact that GeometryCollection#intersects is not currently implemented.void
layerChanged(LayerEvent e)
void
paintComponent(Graphics g)
static JPopupMenu
popupMenu()
void
removeListener(LayerViewPanelListener listener)
void
repaint()
void
setCurrentCursorTool(CursorTool currentCursorTool)
void
setViewportInitialized(boolean viewportInitialized)
When a layer is added, if this flag is false, the viewport will be zoomed to the extent of the layer.void
superRepaint()
Map
visibleLayerToFeaturesInFenceMap()
The Fence layer will be excluded.Map
visibleLayerToFeaturesInFenceMap(org.locationtech.jts.geom.Geometry fence)
The Fence layer will be included.-
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, 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, 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 Detail
-
LayerViewPanel
public LayerViewPanel(LayerManager layerManager, LayerViewPanelContext context)
-
-
Method Detail
-
getToolTipWriter
public ToolTipWriter getToolTipWriter()
-
getToolTipText
public String getToolTipText(MouseEvent event)
- Overrides:
getToolTipText
in classJComponent
-
components
public static List components(org.locationtech.jts.geom.Geometry g)
-
intersects
public static boolean intersects(org.locationtech.jts.geom.Geometry a, org.locationtech.jts.geom.Geometry b)
Workaround for the fact that GeometryCollection#intersects is not currently implemented.
-
visibleLayerToFeaturesInFenceMap
public Map visibleLayerToFeaturesInFenceMap()
The Fence layer will be excluded.
-
visibleLayerToFeaturesInFenceMap
public Map visibleLayerToFeaturesInFenceMap(org.locationtech.jts.geom.Geometry fence)
The Fence layer will be included.
-
popupMenu
public static JPopupMenu popupMenu()
-
setCurrentCursorTool
public void setCurrentCursorTool(CursorTool currentCursorTool)
-
setViewportInitialized
public void setViewportInitialized(boolean viewportInitialized)
When a layer is added, if this flag is false, the viewport will be zoomed to the extent of the layer.
-
getCurrentCursorTool
public CursorTool getCurrentCursorTool()
-
getLastClickedPoint
public Point getLastClickedPoint()
Note: the popup menu is shown only if the user right-clicks the panel. Thus, popup-menu event handlers don't need to check whether the return value is null.
-
getViewport
public Viewport getViewport()
-
getJava2DConverter
public Java2DConverter getJava2DConverter()
-
getFence
public org.locationtech.jts.geom.Geometry getFence()
- Returns:
- the fence in model-coordinates, or null if there is no fence
-
getLayerManager
public LayerManager getLayerManager()
- Specified by:
getLayerManager
in interfaceLayerManagerProxy
-
featuresChanged
public void featuresChanged(FeatureEvent e)
Description copied from interface:LayerListener
Fired when a feature is added to or removed from a layer, or when a feature is edited (using an EditTransaction). Warning: this event is fired often.- Specified by:
featuresChanged
in interfaceLayerListener
-
categoryChanged
public void categoryChanged(CategoryEvent e)
- Specified by:
categoryChanged
in interfaceLayerListener
-
layerChanged
public void layerChanged(LayerEvent e)
- Specified by:
layerChanged
in interfaceLayerListener
-
createBlankPanelImage
public Image createBlankPanelImage()
Returns an image with the dimensions of this panel. Note that the image has an alpha component, and thus is not suitable for creating JPEGs -- they will look pinkish.
-
superRepaint
public void superRepaint()
-
paintComponent
public void paintComponent(Graphics g)
- Overrides:
paintComponent
in classJComponent
-
erase
public void erase(Graphics2D g)
-
fill
public void fill(Graphics2D g, Color color)
-
getContext
public LayerViewPanelContext getContext()
-
addListener
public void addListener(LayerViewPanelListener listener)
-
removeListener
public void removeListener(LayerViewPanelListener listener)
-
format
public String format(double d)
- Returns:
- d rounded off to the distance represented by one pixel
-
format
protected String format(double d, double pixelWidthInModelUnits)
-
fireSelectionChanged
public void fireSelectionChanged()
-
getRenderingManager
public RenderingManager getRenderingManager()
-
featuresWithVertex
public Collection featuresWithVertex(Point2D viewPoint, double viewTolerance, Collection features) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
dispose
public void dispose()
-
flash
public void flash(Shape shape, Color color, Stroke stroke, int millisecondDelay)
- Parameters:
millisecondDelay
- the GUI will be unresponsive for this length of time, so keep it short!
-
getSelectionManager
public SelectionManager getSelectionManager()
- Specified by:
getSelectionManager
in interfaceSelectionManagerProxy
-
getBlackboard
public Blackboard getBlackboard()
-
flash
public void flash(org.locationtech.jts.geom.GeometryCollection geometryCollection) throws NoninvertibleTransformException
- Throws:
NoninvertibleTransformException
-
-