com.bbn.openmap.layer.policy
Class BufferedImageRenderPolicy

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.layer.policy.StandardRenderPolicy
              extended by com.bbn.openmap.layer.policy.RenderingHintsRenderPolicy
                  extended by com.bbn.openmap.layer.policy.BufferedImageRenderPolicy
All Implemented Interfaces:
RenderPolicy, LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener

public class BufferedImageRenderPolicy
extends RenderingHintsRenderPolicy

The BufferedImageRenderPolicy is a RenderPolicy that creates and uses an image buffer based on the painting times for the layer. If the time to paint exceeds the bufferTiggerDelay, an image buffer for the layer is used for paints as long as the projection doesn't change. A new buffer is used for a projection change because we need the image buffer to be transparent for parts of the map that are not used by the layer.


Nested Class Summary
protected  class BufferedImageRenderPolicy.ImageBuffer
           
 
Field Summary
protected  BufferedImageRenderPolicy.ImageBuffer imageBuffer
           
 
Fields inherited from class com.bbn.openmap.layer.policy.RenderingHintsRenderPolicy
renderingHints, RenderingHintsProperty
 
Fields inherited from class com.bbn.openmap.layer.policy.StandardRenderPolicy
composite, layer, logger
 
Fields inherited from class com.bbn.openmap.OMComponent
i18n, propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
BufferedImageRenderPolicy()
          Set the layer at some point before use.
BufferedImageRenderPolicy(OMGraphicHandlerLayer layer)
          Don't pass in a null layer.
 
Method Summary
protected  BufferedImageRenderPolicy.ImageBuffer getImageBuffer()
           
 void paint(java.awt.Graphics g)
          If you are going to change the Graphics object in this method, you should make a copy of it first using the Graphics.create() method so the changes won't affect other layers.
 OMGraphicList prepare()
          Called when an OMGraphicHandlerLayer should begin preparing OMGraphics for the map.
 void prePrepare(Projection newProj)
          Called from the OMGraphicHandlerLayer's projectionChanged() method.
protected  void setImageBuffer(BufferedImageRenderPolicy.ImageBuffer iBuffer)
          Set the ImageBuffer, for subclasses to modify it's particular behavior
 
Methods inherited from class com.bbn.openmap.layer.policy.RenderingHintsRenderPolicy
getProperties, getPropertyInfo, getRenderingHints, put, setProperties, setRenderingHints, setRenderingHints
 
Methods inherited from class com.bbn.openmap.layer.policy.StandardRenderPolicy
getComposite, getLayer, setComposite, setCompositeOnGraphics, setLayer
 
Methods inherited from class com.bbn.openmap.OMComponent
getPropertyPrefix, setProperties, setPropertyPrefix
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imageBuffer

protected BufferedImageRenderPolicy.ImageBuffer imageBuffer
Constructor Detail

BufferedImageRenderPolicy

public BufferedImageRenderPolicy()
Set the layer at some point before use.


BufferedImageRenderPolicy

public BufferedImageRenderPolicy(OMGraphicHandlerLayer layer)
Don't pass in a null layer.

Method Detail

setImageBuffer

protected void setImageBuffer(BufferedImageRenderPolicy.ImageBuffer iBuffer)
Set the ImageBuffer, for subclasses to modify it's particular behavior


getImageBuffer

protected BufferedImageRenderPolicy.ImageBuffer getImageBuffer()
Returns:
the imageBuffer

prePrepare

public void prePrepare(Projection newProj)
Called from the OMGraphicHandlerLayer's projectionChanged() method. This method updates the current image buffer so it can be re-projected for the current projection before the layer worker goes off to do more work. In case of rapid projection changes, the layer should be able to display the current buffer in the right place, at least. Ghah! Don't do a lot of work in this thread.

Specified by:
prePrepare in interface RenderPolicy
Overrides:
prePrepare in class StandardRenderPolicy
Parameters:
newProj - the newest projection known.

prepare

public OMGraphicList prepare()
Description copied from interface: RenderPolicy
Called when an OMGraphicHandlerLayer should begin preparing OMGraphics for the map. This is a hook into the list to help RenderPolicy make decisions or set up the list for faster rendering.

Specified by:
prepare in interface RenderPolicy
Overrides:
prepare in class StandardRenderPolicy

paint

public void paint(java.awt.Graphics g)
Description copied from class: RenderingHintsRenderPolicy
If you are going to change the Graphics object in this method, you should make a copy of it first using the Graphics.create() method so the changes won't affect other layers.

Specified by:
paint in interface RenderPolicy
Overrides:
paint in class RenderingHintsRenderPolicy


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details