edu.stanford.hci.r3.units.coordinates
Class PercentageCoordinates

java.lang.Object
  extended by edu.stanford.hci.r3.units.coordinates.Coordinates
      extended by edu.stanford.hci.r3.units.coordinates.PercentageCoordinates

public class PercentageCoordinates
extends Coordinates

Can be used for specifying where we are on a sheet, region, etc. Instead of specifying absolute coordinates (number of pixels), we specify in a fraction relative to the upper left corner of the document (0,0).

This software is distributed under the BSD License.


Field Summary
 
Fields inherited from class edu.stanford.hci.r3.units.coordinates.Coordinates
x, y
 
Constructor Summary
PercentageCoordinates(Percentage pctInX, Percentage pctInY)
           
 
Method Summary
 Units getActualValueInXDirection()
           
 Units getActualValueInYDirection()
           
 double getPercentageInXDirection()
          Not as useful as the actual value, because of the aspect ratio of the sheet/region.
 double getPercentageInYDirection()
           
 void setX(Units xCoord)
          Verifies that the passed-in unit is in fact of the right type!
 void setY(Units yCoord)
          Verifies that the passed-in unit is in fact of the right type!
 java.lang.String toString()
           
 
Methods inherited from class edu.stanford.hci.r3.units.coordinates.Coordinates
getX, getY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PercentageCoordinates

public PercentageCoordinates(Percentage pctInX,
                             Percentage pctInY)
Parameters:
pctInX -
pctInY -
Method Detail

getActualValueInXDirection

public Units getActualValueInXDirection()
Returns:

getActualValueInYDirection

public Units getActualValueInYDirection()
Returns:

getPercentageInXDirection

public double getPercentageInXDirection()
Not as useful as the actual value, because of the aspect ratio of the sheet/region. If it's a wide sheet, 50% is a lot bigger in X than it is in Y.

Returns:
the percentage value in the horizontal direction.

getPercentageInYDirection

public double getPercentageInYDirection()
Returns:
the percentage value in the vertical direction.

setX

public void setX(Units xCoord)
Verifies that the passed-in unit is in fact of the right type!

Overrides:
setX in class Coordinates
Parameters:
xCoord -
See Also:
Coordinates.setX(edu.stanford.hci.r3.units.Units)

setY

public void setY(Units yCoord)
Verifies that the passed-in unit is in fact of the right type!

Overrides:
setY in class Coordinates
Parameters:
yCoord -
See Also:
Coordinates.setY(edu.stanford.hci.r3.units.Units)

toString

public java.lang.String toString()
Overrides:
toString in class Coordinates
See Also:
Object.toString()

Copyright 2006 Stanford University