Unified Typesetting API M1-20040817

de.inghuimische.uta.test
Class SimpleEmbeddingLevel

java.lang.Object
  extended byde.inghuimische.uta.test.SimpleEmbeddingLevel
All Implemented Interfaces:
Box, EmbeddingLevel

public class SimpleEmbeddingLevel
extends Object
implements EmbeddingLevel

A limited implementation of the EmbeddingLevel interface for testing purposes.

Author:
Christian Ziesemer

Field Summary
 
Fields inherited from interface de.inghuimische.uta.typeset.EmbeddingLevel
REFERENCE_NEG_X_AXIS, REFERENCE_NEG_Y_AXIS, REFERENCE_POS_X_AXIS, REFERENCE_POS_Y_AXIS
 
Constructor Summary
SimpleEmbeddingLevel(int order)
           
 
Method Summary
 void add(Item anItem)
          Adds an item to this level.
 List getAnchors()
          Returns a list of all anchors.
 List getAnchorsByClass(AnchorClass anchorClass)
          Returns a list containing only those anchors of the given type.
 Map getAttributes()
          Returns a map of key value pairs, the attributes of this box.
 Rectangle2D getBoundingBox()
          Returns the bounding box of this object containing the whole shape.
 List getItems()
          Returns the items this embedding level consists of.
 int getOrder()
          Returns the order of the embedding level.
 Shape getShape()
          Returns the shape of this box.
 AffineTransform getTransformation()
          Returns the transformation matrix associated with this box.
 Point2D getXAxis()
          Returns the orientation of the x-axis of the coordinate system used by this embedding level in relation to the reference coordinate system which has a x-axis of the orientation (1/0).
 Point2D getYAxis()
          Returns the orientation of the y-axis of the coordinate system used by this embedding level in relation to the normal coordinate system which has a y-axis of the orientation (0/1).
 void setTransformation(AffineTransform aTransformation)
          Sets the relative transformation to the previous box.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleEmbeddingLevel

public SimpleEmbeddingLevel(int order)
Method Detail

add

public void add(Item anItem)
Description copied from interface: EmbeddingLevel
Adds an item to this level. Direct or indirect back-references are not allowed.

Note: Boxes contained within the item are added to an embedding level are placed relative to the coordinate system of the embedding level.

Specified by:
add in interface EmbeddingLevel
Parameters:
anItem - The item to add.

getItems

public List getItems()
Description copied from interface: EmbeddingLevel
Returns the items this embedding level consists of.

Specified by:
getItems in interface EmbeddingLevel
Returns:
The items this embedding level consists of.

getXAxis

public Point2D getXAxis()
Description copied from interface: EmbeddingLevel
Returns the orientation of the x-axis of the coordinate system used by this embedding level in relation to the reference coordinate system which has a x-axis of the orientation (1/0). For simplicity the point can only be on of (0/1), (0/-1), (1/0), (-1/0). Note that in any case both axis must form a Cartesian coordinate system. Thus, if you specifiy (1/0) here and (0/1) as y-axis you use the same orientation as the reference system.

Specified by:
getXAxis in interface EmbeddingLevel
Returns:
The orientation of the x-axis of the coordinate system used by this embedding level.
See Also:
EmbeddingLevel.REFERENCE_POS_X_AXIS, EmbeddingLevel.REFERENCE_NEG_X_AXIS, EmbeddingLevel.REFERENCE_POS_Y_AXIS, EmbeddingLevel.REFERENCE_NEG_Y_AXIS

getYAxis

public Point2D getYAxis()
Description copied from interface: EmbeddingLevel
Returns the orientation of the y-axis of the coordinate system used by this embedding level in relation to the normal coordinate system which has a y-axis of the orientation (0/1). For simplicity the point can only be on of (0/1), (0/-1), (1/0), (-1/0). Note that in any case both axis must form a Cartesian coordinate system. Thus, if you specifiy (0/1) here and (1/0) as x-axis you use the same orientation as the reference system.

Specified by:
getYAxis in interface EmbeddingLevel
Returns:
The orientation of the y-axis of the coordinate system used by this embedding level.
See Also:
EmbeddingLevel.REFERENCE_POS_X_AXIS, EmbeddingLevel.REFERENCE_NEG_X_AXIS, EmbeddingLevel.REFERENCE_POS_Y_AXIS, EmbeddingLevel.REFERENCE_NEG_Y_AXIS

getOrder

public int getOrder()
Description copied from interface: EmbeddingLevel
Returns the order of the embedding level.

Specified by:
getOrder in interface EmbeddingLevel
Returns:
The order of the embedding level.

getAnchors

public List getAnchors()
Description copied from interface: Box
Returns a list of all anchors. A box has n anchors.

Specified by:
getAnchors in interface Box
Returns:
A list of all anchors.

getAnchorsByClass

public List getAnchorsByClass(AnchorClass anchorClass)
Description copied from interface: Box
Returns a list containing only those anchors of the given type.

Specified by:
getAnchorsByClass in interface Box
Parameters:
anchorClass - One of the anchor types defined in Anchor.
Returns:
A list containing only those anchors of the given type.

getShape

public Shape getShape()
Description copied from interface: Box
Returns the shape of this box.

In the case of a box this is simply a rectangle while other classes implementing this interface may have quite complex shapes.

Document processors may never need this method therefore implementations should care that the shape is returned on demand to save runtime/memory.

Specified by:
getShape in interface Box
Returns:
The shape of this box.

getAttributes

public Map getAttributes()
Description copied from interface: Box
Returns a map of key value pairs, the attributes of this box.

Specified by:
getAttributes in interface Box
Returns:
A map of key value pairs.

setTransformation

public void setTransformation(AffineTransform aTransformation)
Description copied from interface: Box
Sets the relative transformation to the previous box. The previous box is either a normal preceding box or the embedding level this box is placed in. In the latter case this box is the first to be placed in the embedding level and the transformation is therefore absolute to the origin of the embedding level.

Specified by:
setTransformation in interface Box
Parameters:
aTransformation - The transformation relative to the origin of the previous box.

getTransformation

public AffineTransform getTransformation()
Description copied from interface: Box
Returns the transformation matrix associated with this box. This transformation is relative to the origin.

Specified by:
getTransformation in interface Box
Returns:
The transformation matrix associated with this box.

getBoundingBox

public Rectangle2D getBoundingBox()
Description copied from interface: Box
Returns the bounding box of this object containing the whole shape. The returned rectangle therefore provides the exact dimension of the box.

Specified by:
getBoundingBox in interface Box
Returns:
The bounding box of this object.

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.