com.tensegrity.composite.geometry
Interface GeometryDescriptorItem

All Known Implementing Classes:
DefaultGeometryDescriptorItem

public interface GeometryDescriptorItem

A GeometryDescriptorItem represents the first level of GeometryItem (aka "basic item") reuse. This interface exists because basic items will be referenced by one or more composites. Moreover, basic items do not specify any coordinate data for the objects that aggregate and draw them. This makes perfect sense. A composite will need to position basic items relative to one another. In most cases, drawing individual items in the context of a composite will not always begin in the upper left-hand corner of a composite's coordinate system.

To make things perfectly clear, a GeometryDescriptorItem represents an association between a single GeometryItem (atomic geometry, basic item) and a single GeometryDescriptor. A GeometryDescriptorItem element is embedded inside a <DescriptorItem> tag inside the geometry.xml configuration file.

Each and every GeometryDescriptorItem references a particular GeometryItem by name and includes additional coordinate data inside one or more child <attribute> tags.

Every GeometryDescriptorItem, embedded inside a parent GeometryDescriptor element, consists of its unique name, the name of the referenced GeometryItem as well the drawing coordinates within the composite.

A minimal specification for a GeometryDescriptorItem is this:

 <!-- a minimal geometry descriptor -->
 <list name="DescriptorItem">
  <attribute name="Name" value="GEOMETRY_DESCRIPTOR_ITEM_NAME"/>
  <attribute name="GeometryItemName" value="REFERENCED_GEOMETRY_ITEM_NAME"/>
  <list name="Coordinates">
   <attribute name="Coordinate" value="X_COMPONENT, Y_COMPONENT"/>
   <attribute name="Coordinate" value="X_COMPONENT, Y_COMPONENT"/>
 [...]
 

A single coordinate of a GeometryDescriptorItem specifies a single point of the basic graphical object it represents. Such a coordinate is defined in form of an attribute whose value represents the coordinate value. The definition looks like this:

 <attribute name="Coordinate" value="X_COMPONENT, Y_COMPONENT" />
 
As you can see, the attribute contains two values separated by a comma. The first value part holds the value for X and the second value part holds the value for Y. A well-defined coordinate would therefore look like this:
 <attribute name="Coordinate" value="100, 100" />
 
The coordinates of a GeometryDescriptorItem are given in the units of the GeometryDescriptor that contains it.

Version:
$Id: GeometryDescriptorItem.java,v 1.11 2005/06/10 08:26:39 AndreasEbbert Exp $
Author:
MichaelKegel
See Also:
GeometryDescriptor, GeometryItem

Method Summary
 AttributeSet getAttributes()
          Returns an AttributeSet that holds the various attributes of this GeometryDescriptorItem.
 GeometryItemCoordinates getCoordinates()
          Returns the coordinates of this descriptor-item.
 AttributeSet getHints()
          Returns an AttributeSet that holds the geometrical hints provides by the GeometryDescriptorItem.
 GeometryItem getItem()
          Returns the GeometryItem belonging to this descriptor.
 java.lang.String getItemName()
           
 java.lang.String getName()
          Returns the name of this GeometryDescriptorItem.
 int getType()
          Returns the type of the GeometryDescriptorItem.
 boolean hasHints()
          Returns a boolean that indicates whether the GeometryDescriptorItem provides geometrical hints or not.
 

Method Detail

getType

public int getType()
Returns the type of the GeometryDescriptorItem. The type of a GeometryDescriptorItem identifies the item.

Returns:
an int specifying the type. Possible values are defined in GeometryItem.
See Also:
GeometryItem

getName

public java.lang.String getName()
Returns the name of this GeometryDescriptorItem.

Returns:
the name of this GeometryDescriptorItem.

getItemName

public java.lang.String getItemName()

getItem

public GeometryItem getItem()
Returns the GeometryItem belonging to this descriptor.

Returns:
the GeometryItem belonging to this descriptor.

getCoordinates

public GeometryItemCoordinates getCoordinates()
Returns the coordinates of this descriptor-item.

Returns:
the coordinates of this descriptor-item.

getAttributes

public AttributeSet getAttributes()
Returns an AttributeSet that holds the various attributes of this GeometryDescriptorItem. If no attributes are assigned to the GeometryDescriptorItem the return value is null.

Returns:
an AttributeSet holding the various attributes of this GeometryDescriptorItem or null.

hasHints

public boolean hasHints()
Returns a boolean that indicates whether the GeometryDescriptorItem provides geometrical hints or not.

Returns:
boolean flag that indicates whether geometrical hints are provided or not

getHints

public AttributeSet getHints()
Returns an AttributeSet that holds the geometrical hints provides by the GeometryDescriptorItem.

Returns:
AttributeSet the geometrical hints


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.