PolygonalRegion Class Reference

Inheritance diagram for PolygonalRegion:

Region List of all members.

Public Member Functions

 PolygonalRegion (String name, Units u, Point2D...points)
 Creates a polygon with origin at the first point that was passed in.
 PolygonalRegion (String name, Units currUnits, Units destUnits, Point2D...pts)
 Alternate constructor, if your current units are not optimal (e.g., Inches, Centimeters, and anything really big).
Units getOffsetX ()
Units getOffsetY ()
Polygon getPolygonReference ()
RegionRenderer getRenderer ()
Color getStrokeColor ()
int getStrokeThickness ()
void setStrokeColor (Color strokeColor)
void setStrokeThickness (int strokeThickness)
String toString ()
 Please override for more interesting output.

Detailed Description

Polygonal Regions store the individual vertices and the units to interpret the vertices.

WARNING: Java2D Polygons only accept integer values! Thus, it might not be smart to pass in fractional values (even though we accept Floats/Doubles). We WILL round off each input value with Math.round(...). So, if you pass in a point to the main constructor PolygonalRegion(Units, Point2D) with vertices such as 0.45 inches, your vertex may be snapped to 0.0 inches!

Instead, you may use the alternate convenience constructor PolygonalRegion(Units current, Units destination, Point2D). This constructor will take in your Polygon in the current units, and convert all the values to the (presumably finer) destination unit. For example, to convert your Points from Inches to Points, call PolygonalRegion(new Inches(), new Points(), Point2D vertex1, Point2D vertex2, ...). Of course, with Java's varargs, you can pass in a Point2D[] as the final argument.

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 36 of file PolygonalRegion.java.


Constructor & Destructor Documentation

PolygonalRegion ( String  name,
Units  u,
Point2D...  points 
)

Creates a polygon with origin at the first point that was passed in.

Parameters:
u 
points 

Definition at line 76 of file PolygonalRegion.java.

References Units.getUnitsObjectOfSameTypeWithValue().

PolygonalRegion ( String  name,
Units  currUnits,
Units  destUnits,
Point2D...  pts 
)

Alternate constructor, if your current units are not optimal (e.g., Inches, Centimeters, and anything really big).

For destinationUnits, choose something fine, like Millimeters, Points, or your desired Screen Pixel or PrinterDPI conversion.

Parameters:
currUnits 
destUnits 
pts 

Definition at line 90 of file PolygonalRegion.java.


Member Function Documentation

Units getOffsetX (  ) 

Returns:

Definition at line 120 of file PolygonalRegion.java.

Referenced by PolygonRenderer.renderToG2D().

Units getOffsetY (  ) 

Returns:

Definition at line 127 of file PolygonalRegion.java.

Referenced by PolygonRenderer.renderToG2D().

Polygon getPolygonReference (  ) 

Returns:
the internal polygon (unscaled).

Definition at line 134 of file PolygonalRegion.java.

References Region.getShape().

Referenced by PolygonalRegion.toString().

RegionRenderer getRenderer (  ) 

See also:
edu.stanford.hci.r3.paper.Region.getRenderer()

Reimplemented from Region.

Definition at line 141 of file PolygonalRegion.java.

String toString (  ) 

Please override for more interesting output.

See also:
java.lang.Object.toString()

Reimplemented from Region.

Definition at line 166 of file PolygonalRegion.java.

References PolygonalRegion.getPolygonReference(), Region.getScaleX(), Region.getScaleY(), and Region.getUnits().


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:42 2007 for R3 Paper Toolkit by  doxygen 1.4.7