|
|||||||||
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
public class Region
A region is defined by a Shape that outlines the region. Internally, the region remembers the Units that it is represented in. Thus, you may use whatever units pleases you.
Also, a region can be INPUT(REALTIME|BATCH), OUTPUT(REALTIME|INTERMITTENT), or STATIC. This is entirely determined by the type(s) of attachments (input event handlers, input filters, realtime outputs, print output) you add to a region. If you do not add anything, it is by default a STATIC region. For example, if you add an input event handler for a streaming pen, it becomes an INPUT(REALTIME) region. Regions that handle interactive input will automatically be overlaid with pattern when rendered to PDF or to a printer.
Regardless of whether the Shape is closed or not, we assume that all regions are closed Shapes. A rectangular region is represented using this class's Region(4 args) constructors.
This software is distributed under the BSD License.
Field Summary | |
---|---|
protected Units |
referenceUnits
This is used only to interpret the shape's true physical size. |
protected double |
scaleX
Internal horizontal scale of the region. |
protected double |
scaleY
Internal vertical scale of the region. |
Constructor Summary | |
---|---|
|
Region(java.lang.String name,
double xInches,
double yInches,
double wInches,
double hInches)
For our American friends. |
|
Region(java.lang.String theName,
java.awt.Shape s,
Units u)
|
protected |
Region(java.lang.String theName,
Units u)
A protected constructor so subclasses can assign the shape whichever way they please. |
|
Region(java.lang.String name,
Units x,
Units y,
Units w,
Units h)
We will convert all the units to x's type. |
Method Summary | |
---|---|
void |
addEventHandler(EventHandler handler)
Keeps track of this event handler. |
java.util.List<EventHandler> |
getEventHandlers()
|
java.awt.Color |
getFillColor()
|
Units |
getHeight()
|
java.lang.String |
getIsActiveString()
|
java.lang.String |
getName()
|
double |
getOpacity()
|
Units |
getOriginX()
|
Units |
getOriginY()
|
Sheet |
getParentSheet()
|
RegionRenderer |
getRenderer()
Subclasses should override this, to customize rendering. |
double |
getScaleX()
|
double |
getScaleY()
|
java.awt.Shape |
getShape()
Subclasses can modify the internal shape object. |
java.awt.Color |
getStrokeColor()
|
Units |
getUnits()
TODO: We should make sure that Units objects immutable if possible. |
java.awt.geom.Rectangle2D |
getUnscaledBounds2D()
|
Units |
getUnscaledBoundsHeight()
|
Units |
getUnscaledBoundsWidth()
|
java.awt.Shape |
getUnscaledShapeCopy()
|
Units |
getWidth()
|
boolean |
isActive()
|
boolean |
isVisible()
|
void |
resetScale()
Resets to the default scaling factors. |
void |
scaleRegion(double sX,
double sY)
Scales the points in the current region by a horizontal and vertical multiplier. |
void |
scaleRegionUniformly(double scale)
Resizes the region uniformly in x and y. |
void |
setActive(boolean isRegionActive)
|
void |
setFillColor(java.awt.Color theFillColor)
|
void |
setName(java.lang.String theName)
|
void |
setOpacity(double theOpacityFrom0To1)
|
void |
setParentSheet(Sheet sheet)
For traversing up the UI hierarchy, in Event Visualizations. |
void |
setScale(double newScaleX,
double newScaleY)
Replaces the scaling factors. |
protected void |
setShape(java.awt.Shape s)
Subclasses can use this method to set the shape after constructing the object. |
void |
setStrokeColor(java.awt.Color strokeCol)
|
void |
setVisible(boolean v)
|
java.lang.String |
toString()
Please override for more interesting output. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Units referenceUnits
protected double scaleX
protected double scaleY
Constructor Detail |
---|
public Region(java.lang.String name, double xInches, double yInches, double wInches, double hInches)
xInches
- yInches
- wInches
- hInches
- public Region(java.lang.String theName, java.awt.Shape s, Units u)
name
- s
- the shape that defines this region.u
- the reference unit for interpreting the shape's coordinatesprotected Region(java.lang.String theName, Units u)
u
- public Region(java.lang.String name, Units x, Units y, Units w, Units h)
x
- y
- w
- h
- Method Detail |
---|
public void addEventHandler(EventHandler handler)
handler
- public java.util.List<EventHandler> getEventHandlers()
public java.awt.Color getFillColor()
public Units getHeight()
public java.lang.String getIsActiveString()
public java.lang.String getName()
public double getOpacity()
public Units getOriginX()
public Units getOriginY()
public Sheet getParentSheet()
public RegionRenderer getRenderer()
public double getScaleX()
public double getScaleY()
public java.awt.Shape getShape()
public java.awt.Color getStrokeColor()
public Units getUnits()
public java.awt.geom.Rectangle2D getUnscaledBounds2D()
public Units getUnscaledBoundsHeight()
public Units getUnscaledBoundsWidth()
public java.awt.Shape getUnscaledShapeCopy()
public Units getWidth()
public boolean isActive()
public boolean isVisible()
public void resetScale()
public void scaleRegion(double sX, double sY)
sX
- sY
- public void scaleRegionUniformly(double scale)
scale
- public void setActive(boolean isRegionActive)
isRegionActive
- determines whether this will be an active region or notpublic void setFillColor(java.awt.Color theFillColor)
theFillColor
- public void setName(java.lang.String theName)
theName
- the name of the region. Name it something useful, like "Blue Button for Changing
Pen Colors"public void setOpacity(double theOpacityFrom0To1)
theOpacityFrom0To1
- bounds checked from 0.0 to 1.0public void setParentSheet(Sheet sheet)
sheet
- public void setScale(double newScaleX, double newScaleY)
newScaleX
- newScaleY
- protected void setShape(java.awt.Shape s)
s
- public void setStrokeColor(java.awt.Color strokeCol)
public void setVisible(boolean v)
v
- whether the region will be visiblepublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
Copyright 2006 Stanford University | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |