harmonic.mz.util
Class ObjectRelater

java.lang.Object
  |
  +--harmonic.mz.util.ObjectRelater

public class ObjectRelater
extends java.lang.Object

This is a utility for preparing ShapeNode geometries for related computations. It produces new geometries in compatable coordinate systems. To use this, create an ObjectRelater, call prepareCompositeCalculation(), and then get the geometries out with getGeom(). Different ObjectRelaters can be used at the same time, since they keep the replacement geometries independantly of one another.


Field Summary
 boolean bDebug
           
static int CONSUME_COMPOSITES
           
static int COPY_COMPOSITES
           
static int LINK_COPY_COMPOSITES
           
 
Constructor Summary
ObjectRelater()
           
 
Method Summary
 void addToCompositeObject(ShapeNode niw, UndoGroup block, int cmode, boolean hide)
           
 void beginCompareCalculation(ShapeNode[] input, java.lang.String geomType)
          Prepare object that do not have the same parent to be compared by getting them all in the user coordinate system.
 void beginCompareCalculation(ShapeNode[] input, java.lang.String[] geomType)
           
 void beginCompositeCalculation(ShapeNode output, ShapeNode[] input, java.lang.String[] geomTypes)
          Prepare geometries of shape defs to be used for some computation.
 void beginCompositeCalculation(ShapeNode niw, java.lang.String geomType)
           
 void beginCompositeCalculation(ShapeNode niw, java.lang.String[] geomType)
           
 void debug(java.lang.String msg)
           
 void endCompareCalculation(ShapeNode[] input, java.lang.String geomType)
          Call after compare calculation is finished to remove any temporary geometries or vertex arrays
 void endCompareCalculation(ShapeNode[] input, java.lang.String[] geomType)
           
 void endCompositeCalculation(ShapeNode[] input, java.lang.String[] geomTypes)
          Call after prepareCompositeCalculation, when the calculation is done.
 void endCompositeCalculation(ShapeNode niw, java.lang.String geomType)
           
 void endCompositeCalculation(ShapeNode niw, java.lang.String[] geomType)
           
 harmonic.meshGeom.math.TMat getCompositeTransform(harmonic.viewer3D.PaintStruct painter)
           
 harmonic.meshGeom.geom.Geom getGeom(harmonic.viewer3D.PaintStruct painter)
          Return geometry of given painter.
 ShapeNode prepareArrayCopy(ShapeNode source, int xCompositeMode)
           
 void prepareCompositeObject(ShapeNode niw, int xCompositeMode)
          Use the compositing mode to stash away composited objects properly, and set up niw painter in proper layer, etc, and set up undo, and position and transform.
 void prepareCompositeObject(ShapeNode niw, ShapeNode[] input, int xCompositeMode, boolean hide)
          Lower level version of prepareCompositeObject
 void prepareCopy(ShapeNode[] painter, int xCompositeMode)
          Prepare a set of objects to be moved Make sure copy is visible, even if source is not
 void preparePrimativeObject(ShapeNode to)
           
 void setCopyGroups(ShapeNode niw, ShapeNode source)
           
 void transformToNotMove(Transformable oldParent, Transformable newParent, ShapeNode copy)
          Transform object objB so that when it is parented to newParent it will be where it was before.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONSUME_COMPOSITES

public static final int CONSUME_COMPOSITES
See Also:
Constant Field Values

COPY_COMPOSITES

public static final int COPY_COMPOSITES
See Also:
Constant Field Values

LINK_COPY_COMPOSITES

public static final int LINK_COPY_COMPOSITES
See Also:
Constant Field Values

bDebug

public boolean bDebug
Constructor Detail

ObjectRelater

public ObjectRelater()
Method Detail

debug

public void debug(java.lang.String msg)

preparePrimativeObject

public void preparePrimativeObject(ShapeNode to)

prepareCompositeObject

public void prepareCompositeObject(ShapeNode niw,
                                   int xCompositeMode)
Use the compositing mode to stash away composited objects properly, and set up niw painter in proper layer, etc, and set up undo, and position and transform. CONSUME_COMPOSITES: the actual input is parented to the composited object LINK_COPY_COMPOSITED: link copies of the input are parented to the composited object COPY_COMPOSITES: full copies of input are parented to the composited object The goal is to maintain the same position and attributes of input, which will become children of niw. The niw painters coordinate system is set to match that of the first input (often the only input), and the other input coordinate systems are adjusted. This differs from new primitives, where the coordinate system is set to match the current UCS. It would be the same if the UCS was matched the first input at the time of the operation. TODO: This is rather kludgy - the caller is supposed to put the objects to reparent in NodeSetFields using addShared node evan though the nsf is set to bNodeParent == true - need a more official way to do this. CURRENT_GROUPS: the new object will be put in current groups PRESERVE_GROUPS: the new object will be put in groups of first input


addToCompositeObject

public void addToCompositeObject(ShapeNode niw,
                                 UndoGroup block,
                                 int cmode,
                                 boolean hide)

prepareCompositeObject

public void prepareCompositeObject(ShapeNode niw,
                                   ShapeNode[] input,
                                   int xCompositeMode,
                                   boolean hide)
Lower level version of prepareCompositeObject


beginCompareCalculation

public void beginCompareCalculation(ShapeNode[] input,
                                    java.lang.String geomType)
Prepare object that do not have the same parent to be compared by getting them all in the user coordinate system. Geometries matching geomType are looked at.


beginCompareCalculation

public void beginCompareCalculation(ShapeNode[] input,
                                    java.lang.String[] geomType)

endCompareCalculation

public void endCompareCalculation(ShapeNode[] input,
                                  java.lang.String geomType)
Call after compare calculation is finished to remove any temporary geometries or vertex arrays


endCompareCalculation

public void endCompareCalculation(ShapeNode[] input,
                                  java.lang.String[] geomType)

beginCompositeCalculation

public void beginCompositeCalculation(ShapeNode niw,
                                      java.lang.String geomType)

beginCompositeCalculation

public void beginCompositeCalculation(ShapeNode niw,
                                      java.lang.String[] geomType)

beginCompositeCalculation

public void beginCompositeCalculation(ShapeNode output,
                                      ShapeNode[] input,
                                      java.lang.String[] geomTypes)
Prepare geometries of shape defs to be used for some computation. The main thing this function does it to set the input geometries in the outputs coordinate system. If some of the input shape defs share geometries with each other, temporary replacement geometries are created in place of the shared geometries to enable their vertex arrays to be transformed independently. This function will also reverse faces of geometries that are in a left hand coordinate system.


endCompositeCalculation

public void endCompositeCalculation(ShapeNode niw,
                                    java.lang.String geomType)

endCompositeCalculation

public void endCompositeCalculation(ShapeNode niw,
                                    java.lang.String[] geomType)

endCompositeCalculation

public void endCompositeCalculation(ShapeNode[] input,
                                    java.lang.String[] geomTypes)
Call after prepareCompositeCalculation, when the calculation is done. This will remove any temporary geometries and vertex arrays.


transformToNotMove

public void transformToNotMove(Transformable oldParent,
                               Transformable newParent,
                               ShapeNode copy)
Transform object objB so that when it is parented to newParent it will be where it was before. Divide out new parents transform and multiply in old parents.
oldParent*oldLocal == newParent*newLocal ==> newLocal = (1/newParent)*oldParent*oldLocal //call from pepareCompositeObject... transformToNotMove( source.parentAt(PaintStruct.TRANSFORM_GROUP), niw, copy );


setCopyGroups

public void setCopyGroups(ShapeNode niw,
                          ShapeNode source)

prepareCopy

public void prepareCopy(ShapeNode[] painter,
                        int xCompositeMode)
Prepare a set of objects to be moved Make sure copy is visible, even if source is not


prepareArrayCopy

public ShapeNode prepareArrayCopy(ShapeNode source,
                                  int xCompositeMode)

getGeom

public harmonic.meshGeom.geom.Geom getGeom(harmonic.viewer3D.PaintStruct painter)
Return geometry of given painter. This should be used intead of painter.geom because DataManager.prepareCompositeCalculation may replace the geometry with another geometry in a new coordinate system. This must be done rather than transfroming the verticies of the geometry if it shared between more than one input object of a geometrical composte calculation.


getCompositeTransform

public harmonic.meshGeom.math.TMat getCompositeTransform(harmonic.viewer3D.PaintStruct painter)