public class RootModel extends RenderableModelBase implements Disposable
ModelComponent.NavpanelVisibility
CompositeComponent.NavpanelDisplay
Modifier and Type | Field and Description |
---|---|
static PropertyList |
myProps |
static boolean |
testSaveAndRestoreState |
DEFAULT_NAVPANEL_DISPLAY
enforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
RootModel()
Empty constructor, for creating a basic class instance
|
RootModel(java.lang.String name)
Constructor used to build the model
|
Modifier and Type | Method and Description |
---|---|
WayPoint |
addBreakPoint(double t) |
void |
addComponentChangeListener(ComponentChangeListener l) |
void |
addController(Controller controller) |
void |
addController(Controller controller,
Model model) |
void |
addControlPanel(ControlPanel panel) |
void |
addControlPanel(ControlPanel panel,
int idx) |
void |
addInputProbe(Probe probe) |
void |
addInputProbe(Probe probe,
int idx) |
void |
addModel(Model model) |
void |
addMonitor(Monitor monitor) |
void |
addMonitor(Monitor monitor,
Model model) |
void |
addOutputProbe(Probe probe) |
void |
addOutputProbe(Probe probe,
int idx) |
IsRenderableHolder |
addRenderable(Renderable renderable) |
void |
addRenderable(RenderableComponent comp) |
TracingProbe |
addTracingProbe(Traceable traceable,
java.lang.String traceName,
double startTime,
double stopTime)
Convenience routine to add a tracing probe to this RootModel.
|
WayPoint |
addWayPoint(double t) |
void |
addWayPoint(WayPoint way) |
StepAdjustment |
advance(double t0,
double t1,
int flags)
Advances this object from time t0 to time t1.
|
void |
applyControllers(java.util.List<Controller> list,
double t0,
double t1) |
void |
applyInputProbes(java.util.List<Probe> list,
double t) |
void |
applyMonitors(java.util.List<Monitor> list,
double t0,
double t1) |
void |
applyOutputProbes(java.util.List<Probe> list,
double t1,
artisynth.core.workspace.RootModel.ModelInfo info) |
void |
attach(DriverInterface driver)
Attach this root model to a driver program
|
void |
build(java.lang.String[] args) |
void |
checkWrite(java.lang.String str) |
void |
clear() |
void |
clearRenderables() |
void |
clearTraces() |
void |
clearTracing(Traceable tr) |
void |
componentChanged(ComponentChangeEvent e)
Notifies this composite component that a change has occured within one or
more of its descendants.
|
ComponentState |
createState(ComponentState prevState)
Factory routine to create a state object for this component, which can
then be used as an argument for
HasState.setState(artisynth.core.modelbase.ComponentState) and HasState.getState(artisynth.core.modelbase.ComponentState) . |
void |
detach(DriverInterface driver)
Detach this root model from a driver program.
|
void |
disableAllTracing() |
boolean |
disableTracing(Traceable tr) |
void |
dispose()
Called when the model is discarded.
|
void |
enableTracing(Traceable tr) |
java.lang.String |
getAbout()
Returns a text string giving a short description of this model.
|
boolean |
getAdaptiveStepping() |
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
ComponentListView<Controller> |
getControllers() |
ComponentListView<ControlPanel> |
getControlPanels() |
javax.swing.JTabbedPane |
getControlPanelTabs() |
AxisAngle |
getDefaultViewOrientation()
Obtains the default orientation that should be used for viewing this
model.
|
void |
getInitialState(ComponentState newstate,
ComponentState oldstate)
Gets an initial state for this component and returns the value in
state . |
ComponentList<Probe> |
getInputProbes() |
javax.swing.JFrame |
getMainFrame() |
GLViewer |
getMainViewer() |
double |
getMinStepSize() |
ComponentListView<Monitor> |
getMonitors() |
double |
getNextAdvanceTime(java.util.List<Probe> probes,
double stepSize,
double t0,
double t1) |
int |
getNumTraceables() |
RenderableComponentList<Probe> |
getOutputProbes() |
static RootModel |
getRoot(ModelComponent comp)
Find the most immediate RootModel, if any, that is an ancestor of a
specified component.
|
void |
getState(ComponentState state)
Get the current state of this component.
|
boolean |
getStopRequest() |
java.util.Collection<Traceable> |
getTraceSet() |
TracingProbe |
getTracingProbe(Traceable tr,
java.lang.String propName) |
java.util.LinkedList<TracingProbe> |
getTracingProbes() |
Point3d |
getViewerCenter() |
Point3d |
getViewerEye() |
WayPoint |
getWayPoint(double t) |
boolean |
getWaypointChecking() |
WayPointProbe |
getWayPoints() |
static boolean |
hasRoot(ModelComponent comp)
Queries if a specified component has a RootModel as an ancestor.
|
boolean |
hasState()
Queries if this component has state.
|
boolean |
hasTracingProbes() |
void |
initialize(double t)
Causes this model to initialize itself at time t.
|
boolean |
isCheckEnabled() |
static boolean |
isFocusable() |
boolean |
isTracing(Traceable tr) |
ControlPanel |
loadControlPanel(java.lang.String filename) |
void |
mergeAllControlPanels(boolean combine) |
void |
mergeControlPanel(boolean combine,
ControlPanel panel) |
ComponentListView<Model> |
models() |
void |
notifyParentOfChange(ComponentChangeEvent e)
Notifies the parent of this component (if any) of changes within in its
descendants.
|
void |
notifyStructureChanged(java.lang.Object comp) |
void |
postscan(java.util.Deque<ScanToken> tokens,
CompositeComponent ancestor)
Performs any required post-scanning for this component.
|
void |
prerender(RenderList list)
Called prior to rendering to allow this object to update the internal
state required for rendering (such as by caching rendering coordinates).
|
void |
removeAllControllers() |
void |
removeAllControlPanels() |
void |
removeAllInputProbes() |
void |
removeAllModels() |
void |
removeAllMonitors() |
void |
removeAllOutputProbes() |
void |
removeAllWayPoints() |
boolean |
removeComponentChangeListener(ComponentChangeListener l) |
boolean |
removeController(Controller controller) |
boolean |
removeControlPanel(ControlPanel panel) |
boolean |
removeInputProbe(Probe probe) |
boolean |
removeModel(Model model) |
boolean |
removeMonitor(Monitor monitor) |
boolean |
removeOutputProbe(Probe probe) |
boolean |
removeRenderable(Renderable renderable) |
boolean |
removeRenderable(RenderableComponent comp) |
boolean |
removeWayPoint(WayPoint way) |
void |
render(Renderer renderer,
int flags)
Render this object using the functionality of the supplied
Renderer . |
RenderableComponentList<RenderableComponent> |
renderables() |
void |
rerender() |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
scanProbes(ReaderTokenizer rtok) |
void |
setAdaptiveStepping(boolean enable) |
void |
setCheckEnabled(boolean enable) |
void |
setDefaultValues()
Sets the attributes of this component to their default values.
|
void |
setDefaultViewOrientation(AxisAngle REW)
Sets the default orientation that should be used for viewing
this model to
REW . |
static void |
setFocusable(boolean focusable) |
void |
setMainViewer(GLViewer v) |
void |
setMaxStepSize(double step)
Sets the maximum step size by which this model should be advanced within a
simulation loop.
|
void |
setMinStepSize(double step) |
void |
setState(ComponentState state)
Set the state of this component.
|
void |
setStopRequest(boolean req)
If set true, tells the scheduler to stop simulating this root model.
|
void |
setTracingProbesVisible(boolean visible) |
void |
setViewerCenter(Point3d c) |
void |
setViewerEye(Point3d e) |
void |
setViewerUp(Vector3d up) |
void |
setWaypointChecking(boolean enable) |
void |
stopAdvance()
This is used by the scheduler to interrupts the current call to advance
and cause state to be restored to that of the start time for the advance.
|
void |
updateBounds(Vector3d pmin,
Vector3d pmax)
Update the minimum and maximum points for this object.
|
void |
writeProbes(java.io.PrintWriter pw,
NumberFormat fmt) |
createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps
actionPerformed, copy, getInitialState, getMaxStepSize, getMenuItems, hierarchyContainsReferences, preadvance, setInitialState
add, add, addAll, addComponents, addFixed, addNumbered, clone, contains, contains, containsAll, copy, ensureCapacity, findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, getShortName, getTypeParameter, hasChildren, hasParameterizedType, indexOf, invalidateNumbers, isEmpty, iterator, nextComponentNumber, numComponents, remove, remove, removeAll, removeAll, removeComponents, retainAll, set, setNavpanelDisplay, setNumbered, setNumberingStartAtOne, setShortName, size, toArray, toArray, updateNameMap
checkFlag, checkName, checkNameUniqueness, clearFlag, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isConnectedToHierarchy, isFixed, isMarked, isSelected, isWritable, makeValidName, makeValidName, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setSelected, updateReferences, write
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, setFixed, setMarked, setName, setNumber, setParent, setSelected, updateReferences
getProperty
getChildren, hasChildren
isWritable, write
getName
public static boolean testSaveAndRestoreState
public static PropertyList myProps
public RootModel()
public RootModel(java.lang.String name)
name
- the name of the new modelpublic static void setFocusable(boolean focusable)
public static boolean isFocusable()
public void build(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public java.lang.String getAbout()
public void setDefaultValues()
ModelComponentBase
public boolean getAdaptiveStepping()
public void setAdaptiveStepping(boolean enable)
public double getMinStepSize()
public void setMinStepSize(double step)
public void setMaxStepSize(double step)
ModelBase
setMaxStepSize
in class ModelBase
step
- maximum step size (seconds)public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class RenderableModelBase
public ComponentListView<Model> models()
public void addModel(Model model)
public boolean removeModel(Model model)
public void removeAllModels()
public void addMonitor(Monitor monitor)
public void addController(Controller controller)
public IsRenderableHolder addRenderable(Renderable renderable)
public boolean removeRenderable(Renderable renderable)
public void addRenderable(RenderableComponent comp)
public boolean removeRenderable(RenderableComponent comp)
public void clearRenderables()
public RenderableComponentList<RenderableComponent> renderables()
public GLViewer getMainViewer()
public void setMainViewer(GLViewer v)
public javax.swing.JFrame getMainFrame()
public void setViewerCenter(Point3d c)
public Point3d getViewerCenter()
public void setViewerEye(Point3d e)
public Point3d getViewerEye()
public void setViewerUp(Vector3d up)
public AxisAngle getDefaultViewOrientation()
public void setDefaultViewOrientation(AxisAngle REW)
REW
. Setting a value of 0 indicates
that no orientation is specified and so the viewer should
use its default view.REW
- rotational transform from eye to world coordinatespublic boolean removeMonitor(Monitor monitor)
public void removeAllMonitors()
public ComponentListView<Monitor> getMonitors()
public void addController(Controller controller, Model model)
public boolean removeController(Controller controller)
public void removeAllControllers()
public ComponentListView<Controller> getControllers()
public void addControlPanel(ControlPanel panel)
public void addControlPanel(ControlPanel panel, int idx)
public boolean removeControlPanel(ControlPanel panel)
public void removeAllControlPanels()
public ComponentListView<ControlPanel> getControlPanels()
public ControlPanel loadControlPanel(java.lang.String filename)
public void addInputProbe(Probe probe)
public void addInputProbe(Probe probe, int idx)
public boolean removeInputProbe(Probe probe)
public void removeAllInputProbes()
public ComponentList<Probe> getInputProbes()
public TracingProbe addTracingProbe(Traceable traceable, java.lang.String traceName, double startTime, double stopTime)
traceable
- component to be tracedtraceName
- name of the tracestartTime
- start time (seconds)stopTime
- stop time (seconds)public void addOutputProbe(Probe probe)
public void addOutputProbe(Probe probe, int idx)
public boolean removeOutputProbe(Probe probe)
public void removeAllOutputProbes()
public RenderableComponentList<Probe> getOutputProbes()
public boolean hasTracingProbes()
public void setTracingProbesVisible(boolean visible)
public WayPointProbe getWayPoints()
public void addWayPoint(WayPoint way)
public WayPoint addWayPoint(double t)
public WayPoint addBreakPoint(double t)
public boolean removeWayPoint(WayPoint way)
public WayPoint getWayPoint(double t)
public void removeAllWayPoints()
public TracingProbe getTracingProbe(Traceable tr, java.lang.String propName)
public void enableTracing(Traceable tr)
public boolean isTracing(Traceable tr)
public boolean disableTracing(Traceable tr)
public void clearTracing(Traceable tr)
public java.util.LinkedList<TracingProbe> getTracingProbes()
public void disableAllTracing()
public void clearTraces()
public java.util.Collection<Traceable> getTraceSet()
public int getNumTraceables()
public void clear()
clear
in interface java.util.Collection<ModelComponent>
clear
in class ComponentList<ModelComponent>
public void prerender(RenderList list)
IsRenderable
list.addIfVisible (obj);
for each of the objects in question.prerender
in interface IsRenderable
prerender
in class RenderableModelBase
list
- list of objects to be renderedpublic void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderable
updateBounds
in interface IsRenderable
updateBounds
in class RenderableModelBase
pmin
- minimum pointpmax
- maximum pointpublic void render(Renderer renderer, int flags)
IsRenderable
Renderer
.render
in interface IsRenderable
render
in class RenderableModelBase
renderer
- provides the functionality used to perform the rendering.flags
- flags that may be used to control different
aspects of the rendering. Flags are defined in Renderer
and currently include
Renderer.HIGHLIGHT
and
Renderer.SORT_FACES
.public void rerender()
public void initialize(double t)
HasState.setState(artisynth.core.modelbase.ComponentState)
, in which case t
may have an arbitrary value.initialize
in interface Model
initialize
in class ModelBase
t
- initialization time (seconds)public void attach(DriverInterface driver)
driver
- Interface giving access to the frame and viewerpublic void detach(DriverInterface driver)
driver
- Interface giving access to the frame and viewerpublic void addComponentChangeListener(ComponentChangeListener l)
public boolean removeComponentChangeListener(ComponentChangeListener l)
public void componentChanged(ComponentChangeEvent e)
ComponentList
This method should propagate the notification up the component hierarchy
by calling notifyParentOfChange
.
componentChanged
in interface ComponentChangeListener
componentChanged
in interface CompositeComponent
componentChanged
in class ComponentList<ModelComponent>
e
- optional argument giving specific information about the changepublic void notifyStructureChanged(java.lang.Object comp)
public boolean hasState()
ModelComponent
hasState
in interface ModelComponent
hasState
in class ModelComponentBase
true
if this component has statepublic ComponentState createState(ComponentState prevState)
HasState.setState(artisynth.core.modelbase.ComponentState)
and HasState.getState(artisynth.core.modelbase.ComponentState)
. The state object does not have to be set to the component's
current state. If the component does not have any state information,
this method should return an instance of
EmptyState
.createState
in interface HasState
createState
in class ModelBase
prevState
- If non-null, supplies a previous state that
was created by this component and which can be used to provide
pre-sizing hints.public void setState(ComponentState state)
public void getState(ComponentState state)
public void getInitialState(ComponentState newstate, ComponentState oldstate)
HasState
state
. If prevstate
is non-null, then it is
assumed to contain a previous initial state value returned by this
method, and state
should be set to be as consistent with
this previous state as possible. For example, suppose that this component
currently contains subcomponents A, B, and C, while the
prevstate
contains the state from a previous time when it
had components B, C, and D. Then state
should contain
substate values for B and C that are taken from
prevstate
. To facilitate this, the information returned in
state
should contain additional information such as the
identities of all the (current) sub-components.getInitialState
in interface HasState
getInitialState
in class ModelBase
newstate
- receives the state informationoldstate
- previous state information; may be null
.public StepAdjustment advance(double t0, double t1, int flags)
ModelBase
If the method determines that the step size should be
reduced, it can return a StepAdjustment
object indicating
the recommended reduction. Otherwise, the method may return
null
public void applyInputProbes(java.util.List<Probe> list, double t)
public void applyControllers(java.util.List<Controller> list, double t0, double t1)
public void applyMonitors(java.util.List<Monitor> list, double t0, double t1)
public void applyOutputProbes(java.util.List<Probe> list, double t1, artisynth.core.workspace.RootModel.ModelInfo info)
public double getNextAdvanceTime(java.util.List<Probe> probes, double stepSize, double t0, double t1)
public void stopAdvance()
public void setStopRequest(boolean req)
req
- if true
, requests a simulation stoppublic boolean getStopRequest()
public void scanProbes(ReaderTokenizer rtok) throws java.io.IOException
java.io.IOException
public void writeProbes(java.io.PrintWriter pw, NumberFormat fmt) throws java.io.IOException
java.io.IOException
public void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
write
.scan
in interface ModelComponent
scan
in interface Scannable
scan
in class ComponentList<ModelComponent>
rtok
- Tokenizer from which to scan the elementref
- optional reference object which can be used for resolving references to
other objectsjava.io.IOException
- if an I/O or formatting error occuredpublic void postscan(java.util.Deque<ScanToken> tokens, CompositeComponent ancestor) throws java.io.IOException
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.postscan
in interface ModelComponent
postscan
in class ComponentList<ModelComponent>
tokens
- token information that was stored during
scan()
.ancestor
- ancestor component with respect to which
reference component paths are defined.java.io.IOException
- if an error is encountered (such as a reference to a
non-existent component)public void dispose()
ModelBase
public void setWaypointChecking(boolean enable)
public boolean getWaypointChecking()
public boolean isCheckEnabled()
public void setCheckEnabled(boolean enable)
public void checkWrite(java.lang.String str)
public void mergeAllControlPanels(boolean combine)
public javax.swing.JTabbedPane getControlPanelTabs()
public void mergeControlPanel(boolean combine, ControlPanel panel)
public void notifyParentOfChange(ComponentChangeEvent e)
componentChanged
method.notifyParentOfChange
in interface ModelComponent
notifyParentOfChange
in class ModelComponentBase
e
- optional argument giving specific information about the changepublic static RootModel getRoot(ModelComponent comp)
comp
- component to seek RootModel fornull
public static boolean hasRoot(ModelComponent comp)
comp
- component to querycomp
has a RootModel as an ancestor.