lt.monarch.chart.chart2D.engine
Class SimpleProjector2D

java.lang.Object
  extended by lt.monarch.chart.chart2D.engine.SimpleProjector2D
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Projector2D, Projector

public class SimpleProjector2D
extends java.lang.Object
implements Projector2D, java.io.Serializable

2D which maps Point2D objects into the specified projection area by scaling.

See Also:
Serialized Form

Constructor Summary
Constructor and Description
SimpleProjector2D()
          Constructs a new SimpleProjector2D.
 
Method Summary
Modifier and Type Method and Description
 java.lang.Object clone()
          Returns a copy o the projector.
 Rectangle2D getProjectionArea()
          Returns a projection area of this projector.
 Rectangle2D getProjectionAreaReference()
          Returns a reference to projection area of this projector.
 Rectangle2D getViewableArea()
          Returns viewable area for projector.
 void prepare()
          Prepares the projector.
 GeneralPoint project(GeneralPoint point)
          Projects the specified normalized point into projection area of the projector.
 GeneralPoint project(GeneralPoint point, GeneralPoint pt)
          Projects the specified normalized point into projection area of the projector.
 Polygon2D project(Rectangle2D r)
          Projects a rectangle into polygon.
 Point2D projectBack(java.awt.Point pt)
          Projects the specified 2-dimensional point back into normalized point.
 Point2D projectBack(java.awt.Point pt, Point2D pt2D)
          Projects the specified 2-dimensional point back into normalized point.
 void setProjectionArea(Rectangle2D r)
          Sets the projection area for this projector.
 void setViewableArea(Rectangle2D viewableArea)
          Sets viewable area for projector: (0.0, 0.0, 1.0, 1.0) visible full chart.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleProjector2D

public SimpleProjector2D()
Constructs a new SimpleProjector2D.

Method Detail

setProjectionArea

public void setProjectionArea(Rectangle2D r)
Sets the projection area for this projector.

Specified by:
setProjectionArea in interface Projector
Parameters:
r - the Rectangle that specifies projection area for this projector

getProjectionArea

public Rectangle2D getProjectionArea()
Returns a projection area of this projector.

Specified by:
getProjectionArea in interface Projector
Returns:
projection area of this projector

getProjectionAreaReference

public Rectangle2D getProjectionAreaReference()
Returns a reference to projection area of this projector.

Specified by:
getProjectionAreaReference in interface Projector
Returns:
projection area of this projector

project

public GeneralPoint project(GeneralPoint point)
Projects the specified normalized point into projection area of the projector.

Specified by:
project in interface Projector
Parameters:
point - the normalized point to project
Returns:
a projection of the specified normalized point in the projection area of this projector

project

public GeneralPoint project(GeneralPoint point,
                            GeneralPoint pt)
Projects the specified normalized point into projection area of the projector. Uses the specified Point template to avoid unnecessary object creation.

Specified by:
project in interface Projector
Parameters:
point - the normalized point to project
pt - the Point template
Returns:
a projection of the specified normalized point in the projection area of this projector

projectBack

public Point2D projectBack(java.awt.Point pt)
Projects the specified 2-dimensional point back into normalized point.

Specified by:
projectBack in interface Projector2D
Parameters:
pt - the point to project
Returns:
normalized point representing the specified point

projectBack

public Point2D projectBack(java.awt.Point pt,
                           Point2D pt2D)
Projects the specified 2-dimensional point back into normalized point. A Point2D template is used to avoid unnecessary object creation.

Specified by:
projectBack in interface Projector2D
Parameters:
pt - the point to project
pt2D - Point2D template to write back-projection results to
Returns:
the reference to the template point containing back-projection results

prepare

public void prepare()
Prepares the projector.

Specified by:
prepare in interface Projector

clone

public java.lang.Object clone()
Returns a copy o the projector.

Specified by:
clone in interface Projector
Overrides:
clone in class java.lang.Object
Returns:
a copy o the projector

project

public Polygon2D project(Rectangle2D r)
Description copied from interface: Projector
Projects a rectangle into polygon.

Specified by:
project in interface Projector
Parameters:
r - 2D rectangle
Returns:
projected polygon

setViewableArea

public void setViewableArea(Rectangle2D viewableArea)
Description copied from interface: Projector2D
Sets viewable area for projector: (0.0, 0.0, 1.0, 1.0) visible full chart.

Specified by:
setViewableArea in interface Projector2D
Parameters:
viewableArea - projector viewable area

getViewableArea

public Rectangle2D getViewableArea()
Description copied from interface: Projector2D
Returns viewable area for projector.

Specified by:
getViewableArea in interface Projector2D
Returns:
projector viewable area