com.bbn.openmap.layer.policy
Class PanningImageRenderPolicy

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.PanningImageRenderPolicy
All Implemented Interfaces:
RenderPolicy, LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener

public class PanningImageRenderPolicy
extends RenderingHintsRenderPolicy

The PanningImageRenderPolicy renders all OMGraphics into a buffering image, and responds to projection changes by immediately rendering a translated version of the image at a new projection location before calling prepare() on the layer to get the OMGraphics for the new projection and untranslated image. When the new image is ready, it will be painted. Using this policy on background layers eliminates the flashing effect seen when panning or zooming a map when a faster-responding layer is on top.

NOTE: The need for this RenderPolicy is superseded by using the PanningMouseMode on the MapBean instead.

You can set this object on an OMGraphicHandlerLayer through the API, or set it in the properties:

 layer.renderPolicy=rp
 layer.rp.class=com.bbn.openmap.layer.policy.PanningImageRenderPolicy
 


Field Summary
protected  java.awt.image.BufferedImage buffer
           
protected  java.awt.geom.Point2D offset
           
protected  java.lang.Class<? extends Proj> oldProjType
           
protected  float oldScale
           
protected  java.awt.geom.Point2D oldUL
           
 
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
PanningImageRenderPolicy()
          Set the layer at some point before use.
PanningImageRenderPolicy(OMGraphicHandlerLayer layer)
          Don't pass in a null layer.
 
Method Summary
protected  java.awt.image.BufferedImage createAndPaintImageBuffer(OMGraphicList list)
           
protected  java.awt.image.BufferedImage 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.
protected  void setBuffer(java.awt.image.BufferedImage 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, prePrepare, 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 java.awt.image.BufferedImage buffer

offset

protected java.awt.geom.Point2D offset

oldUL

protected java.awt.geom.Point2D oldUL

oldScale

protected float oldScale

oldProjType

protected java.lang.Class<? extends Proj> oldProjType
Constructor Detail

PanningImageRenderPolicy

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


PanningImageRenderPolicy

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

Method Detail

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 java.awt.image.BufferedImage getBuffer()
Get the BufferedImage for the layer.


setBuffer

protected void setBuffer(java.awt.image.BufferedImage bi)
Set the BufferedImage for the layer.


createAndPaintImageBuffer

protected java.awt.image.BufferedImage createAndPaintImageBuffer(OMGraphicList list)


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