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.


Field Summary
protected  OMRaster buffer
           
protected  java.lang.String CURRENT_PROJECTION
           
 
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  OMRaster createAndPaintImageBuffer(OMGraphicList list, Projection proj)
           
protected  OMRaster getBuffer()
          Get the BufferedImage for the layer.
 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()
          Called from the OMGraphicHandlerLayer's doPrepare() method.
protected  void setBuffer(OMRaster bi)
          Set the BufferedImage for the layer.
 
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

buffer

protected OMRaster buffer

CURRENT_PROJECTION

protected java.lang.String CURRENT_PROJECTION
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

prePrepare

public void prePrepare()
Called from the OMGraphicHandlerLayer's doPrepare() 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.

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

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

getBuffer

protected OMRaster getBuffer()
Get the BufferedImage for the layer.


setBuffer

protected void setBuffer(OMRaster bi)
Set the BufferedImage for the layer.


createAndPaintImageBuffer

protected OMRaster createAndPaintImageBuffer(OMGraphicList list,
                                             Projection proj)


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