|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.stanford.hci.r3.paper.Region edu.stanford.hci.r3.paper.regions.PolygonalRegion
public class PolygonalRegion
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.
Field Summary |
---|
Fields inherited from class edu.stanford.hci.r3.paper.Region |
---|
referenceUnits, scaleX, scaleY |
Constructor Summary | |
---|---|
PolygonalRegion(java.lang.String name,
Units u,
java.awt.geom.Point2D... points)
Creates a polygon with origin at the first point that was passed in. |
|
PolygonalRegion(java.lang.String name,
Units currUnits,
Units destUnits,
java.awt.geom.Point2D... pts)
Alternate constructor, if your current units are not optimal (e.g., Inches, Centimeters, and anything really big). |
Method Summary | |
---|---|
Units |
getOffsetX()
|
Units |
getOffsetY()
|
java.awt.Polygon |
getPolygonReference()
|
RegionRenderer |
getRenderer()
Subclasses should override this, to customize rendering. |
java.awt.Color |
getStrokeColor()
|
int |
getStrokeThickness()
|
void |
setStrokeColor(java.awt.Color strokeColor)
|
void |
setStrokeThickness(int strokeThickness)
|
java.lang.String |
toString()
Please override for more interesting output. |
Methods inherited from class edu.stanford.hci.r3.paper.Region |
---|
addEventHandler, getEventHandlers, getFillColor, getHeight, getIsActiveString, getName, getOpacity, getOriginX, getOriginY, getParentSheet, getScaleX, getScaleY, getShape, getUnits, getUnscaledBounds2D, getUnscaledBoundsHeight, getUnscaledBoundsWidth, getUnscaledShapeCopy, getWidth, isActive, isVisible, resetScale, scaleRegion, scaleRegionUniformly, setActive, setFillColor, setName, setOpacity, setParentSheet, setScale, setShape, setVisible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PolygonalRegion(java.lang.String name, Units u, java.awt.geom.Point2D... points)
u
- points
- public PolygonalRegion(java.lang.String name, Units currUnits, Units destUnits, java.awt.geom.Point2D... pts)
currUnits
- destUnits
- pts
- Method Detail |
---|
public Units getOffsetX()
public Units getOffsetY()
public java.awt.Polygon getPolygonReference()
public RegionRenderer getRenderer()
Region
getRenderer
in class Region
Region.getRenderer()
public java.awt.Color getStrokeColor()
getStrokeColor
in class Region
public int getStrokeThickness()
public void setStrokeColor(java.awt.Color strokeColor)
setStrokeColor
in class Region
public void setStrokeThickness(int strokeThickness)
public java.lang.String toString()
toString
in class Region
Object.toString()
|
Copyright 2006 Stanford University | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |