com.tensegrity.composite.util
Class CompositeHierarchyUtilities

java.lang.Object
  extended bycom.tensegrity.composite.util.CompositeHierarchyUtilities

public class CompositeHierarchyUtilities
extends java.lang.Object

Class CompositeHierarchyUtilities contains some utility functions that will ease your life if you ever have to deal with transformations from or to Composite instances.

Version:
$Id: CompositeHierarchyUtilities.java,v 1.40 2005/09/24 17:37:06 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
static int CRITERION_NONE
          Constants to specify the criterion.
static int CRITERION_X1
          Constants to specify the criterion.
static int CRITERION_X2
          Constants to specify the criterion.
static int CRITERION_XCENTER
          Constants to specify the criterion.
static int CRITERION_Y1
          Constants to specify the criterion.
static int CRITERION_Y2
          Constants to specify the criterion.
static int CRITERION_YCENTER
          Constants to specify the criterion.
static int HIERARCHY_ADDED_ORDER
          Constants to specify the order
static int HIERARCHY_DRAWING_ORDER
          Constants to specify the order
static int HIERARCHY_EXCLUDES_COMPOSITE_LINES
          Constants to specify the exclusion mode
static int HIERARCHY_EXCLUDES_FOLDED_GROUPS
          Constants to specify the exclusion mode
static int HIERARCHY_EXCLUDES_NONE
          Constants to specify the exclusion mode
static int HIERARCHY_SELECTION_ORDER
          Constants to specify the order
static int TRANSFORM_FROM_COMPOSITE_TO_VIEW
          Vice versa, apart from the direction same as TRANSFORM_FROM_VIEW_TO_COMPOSITE.
static int TRANSFORM_FROM_CONTAINER_TO_VIEW
          Vice versa, but apart from the direction same as TRANSFORM_FROM_VIEW_TO_CONTAINER.
static int TRANSFORM_FROM_VIEW_TO_COMPOSITE
          The transformation is done using the (Composite)View as the starting point and the first appearing Composite in the path as the end-point.
static int TRANSFORM_FROM_VIEW_TO_CONTAINER
          The transformation is done using the View as the starting point and the first appearing (BaseComposite)Container object in the path as the end-point.
 
Method Summary
static java.util.Collection buildCollectionFromHierarchy(CompositeHierarchy hierarchy)
           
static CompositeHierarchy buildCompleteHierarchy(CompositeGroup compositegroup, int type)
          Return the CompositeHierarchy of type type for the given CompositeGroup.
static CompositeHierarchy buildCompleteHierarchy(CompositeView compositeview, int type)
          Returns the complete CompositeHierarchy of type type for the given CompositeView.
static CompositeHierarchy buildLeveledHierarchy(CompositeGroup compositegroup, int type, int maxlevel)
          Return the CompositeHierarchy of type type up to level maxlevel for the given CompositeGroup.
static CompositeHierarchy buildLeveledSelectionHierarchy(CompositeGroup compositegroup, int type, int maxlevel)
          Return the CompositeHierarchy of type type up to level maxlevel for the given CompositeGroup.
static CompositeHierarchy buildLeveledSelectionHierarchy(CompositeView compositeview, int type, int maxlevel)
          Return the CompositeHierarchy of type type up to level maxlevel for the given CompositeGroup.
static Transform2D buildTransformation(CompositeHierarchyPath hierarchypath, int type)
          Returns the transformation of type type for the given CompositeHierarchyPath.
static java.util.Map buildTransformationMap(CompositeHierarchy hierarchy, int type)
          Returns a map containing all transforms of the given CompositeHierarchy.
static void dumpHierarchy(CompositeHierarchy hierarchy, java.io.PrintStream ps)
          Dumps the given CompositeHierarchy to the specified PrintStream.
static void dumpHierarchyPath(CompositeHierarchyPath path, java.io.PrintStream ps)
          Dumps the given CompositeHierarchyPath to the specified PrintStream.
static CompositeHierarchyPath findCompositeHierarchyAt(CompositeView compositeview, int x, int y)
          Returns the CompositeHierarchyPath found int the specified CompositeView at location (x, y).
static CompositeHierarchyPath findCompositeHierarchyAt(CompositeView compositeview, int x, int y, java.lang.Class[] instanceclass)
          Returns the CompositeHierarchyPath found int the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchy findSelectionHierarchy(CompositeView compositeview)
          Return the CompositeHierarchyPath for the current selection in the given CompositeView.
static CompositeHierarchyPath findSingleSelectionHierarchyPath(CompositeView compositeview)
          Return the CompositeHierarchyPath for the current selection in the given CompositeView.
static CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview, int x, int y, boolean checkInvisible, java.lang.Class[] instanceclass)
          Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview, int x, int y, boolean checkInvisible, java.lang.Class[] instanceclass, boolean includeExternalPrimitives)
          Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview, int x, int y, boolean checkInvisible, java.lang.Class[] instanceclass, boolean includeExternalPrimitives, boolean ignoreSelected)
          Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview, int x, int y, boolean checkInvisible, java.lang.Class[] instanceclass, boolean includeExternalPrimitives, boolean ignoreSelected, int minLabelWidth, int minLabelHeight)
          Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview, int x, int y, boolean checkInvisible, java.lang.Class[] instanceclass, boolean includeExternalPrimitives, int minLabelWidth, int minLabelHeight)
          Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview, int x, int y, boolean checkInvisible, java.lang.Class[] instanceclass, int minLabelWidth, int minLabelHeight)
          Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.
static CompositeHierarchyPath getCompositeHierarchyFor(BaseComposite bcomposite)
          Returns the CompositeHierarchyPath found int the specified BaseComposite.
static void sortHierarchyToLocation(CompositeHierarchy hierarchy, int primarySortCriterion, boolean primaryAscending)
          Sorts the given CompositeHierarchy under consideration of the given sort criteria and -ascending.
static void sortHierarchyToLocation(CompositeHierarchy hierarchy, int primarySortCriterion, boolean primaryAscending, int secondarySortCriterion, boolean secondaryAscending)
          Sorts the given CompositeHierarchy under consideration of the given sort criterias and -ascendings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIERARCHY_EXCLUDES_NONE

public static final int HIERARCHY_EXCLUDES_NONE
Constants to specify the exclusion mode

See Also:
Constant Field Values

HIERARCHY_EXCLUDES_COMPOSITE_LINES

public static final int HIERARCHY_EXCLUDES_COMPOSITE_LINES
Constants to specify the exclusion mode

See Also:
Constant Field Values

HIERARCHY_EXCLUDES_FOLDED_GROUPS

public static final int HIERARCHY_EXCLUDES_FOLDED_GROUPS
Constants to specify the exclusion mode

See Also:
Constant Field Values

HIERARCHY_ADDED_ORDER

public static final int HIERARCHY_ADDED_ORDER
Constants to specify the order

See Also:
Constant Field Values

HIERARCHY_DRAWING_ORDER

public static final int HIERARCHY_DRAWING_ORDER
Constants to specify the order

See Also:
Constant Field Values

HIERARCHY_SELECTION_ORDER

public static final int HIERARCHY_SELECTION_ORDER
Constants to specify the order

See Also:
Constant Field Values

TRANSFORM_FROM_VIEW_TO_COMPOSITE

public static final int TRANSFORM_FROM_VIEW_TO_COMPOSITE
The transformation is done using the (Composite)View as the starting point and the first appearing Composite in the path as the end-point.

See Also:
Constant Field Values

TRANSFORM_FROM_COMPOSITE_TO_VIEW

public static final int TRANSFORM_FROM_COMPOSITE_TO_VIEW
Vice versa, apart from the direction same as TRANSFORM_FROM_VIEW_TO_COMPOSITE.

See Also:
Constant Field Values

TRANSFORM_FROM_VIEW_TO_CONTAINER

public static final int TRANSFORM_FROM_VIEW_TO_CONTAINER
The transformation is done using the View as the starting point and the first appearing (BaseComposite)Container object in the path as the end-point.

See Also:
Constant Field Values

TRANSFORM_FROM_CONTAINER_TO_VIEW

public static final int TRANSFORM_FROM_CONTAINER_TO_VIEW
Vice versa, but apart from the direction same as TRANSFORM_FROM_VIEW_TO_CONTAINER.

See Also:
Constant Field Values

CRITERION_NONE

public static final int CRITERION_NONE
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values

CRITERION_X1

public static final int CRITERION_X1
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values

CRITERION_X2

public static final int CRITERION_X2
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values

CRITERION_Y1

public static final int CRITERION_Y1
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values

CRITERION_Y2

public static final int CRITERION_Y2
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values

CRITERION_XCENTER

public static final int CRITERION_XCENTER
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values

CRITERION_YCENTER

public static final int CRITERION_YCENTER
Constants to specify the criterion. Used by method sortHierarchyToLocation.

See Also:
Constant Field Values
Method Detail

sortHierarchyToLocation

public static final void sortHierarchyToLocation(CompositeHierarchy hierarchy,
                                                 int primarySortCriterion,
                                                 boolean primaryAscending)
Sorts the given CompositeHierarchy under consideration of the given sort criteria and -ascending.

Parameters:
hierarchy - CompositeHierarchy to sort.
primarySortCriterion - the primary sort criteria.
primaryAscending - indicating whether the primary sort sequence is ascending.

sortHierarchyToLocation

public static final void sortHierarchyToLocation(CompositeHierarchy hierarchy,
                                                 int primarySortCriterion,
                                                 boolean primaryAscending,
                                                 int secondarySortCriterion,
                                                 boolean secondaryAscending)
Sorts the given CompositeHierarchy under consideration of the given sort criterias and -ascendings.

Parameters:
hierarchy - CompositeHierarchy to sort.
primarySortCriterion - the primary sort criteria.
primaryAscending - indicating whether the primary sort sequence is ascending.
secondarySortCriterion - the secondary sort criteria.
secondaryAscending - indicating whether the primary sort sequence is ascending.

buildCollectionFromHierarchy

public static final java.util.Collection buildCollectionFromHierarchy(CompositeHierarchy hierarchy)

buildTransformationMap

public static final java.util.Map buildTransformationMap(CompositeHierarchy hierarchy,
                                                         int type)
Returns a map containing all transforms of the given CompositeHierarchy.

Parameters:
hierarchy - the CompositeHierarchy to retrieve the transforms for.
type - the type of the transformations.
Returns:
a map containing all transforms of the given CompositeHierarchy.

buildTransformation

public static final Transform2D buildTransformation(CompositeHierarchyPath hierarchypath,
                                                    int type)
Returns the transformation of type type for the given CompositeHierarchyPath.

Parameters:
hierarchypath - the CompositeHierarchyPath to retrieve the Tranform2D of the given type for.
type - the type of the transformation to return.
Returns:
the transformation of type type for the given CompositeHierarchyPath.

buildCompleteHierarchy

public static final CompositeHierarchy buildCompleteHierarchy(CompositeView compositeview,
                                                              int type)
Returns the complete CompositeHierarchy of type type for the given CompositeView.

Parameters:
compositeview - the CompositeView to retrieve the CompositeHierarchy for.
type - the type of build; valid values are HIERARCHY_EXCLUDES_NONE and HIERARCHY_EXCLUDES_COMPOSITE_LINES.
Returns:
the complete CompositeHierarchy of type type for the given CompositeView.

buildCompleteHierarchy

public static final CompositeHierarchy buildCompleteHierarchy(CompositeGroup compositegroup,
                                                              int type)
Return the CompositeHierarchy of type type for the given CompositeGroup.

Parameters:
compositegroup - CompositeGroup to examine.
type - the type the CompositeHierarchy to build. Valid values are HIERARCHY_EXCLUDES_NONE and HIERARCHY_EXCLUDES_COMPOSITE_LINES.
Returns:
the found CompositeHierarchy.

buildLeveledHierarchy

public static final CompositeHierarchy buildLeveledHierarchy(CompositeGroup compositegroup,
                                                             int type,
                                                             int maxlevel)
Return the CompositeHierarchy of type type up to level maxlevel for the given CompositeGroup.

Parameters:
compositegroup - the CompositeGroup to examine.
type - the type to look up.
maxlevel - up to this level we go.
Returns:
the found CompositeHierarchy.

buildLeveledSelectionHierarchy

public static final CompositeHierarchy buildLeveledSelectionHierarchy(CompositeView compositeview,
                                                                      int type,
                                                                      int maxlevel)
Return the CompositeHierarchy of type type up to level maxlevel for the given CompositeGroup. Only the currently selected BaseComposites are added to the hierarchy.

Parameters:
type - the type to look up.
maxlevel - up to this level we go.
Returns:
the found CompositeHierarchy.

buildLeveledSelectionHierarchy

public static final CompositeHierarchy buildLeveledSelectionHierarchy(CompositeGroup compositegroup,
                                                                      int type,
                                                                      int maxlevel)
Return the CompositeHierarchy of type type up to level maxlevel for the given CompositeGroup. Only the currently selected BaseComposites are added to the hierarchy.

Parameters:
compositegroup - the CompositeGroup to examine.
type - the type to look up.
maxlevel - up to this level we go.
Returns:
the found CompositeHierarchy.

findSelectionHierarchy

public static final CompositeHierarchy findSelectionHierarchy(CompositeView compositeview)
Return the CompositeHierarchyPath for the current selection in the given CompositeView.

Parameters:
compositeview - the CompositeView to examine.
Returns:
the found CompositeHierarchyPath.

findSingleSelectionHierarchyPath

public static final CompositeHierarchyPath findSingleSelectionHierarchyPath(CompositeView compositeview)
Return the CompositeHierarchyPath for the current selection in the given CompositeView.

Parameters:
compositeview - the CompositeView to examine.
Returns:
the found CompositeHierarchyPath; null, if nothing or more than one element is selected.

getCompositeHierarchyFor

public static final CompositeHierarchyPath getCompositeHierarchyFor(BaseComposite bcomposite)
Returns the CompositeHierarchyPath found int the specified BaseComposite.

Parameters:
bcomposite - the BaseComposite examine.
Returns:
the found CompositeHierarchyPath, might be empty.

findCompositeHierarchyAt

public static final CompositeHierarchyPath findCompositeHierarchyAt(CompositeView compositeview,
                                                                    int x,
                                                                    int y)
Returns the CompositeHierarchyPath found int the specified CompositeView at location (x, y).

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
Returns:
the found CompositeHierarchyPath, might be empty.

findCompositeHierarchyAt

public static final CompositeHierarchyPath findCompositeHierarchyAt(CompositeView compositeview,
                                                                    int x,
                                                                    int y,
                                                                    java.lang.Class[] instanceclass)
Returns the CompositeHierarchyPath found int the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
Returns:
the found CompositeHierarchyPath, might be empty.

findZOrderedBaseCompositeHierarchyAt

public static final CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview,
                                                                                int x,
                                                                                int y,
                                                                                boolean checkInvisible,
                                                                                java.lang.Class[] instanceclass,
                                                                                int minLabelWidth,
                                                                                int minLabelHeight)
Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
minLabelWidth - The minimum size for labels, the boundary of a label will automatically be resized to this for hit checking. Pass 0 to disable this.
minLabelHeight - The minimum size for labels, the boundary of a label will automatically be resized to this for hit checking. Pass 0 to disable this.
Returns:
the found CompositeHierarchyPath, might be empty.

findZOrderedBaseCompositeHierarchyAt

public static final CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview,
                                                                                int x,
                                                                                int y,
                                                                                boolean checkInvisible,
                                                                                java.lang.Class[] instanceclass)
Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
Returns:
the found CompositeHierarchyPath, might be empty.

findZOrderedBaseCompositeHierarchyAt

public static final CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview,
                                                                                int x,
                                                                                int y,
                                                                                boolean checkInvisible,
                                                                                java.lang.Class[] instanceclass,
                                                                                boolean includeExternalPrimitives)
Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
Returns:
the found CompositeHierarchyPath, might be empty.

findZOrderedBaseCompositeHierarchyAt

public static final CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview,
                                                                                int x,
                                                                                int y,
                                                                                boolean checkInvisible,
                                                                                java.lang.Class[] instanceclass,
                                                                                boolean includeExternalPrimitives,
                                                                                int minLabelWidth,
                                                                                int minLabelHeight)
Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
minLabelWidth - The minimum size for labels, the boundary of a label will automatically be resized to this for hit checking. Pass 0 to disable this.
minLabelHeight - The minimum size for labels, the boundary of a label will automatically be resized to this for hit checking. Pass 0 to disable this.
Returns:
the found CompositeHierarchyPath, might be empty.

findZOrderedBaseCompositeHierarchyAt

public static final CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview,
                                                                                int x,
                                                                                int y,
                                                                                boolean checkInvisible,
                                                                                java.lang.Class[] instanceclass,
                                                                                boolean includeExternalPrimitives,
                                                                                boolean ignoreSelected)
Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
Returns:
the found CompositeHierarchyPath, might be empty.

findZOrderedBaseCompositeHierarchyAt

public static final CompositeHierarchyPath findZOrderedBaseCompositeHierarchyAt(CompositeView compositeview,
                                                                                int x,
                                                                                int y,
                                                                                boolean checkInvisible,
                                                                                java.lang.Class[] instanceclass,
                                                                                boolean includeExternalPrimitives,
                                                                                boolean ignoreSelected,
                                                                                int minLabelWidth,
                                                                                int minLabelHeight)
Returns the CompositeHierarchyPath found in the specified CompositeView at location (x, y) that matches the class given by instanceclass.

Parameters:
compositeview - the CompositeView examine.
x - the x-coordinate of the location to search.
y - the y-coordinate of the location to search.
instanceclass - the classes the returned composite must be a type of
minLabelWidth - The minimum size for labels, the boundary of a label will automatically be resized to this for hit checking. Pass 0 to disable this.
minLabelHeight - The minimum size for labels, the boundary of a label will automatically be resized to this for hit checking. Pass 0 to disable this.
Returns:
the found CompositeHierarchyPath, might be empty.

dumpHierarchy

public static final void dumpHierarchy(CompositeHierarchy hierarchy,
                                       java.io.PrintStream ps)
Dumps the given CompositeHierarchy to the specified PrintStream.

Parameters:
hierarchy - the CompositeHierarchy to dump out.
ps - the PrintStream to dump to.

dumpHierarchyPath

public static final void dumpHierarchyPath(CompositeHierarchyPath path,
                                           java.io.PrintStream ps)
Dumps the given CompositeHierarchyPath to the specified PrintStream.

Parameters:
path - the CompositeHierarchyPath to dump out.
ps - the PrintStream to dump to.


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