lt.monarch.chart.servlet
Class ImageMap

java.lang.Object
  extended by lt.monarch.chart.engine.HotSpotMap
      extended by lt.monarch.chart.engine.SimpleHotSpotMap
          extended by lt.monarch.chart.servlet.ImageMap
All Implemented Interfaces:
java.io.Serializable

public class ImageMap
extends SimpleHotSpotMap

HotSpotMap class for HTML client side image map generation. It has to be configured with a list of desired HTML links and associated chart entities. Only information for the desired link hot spot areas is gathered. All other hot spots are ignored.
Also features a polygon optimizer, which decreases the number of polygon points up to the configured limit, while trying to preserve the original polygon shape.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
 
Nested classes/interfaces inherited from class lt.monarch.chart.engine.SimpleHotSpotMap
SimpleHotSpotMap.HotSpot
 
Field Summary
Modifier and Type Field and Description
protected  java.util.ArrayList<ImageMapLink> definedLinks
          an array of defined links
 
Fields inherited from class lt.monarch.chart.engine.SimpleHotSpotMap
map
 
Constructor Summary
Constructor and Description
ImageMap()
           
 
Method Summary
Modifier and Type Method and Description
protected  java.lang.String buildHTMLdef(java.awt.geom.GeneralPath p)
          Returns a HTML definition of tag parameters.
protected  java.lang.String buildHTMLdef(Rectangle2D r)
          Returns a HTML definition of tag parameters.
 void defineLink(ImageMapLink link)
          Adds a link and instructs the map to gather information on the entities, which are addressed by the link entity.
 void mapEntity(ChartEntity entity, Polygon2D polygon)
          Maps the chart entity to the specified polygon.
 void mapEntity(ChartEntity entity, Rectangle2D rectangle)
          Maps the chart entity to the specified Rectangle.
 void mapEntity(ChartEntity entity, java.awt.Shape shape)
          Maps the specified chart entity to the specified polygon.
 void mapLegend(boolean mapping)
          Sets capability map legend to image map or not.
 java.lang.String renderMap()
          Creates and returns the image map as an HTML string.
 void setMaxPolygonPoints(int count)
          Sets the maximum number of acceptable polygon points for the polygon optimizer.
 void undefineLink(ImageMapLink link)
          Removes the link and cleans up all associated hot spot information.
 
Methods inherited from class lt.monarch.chart.engine.SimpleHotSpotMap
clear, clearEntity, findAllEntitiesAt, findEntitiesInside, findEntitiesIntersecting, findEntityAt, getEntityPosition, getEntityShape, getEntityShape, getObjectById, mapEntity, mapEntity, mapEntity
 
Methods inherited from class lt.monarch.chart.engine.HotSpotMap
contains
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

definedLinks

protected java.util.ArrayList<ImageMapLink> definedLinks
an array of defined links

Constructor Detail

ImageMap

public ImageMap()
Method Detail

setMaxPolygonPoints

public void setMaxPolygonPoints(int count)
Sets the maximum number of acceptable polygon points for the polygon optimizer.

Parameters:
count - number of polygon points

defineLink

public void defineLink(ImageMapLink link)
Adds a link and instructs the map to gather information on the entities, which are addressed by the link entity.

Parameters:
link - link object

undefineLink

public void undefineLink(ImageMapLink link)
Removes the link and cleans up all associated hot spot information.

Parameters:
link - link object

mapEntity

public void mapEntity(ChartEntity entity,
                      Rectangle2D rectangle)
Maps the chart entity to the specified Rectangle.

Overrides:
mapEntity in class SimpleHotSpotMap
Parameters:
entity - the chart entity
rectangle - the Rectangle

mapEntity

public void mapEntity(ChartEntity entity,
                      Polygon2D polygon)
Maps the chart entity to the specified polygon.

Parameters:
entity - the chart entity
polygon - the polygon

mapEntity

public void mapEntity(ChartEntity entity,
                      java.awt.Shape shape)
Maps the specified chart entity to the specified polygon.

Overrides:
mapEntity in class SimpleHotSpotMap
Parameters:
entity - the chart entity
shape - the shape

mapLegend

public void mapLegend(boolean mapping)
Sets capability map legend to image map or not.

Parameters:
mapping - boolean constant

buildHTMLdef

protected java.lang.String buildHTMLdef(java.awt.geom.GeneralPath p)
Returns a HTML definition of tag parameters. The definition string is built as shape="poly" coords= plus list of the polygon points coordinate's. For example: shape="poly" coords="15,21,24,54,25,75".

Parameters:
p - the polygon containing image map's coordinates
Returns:
a HTML definition of tag parameters

buildHTMLdef

protected java.lang.String buildHTMLdef(Rectangle2D r)
Returns a HTML definition of tag parameters. The definition string is built as shape="rect" coords= plus coordinates of top left and bottom right points of the rectangle. For example: shape="rect" coords="15,21,24,54".

Parameters:
r - the rectangle containing image map's coordinates
Returns:
a HTML definition of tag parameters

renderMap

public java.lang.String renderMap()
Creates and returns the image map as an HTML string.

Returns:
client side map HTML source code