PenProfile 2.x

com.livescribe.penlet
Class RegionCollection

java.lang.Object
  extended by com.livescribe.penlet.RegionCollection

public final class RegionCollection
extends Object

The RegionCollection class enables the manipulation of your regions on a page associated with the application.


Method Summary
 Region addBitmapRegion(Shape shape, Region region, int cellWidth, int cellHeight)
          Adds a Bitmap region to the current page.
 Region addRegion(Shape shape, Region region)
          Adds a region to this collection and maps the given physical shape to the added region.
 Region addRegion(Shape shape, Region region, boolean storeStrokes)
          Deprecated. Use addRegion(Shape, Region).
 boolean getBitmapRegionCellState(Region region, int cellX, int cellY)
          Gets the state of a cell in the bitmap region (true = on, false = off) Note that this function will fail if the region is not referring to a bitmap region.
 Rectangle getBoundingBox(Region region)
          Gets the bounding box of the Region.
 Region getFirstRegion(int areaId)
          Gets the first Region for the area identifier passed.
 Shape getShape(Region region)
          Lets the user obtain a Shape object that corresponds to the region stored by the system.
 boolean isOverlappingExistingArea(Shape shape)
          Deprecated. use isOverlappingExistingRegion(Shape)
 boolean isOverlappingExistingRegion(Shape shape)
          Checks whether the supplied Shape object overlaps any region present in this collection.
 void removeAllRegions()
          Removes all the regions.
 boolean removeRegion(Region region)
          Removes the region from the collection.
 void setBitmapRegionCellState(Region region, int cellX, int cellY, boolean state)
          Paints a grid cell to the state (true = on, false = off).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addRegion

public Region addRegion(Shape shape,
                        Region region)
Adds a region to this collection and maps the given physical shape to the added region. The Z-order and instance ID of the region may be modified.

When a region is registered, it becomes possible to receive different events occurring within that region. For example, a region-enter event will be generated if the user taps within the shape defining the new region.

This returns a reference to the given Region object.

Parameters:
shape - map this physical shape to the region
region - the region to be added.
Returns:
a reference to the added region.

addRegion

public Region addRegion(Shape shape,
                        Region region,
                        boolean storeStrokes)
Deprecated. Use addRegion(Shape, Region).

This method ignores the storeStrokes parameter. Note that the region object may have its Z-order and instance ID modified.

Parameters:
shape - the physical shape to map to the region
region - the region to be added
storeStrokes - whether to store strokes in this region, ignored
Returns:
the reference to the added region.

addBitmapRegion

public Region addBitmapRegion(Shape shape,
                              Region region,
                              int cellWidth,
                              int cellHeight)
Adds a Bitmap region to the current page. A bitmap region is a specific type of region that allows the user to paint the cells on and off.

Parameters:
shape - represented by a Shape object.
region - the region to be added.
cellWidth - the width in Anoto units of the cells
cellHeight - the height in Anoto units of the cells strokes made inside the area.
Returns:
the reference to the added region. The returned region would have other attributes set, compared to the source region passed.
See Also:
Scale

setBitmapRegionCellState

public void setBitmapRegionCellState(Region region,
                                     int cellX,
                                     int cellY,
                                     boolean state)
Paints a grid cell to the state (true = on, false = off). Note that this function will fail if the region is not referring to a bitmap region.

Parameters:
region - unique identifier for the region to paint
cellX - cell index in horizontal direction
cellY - cell index in vertical direction
state - the state to paint on/off

getBitmapRegionCellState

public boolean getBitmapRegionCellState(Region region,
                                        int cellX,
                                        int cellY)
Gets the state of a cell in the bitmap region (true = on, false = off) Note that this function will fail if the region is not referring to a bitmap region.

Parameters:
region - unique identifier for the area to paint
cellX - cell index in horizontal direction
cellY - cell index in vertical direction
Returns:
the boolean state of the cell on/off

removeRegion

public boolean removeRegion(Region region)
Removes the region from the collection.

Parameters:
region - region to be removed from the collection.
Returns:
true if region was found and removed, false otherwise

removeAllRegions

public void removeAllRegions()
Removes all the regions.


getShape

public Shape getShape(Region region)
Lets the user obtain a Shape object that corresponds to the region stored by the system.

Parameters:
region - the region instance
Returns:
the Shape object that represent the area that was copied. Returns null if no shape was connected to the region provided.

getBoundingBox

public Rectangle getBoundingBox(Region region)
Gets the bounding box of the Region. Note that this is faster than first retrieving the shape and then getting the bounding box

Parameters:
region - region whose associated shape's bounding box should be got.
Returns:
the bounding box or null if a shape is not associated with the region

isOverlappingExistingRegion

public boolean isOverlappingExistingRegion(Shape shape)
Checks whether the supplied Shape object overlaps any region present in this collection.

Parameters:
shape - the Shape to be checked for overlap.
Returns:
true if any area in the collection overlaps the theArea, false otherwise

isOverlappingExistingArea

public boolean isOverlappingExistingArea(Shape shape)
Deprecated. use isOverlappingExistingRegion(Shape)

Checks whether the supplied Shape object overlaps any region present in this collection.

Parameters:
shape - the Shape to be checked for overlap.
Returns:
true if any area in the collection overlaps the theArea, false otherwise

getFirstRegion

public Region getFirstRegion(int areaId)
Gets the first Region for the area identifier passed.

Parameters:
areaId - the application identifier for the region.
Returns:
the region instance if a region is bound to the area id or null of none bound.

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.