Inheritance diagram for PolygonalRegion:
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. |
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.
Definition at line 36 of file PolygonalRegion.java.
PolygonalRegion | ( | String | name, | |
Units | u, | |||
Point2D... | points | |||
) |
Creates a polygon with origin at the first point that was passed in.
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.
currUnits | ||
destUnits | ||
pts |
Definition at line 90 of file PolygonalRegion.java.
Units getOffsetX | ( | ) |
Definition at line 120 of file PolygonalRegion.java.
Referenced by PolygonRenderer.renderToG2D().
Units getOffsetY | ( | ) |
Definition at line 127 of file PolygonalRegion.java.
Referenced by PolygonRenderer.renderToG2D().
Polygon getPolygonReference | ( | ) |
Definition at line 134 of file PolygonalRegion.java.
References Region.getShape().
Referenced by PolygonalRegion.toString().
RegionRenderer getRenderer | ( | ) |
String toString | ( | ) |
Please override for more interesting output.
Reimplemented from Region.
Definition at line 166 of file PolygonalRegion.java.
References PolygonalRegion.getPolygonReference(), Region.getScaleX(), Region.getScaleY(), and Region.getUnits().