com.tensegrity.composite.geometry
Class GeometryService

java.lang.Object
  extended bycom.tensegrity.composite.geometry.GeometryService

public class GeometryService
extends java.lang.Object

This class contains static methods that are useful when dealing with geometry-definitions. Method loadGeometriesFromResource loads a geometry XML file. The various get-methods can be used to retrieve the attributes defined in this file.

Version:
$Id: GeometryService.java,v 1.49 2006/05/30 10:17:56 BurkhardWick Exp $
Author:
MichaelKegel

Method Summary
static BaseComposite createElementFromItem(GeometryDescriptorItem item)
          Returns a BaseComposite that is build from the given GeometryDescriptorItem.
static Primitive createPrimitiveFromItem(GeometryDescriptorItem item)
          Returns a Primitive that is build from the given GeometryDescriptorItem.
static GeometryItemProvider getGeometryItemProvider()
           
static AttributeSet getItemAttributes(int itemType)
          Returns an AttributeSet that contains attributes for the specified itemType.
static int getItemID(java.lang.String itemName)
          Returns the corresponding id to the given itemName.
static java.lang.String getItemName(int itemID)
          Returns the name of the specified item.
static void loadGeometriesFromResource(java.lang.String filename, java.lang.Class resourceclass)
          Loads the geometry definitions from the given file.
static void loadGeometriesFromResource(java.lang.String filename, java.lang.Class resourceclass, boolean overwriteExisting)
          Loads the geometry definitions from the given file.
static void registerGeometryItemProvider(GeometryItemProvider provider)
           
static void registerItem(int itemID, java.lang.String name)
          Combines the given itemID with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

registerItem

public static final void registerItem(int itemID,
                                      java.lang.String name)
Combines the given itemID with the given name.

Parameters:
itemID - the id to register.
name - the name to register the id with.

registerGeometryItemProvider

public static final void registerGeometryItemProvider(GeometryItemProvider provider)

getGeometryItemProvider

public static final GeometryItemProvider getGeometryItemProvider()

getItemName

public static final java.lang.String getItemName(int itemID)
Returns the name of the specified item.

Parameters:
itemID - the id to look up the name for.
Returns:
the name of the specified item.

loadGeometriesFromResource

public static final void loadGeometriesFromResource(java.lang.String filename,
                                                    java.lang.Class resourceclass)
                                             throws ReadException,
                                                    XMLParseException
Loads the geometry definitions from the given file. The filename must be relative to the given resource class.

Parameters:
filename - the relative filename.
resourceclass - the resource class.
Throws:
ReadException
XMLParseException

loadGeometriesFromResource

public static final void loadGeometriesFromResource(java.lang.String filename,
                                                    java.lang.Class resourceclass,
                                                    boolean overwriteExisting)
                                             throws ReadException,
                                                    XMLParseException
Loads the geometry definitions from the given file. The filename must be relative to the given resource class.

Parameters:
filename - the relative filename.
resourceclass - the resource class.
overwriteExisting - overwrites existing definitions while loading new
Throws:
ReadException
XMLParseException

getItemID

public static final int getItemID(java.lang.String itemName)
Returns the corresponding id to the given itemName.

Parameters:
itemName - the name for which to look up the id.
Returns:
the corresponding id to the given itemName.

getItemAttributes

public static final AttributeSet getItemAttributes(int itemType)
Returns an AttributeSet that contains attributes for the specified itemType.

Parameters:
itemType - the type to retrieve the AttributeSet for.
Returns:
an AttributeSet for the given type.

createPrimitiveFromItem

public static final Primitive createPrimitiveFromItem(GeometryDescriptorItem item)
                                               throws GeometryItemCreationException
Returns a Primitive that is build from the given GeometryDescriptorItem.

Parameters:
item - the GeometryDescriptorItem for the Primitve.
Returns:
a Primitive that is build from the given GeometryDescriptorItem.
Throws:
GeometryItemCreationException - if the Primitive can not be build.

createElementFromItem

public static final BaseComposite createElementFromItem(GeometryDescriptorItem item)
                                                 throws GeometryItemCreationException
Returns a BaseComposite that is build from the given GeometryDescriptorItem.

Parameters:
item - the GeometryDescriptorItem for the BaseComposite.
Returns:
a BaseComposite that is build from the given GeometryDescriptorItem.
Throws:
GeometryItemCreationException - if the BaseComposite can not be build.


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