artisynth.core.modelbase
Interface ModelComponent
- All Superinterfaces:
- HasProperties, HierarchyNode, Scannable
- All Known Subinterfaces:
- Collidable, CompositeComponent, Controller, CopyableComponent, DynamicMechComponent, ExcitationComponent, ForceComponent, MechSystemModel, Model, ModelAgent, Monitor, MotionTargetComponent, MutableCompositeComponent<C>, PlanarComponent, RenderableComponent
- All Known Implementing Classes:
- AffineNumericInputProbe, ArticulatedBeamBody, ArticulatedDemo, ArticulatedFem, AttachDemo, AttachedBeamDemo, AuxMaterialBundle, AuxMaterialBundleList, AuxMaterialElementDesc, AuxMaterialElementDescList, AxialSpring, AxialSpringList, BeamBody, BlockTest, Collidable.DefaultCollidable, CollisionComponent, CollisionHandler, CollisionHandlerGeneric, CollisionHandlerList, CollisionHandlerOld, CollisionManager, ColorBar, ColoredFemBeam3d, CompliantConstraintDemo, ComponentList, CompositeComponentBase, ConstrainedParticle, ConstrainerBase, ControllerBase, ControllerMonitorBase, ControlPanel, CoupledSolveDemo, CutPlaneProbe, DeformableBody, DoubleArmDemo, DynamicAttachment, DynamicMechComponentBase, EditableMesh, EditablePolygonalMesh, Elaston, FaceComponent, FaceList, FallingSkull, Fem3dBlock, FemBeam3d, FemBeamMech, FemCollision, FemDisplayProbe, FemElement, FemElement3d, FemElement3dList, FemFrictionBeam, FemMarker, FemMesh, FemMeshBase, FemModel, FemModel3d, FemMuscleArm, FemMuscleDemo, FemMuscleModel, FemNode, FemNode3d, FemSingleTet, FemSkinDemo, FemSphere, FishDemo, FixedMesh, ForceEffectorList, Frame, FrameExciter, FrameMarker, FrameSpring, FrameSpringDemo, FullPlanarJoint, GLRenderableHolder, Hex3dBlock, HexBeam3d, HexElement, HexFrame, HexIncompress, HexSheet, HudPrintStream, HydrostatDemo, HydrostatInvDemo, HydrostatModel, HydrostatTubeDemo, ImagePlaneProbe, ImageProbe, InputProbe, JointBase, LaymanBowl, LaymanDemo, LaymanModel, LightComponent, LockingDemo, LumbarSpringDemo, Marker, MarkerPlanarConnector, MassSpringDemo, MechModel, MechModelCollide, MechModelDemo, MechSystemBase, MeshComponent, MeshComponentList, MeshIntersectingProbe, MFreeAuxMaterialBundle, MFreeAuxMaterialBundleList, MFreeAuxMaterialElementDesc, MFreeAuxMaterialElementDescList, MFreeElement3d, MFreeElement3dList, MFreeHermiteNode3d, MFreeModel3d, MFreeMuscleBundle, MFreeMuscleBundleList, MFreeMuscleElementDesc, MFreeMuscleElementDescList, MFreeMuscleModel, MFreeNode3d, ModelAgentBase, ModelBase, ModelBaseOld, ModelComponentBase, MonitorBase, MultiMuscleDemo, MultiPointMuscle, MultiPointMuscleVia, MultiPointSpring, MultiPointSpringList, MultiSpringDemo, Muscle, MuscleArm, MuscleBundle, MuscleBundleList, MuscleElementDesc, MuscleElementDescList, MuscleExciter, NetDemo, NumericInputProbe, NumericOutputProbe, NumericProbeBase, OutputProbe, Particle, ParticleConstraint, ParticleMeshConstraint, ParticlePlaneConstraint, PlanarConnector, PlanarConnectorDemo, PlanarPoint, PlaneConstrainedFem, Point, PointAttachment, PointExciter, PointFem3dAttachment, PointForce, PointForceDemo, PointFrameAttachment, PointList, PointModel, PointModel1d, PointModel2d, PointModel3d, PointParticleAttachment, PointSkinAttachment, PointSpringBase, PointSpringList, PointToPointMuscle, PointTracingProbe, Probe, PuddleDemo, PullController, PuppetDemo, PyramidElement, QuadFishDemo, QuadhexElement, QuadpyramidElement, QuadtetElement, QuadwedgeElement, ReferenceComponent, ReferenceList, RenderableComponentBase, RenderableComponentList, RenderableCompositeBase, RenderableModelBase, RenderableModelBaseOld, RenderProbe, RevoluteJoint, RigidBody, RigidBodyCollision, RigidBodyConnector, RigidBodyDemo, RigidCompositeBody, RigidMeshComponent, RigidTentacle, RigidTransformInputProbe, RobustCube, RollPitchJoint, RollPitchJointDemo, RootModel, ScalableList, SegmentedPlanarConnector, SegmentedPlaneDemo, SelfCollision, SheetDemo, SimpleCollide, SingleHex, SinglePyramid, SingleQuadhex, SingleQuadpyramid, SingleQuadtet, SingleQuadwedge, SingleTet, SingleWedge, SkinDemo, SkinMesh, SkinMeshBase, SkullParticles, SleepProbe, SoftPlaneCollider, SolidJoint, SphericalJoint, SphericalJointBase, SphericalJointDemo, SphericalRpyJoint, SpongeDemo, SpongeModel, Spring, SpringMeshDemo, TargetFrame, TargetPoint, Tentacle, TetBeam3d, TetElement, TextComponent2d, TextComponent3d, TextComponentBase, TextLabeller3d, TracingProbe, TrackingController, TransformableList, VectorTracingProbe, VertexComponent, VertexList, ViscousBeam, WayPointProbe, WedgeElement
public interface ModelComponent
- extends HasProperties, HierarchyNode, Scannable
Basic interface for all Artisynth elements
Method Summary |
void |
connectToHierarchy()
Called by the system after this component is added to the
component hierarchy (i.e., when it is added as a child of another
CompositeComponent). |
void |
disconnectFromHierarchy()
Called by the system after this component is removed from the component
hierarchy (i.e., when it is removed as a child of its parent). |
void |
getHardReferences(java.util.List<ModelComponent> refs)
Appends all hard references for this component to a list. |
java.lang.String |
getName()
Gets the name of this component. |
ModelComponent.NavpanelVisibility |
getNavpanelVisibility()
|
int |
getNumber()
Gets the number of this component. |
CompositeComponent |
getParent()
Returns the current parent of this ModelComponent, if any. |
void |
getSoftReferences(java.util.List<ModelComponent> refs)
Appends all soft references for this component to a list. |
boolean |
hasState()
Returns true if this component has state. |
boolean |
isFixed()
Returns true if this model component is fixed. |
boolean |
isMarked()
Returns true if this model component is marked. |
boolean |
isSelected()
Returns true if this model component is selected. |
void |
notifyParentOfChange(ComponentChangeEvent e)
Notifies the parent of this component (if any) of changes within in its
descendants. |
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component. |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer. |
void |
setFixed(boolean fixed)
Fixes or unfixes this component. |
void |
setMarked(boolean marked)
Marks or unmarks this component. |
void |
setName(java.lang.String name)
Sets the name of this component. |
void |
setNumber(int num)
Sets the number of this component. |
void |
setParent(CompositeComponent parent)
Sets the parent for this component. |
void |
setSelected(boolean selected)
Selects or deselects this component. |
void |
updateReferences(boolean undo,
java.util.Deque<java.lang.Object> undoInfo)
May be called by the system if any of the soft references for
this component are removed from the the component hierarchy. |
getName
java.lang.String getName()
- Gets the name of this component.
- Returns:
- name of this component
setName
void setName(java.lang.String name)
throws java.lang.IllegalArgumentException
- Sets the name of this component. When the name is set, this method should
call
notifyParentOfChange
with a NameChangeEvent
so that it's
parent can update the name map entry and other ancestors can adjust for
the new name.
Component names can be specified as null. However, if not null, they
should have non-zero length and should not begin with a digit or contain
the characters '.' or '/'. Implementations can use ModelComponentBase.checkName()
to determine if a proposed name is valid.
- Parameters:
name
- new component name
- Throws:
java.lang.IllegalArgumentException
- if the name does not have a valid format
getNumber
int getNumber()
- Gets the number of this component. A unique component number is assigned
whenever a component is made a child of a parent component, and this
number will be persistent as long as the component remains a child that
parent. In particular, cmponent numbers are not indices, and will not
change as other components are added or removed from the parent. The
purpose of the component number is to provide a alternate name for a
component in case the string name is not set.
- Returns:
- number of this component
setNumber
void setNumber(int num)
- Sets the number of this component. This method should only be called by
parent components when they add or remove this component as a child.
- Parameters:
num
- new component number
getParent
CompositeComponent getParent()
- Returns the current parent of this ModelComponent, if any.
- Specified by:
getParent
in interface HierarchyNode
- Returns:
- parent of this ModelComponent
setParent
void setParent(CompositeComponent parent)
- Sets the parent for this component. A value of
null
is specified when the component is being removed from the hierarchy.
This method is intended for internal use by the system only.
- Parameters:
parent
- new parent component, or null
.
connectToHierarchy
void connectToHierarchy()
- Called by the system after this component is added to the
component hierarchy (i.e., when it is added as a child of another
CompositeComponent). This method is responsible for doing
any required hierarchy-dependent initialization.
When this method is called, getParent()
will return
the new parent component; the system will have set this beforehand.
disconnectFromHierarchy
void disconnectFromHierarchy()
- Called by the system after this component is removed from the component
hierarchy (i.e., when it is removed as a child of its parent). This
method is responsible for any required hierarchy-dependent
deinitialization.
When this
method is called, getParent()
will still return this original
parent component; the system will set this to null
after.
isSelected
boolean isSelected()
- Returns true if this model component is selected.
- Returns:
- true if this component is selected
setSelected
void setSelected(boolean selected)
- Selects or deselects this component. This method should only be
used by the selection manager, since object selection must be coordinated
with other system components.
- Parameters:
selected
- if true, this component is selected
isMarked
boolean isMarked()
- Returns true if this model component is marked. Marking is used
temporarily for applications such as determining which components which
are referenced by a set of components.
- Returns:
- true if this component is marked
setMarked
void setMarked(boolean marked)
- Marks or unmarks this component.
- Parameters:
marked
- if true, this component is marked
isFixed
boolean isFixed()
- Returns true if this model component is fixed. Fixed is used to indicate
that the component should not be removed from its parent.
- Returns:
- true if this component is fixed
setFixed
void setFixed(boolean fixed)
- Fixes or unfixes this component. This method should be used with care,
and only be component designers.
- Parameters:
fixed
- if true, this component will be fixed to its parent.
getNavpanelVisibility
ModelComponent.NavpanelVisibility getNavpanelVisibility()
notifyParentOfChange
void notifyParentOfChange(ComponentChangeEvent e)
- Notifies the parent of this component (if any) of changes within in its
descendants. This is done by calling the parent's
componentChanged
method.
- Parameters:
e
- optional argument giving specific information about the change
getHardReferences
void getHardReferences(java.util.List<ModelComponent> refs)
- Appends all hard references for this component to a list.
References are other components, outside of this component's
immediate ancestry, on which this component depends. For
example, an AxialSpring refers to two Point components as
for it's end points. A hard reference is one which
the referring component must have, and which if deleted, implies
that the referring component should be deleted too.
- Parameters:
refs
- list to which hard references are appended
getSoftReferences
void getSoftReferences(java.util.List<ModelComponent> refs)
- Appends all soft references for this component to a list.
References are other components, outside of this component's
immediate ancestry, on which this component depends. For
example, an ExcitationComponent may refer to one or more
other ExcitationComponents to act as excitation sources.
A soft reference is one which can be removed from the
referring component. In particular, if any soft references
for a component are deleted, then that component's
updateReferences()
method will
be called to update its internal reference information.
- Parameters:
refs
- list to which soft references are appended
hasState
boolean hasState()
- Returns true if this component has state. Structure change events involving
components that have state will cause the current state history of
of the system to be cleared.
scan
void scan(ReaderTokenizer rtok,
java.lang.Object ref)
throws java.io.IOException
- Description copied from interface:
Scannable
- Scans this element from a ReaderTokenizer. The expected text format is
assumed to be compatible with that produced by
write
.
- Specified by:
scan
in interface Scannable
- Parameters:
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objects
- Throws:
java.io.IOException
- if an I/O or formatting error occured
postscan
void postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
throws java.io.IOException
- Performs any required post-scanning for this component.
This involves handling any information whose processing was deferred
during the
scan()
method and stored in the token queue.
The most common use of this method is to resolve the paths
of component references, which may not have been created
at the time of the initial scan()
call.
- Parameters:
tokens
- token information that was stored during
scan()
.ancestor
- ancestor component with respect to which
reference component paths are defined.
- Throws:
java.io.IOException
updateReferences
void updateReferences(boolean undo,
java.util.Deque<java.lang.Object> undoInfo)
- May be called by the system if any of the soft references for
this component are removed from the the component hierarchy.
If called with
undo
equal to false
,
this component should then examine its soft references and
use ComponentUtils.isConnected()
to determine which of them have been disconnected from the hierarchy.
Disconnected references should be removed, and sufficient information
should be appended to undoInfo
to allow this update
to be undone if this method is called later with undo
equal to true
. When undoing an update, the undo
information should be removed from the front of undoInfo
.
- Parameters:
undo
- if true
, indicates that the most
recent reference update should be undone, using the supplied
undo information.undoInfo
- if undo
is false
, should be used
to store information allowing the reference update to be undone.
Otherwise, if undo
is true
, then this
supplied information to undo the most recent update.