PatternLocationToSheetLocationMapping Class Reference

List of all members.

Public Member Functions

 PatternLocationToSheetLocationMapping (Sheet s)
 One mapping object per sheet.
 PatternLocationToSheetLocationMapping (Sheet s, File patternInfoFile)
 These XML files are created automatically when you render a patterned PDF.
PatternCoordinateConverter getCoordinateConverterForSample (PenSample sample)
 Checks whether this mapping contains the pen sample (streamed coordinates).
PatternCoordinateConverter getPatternBoundsOfRegion (Region r)
Map< Region, PatternCoordinateConvertergetRegionToPatternMapping ()
 An advanced method, to allow us to inspect the region <--> pattern mapping.
Sheet getSheet ()
void initializeMap (List< Region > regions)
 For all ACTIVE regions, we need a coordinate converter that will enable us to find out where the pen is on the region.
void printMapping ()
 For debugging.
void saveConfigurationToXML (File xmlFile)
 Due to xstream's inability to serial/unserialize really complicated classes, we will save only a regionName+origin --> pattern info mapping.
void setPatternInformationOfRegion (Region r, PatternCoordinateConverter coordinateInfo)
 For a region on our sheet, update the coordinate information so that it can be accessed at runtime by our EventEngine.
void setPatternInformationOfRegion (Region region, PatternDots x, PatternDots y, PatternDots width, PatternDots height)
 A convenience function for mapping a contiguous (single-tile) patterned area to a region object.
void setSheet (Sheet s)
String toString ()

Package Functions

 SuppressWarnings ("unchecked") public void loadConfigurationFromXML(File xmlFile)
 On Nov 9, 2006, I changed this to use the interface.

Detailed Description

This class stores mappings from regions of pattern (and their coordinates in Anoto space) to Sheets and locations on those sheets. This mapping works both ways. Given a location on the sheet, we should be able to find the pattern coordinate. Given a coordinate, we should be able to find the location on the sheet.

An instance of this object should be built when a PDF is rendered with pattern. At that moment, regions on a sheet are bound to specific physical coordinates. Each application should store this mapping per sheet.

The SheetRenderer class uses this class to save the mapping to disk, so that a future instance can load the mapping and run the application.

This software is distributed under the BSD License.

Author:
Ron B Yeh (ronyeh(AT)cs.stanford.edu)

Definition at line 47 of file PatternLocationToSheetLocationMapping.java.


Constructor & Destructor Documentation

PatternLocationToSheetLocationMapping ( Sheet  s  ) 

One mapping object per sheet.

Create this object after you have added all the regions that you need to the sheet. This class will maintain a mapping of Regions to physical (streaming) and logical (batched) pen coordinates.

This constructor will try to load the pattern configuration automatically. If you want to set the mapping manually, you will need to load the map with TiledPatternCoordinateConverters so that active regions can be accessed.

Parameters:
s 

Definition at line 74 of file PatternLocationToSheetLocationMapping.java.

References Sheet.getRegions(), and PatternLocationToSheetLocationMapping.initializeMap().

PatternLocationToSheetLocationMapping ( Sheet  s,
File  patternInfoFile 
)

These XML files are created automatically when you render a patterned PDF.

Parameters:
s 
patternInfoFile 

Definition at line 88 of file PatternLocationToSheetLocationMapping.java.

References Sheet.getRegions(), and PatternLocationToSheetLocationMapping.initializeMap().


Member Function Documentation

PatternCoordinateConverter getCoordinateConverterForSample ( PenSample  sample  ) 

Checks whether this mapping contains the pen sample (streamed coordinates).

If it does, it returns the TiledPatternCoordinateConverter object for that sample. If not, it returns null.

Parameters:
sample 
Returns:

Definition at line 103 of file PatternLocationToSheetLocationMapping.java.

PatternCoordinateConverter getPatternBoundsOfRegion ( Region  r  ) 

Parameters:
r find the coordinate converter for this region.
Returns:
the converter that enables you to figure out where on the region a sample falls.

Definition at line 133 of file PatternLocationToSheetLocationMapping.java.

References Region.getName().

Map<Region, PatternCoordinateConverter> getRegionToPatternMapping (  ) 

An advanced method, to allow us to inspect the region <--> pattern mapping.

We can tell if the pattern map has an area of 0, which probably means it is uninitialized!

Returns:

Definition at line 146 of file PatternLocationToSheetLocationMapping.java.

Sheet getSheet (  ) 

Returns:

Definition at line 153 of file PatternLocationToSheetLocationMapping.java.

void initializeMap ( List< Region regions  ) 

For all ACTIVE regions, we need a coordinate converter that will enable us to find out where the pen is on the region.

We should be able to add new regions to a sheet after the fact, so we should have the ability to reinitialize this map later on.

Parameters:
regions 

Definition at line 164 of file PatternLocationToSheetLocationMapping.java.

Referenced by PatternLocationToSheetLocationMapping.PatternLocationToSheetLocationMapping().

void saveConfigurationToXML ( File  xmlFile  ) 

Due to xstream's inability to serial/unserialize really complicated classes, we will save only a regionName+origin --> pattern info mapping.

Parameters:
xmlFile 

Definition at line 243 of file PatternLocationToSheetLocationMapping.java.

Referenced by SheetRenderer.savePatternInformation().

void setPatternInformationOfRegion ( Region  region,
PatternDots  x,
PatternDots  y,
PatternDots  width,
PatternDots  height 
)

A convenience function for mapping a contiguous (single-tile) patterned area to a region object.

Parameters:
region 
x 
y 
width 
height 

Definition at line 295 of file PatternLocationToSheetLocationMapping.java.

References Region.getName(), Units.getValue(), and PatternLocationToSheetLocationMapping.setPatternInformationOfRegion().

void setPatternInformationOfRegion ( Region  r,
PatternCoordinateConverter  coordinateInfo 
)

For a region on our sheet, update the coordinate information so that it can be accessed at runtime by our EventEngine.

The coordinateInfo object will translate incoming samples to coordinates relative to the region.

Parameters:
r 
coordinateInfo 

Definition at line 274 of file PatternLocationToSheetLocationMapping.java.

References Sheet.containsRegion().

Referenced by PatternLocationToSheetLocationMapping.setPatternInformationOfRegion().

void setSheet ( Sheet  s  ) 

Parameters:
s 

Definition at line 305 of file PatternLocationToSheetLocationMapping.java.

SuppressWarnings ( "unchecked"   )  [package]

On Nov 9, 2006, I changed this to use the interface.

.. I'll need to run some regression tests to make sure I didn't break anything.

Parameters:
xmlFile 

Definition at line 212 of file PatternLocationToSheetLocationMapping.java.

String toString (  ) 

See also:
java.lang.Object.toString()

Definition at line 312 of file PatternLocationToSheetLocationMapping.java.


The documentation for this class was generated from the following file:
Generated on Sat Apr 14 18:21:42 2007 for R3 Paper Toolkit by  doxygen 1.4.7