|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
com.bbn.openmap.MapBean
com.bbn.openmap.BufferedMapBean
public class BufferedMapBean
The BufferedMapBean extends the MapBean by adding (you guessed it) buffering.
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.
| Nested Class Summary | |
|---|---|
protected class |
BufferedMapBean.PanHelper
|
| Nested classes/interfaces inherited from class com.bbn.openmap.MapBean |
|---|
MapBean.RotationHelper |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected boolean |
bufferDirty
|
protected java.awt.Image |
drawingBuffer
|
BufferedMapBean.PanHelper |
panningTransform
|
| Fields inherited from class com.bbn.openmap.MapBean |
|---|
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 |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, 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 |
|---|
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 | |
|---|---|
BufferedMapBean()
|
|
BufferedMapBean(boolean useThreadedNotification)
|
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class javax.swing.JComponent |
|---|
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, 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 |
| Methods inherited from class java.awt.Container |
|---|
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, transferFocusBackward, 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, 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, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean bufferDirty
protected java.awt.Image drawingBuffer
public BufferedMapBean.PanHelper panningTransform
| Constructor Detail |
|---|
public BufferedMapBean()
public BufferedMapBean(boolean useThreadedNotification)
| Method Detail |
|---|
public void setLayers(LayerEvent evt)
setLayers in interface LayerListenersetLayers in class MapBeanevt - LayerEventpublic void componentResized(java.awt.event.ComponentEvent e)
componentResized in interface java.awt.event.ComponentListenercomponentResized in class MapBeane - 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 MapBeang - Graphics
public void paintChildren(java.awt.Graphics g,
java.awt.Rectangle clip)
paintChildren in class MapBeanpublic boolean isBuffered()
isBuffered in class MapBeanpublic void setBufferDirty(boolean value)
paintChildren(), we will call paint() on all
Layer components.
setBufferDirty in class MapBeanvalue - booleanpublic boolean isBufferDirty()
isBufferDirty in class MapBeanpublic void dispose()
MapBean
dispose in class MapBeanpublic java.awt.geom.AffineTransform getPanningTransform()
public void setPanningTransform(java.awt.geom.AffineTransform transform)
transform -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||