public class BufferedMapBean extends MapBean
Specifically, the layers are stored in a java.awt.Image so that the frequent painting done by Swing on lightweight components will not cause the layers to do unnecessary work rerendering themselves each time.
Changing the default clipping area may cause some Layers to not be drawn completely, depending on what the clipping area is set to and when the layer is trying to get itself painted. When manually adjusting clipping area, make sure that when restricted clipping is over that a full repaint occurs if there is a chance that another layer may be trying to paint itself.
Modifier and Type | Class and Description |
---|---|
protected class |
BufferedMapBean.PanHelper |
MapBean.RotationHelper
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected boolean |
bufferDirty |
protected java.awt.Image |
drawingBuffer |
BufferedMapBean.PanHelper |
panningTransform |
addedLayers, background, BackgroundProperty, currentLayers, CursorProperty, DEFAULT_BACKGROUND_COLOR, DEFAULT_CENTER_LAT, DEFAULT_CENTER_LON, DEFAULT_HEIGHT, DEFAULT_SCALE, DEFAULT_WIDTH, doContainerChange, layerRemovalDelayed, LayersProperty, logger, minHeight, minWidth, painters, projection, projectionFactory, ProjectionProperty, projectionSupport, ProjectionVetoedProperty, removedLayers, repaintPolicy, rotHelper, suppressCopyright, title, version
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
BufferedMapBean() |
BufferedMapBean(boolean useThreadedNotification) |
Modifier and Type | Method and Description |
---|---|
void |
componentResized(java.awt.event.ComponentEvent e)
Invoked when component has been resized.
|
void |
dispose()
Call when getting rid of the MapBean, it releases pointers to all
listeners and kills the ProjectionSupport thread.
|
java.awt.geom.AffineTransform |
getPanningTransform() |
boolean |
isBufferDirty()
Checks whether the image buffer should be repainted.
|
boolean |
isBuffered()
Interface-like method to query if the MapBean is buffered, so you can
control behavior better.
|
void |
paintChildren(java.awt.Graphics g)
Paint the child components of this component.
|
void |
paintChildren(java.awt.Graphics g,
java.awt.Rectangle clip)
Same as paintChildren, but allows you to set a clipping area to paint.
|
void |
setBufferDirty(boolean value)
Marks the image buffer as dirty if value is true.
|
void |
setLayers(LayerEvent evt)
Set the layers of the MapBean.
|
void |
setPanningTransform(java.awt.geom.AffineTransform transform)
Set a panning transform on the buffer for rendering in a different place,
quickly.
|
addImpl, addPaintListener, addProjectionListener, addPropertyChangeListener, center, changeLayers, componentAdded, componentHidden, componentMoved, componentRemoved, componentShown, debugmsg, drawProjectionBackground, fireProjectionChanged, getBackground, getBckgrnd, getCenter, getCoordinates, getCoordinates, getCopyrightMessage, getDoContainerChange, getGraphics, getGraphics, getInsets, getMapBeanRepaintPolicy, getMinimumSize, getNonRotatedLocation, getNonRotatedLocation, getProjection, getProjectionFactory, getRotation, getScale, hideLayerPalettes, inverse, isLayerRemovalDelayed, paint, paintBorder, paintChildrenWithBorder, pan, projectionChanged, purgeAndNotifyRemovedLayers, removePaintListener, removeProjectionListener, repaint, setBackground, setBackgroundColor, setBckgrnd, setCenter, setCenter, setCenter, setCursor, setDoContainerChange, setLayerRemovalDelayed, setLayout, setMapBeanRepaintPolicy, setMinimumSize, setProjection, setProjectionFactory, setRotation, setScale, showLayerPalettes, toString, zoom
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintComponent, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
add, add, add, add, add, addContainerListener, 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, transferFocusDownCycle, validate, validateTree
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, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
protected boolean bufferDirty
protected java.awt.Image drawingBuffer
public BufferedMapBean.PanHelper panningTransform
public BufferedMapBean()
public BufferedMapBean(boolean useThreadedNotification)
public void setLayers(LayerEvent evt)
setLayers
in interface LayerListener
setLayers
in class MapBean
evt
- LayerEventpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized
in interface java.awt.event.ComponentListener
componentResized
in class MapBean
e
- ComponentEventpublic void paintChildren(java.awt.Graphics g)
WE STRONGLY RECOMMEND THAT YOU DO NOT OVERRIDE THIS METHOD The map layers are buffered in an Image which is drawn to the screen. The buffer is refreshed after repaint() is called on a layer.
In our view, paint() is called on the MapBean excessively, such as when tool tips are displayed and removed on the LayerPanel, or on when menu items are highlighted. This method should greatly reduce the number of times Layers are rendered.
paintChildren
in class MapBean
g
- Graphicspublic void paintChildren(java.awt.Graphics g, java.awt.Rectangle clip)
paintChildren
in class MapBean
public boolean isBuffered()
isBuffered
in class MapBean
public void setBufferDirty(boolean value)
paintChildren()
, we will call paint()
on all
Layer components.setBufferDirty
in class MapBean
value
- booleanpublic boolean isBufferDirty()
isBufferDirty
in class MapBean
public void dispose()
MapBean
public java.awt.geom.AffineTransform getPanningTransform()
public void setPanningTransform(java.awt.geom.AffineTransform transform)
transform
- Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details