lt.monarch.chart.chart2D.engine
Class PolarProjector

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

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

2D projector which maps PolarPoint objects into the specified projection area.

See Also:
Serialized Form

Constructor Summary
Constructor and Description
PolarProjector()
          Constructs a new PolarProjector.
 
Method Summary
Modifier and Type Method and Description
 java.lang.Object clone()
          Creates and returns a copy of this projector.
 Rectangle2D getProjectionArea()
          Returns a projection area of the projector.
 Rectangle2D getProjectionAreaReference()
          Returns a projection area of the projector reference.
 Rectangle2D getViewableArea()
          Returns viewable area for projector.
 void prepare()
          Prepares the projector.
 GeneralPoint project(GeneralPoint point)
          Projects the specified PolarPoint to the projection area.
 GeneralPoint project(GeneralPoint point, GeneralPoint pt)
          Projects the specified PolarPoint to the projection area.
 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 the projector.
 void setRoundingEnabled(boolean rounding)
          Enables or disables projection results rounding.
 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

PolarProjector

public PolarProjector()
Constructs a new PolarProjector.

Method Detail

setRoundingEnabled

public void setRoundingEnabled(boolean rounding)
Enables or disables projection results rounding. If rounding is enabled, the projection results are rounded before returning. If rounding is disabled, projection results are simply casted to int.

Parameters:
rounding - true to enable rounding, false - to disable

setProjectionArea

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

Specified by:
setProjectionArea in interface Projector
Parameters:
r - the Rectangle defining projection area

getProjectionAreaReference

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

Specified by:
getProjectionAreaReference in interface Projector
Returns:
the Rectangle representing current projection area of the projector

getProjectionArea

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

Specified by:
getProjectionArea in interface Projector
Returns:
the Rectangle representing current projection area of the projector

project

public GeneralPoint project(GeneralPoint point)
Projects the specified PolarPoint to the projection area. If rounding is enabled, projection results are rounded before returning. Otherwise results are simply casted to int numbers.

Specified by:
project in interface Projector
Parameters:
point - the PolarPoint to project
Returns:
creates and returns 2-dimensional point representing specified polar point in projector's projection area

project

public GeneralPoint project(GeneralPoint point,
                            GeneralPoint pt)
Projects the specified PolarPoint to the projection area. If rounding is enabled, projection results are rounded before returning. Otherwise results are simply casted to int numbers. A 2D point is template is used to avoid unnecessary object creation.

Specified by:
project in interface Projector
Parameters:
point - the PolarPoint to project
pt - Point template to write projection results to
Returns:
the reference to the template point containing projection results

prepare

public void prepare()
Prepares the projector. Does nothing.

Specified by:
prepare in interface Projector

clone

public java.lang.Object clone()
Creates and returns a copy of this projector.

Specified by:
clone in interface Projector
Overrides:
clone in class java.lang.Object
Returns:
a copy of this 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

projectBack

public Point2D projectBack(java.awt.Point pt)
Description copied from interface: Projector2D
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)
Description copied from interface: Projector2D
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

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