lt.monarch.chart.engine
Class HotSpotMap

java.lang.Object
  extended by lt.monarch.chart.engine.HotSpotMap
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NullHotSpotMap, SimpleHotSpotMap

public abstract class HotSpotMap
extends java.lang.Object
implements java.io.Serializable

Manages a map of hot polygons and related chart entities. There is one HotSpotMap object per chart container. Every time, while chart is being rendered, every chart object may define hot areas in the map. Stored information can then be used by the actual HotSpotMap instance to show tool tips, define event listeners or HTML client maps in a fast and efficient way.

See Also:
Serialized Form

Constructor Summary
Constructor and Description
HotSpotMap()
           
 
Method Summary
Modifier and Type Method and Description
abstract  void clear()
          Removes all chart objects
abstract  void clearEntity(ChartEntity entity)
          Clears all hot spot polygons for the entity and it's all child entities.
protected  boolean contains(ChartEntity container, ChartEntity entity)
          Utility method, to check if one entity is contained in another entity.
 java.util.List<ChartEntity> findAllEntitiesAt(Point2D pt)
          Finds all mapped entities at the specified point.
 ChartEntity findEntityAt(Point2D pt)
          Finds a mapped entity at the specified point.
 Point2D getEntityPosition(ChartEntity entity)
          Returns the entity center point, mapped via the mapEntity method.
abstract  java.awt.Shape getEntityShape(ChartEntity chartEntity)
          Returns the entity shape according to the entity.
abstract  java.awt.Shape getEntityShape(Point2D pt)
          Returns the entity shape according to the point.
abstract  ChartEntity getObjectById(int id)
          Finds a chart object with specified id.
abstract  void mapEntity(ChartEntity entity, Point2D pt)
          Sets the center point for the entity area.
abstract  void mapEntity(ChartEntity entity, Rectangle2D rectangle)
          Maps the rectangle to the entity.
abstract  void mapEntity(ChartEntity entity, java.awt.Shape shape)
          Maps the polygon to the entity.
abstract  void mapEntity(ChartEntity entity, java.awt.Shape shape, int id)
          Maps the polygon to the entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HotSpotMap

public HotSpotMap()
Method Detail

clearEntity

public abstract void clearEntity(ChartEntity entity)
Clears all hot spot polygons for the entity and it's all child entities.

Parameters:
entity - entity to be removed from the map

clear

public abstract void clear()
Removes all chart objects


mapEntity

public abstract void mapEntity(ChartEntity entity,
                               java.awt.Shape shape)
Maps the polygon to the entity. Entities may have several associated polygons.
Warning: The polygon is not copied internally. All changes made to the polygon after the method completes will affect the map.

Parameters:
entity - entity to be mapped
shape - shape

mapEntity

public abstract void mapEntity(ChartEntity entity,
                               java.awt.Shape shape,
                               int id)
Maps the polygon to the entity. Entities may have several associated polygons.
Warning: The polygon is not copied internally. All changes made to the polygon after the method completes will affect the map.

Parameters:
entity - entity to be mapped
shape - shape
id - id

mapEntity

public abstract void mapEntity(ChartEntity entity,
                               Rectangle2D rectangle)
Maps the rectangle to the entity. Entities may have several associated polygons or rectangles.

Parameters:
entity - entity to be mapped
rectangle - rectangle

mapEntity

public abstract void mapEntity(ChartEntity entity,
                               Point2D pt)
Sets the center point for the entity area. This information may be used to show tool tips or notes.

Parameters:
entity - entity to be mapped
pt - entity center point

getObjectById

public abstract ChartEntity getObjectById(int id)
Finds a chart object with specified id. If no entity was found, returns null.

Parameters:
id - id to search for
Returns:
an object with specified if the search was successful, null otherwise

contains

protected boolean contains(ChartEntity container,
                           ChartEntity entity)
Utility method, to check if one entity is contained in another entity.

Parameters:
container - container entity
entity - child entity
Returns:
true if container entity contains child entity, false otherwise

findEntityAt

public ChartEntity findEntityAt(Point2D pt)
Finds a mapped entity at the specified point.

Parameters:
pt - search point
Returns:
null

getEntityPosition

public Point2D getEntityPosition(ChartEntity entity)
Returns the entity center point, mapped via the mapEntity method.

Parameters:
entity - entity
Returns:
entity center point

getEntityShape

public abstract java.awt.Shape getEntityShape(Point2D pt)
Returns the entity shape according to the point.

Parameters:
pt - point of shape
Returns:
selected entity shape

getEntityShape

public abstract java.awt.Shape getEntityShape(ChartEntity chartEntity)
Returns the entity shape according to the entity.

Parameters:
chartEntity - entity
Returns:
selected entity shape

findAllEntitiesAt

public java.util.List<ChartEntity> findAllEntitiesAt(Point2D pt)
Finds all mapped entities at the specified point.

Parameters:
pt - search point
Returns:
null