artisynth.core.modelbase
Interface CopyableComponent

All Superinterfaces:
HasProperties, HierarchyNode, ModelComponent, Scannable
All Known Implementing Classes:
AffineNumericInputProbe, AxialSpring, BeamBody, DeformableBody, Elaston, FemElement, FemElement3d, FemMarker, FemModel3d, FemMuscleModel, FemNode, FemNode3d, Frame, FrameMarker, FrameSpring, FullPlanarJoint, HexElement, HydrostatModel, Marker, MarkerPlanarConnector, MFreeElement3d, MFreeHermiteNode3d, MFreeModel3d, MFreeMuscleModel, MFreeNode3d, MultiPointMuscle, MultiPointMuscleVia, MultiPointSpring, Muscle, NumericInputProbe, NumericOutputProbe, Particle, PlanarConnector, PlanarPoint, Point, PointAttachment, PointFem3dAttachment, PointForce, PointFrameAttachment, PointParticleAttachment, PointSkinAttachment, PointToPointMuscle, PointTracingProbe, PyramidElement, QuadhexElement, QuadpyramidElement, QuadtetElement, QuadwedgeElement, RevoluteJoint, RigidBody, RigidCompositeBody, RollPitchJoint, SegmentedPlanarConnector, SolidJoint, SphericalJoint, SphericalJointBase, SphericalRpyJoint, SpongeModel, TargetFrame, TargetPoint, TetElement, TracingProbe, VectorTracingProbe, WedgeElement

public interface CopyableComponent
extends ModelComponent

Indicates an ArtiSynth ModelComponent that can be copied.


Nested Class Summary
 
Nested classes/interfaces inherited from interface artisynth.core.modelbase.ModelComponent
ModelComponent.NavpanelVisibility
 
Field Summary
static int COPY_REFERENCES
          Indicates that any referenced model components should themselves be copied.
 
Method Summary
 ModelComponent copy(int flags, java.util.Map<ModelComponent,ModelComponent> copyMap)
          Create a copy of this component.
 boolean getCopyReferences(java.util.List<ModelComponent> refs, ModelComponent ancestor)
          Collects external references which must also be copied in order to duplicate this component.
 boolean isDuplicatable()
          Returns true if this component can be duplicated.
 
Methods inherited from interface artisynth.core.modelbase.ModelComponent
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, postscan, scan, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
 
Methods inherited from interface maspack.properties.HasProperties
getAllPropertyInfo, getProperty
 
Methods inherited from interface maspack.properties.HierarchyNode
getChildren, hasChildren
 
Methods inherited from interface maspack.util.Scannable
isWritable, write
 

Field Detail

COPY_REFERENCES

static final int COPY_REFERENCES
Indicates that any referenced model components should themselves be copied.

See Also:
Constant Field Values
Method Detail

copy

ModelComponent copy(int flags,
                    java.util.Map<ModelComponent,ModelComponent> copyMap)
Create a copy of this component. If COPY_REFERENCES is set in flags, then any component referenced by this component should itself be set to a copy. This should be done first checking copyMap for an existing copy of the referenced component. If there is no existing copy, then a copy should be created by calling copy recursively and adding the new copy to copyMap.


isDuplicatable

boolean isDuplicatable()
Returns true if this component can be duplicated. Duplication means that we can expect to be able to make a complete copy of the component along with all it's external references. This method should return true if and only if getCopyReferences(java.util.List, artisynth.core.modelbase.ModelComponent) returns true.

This method is not currently used. It is intended to provide a faster way of determining if a component can be duplicated, without having to use getCopyReferences(java.util.List, artisynth.core.modelbase.ModelComponent) to build the list of copy references.

Returns:
true if this component can be duplicated.

getCopyReferences

boolean getCopyReferences(java.util.List<ModelComponent> refs,
                          ModelComponent ancestor)
Collects external references which must also be copied in order to duplicate this component. These references should exclude those which are contained within a specified component hierarchy. This method should return true if and only if isDuplicatable() returns true.

Parameters:
refs - list to which references are appended
ancestor - root node of the hierarchy from which references are to be excluded
Returns:
false if it is discovered that the component cannot be duplicated