edu.stanford.hci.r3.paper
Class Sheet

java.lang.Object
  extended by edu.stanford.hci.r3.paper.Sheet
Direct Known Subclasses:
PDFSheet, XMLSheet

public class Sheet
extends java.lang.Object

Represents one sheet of interactive/augmented paper. This sheet can be large (like a GIGAprint) or it can be smaller, like an 8.5x11" print.

The Sheet can be rendered in many different contexts. It can be rendered to a PDF/PS file, or printed to a Java2D printer. It can also be rendered to the screen for a quick preview. Each of these options has different advantages/disadvantages. For example, when rendering to the screen or Java2D, no dot pattern is drawn by default. This is because doing so would be inefficient.

The dimensions of the sheet is kept in Units objects, and is only normalized (usually to Points) when necessary (i.e., when rendering a PDF).

On Coordinate Systems: To maintain the analogue with GUI development, we will choose the origin (0,0) to be the top-left corner of the document (I can hear the screams of PDF/Postscript enthusiasts already--I'm sorry). We will make it easy to flip the coordinate systems to a more Postscript-friendly way later. Possibly, we'll have a call like setCoordinateSystem(GUI | POSTSCRIPT).

This software is distributed under the BSD License.


Constructor Summary
Sheet()
          Defaults to US Letter.
Sheet(double widthInches, double heightInches)
          A convenience method for our American friends.
Sheet(Units w, Units h)
          Choose your own units.
 
Method Summary
 void addConfigurationPath(java.io.File configPath)
           
 void addRegion(Region r)
           
 void addRegion(Region r, Units xOffset, Units yOffset)
           
 void addRegions(java.io.File regionConfigurationFile)
          This file must be an XStream-serialized RegionConfiguration object.
 boolean containsRegion(Region r)
           
 java.util.Set<java.io.File> getConfigurationPaths()
           
 Units getHeight()
           
 java.lang.String getName()
           
 Application getParentApplication()
           
 PatternLocationToSheetLocationMapping getPatternLocationToSheetLocationMapping()
           
 PatternLocationToSheetLocationMapping getPatternLocationToSheetLocationMapping(java.io.File patternInfoFile)
          A convenience function for applying a pattern information file (created when the PDF is rendered).
 Region getRegion(java.lang.String regionName)
           
 java.util.List<java.lang.String> getRegionNames()
           
 Coordinates getRegionOffset(Region r)
           
 java.util.List<Region> getRegions()
           
 SheetRenderer getRenderer()
           
 Size getSize()
           
 Units getWidth()
           
 void setName(java.lang.String n)
           
 void setParentApplication(Application application)
           
 void setPatternLocationToSheetLocationMapping(PatternLocationToSheetLocationMapping mapping)
          Pass in a mapping object, that can be created by passing in this Sheet object to a new PatternLocationToSheetLocationMapping object, with an optional pattern info file.
 void setRegionOffset(Region r, Units xOffset, Units yOffset)
           
protected  void setSize(Units width, Units height)
           
 java.lang.String toDetailedString()
           
 java.lang.String toString()
           
 java.lang.String toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Sheet

public Sheet()
Defaults to US Letter.


Sheet

public Sheet(double widthInches,
             double heightInches)
A convenience method for our American friends. =)

Parameters:
widthInches -
heightInches -

Sheet

public Sheet(Units w,
             Units h)
Choose your own units.

Parameters:
width -
height -
Method Detail

addConfigurationPath

public void addConfigurationPath(java.io.File configPath)
Parameters:
configPath - a directory that we should be aware of, for automatically loading things such as the patternInfo.xml file.

addRegion

public void addRegion(Region r)
Parameters:
r - a region to be added to this sheet.

addRegion

public void addRegion(Region r,
                      Units xOffset,
                      Units yOffset)
Parameters:
r -
xOffset - from the top left corner of the sheet
yOffset - from the top left corner of the sheet

addRegions

public void addRegions(java.io.File regionConfigurationFile)
This file must be an XStream-serialized RegionConfiguration object. This can be produced by hand, programmatically, or by the R3 Acrobat plugin.

Parameters:
regionConfigurationFile - read in this file and add all the regions to this Sheet.

containsRegion

public boolean containsRegion(Region r)
Parameters:
r -
Returns:
whether this sheet contains a given region r.

getConfigurationPaths

public java.util.Set<java.io.File> getConfigurationPaths()
Returns:
directories to look in for files like the patterned pdf, patternInfo.xml, or regions.xml files.

getHeight

public Units getHeight()
Returns:
the height of this sheet.

getName

public java.lang.String getName()
Returns:

getPatternLocationToSheetLocationMapping

public PatternLocationToSheetLocationMapping getPatternLocationToSheetLocationMapping()
Returns:
only one of these per any sheet.

getPatternLocationToSheetLocationMapping

public PatternLocationToSheetLocationMapping getPatternLocationToSheetLocationMapping(java.io.File patternInfoFile)
A convenience function for applying a pattern information file (created when the PDF is rendered). Note that if a pattern mapping object already exists for this sheet, it will be overwritten by this method!

Parameters:
patternInfoFile -
Returns:

getRegion

public Region getRegion(java.lang.String regionName)
Parameters:
regionName - This will only work if the names are unique.
Returns:
the region with this name...

getRegionNames

public java.util.List<java.lang.String> getRegionNames()
Returns:

getRegionOffset

public Coordinates getRegionOffset(Region r)
Parameters:
r - if it doesn't exist, that implies a 0,0 offset.
Returns:

getRegions

public java.util.List<Region> getRegions()
Returns:
the internal list of regions

getRenderer

public SheetRenderer getRenderer()
Returns:
a new Renderer for this object.

getSize

public Size getSize()
Returns:
a copy of the Size object (so you can't modify the size of this sheet)

getWidth

public Units getWidth()
Returns:

setName

public void setName(java.lang.String n)
Parameters:
n -

setPatternLocationToSheetLocationMapping

public void setPatternLocationToSheetLocationMapping(PatternLocationToSheetLocationMapping mapping)
Pass in a mapping object, that can be created by passing in this Sheet object to a new PatternLocationToSheetLocationMapping object, with an optional pattern info file. You can even create such an object manually (experts only). See the PatternLocationToSheetLocationMapping object.


setRegionOffset

public void setRegionOffset(Region r,
                            Units xOffset,
                            Units yOffset)
Parameters:
r -
xOffset -
yOffset -

setSize

protected void setSize(Units width,
                       Units height)
Parameters:
width -
height -

toDetailedString

public java.lang.String toDetailedString()
Returns:

toString

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

toXML

public java.lang.String toXML()
Returns:

setParentApplication

public void setParentApplication(Application application)

getParentApplication

public Application getParentApplication()

Copyright 2006 Stanford University