public class RootModel extends RenderableModelBase implements Disposable
ModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibilityCompositeComponent.NavpanelDisplay| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_MODEL_TITLE |
static PropertyList |
myProps |
static boolean |
testSaveAndRestoreState |
DEFAULT_MAX_STEP_SIZEDEFAULT_NAVPANEL_DISPLAYenforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNamesTRANSPARENT, TWO_DIMENSIONALSTATE_IS_VOLATILE| 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 propName,
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 model 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.
|
CompositeState |
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 |
findSourceDir()
Finds and returns the path name of the source directory for this RootModel.
|
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() |
java.lang.String |
getModelTitle() |
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.
|
java.lang.String |
getSourceRelativePath(java.lang.String relpath)
Finds and returns the path name of a file whose location is specified
relative to the source directory for this RootModel.
|
double |
getStartTime()
In development: specifies the simulation start time for a root model.
|
CompositeState |
getState(boolean annotated)
Convenience method that creates and returns a
CompositeState
containing the current state of the root model. |
void |
getState(ComponentState state)
Get the current state of this component.
|
boolean |
getStopRequest() |
TaskManager |
getTaskManager()
Returns the task manager associated with this root model, if any.
|
static boolean |
getTestSaveRestoreState() |
java.util.Collection<Traceable> |
getTraceSet() |
TracingProbe |
getTracingProbe(Traceable tr,
java.lang.String propName) |
java.util.LinkedList<TracingProbe> |
getTracingProbes() |
Point3d |
getViewerCenter() |
Point3d |
getViewerEye() |
Vector3d |
getViewerUp() |
WayPoint |
getWayPoint(double t) |
boolean |
getWayPointChecking() |
WayPointProbe |
getWayPoints() |
java.io.File |
getWorkingFolder()
Returns the working folder for this root model.
|
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.
|
void |
invalidateInitialState() |
static boolean |
isBaseProperty(java.lang.String name)
Returns true if a given property name is a property of the
RootModel class proper.
|
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 |
postscanInitialize() |
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 |
resetInitialState() |
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(AxisAlignedRotation REW)
Sets the default orientation that should be used for viewing this model
to
REW, where REW is specified as an AxisAlignedRotation. |
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 |
setModelTitle(java.lang.String title)
Sets a title for this model.
|
void |
setStartTime(double time)
In development: specifies the simulation start time for a root model.
|
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 |
setTaskManager(TaskManager tm)
Experimental method that sets a task manager for this root model.
|
static void |
setTestSaveRestoreState(boolean enable) |
void |
setTracingProbesVisible(boolean visible) |
void |
setViewerCenter(Point3d c) |
void |
setViewerEye(Point3d e) |
void |
setViewerUp(Vector3d up) |
void |
setWayPointChecking(boolean enable) |
void |
setWorkingFolder(java.io.File dir)
Explicitly sets the working folder for this root model.
|
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.
|
static void |
write(RootModel root,
java.io.PrintWriter pw,
NumberFormat fmt)
Special write method which allows us to write a root model using
only the information known to the RootModel class.
|
createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderPropsactionPerformed, copy, getDefaultMaxStepSize, getMaxStepSize, getMenuItems, hasParameterizedType, hierarchyContainsReferences, preadvance, setDefaultMaxStepSizeadd, add, addAll, addComponents, addFixed, addNumbered, clone, contains, contains, containsAll, copy, ensureCapacity, findComponent, get, get, getByNumber, getChildren, getMinNumber, getNavpanelDisplay, getNumberLimit, getOneBasedNumbering, getParameterType, getShortName, hasChildren, incrementNumbering, indexOf, invalidateNumbers, isEditable, isEmpty, iterator, nextComponentNumber, numComponents, remove, remove, removeAll, removeAll, removeComponents, resetNumbersToIndices, retainAll, set, setEditable, setNavpanelDisplay, setNumbered, setOneBasedNumbering, setShortName, size, toArray, toArray, updateNameMapcheckFlag, checkName, checkNameUniqueness, clearFlag, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitconnectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, isFixed, isMarked, isSelected, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferencesgetPropertygetChildren, hasChildrenisWritable, writegetNameequals, hashCode, parallelStream, removeIf, spliterator, streamrecursivelyFindpublic static boolean testSaveAndRestoreState
public static java.lang.String DEFAULT_MODEL_TITLE
public static PropertyList myProps
public RootModel()
public RootModel(java.lang.String name)
name - the name of the new modelpublic static boolean getTestSaveRestoreState()
public static void setTestSaveRestoreState(boolean enable)
public static void setFocusable(boolean focusable)
public static boolean isFocusable()
public void build(java.lang.String[] args)
throws java.io.IOException
java.io.IOExceptionpublic void postscanInitialize()
throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getAbout()
public void setDefaultValues()
ModelComponentBasepublic boolean getAdaptiveStepping()
public void setAdaptiveStepping(boolean enable)
public double getMinStepSize()
public void setMinStepSize(double step)
public void setMaxStepSize(double step)
ModelBasesetMaxStepSize in class ModelBasestep - maximum step size (seconds)public java.lang.String getModelTitle()
public void setModelTitle(java.lang.String title)
public PropertyList getAllPropertyInfo()
HasPropertiesgetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class RenderableModelBasepublic static boolean isBaseProperty(java.lang.String name)
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 Vector3d getViewerUp()
public AxisAngle getDefaultViewOrientation()
AxisAngle.ZERO indicates that no orientation is specified.public void setDefaultViewOrientation(AxisAngle REW)
REW. Setting a value equal to
AxisAngle.ZERO indicates
that no orientation is specified and so the viewer should
use its default view.REW - rotational transform from eye to world coordinatespublic void setDefaultViewOrientation(AxisAlignedRotation REW)
REW, where REW is specified as an AxisAlignedRotation. Typical values are AxisAlignedRotation.X_Y
(y axis pointing up), and AxisAlignedRotation.X_Z (z axis
pointing up). If REW is passed as null, then no
orientation is specified and so the viewer will 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 double getStartTime()
public void setStartTime(double time)
public TracingProbe addTracingProbe(Traceable traceable, java.lang.String propName, double startTime, double stopTime)
traceable - component to be tracedpropName - name of the property to 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 TaskManager getTaskManager()
null if there is none.setTaskManagerpublic void setTaskManager(TaskManager tm)
This method will typically be called from the build(java.lang.String[])
method. Currently, task managers are not saved when a model is
written to a file.
tm - task manager, or null to remove a task managergetTaskManagerpublic void prerender(RenderList list)
IsRenderablelist.addIfVisible (obj);
for each of the objects in question.prerender in interface IsRenderableprerender in class RenderableModelBaselist - list of objects to be renderedpublic void updateBounds(Vector3d pmin, Vector3d pmax)
IsRenderableupdateBounds in interface IsRenderableupdateBounds in class RenderableModelBasepmin - minimum pointpmax - maximum pointpublic void render(Renderer renderer, int flags)
IsRenderableRenderer.render in interface IsRenderablerender in class RenderableModelBaserenderer - 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 Modelinitialize in class ModelBaset - 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 ComponentChangeListenercomponentChanged in interface CompositeComponentcomponentChanged in class ComponentList<ModelComponent>e - optional argument giving specific information about the changepublic void notifyStructureChanged(java.lang.Object comp)
public boolean hasState()
ModelComponenthasState in interface ModelComponenthasState in class ModelComponentBasetrue if this component has statepublic CompositeState 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 HasStatecreateState in class ModelBaseprevState - 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 resetInitialState()
public void invalidateInitialState()
public void getState(ComponentState state)
public void getInitialState(ComponentState newstate, ComponentState oldstate)
ModelBasestate. 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) subcomponents.getInitialState in interface HasStategetInitialState in class ModelBasenewstate - receives the state informationoldstate - previous state information; may be null.public CompositeState getState(boolean annotated)
CompositeState
containing the current state of the root model.annotated - specifies if the state should be annotatedpublic StepAdjustment advance(double t0, double t1, int flags)
ModelBaseIf 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
The flags argument gives additional information that may
be relevant when advancing the model. Currently implemented
flags include Model.STATE_IS_VOLATILE.
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 static void write(RootModel root, java.io.PrintWriter pw, NumberFormat fmt) throws java.io.IOException
root - model to writepw - print writer to write the model tofmt - format for floating point valuesjava.io.IOExceptionpublic void scanProbes(ReaderTokenizer rtok) throws java.io.IOException
java.io.IOExceptionpublic void scan(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
write.scan in interface ModelComponentscan in interface Scannablescan 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 PostScannablepostscan 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()
ModelBasepublic 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 ModelComponentnotifyParentOfChange in class ModelComponentBasee - optional argument giving specific information about the changepublic static RootModel getRoot(ModelComponent comp)
comp - component to seek RootModel fornullpublic static boolean hasRoot(ModelComponent comp)
comp - component to querycomp has a RootModel as an ancestor.public java.lang.String findSourceDir()
public java.lang.String getSourceRelativePath(java.lang.String relpath)
findSourceDir().relpath - path giving the location of the file relative to
the root model source directorypublic java.io.File getWorkingFolder()
setWorkingFolder(java.io.File), the folder defaults to
the source folder for the Java class, or, if that is not
found, the current working folder specified by ".".public void setWorkingFolder(java.io.File dir)
null causes the working folder to revert to
its default definition.