|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.stanford.hci.r3.pattern.coordinates.conversion.TiledPatternCoordinateConverter
public class TiledPatternCoordinateConverter
Stores the bounds in physical (streaming) coordinates.
This software is distributed under the BSD License.
Constructor Summary | |
---|---|
TiledPatternCoordinateConverter(java.lang.String regionName)
A constructor for when you need to set the information later (The Lazy Approach). |
|
TiledPatternCoordinateConverter(java.lang.String theRegionName,
double leftMostPatternXCoord,
double topMostPatternYCoord,
int dotsAcross,
int dotsDown)
Used when you are creating a converter that lives on a SINGLE PATTERNED TILE. |
|
TiledPatternCoordinateConverter(java.lang.String theRegionName,
int startTile,
int nTilesAcross,
int nTilesDown,
int dotsPerTileHoriz,
int dotsPerTileVert,
double numHorizDotsBetweenTiles,
double numVertDotsBetweenTiles,
double leftMostPatternX,
double topMostPatternY,
double numDotsAcross,
double numDotsDown)
This object deals with physical coordinates (the type that you get when you stream coordinates from the Nokia SU-1B). |
Method Summary | |
---|---|
boolean |
contains(double xValPatternDots,
double yValPatternDots)
For performance, we precompute the boundaries and store just those numbers. |
boolean |
contains(StreamedPatternCoordinates location)
If you have the values and do not need to create a StreamedPatternCoordinates object, use the other contains(...) method. |
double |
getArea()
|
java.lang.String |
getRegionName()
|
PercentageCoordinates |
getRelativeLocation(StreamedPatternCoordinates coord)
Convert the input coordinate into a percentage location relative to this tile configuration (a region that has tiled pattern) |
int |
getTileNumber(StreamedPatternCoordinates coord)
It tries to calculate the tile number given an input coordinate. |
void |
setOriginInDots(double leftMostPatternX,
double topMostPatternY)
What is the physical coordinate of the top-left corner of the top-left tile? |
void |
setPatternInformationByReadingItFrom(TiledPattern p)
Reads in the information to define this coordinate converter. |
void |
setRegionName(java.lang.String rName)
|
void |
setStartingTile(int startTile)
The number of the first (top-left) tile; this is largely arbitrary, but _may_ correlate with a pattern file number N.pattern --> N as a starting tile number. |
void |
setTileConfiguration(int nTilesAcross,
int nTilesDown)
The number of tiles owned by this converter. |
void |
setTileSizeInDots(int dotsPerTileHoriz,
int dotsPerTileVert)
How wide and tall are these tiles? We assume uniform tiles (except for the rightmost and bottommost tiles) |
void |
setTileToTileOffsetInDots(double numHorizDotsBetweenTiles,
double numVertDotsBetweenTiles)
|
void |
setTotalSizeInDots(double numDotsAcross,
double numDotsDown)
Set the size of this tile configuration, irrespective of the tiling. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TiledPatternCoordinateConverter(java.lang.String regionName)
regionName
- the Region that this coordinate converter was created for. The reason we don't
pass in the whole region object is because this converter WILL be serialized and
unserialized. Due to XStream's limitations, we will have to resolve the region at
runtime using the region's name instead.public TiledPatternCoordinateConverter(java.lang.String theRegionName, double leftMostPatternXCoord, double topMostPatternYCoord, int dotsAcross, int dotsDown)
public TiledPatternCoordinateConverter(java.lang.String theRegionName, int startTile, int nTilesAcross, int nTilesDown, int dotsPerTileHoriz, int dotsPerTileVert, double numHorizDotsBetweenTiles, double numVertDotsBetweenTiles, double leftMostPatternX, double topMostPatternY, double numDotsAcross, double numDotsDown)
This object deals with physical coordinates (the type that you get when you stream coordinates from the Nokia SU-1B). They are all huge numbers, but we store them in PatternDots objects. Although we can convert the PatternDots objects into other Units, it doesn't really make sense, as the dots are specified in the world of Anoto's gargantuan pattern space. For example, if you converted the xOrigin to inches, you would get a beast of a number.
We precompute the boundaries so that we can do contains(...) tests faster.
theRegionName
- The region that this converter was created for.startTile
- the number that you assign to the top-left tilenTilesAcross
- width of this tile configuration, in # of tilesnTilesDown
- height of this tile configuration, in # of tilesdotsPerTileHoriz
- width of each tile, in # dotsdotsPerTileVert
- height of each tile, in # dotsleftMostPatternX
- left boundary in pattern dotstopMostPatternY
- top boundary, in pattern dotsnumDotsAcross
- width of entire region in dots, not including the between-tile paddingnumDotsDown
- height of entire region in dots, not including the padding in between tilesnumHorizDotsBetweenTiles
- the horizontal padding between adjacent tilesnumVertDotsBetweenTiles
- the vertical padding between adjacent tiles (tends to be 0, in our experience)Method Detail |
---|
public boolean contains(double xValPatternDots, double yValPatternDots)
xValPatternDots
- x value of the location, in PatternDots (physical/streamed coordinates)yValPatternDots
- y value of the location, in PatternDots (physical/streamed coordinates)
public boolean contains(StreamedPatternCoordinates location)
contains
in interface PatternCoordinateConverter
location
-
public double getArea()
getArea
in interface PatternCoordinateConverter
public java.lang.String getRegionName()
getRegionName
in interface PatternCoordinateConverter
public PercentageCoordinates getRelativeLocation(StreamedPatternCoordinates coord)
getRelativeLocation
in interface PatternCoordinateConverter
public int getTileNumber(StreamedPatternCoordinates coord)
[0][1][2]
[3][4][5]
This should work if the pattern space is short and wide, or thin and tall...
coord
-
public void setOriginInDots(double leftMostPatternX, double topMostPatternY)
leftMostPatternX
- topMostPatternY
- public void setPatternInformationByReadingItFrom(TiledPattern p)
p
- the tiled pattern object produced by sheet renderers.public void setRegionName(java.lang.String rName)
rName
- the name of the region that this converter manages. It's important to keep your
regions uniquely identifiable.public void setStartingTile(int startTile)
startTile
- public void setTileConfiguration(int nTilesAcross, int nTilesDown)
nTilesAcross
- nTilesDown
- public void setTileSizeInDots(int dotsPerTileHoriz, int dotsPerTileVert)
dotsPerTileHoriz
- dotsPerTileVert
- public void setTileToTileOffsetInDots(double numHorizDotsBetweenTiles, double numVertDotsBetweenTiles)
numHorizDotsBetweenTiles
- numVertDotsBetweenTiles
- public void setTotalSizeInDots(double numDotsAcross, double numDotsDown)
numDotsAcross
- numDotsDown
- public 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 |