lt.monarch.chart.marker
Class SimpleCachableMarker

java.lang.Object
  extended by lt.monarch.chart.marker.AbstractMarker
      extended by lt.monarch.chart.marker.SimpleCachableMarker
All Implemented Interfaces:
java.io.Serializable, Marker, StyleEditorEntity, SymetricMarker, StylesheetListener
Direct Known Subclasses:
CrossMarker, DiamondMarker, DotMarker, SimpleCrossMarker, SquareMarker

public abstract class SimpleCachableMarker
extends AbstractMarker
implements SymetricMarker, StylesheetListener

Base class for simple markers that are able to use off screen image to cache their view for improved rendering performance.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
protected static class SimpleCachableMarker.AWTImageFactory
           
protected static class SimpleCachableMarker.BufferedImageFactory
           
protected static interface SimpleCachableMarker.ImageFactory
           
 
Field Summary
Modifier and Type Field and Description
protected  java.awt.Image cacheImage
          Offscreen image used for caching.
protected  boolean cachingEnabled
          Indicates whether offscreen image should be used for drawing a marker.
protected static SimpleCachableMarker.ImageFactory imageFactory
          Factory for offscreen cache image creation.
protected  double markerSize
          Marker dot size
 
Fields inherited from class lt.monarch.chart.marker.AbstractMarker
dirty, map, metaModel, paintStyle, projectedLocation, style
 
Constructor Summary
Constructor and Description
SimpleCachableMarker()
          Default marker constructor.
 
Method Summary
Modifier and Type Method and Description
 void dispose()
          Disposes object
 double getMarkerSize()
          Gets marker radius
 boolean isCachingEnabled()
          Returns true, if caching is used when drawing the marker.
protected  void resetCache()
          Resets the cached image.
 void setCachingEnabled(boolean enabled)
          Enables/disables a caching when drawing the marker.
By default caching is disabled.
 void setMarkerSize(double size)
          Sets size for this marker.
 void stylesheetChanged(Stylesheet stylesheet)
          Notifies that stylesheet structure has totally changed.
 void stylesheetKeyChanged(Stylesheet stylesheet, Key key)
          Notifies that stylesheet key has been added or removed.
 
Methods inherited from class lt.monarch.chart.marker.AbstractMarker
clearChartObjectsMap, draw, finalize, getChartObjectBounds, getMetaModel, getPaintStyle, getParent, getStyle, getTransparencyValue, isVisible, mapChartObject, prepare, reset, setChartObjectsMap, setEntity, setLocation, setMetaModel, setTextAlignment, setTransparencyValue, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface lt.monarch.chart.engine.Marker
clearChartObjectsMap, draw, draw, getBounds, getMetaModel, getPaintStyle, getTransparencyValue, isVisible, prepare, reset, setChartObjectsMap, setEntity, setLocation, setMetaModel, setTextAlignment, setTransparencyValue
 
Methods inherited from interface lt.monarch.chart.engine.StyleEditorEntity
getChartObjectBounds, getParent, getStyle
 

Field Detail

markerSize

protected double markerSize
Marker dot size


cachingEnabled

protected boolean cachingEnabled
Indicates whether offscreen image should be used for drawing a marker.


cacheImage

protected java.awt.Image cacheImage
Offscreen image used for caching.


imageFactory

protected static final SimpleCachableMarker.ImageFactory imageFactory
Factory for offscreen cache image creation.

Constructor Detail

SimpleCachableMarker

public SimpleCachableMarker()
Default marker constructor.

Method Detail

setCachingEnabled

public void setCachingEnabled(boolean enabled)
Enables/disables a caching when drawing the marker.
By default caching is disabled. Caching definitely should be used when drawing large numbers of markers.

Parameters:
enabled - true, if caching should be used.

isCachingEnabled

public boolean isCachingEnabled()
Returns true, if caching is used when drawing the marker.

Returns:
value showing if caching is enabled

stylesheetChanged

public void stylesheetChanged(Stylesheet stylesheet)
Description copied from interface: StylesheetListener
Notifies that stylesheet structure has totally changed.

Specified by:
stylesheetChanged in interface StylesheetListener
Parameters:
stylesheet - stylesheet, which has changed

stylesheetKeyChanged

public void stylesheetKeyChanged(Stylesheet stylesheet,
                                 Key key)
Description copied from interface: StylesheetListener
Notifies that stylesheet key has been added or removed.

Specified by:
stylesheetKeyChanged in interface StylesheetListener
Parameters:
stylesheet - stylesheet, which has changed
key - the key that has been added or removed

resetCache

protected void resetCache()
Resets the cached image. This method must be called when marker view is changed and therefore offscreen image must be repainted.


setMarkerSize

public void setMarkerSize(double size)
Description copied from interface: SymetricMarker
Sets size for this marker.

Specified by:
setMarkerSize in interface SymetricMarker
Parameters:
size - new marker size

getMarkerSize

public double getMarkerSize()
Description copied from interface: SymetricMarker
Gets marker radius

Specified by:
getMarkerSize in interface SymetricMarker
Returns:
marker radius

dispose

public void dispose()
Description copied from class: AbstractMarker
Disposes object

Specified by:
dispose in interface Marker
Overrides:
dispose in class AbstractMarker