com.tensegrity.composite
Class CompositeUtilities

java.lang.Object
  extended bycom.tensegrity.composite.CompositeUtilities

public class CompositeUtilities
extends java.lang.Object

This class provides static helper methods if you need to find a nested Composite, a BaseComposite or CompositeGroups in a CompositeGroup respectively a CompositeView.

Version:
$Id: CompositeUtilities.java,v 1.30 2006/03/21 14:28:14 MichaelKegel Exp $
Author:
MichaelKegel

Method Summary
static Composite createCompositeByDescriptorName(java.lang.String geometryName, java.lang.String styleName)
          Creates a Composite instance from the given geometry and style descriptor names.
static CompositeLine createCompositeLineByDescriptorName(java.lang.String geometryName, java.lang.String styleName)
          Creates a CompositeLine instance from the given geometry and style descriptor names.
static java.lang.String drawflags2String(int drawflags)
          Returns a string representation of the specified mask that represents any combination of drawing-flags from a CompositeView instance.
static BaseComposite findDeepestBaseCompositeAt(CompositeGroup compositegroup, int x, int y)
          Returns the deepest nested BaseComposite in the given CompositeGroup at location (x, y).
static BaseComposite findDeepestBaseCompositeAt(CompositeGroup compositegroup, int x, int y, boolean includeExternalPrimitives)
          Returns the deepest nested BaseComposite in the given CompositeGroup at location (x, y).
static BaseComposite findDeepestBaseCompositeAt(CompositeGroup compositegroup, int x, int y, boolean includeExternalPrimitives, int minLabelWidth, int minLabelHeight)
          Returns the deepest nested BaseComposite in the given CompositeGroup at location (x, y).
static BaseComposite findDeepestBaseCompositeAt(CompositeView compositeview, int x, int y)
          Returns the deepest nested BaseComposite in the given CompositeView at location (x, y).
static BaseComposite findDeepestBaseCompositeAt(CompositeView compositeview, int x, int y, boolean includeExternalPrimitives)
          Returns the deepest nested BaseComposite in the given CompositeView at location (x, y).
static BaseComposite findDeepestBaseCompositeAt(CompositeView compositeview, int x, int y, boolean includeExternalPrimitives, int minLabelWidth, int minLabelHeight)
          Returns the deepest nested BaseComposite in the given CompositeView at location (x, y).
static Composite findDeepestCompositeAt(CompositeGroup compositegroup, int x, int y)
          Returns the deepest nested Composite in the given CompositeGroup at location (x, y).
static Composite findDeepestCompositeAt(CompositeGroup compositegroup, int x, int y, boolean traverseFoldedGroups)
           Returns the deepest nested Composite in the given CompositeGroup at location (x, y).
static Composite findDeepestCompositeAt(CompositeView compositeview, int x, int y)
          Returns the deepest nested Composite in the given CompositeView at location (x, y).
static Composite findDeepestCompositeAt(CompositeView compositeview, int x, int y, boolean traverseFoldedGroups)
           Returns the deepest nested Composite in the given CompositeView at location (x, y).
static CompositeGroup findDeepestCompositeGroupAt(CompositeGroup compositegroup, int x, int y)
          Returns the deepest nested CompositeGroup in the given CompositeGroup at location (x, y).
static CompositeGroup findDeepestCompositeGroupAt(CompositeView compositeview, int x, int y)
          Returns the deepest nested CompositeGroup in the given CompositeView at location (x, y).
static boolean isHit(Transform2D xForm, BaseComposite composite, int x, int y)
          Checks if the given BaseComposite is hit at the given coordinates
static boolean isHit(Transform2D xForm, BaseComposite composite, int x, int y, int minLabelWidth, int minLabelHeight)
          Checks if the given BaseComposite is hit at the given coordinates
static boolean isPrimitiveHit(BaseComposite composite, int x, int y, java.lang.Class primitiveType)
          Checks if the given BaseComposite is hit at the given coordinates
static boolean isPrimitiveHit(BaseComposite composite, int x, int y, java.lang.Class primitiveType, int minLabelWidth, int minLabelHeight)
          Checks if the given BaseComposite is hit at the given coordinates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

findDeepestBaseCompositeAt

public static final BaseComposite findDeepestBaseCompositeAt(CompositeView compositeview,
                                                             int x,
                                                             int y)
Returns the deepest nested BaseComposite in the given CompositeView at location (x, y). Null is returned, if no such BaseComposite exists.

Parameters:
compositeview - the CompositeView to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
Returns:
the found BaseComposite; null if there is none.

findDeepestBaseCompositeAt

public static final BaseComposite findDeepestBaseCompositeAt(CompositeView compositeview,
                                                             int x,
                                                             int y,
                                                             boolean includeExternalPrimitives)
Returns the deepest nested BaseComposite in the given CompositeView at location (x, y). Null is returned, if no such BaseComposite exists.

Parameters:
compositeview - the CompositeView to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
includeExternalPrimitives - true, to include external primitive bounds in the hit check
Returns:
the found BaseComposite; null if there is none.

findDeepestBaseCompositeAt

public static final BaseComposite findDeepestBaseCompositeAt(CompositeView compositeview,
                                                             int x,
                                                             int y,
                                                             boolean includeExternalPrimitives,
                                                             int minLabelWidth,
                                                             int minLabelHeight)
Returns the deepest nested BaseComposite in the given CompositeView at location (x, y). Null is returned, if no such BaseComposite exists.

Parameters:
compositeview - the CompositeView to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
includeExternalPrimitives - true, to include external primitive bounds in the hit check
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 BaseComposite; null if there is none.

findDeepestBaseCompositeAt

public static final BaseComposite findDeepestBaseCompositeAt(CompositeGroup compositegroup,
                                                             int x,
                                                             int y)
Returns the deepest nested BaseComposite in the given CompositeGroup at location (x, y). Null is returned, if no such BaseComposite exists.

Parameters:
compositegroup - the CompositeGroup to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
Returns:
the found BaseComposite;null if there is none.

findDeepestBaseCompositeAt

public static final BaseComposite findDeepestBaseCompositeAt(CompositeGroup compositegroup,
                                                             int x,
                                                             int y,
                                                             boolean includeExternalPrimitives)
Returns the deepest nested BaseComposite in the given CompositeGroup at location (x, y). Null is returned, if no such BaseComposite exists.

Parameters:
compositegroup - the CompositeGroup to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
includeExternalPrimitives - true, to include external primitive bounds in the hit check
Returns:
the found BaseComposite;null if there is none.

findDeepestBaseCompositeAt

public static final BaseComposite findDeepestBaseCompositeAt(CompositeGroup compositegroup,
                                                             int x,
                                                             int y,
                                                             boolean includeExternalPrimitives,
                                                             int minLabelWidth,
                                                             int minLabelHeight)
Returns the deepest nested BaseComposite in the given CompositeGroup at location (x, y). Null is returned, if no such BaseComposite exists.

Parameters:
compositegroup - the CompositeGroup to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
includeExternalPrimitives - true, to include external primitive bounds in the hit check
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 BaseComposite;null if there is none.

findDeepestCompositeAt

public static final Composite findDeepestCompositeAt(CompositeView compositeview,
                                                     int x,
                                                     int y)
Returns the deepest nested Composite in the given CompositeView at location (x, y). Null is returned, if no such Composite exists.

Parameters:
compositeview - the CompositeView to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
Returns:
the found Composite; null if there is none.

findDeepestCompositeAt

public static final Composite findDeepestCompositeAt(CompositeGroup compositegroup,
                                                     int x,
                                                     int y)
Returns the deepest nested Composite in the given CompositeGroup at location (x, y). Null is returned, if no such Composite exists.

Parameters:
compositegroup - the CompositeGroup to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
Returns:
the found Composite; null if there is none.

findDeepestCompositeGroupAt

public static final CompositeGroup findDeepestCompositeGroupAt(CompositeView compositeview,
                                                               int x,
                                                               int y)
Returns the deepest nested CompositeGroup in the given CompositeView at location (x, y). Null is returned, if no nested CompositeGroup can be found in the given location.

Parameters:
compositeview - the CompositeView to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
Returns:
the found CompositGroup; null if there is none.

findDeepestCompositeGroupAt

public static final CompositeGroup findDeepestCompositeGroupAt(CompositeGroup compositegroup,
                                                               int x,
                                                               int y)
Returns the deepest nested CompositeGroup in the given CompositeGroup at location (x, y). Null is returned, if no nested CompositeGroup can be found in the given location.

Parameters:
compositegroup - the CompositeGroup to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
Returns:
the found CompositGroup; null if there is none.

findDeepestCompositeAt

public static final Composite findDeepestCompositeAt(CompositeGroup compositegroup,
                                                     int x,
                                                     int y,
                                                     boolean traverseFoldedGroups)

Returns the deepest nested Composite in the given CompositeGroup at location (x, y). Null is returned, if no such Composite exists. If the parameter traverseFoldedGroups is set to false, the first folded CompositeGroup found at the given coordinate is considered as the deepest Composite for this coordinate and is therefore returned by this method.

Parameters:
compositegroup - the CompositeGroup to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
traverseFoldedGroups - set to false if Composites inside a folded CompositeGroup should be ignored.
Returns:
the found Composite; null if there is none.

findDeepestCompositeAt

public static final Composite findDeepestCompositeAt(CompositeView compositeview,
                                                     int x,
                                                     int y,
                                                     boolean traverseFoldedGroups)

Returns the deepest nested Composite in the given CompositeView at location (x, y). Null is returned, if no such Composite exists. If the parameter traverseFoldedGroups is set to false, the first folded CompositeGroup found at the given coordinate is considered as the deepest Composite for this coordinate and is therefore returned by this method.

Parameters:
compositeview - the CompositeView to search.
x - the x-coordinate of the search point.
y - the y-coordinate of the search point.
traverseFoldedGroups - set to false if Composites inside a folded CompositeGroup should be ignored.
Returns:
the found Composite; null if there is none.

drawflags2String

public static final java.lang.String drawflags2String(int drawflags)
Returns a string representation of the specified mask that represents any combination of drawing-flags from a CompositeView instance.

Parameters:
drawflags - the mask to convert to a string.
Returns:
a string representation of the specified drawflags.

isHit

public static final boolean isHit(Transform2D xForm,
                                  BaseComposite composite,
                                  int x,
                                  int y)
Checks if the given BaseComposite is hit at the given coordinates

Parameters:
xForm - The local transform
composite - The Composite to check
x - The x coordinate to check
y - The x coordinate to check
Returns:
True, if the given BaseComposite is hit at the given coordinates

isHit

public static final boolean isHit(Transform2D xForm,
                                  BaseComposite composite,
                                  int x,
                                  int y,
                                  int minLabelWidth,
                                  int minLabelHeight)
Checks if the given BaseComposite is hit at the given coordinates

Parameters:
xForm - The local transform
composite - The Composite to check
x - The x coordinate to check
y - The x coordinate to check
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:
True, if the given BaseComposite is hit at the given coordinates

isPrimitiveHit

public static final boolean isPrimitiveHit(BaseComposite composite,
                                           int x,
                                           int y,
                                           java.lang.Class primitiveType)
Checks if the given BaseComposite is hit at the given coordinates

Parameters:
composite - The Composite to check
x - The x coordinate to check
y - The x coordinate to check
primitiveType - The type filter for the primitives
Returns:
True, if the given BaseComposite is hit at the given coordinates

isPrimitiveHit

public static final boolean isPrimitiveHit(BaseComposite composite,
                                           int x,
                                           int y,
                                           java.lang.Class primitiveType,
                                           int minLabelWidth,
                                           int minLabelHeight)
Checks if the given BaseComposite is hit at the given coordinates

Parameters:
composite - The Composite to check
x - The x coordinate to check
y - The x coordinate to check
primitiveType - The type filter for the primitives
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:
True, if the given BaseComposite is hit at the given coordinates

createCompositeByDescriptorName

public static final Composite createCompositeByDescriptorName(java.lang.String geometryName,
                                                              java.lang.String styleName)
Creates a Composite instance from the given geometry and style descriptor names. In case the Composite instance could not be created this method returns null.

Parameters:
geometryName - the name of the GeometryDescriptor
styleName - the name of the StyleDescriptor
Returns:
Composite the created instance or null

createCompositeLineByDescriptorName

public static final CompositeLine createCompositeLineByDescriptorName(java.lang.String geometryName,
                                                                      java.lang.String styleName)
Creates a CompositeLine instance from the given geometry and style descriptor names. In case the CompositeLine instance could not be created this method returns null.

Parameters:
geometryName - the name of the GeometryDescriptor
styleName - the name of the StyleDescriptor
Returns:
CompositeLine the created instance or null


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