com.bbn.openmap.layer.policy
Class RenderingHintsRenderPolicy

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

public class RenderingHintsRenderPolicy
extends StandardRenderPolicy

The RenderingHintsRenderPolicy is a StandardRenderPolicy that lets you set RenderingHints on the java.awt.Graphics object before the layer is painted, and then simply paints the current graphic list. No conditions or deviations are considered. This class can be set with properties.

The properties have to look like:

 
 
  prefix.renderingHints=RENDERINGHINTS_KEY1 RENDERINGHINTS_KEY2
  prefix.RENDERINGHINTS_KEY1=RENDERINGHINTS_VALUE1
  prefix.RENDERINGHINTS_KEY2=RENDERINGHINTS_VALUE2
 
 
 
For example, for a GraticuleLayer in the properties file with a 'graticule' prefix:
 
 
  graticule.renderPolicy=textAliasing
  graticule.textAliasing.class=com.bbn.openmap.layer.policy.RenderingHintsRenderPolicy
  graticule.textAliasing.renderingHints=KEY_TEXT_ANTIALIASING
  graticule.textAliasing.KEY_TEXT_ANTIALIASING=VALUE_TEXT_ANTIALIAS_ON
 
 
 
The HintsMapBeanRepaintPolicy uses a RenderingHintsRenderPolicy with properties that look like these, where 'repaintPolicy' is the prefix for the RenderingHintsRenderPolicy:
 
 
  repaintPolicy.class=com.bbn.openmap.HintsMapBeanRepaintPolicy
  repaintPolicy.renderingHints=KEY_ANTIALIASING
  repaintPolicy.KEY_ANTIALIASING=VALUE_ANTIALIAS_ON
  repaintPolicy.KEY_RENDERING=VALUE_RENDER_SPEED
 
 
 
See the java.awt.RenderingHints javadocs for the key-value pairs that can be used.


Field Summary
protected  java.awt.RenderingHints renderingHints
           
static java.lang.String 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
RenderingHintsRenderPolicy()
          The layer needs to be set at some point before use.
RenderingHintsRenderPolicy(OMGraphicHandlerLayer layer)
           
 
Method Summary
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer.
 java.awt.RenderingHints getRenderingHints()
          Get the RenderingHints Map that should be used on the MapBean.
 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.
 void put(java.lang.Object key, java.lang.Object value)
          Set a RenderingHint on this object.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setRenderingHints(java.awt.Graphics g)
           
 void setRenderingHints(java.awt.RenderingHints rh)
          Set the RenderingHints Map that should be used on the MapBean.
 
Methods inherited from class com.bbn.openmap.layer.policy.StandardRenderPolicy
getComposite, getLayer, prepare, 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

RenderingHintsProperty

public static final java.lang.String RenderingHintsProperty
See Also:
Constant Field Values

renderingHints

protected java.awt.RenderingHints renderingHints
Constructor Detail

RenderingHintsRenderPolicy

public RenderingHintsRenderPolicy()
The layer needs to be set at some point before use.


RenderingHintsRenderPolicy

public RenderingHintsRenderPolicy(OMGraphicHandlerLayer layer)
Method Detail

setRenderingHints

public void setRenderingHints(java.awt.RenderingHints rh)
Set the RenderingHints Map that should be used on the MapBean. If null, no modifications will be set on the MapBean's Graphics object.


getRenderingHints

public java.awt.RenderingHints getRenderingHints()
Get the RenderingHints Map that should be used on the MapBean. May be null (default).


put

public void put(java.lang.Object key,
                java.lang.Object value)
Set a RenderingHint on this object.

Parameters:
key - RenderingHint KEY
value - RenderingHint VALUE

paint

public 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.

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

setRenderingHints

public void setRenderingHints(java.awt.Graphics g)

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponent
Parameters:
prefix - the token to prefix the property names
props - the Properties object

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMComponent
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMComponent
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties props)
Description copied from class: OMComponent
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). For Layer, this method should at least return the 'prettyName' property.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMComponent
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.


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