lt.monarch.chart.chart2D.engine
Class Shape2D

java.lang.Object
  extended by lt.monarch.chart.chart2D.engine.Shape2D
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
Bar2D, Bar3DSymbol, Circle, Ellipse, ErrorBar, LineBar2D, Pyramid2D, RoundedBar2D, X2D

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

Shape interface for drawing shapes in bar series.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
protected static class Shape2D.Elipse
          Class for storing ellipse coordinates
protected  class Shape2D.Line
          Class for storing line coordinates
protected  class Shape2D.Polygon
          Class for storing polygon coordinates
protected static interface Shape2D.ProjectableShape
           
protected  class Shape2D.Rectangle
          Class for storing bar coordinates
 
Field Summary
Modifier and Type Field and Description
protected  Rectangle2D bounds
          Bounds of the shape
protected  java.util.ArrayList<Shape2D.ProjectableShape> shapeList
          List of shapes to draw
 
Constructor Summary
Constructor and Description
Shape2D()
           
 
Method Summary
Modifier and Type Method and Description
 void draw(int index, AbstractGraphics g, Projector projector, PlaneMapper mapper, Style style, AbstractPaintTags tag, PaintMode paintMode)
          Draws the shape into the graphic context
 void draw(int index, AbstractGraphics g, Projector projector, PlaneMapper mapper, Style style, PaintMode paintMode)
          Draws the shape into the graphic context
 Rectangle2D getBounds()
          Gets bounds of the shape
 java.awt.Shape getShape()
          Gets the polygon
protected abstract  void initShape()
          Initializes the shape and adds its points to the array
protected  Point2D projectPoint(Point2D point, Projector projector)
          Projects point to the real coordinates
protected  Point2D projectPointInplace(Point2D point, Projector projector)
          Projects point to the real coordinates
protected  void projectShape(Projector projector)
          Calculates and return the polygon
 void setBounds(double x, double y, double width, double height)
          Sets bounds of the shape
 void transform(Transformation matrix)
          Transforms the shape according to the transformation matrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

shapeList

protected java.util.ArrayList<Shape2D.ProjectableShape> shapeList
List of shapes to draw


bounds

protected Rectangle2D bounds
Bounds of the shape

Constructor Detail

Shape2D

public Shape2D()
Method Detail

setBounds

public void setBounds(double x,
                      double y,
                      double width,
                      double height)
Sets bounds of the shape

Parameters:
x - x position
y - y position
width - shape width
height - shape height

draw

public void draw(int index,
                 AbstractGraphics g,
                 Projector projector,
                 PlaneMapper mapper,
                 Style style,
                 AbstractPaintTags tag,
                 PaintMode paintMode)
Draws the shape into the graphic context

Parameters:
index - index of the bar in the series
g - graphic context
projector - projector
mapper - mapper
style - bar style
tag - tag
paintMode - painting mode

draw

public void draw(int index,
                 AbstractGraphics g,
                 Projector projector,
                 PlaneMapper mapper,
                 Style style,
                 PaintMode paintMode)
Draws the shape into the graphic context

Parameters:
index - index of the bar in the series
g - graphic context
projector - projector
mapper - mapper
style - bar style
paintMode - painting mode

getBounds

public Rectangle2D getBounds()
Gets bounds of the shape

Returns:
shape bounds

projectShape

protected void projectShape(Projector projector)
Calculates and return the polygon

Parameters:
projector - projector

projectPoint

protected Point2D projectPoint(Point2D point,
                               Projector projector)
Projects point to the real coordinates

Parameters:
point - point to project
projector - projector
Returns:
projected point

projectPointInplace

protected Point2D projectPointInplace(Point2D point,
                                      Projector projector)
Projects point to the real coordinates

Parameters:
point - point to project
projector - projector
Returns:
projected point

getShape

public java.awt.Shape getShape()
Gets the polygon

Returns:
the polygon

transform

public void transform(Transformation matrix)
Transforms the shape according to the transformation matrix

Parameters:
matrix - Transformation matrix.

initShape

protected abstract void initShape()
Initializes the shape and adds its points to the array