com.vividsolutions.jump.workbench.ui
Class LayerViewPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.vividsolutions.jump.workbench.ui.LayerViewPanel
All Implemented Interfaces:
LayerListener, LayerManagerProxy, SelectionManagerProxy, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class LayerViewPanel
extends javax.swing.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.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
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
LayerViewPanel(LayerManager layerManager, LayerViewPanelContext context)
           
 
Method Summary
 void addListener(LayerViewPanelListener listener)
           
 void categoryChanged(CategoryEvent e)
           
static java.util.List components(com.vividsolutions.jts.geom.Geometry g)
           
 java.awt.Image createBlankPanelImage()
          Returns an image with the dimensions of this panel.
 void dispose()
           
 void erase(java.awt.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).
 java.util.Collection featuresWithVertex(java.awt.geom.Point2D viewPoint, double viewTolerance, java.util.Collection features)
           
 void fill(java.awt.Graphics2D g, java.awt.Color color)
           
 void fireSelectionChanged()
           
 void flash(com.vividsolutions.jts.geom.GeometryCollection geometryCollection)
           
 void flash(java.awt.Shape shape, java.awt.Color color, java.awt.Stroke stroke, int millisecondDelay)
           
 java.lang.String format(double d)
           
 Blackboard getBlackboard()
           
 LayerViewPanelContext getContext()
           
 CursorTool getCurrentCursorTool()
           
 com.vividsolutions.jts.geom.Geometry getFence()
           
 Java2DConverter getJava2DConverter()
           
 java.awt.Point getLastClickedPoint()
          Note: the popup menu is shown only if the user right-clicks the panel.
 LayerManager getLayerManager()
           
 RenderingManager getRenderingManager()
           
 SelectionManager getSelectionManager()
           
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
           
 ToolTipWriter getToolTipWriter()
           
 Viewport getViewport()
           
static boolean intersects(com.vividsolutions.jts.geom.Geometry a, com.vividsolutions.jts.geom.Geometry b)
          Workaround for the fact that GeometryCollection#intersects is not currently implemented.
 void layerChanged(LayerEvent e)
           
 void paintComponent(java.awt.Graphics g)
           
static javax.swing.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()
           
 java.util.Map visibleLayerToFeaturesInFenceMap()
          The Fence layer will be excluded.
 java.util.Map visibleLayerToFeaturesInFenceMap(com.vividsolutions.jts.geom.Geometry fence)
          The Fence layer will be included.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayerViewPanel

public LayerViewPanel(LayerManager layerManager,
                      LayerViewPanelContext context)
Method Detail

getToolTipWriter

public ToolTipWriter getToolTipWriter()

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
Overrides:
getToolTipText in class javax.swing.JComponent

components

public static java.util.List components(com.vividsolutions.jts.geom.Geometry g)

intersects

public static boolean intersects(com.vividsolutions.jts.geom.Geometry a,
                                 com.vividsolutions.jts.geom.Geometry b)
Workaround for the fact that GeometryCollection#intersects is not currently implemented.


visibleLayerToFeaturesInFenceMap

public java.util.Map visibleLayerToFeaturesInFenceMap()
The Fence layer will be excluded.


visibleLayerToFeaturesInFenceMap

public java.util.Map visibleLayerToFeaturesInFenceMap(com.vividsolutions.jts.geom.Geometry fence)
The Fence layer will be included.


popupMenu

public static javax.swing.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 java.awt.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 com.vividsolutions.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 interface LayerManagerProxy

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 interface LayerListener

categoryChanged

public void categoryChanged(CategoryEvent e)
Specified by:
categoryChanged in interface LayerListener

layerChanged

public void layerChanged(LayerEvent e)
Specified by:
layerChanged in interface LayerListener

createBlankPanelImage

public java.awt.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.


repaint

public void repaint()
Overrides:
repaint in class java.awt.Component

superRepaint

public void superRepaint()

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

erase

public void erase(java.awt.Graphics2D g)

fill

public void fill(java.awt.Graphics2D g,
                 java.awt.Color color)

getContext

public LayerViewPanelContext getContext()

addListener

public void addListener(LayerViewPanelListener listener)

removeListener

public void removeListener(LayerViewPanelListener listener)

format

public java.lang.String format(double d)
Returns:
d rounded off to the distance represented by one pixel

fireSelectionChanged

public void fireSelectionChanged()

getRenderingManager

public RenderingManager getRenderingManager()

featuresWithVertex

public java.util.Collection featuresWithVertex(java.awt.geom.Point2D viewPoint,
                                               double viewTolerance,
                                               java.util.Collection features)
                                        throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException

dispose

public void dispose()

flash

public void flash(java.awt.Shape shape,
                  java.awt.Color color,
                  java.awt.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 interface SelectionManagerProxy

getBlackboard

public Blackboard getBlackboard()

flash

public void flash(com.vividsolutions.jts.geom.GeometryCollection geometryCollection)
           throws java.awt.geom.NoninvertibleTransformException
Throws:
java.awt.geom.NoninvertibleTransformException