public class RootModel extends RenderableModelBase implements Disposable, java.awt.event.ActionListener
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
TRANSLUCENT, 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 |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent event)
By default, this method does nothing.
|
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) |
GLRenderableHolder |
addRenderable(GLRenderable renderable) |
void |
addRenderable(RenderableComponent comp) |
TracingProbe |
addTracingProbe(Tracable tracable,
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(Tracable 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(Tracable tr) |
void |
dispose()
Called when the model is discarded.
|
void |
enableTracing(Tracable 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 is 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() |
GLViewer |
getMainViewer() |
double |
getMinStepSize() |
java.lang.Object[] |
getModelMenuItems()
Can be overriden by a subclass to generate a list of objects to be
displayed under a "Model" menu in the main ArtiSynth frame.
|
ComponentListView<Monitor> |
getMonitors() |
double |
getNextAdvanceTime(java.util.List<Probe> probes,
double stepSize,
double t0,
double t1) |
int |
getNumTracables() |
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.
|
java.util.Collection<Tracable> |
getTraceSet() |
TracingProbe |
getTracingProbe(Tracable 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)
Returns true if a specified component has a RootModel as an ancestor.
|
boolean |
hasState()
Returns true 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(Tracable tr) |
ControlPanel |
loadControlPanel(java.lang.String filename) |
javax.swing.JMenuItem |
makeMenuItem(java.lang.String cmd,
java.lang.String toolTip)
Convenience method for creating menu items to be placed under the "Model"
menu.
|
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)
Prepare for rendering, and potentially add itself to a list to be drawn
by a GLRenderer.
|
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(GLRenderable renderable) |
boolean |
removeRenderable(RenderableComponent comp) |
boolean |
removeWayPoint(WayPoint way) |
void |
render(GLRenderer renderer,
int flags)
Render this object using Open GL via the JOGL.
|
RenderableComponentList<RenderableComponent> |
renderables() |
void |
requestStop()
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 |
rerender() |
void |
scan(ReaderTokenizer rtok,
java.lang.Object ref)
Scans this element from a ReaderTokenizer.
|
void |
setAdaptiveStepping(boolean enable) |
void |
setCheckEnabled(boolean enable) |
void |
setDefaultValues()
Sets the attributes of this component to their default values.
|
void |
setDefaultViewOrientation(AxisAngle R)
Sets the default orientation that should be used for viewing
this model.
|
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 |
setTracingProbesVisible(boolean visible) |
void |
setViewerCenter(Point3d c) |
void |
setViewerEye(Point3d e) |
void |
setWaypointChecking(boolean enable) |
void |
updateBounds(Point3d pmin,
Point3d pmax)
Update the minimum and maximum points for this object.
|
createRenderProps, getRenderHints, getRenderProps, getSelection, isSelectable, numSelectionQueriesNeeded, setRenderProps
copy, getInitialState, getMaxStepSize, 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, isEmpty, iterator, nextComponentNumber, numComponents, remove, remove, removeAll, removeAll, removeComponents, retainAll, setNavpanelDisplay, setNumberingStartAtOne, setShortName, size, toArray, toArray, updateNameMap
checkFlag, checkName, checkNameUniqueness, clearFlag, connectToHierarchy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getProperty, getSoftReferences, 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 GLRenderableHolder addRenderable(GLRenderable renderable)
public boolean removeRenderable(GLRenderable 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 void setViewerCenter(Point3d c)
public Point3d getViewerCenter()
public void setViewerEye(Point3d e)
public Point3d getViewerEye()
public AxisAngle getDefaultViewOrientation()
public void setDefaultViewOrientation(AxisAngle R)
R
- 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(Tracable tracable, java.lang.String traceName, double startTime, double stopTime)
tracable
- 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(Tracable tr, java.lang.String propName)
public void enableTracing(Tracable tr)
public boolean isTracing(Tracable tr)
public boolean disableTracing(Tracable tr)
public void clearTracing(Tracable tr)
public java.util.LinkedList<TracingProbe> getTracingProbes()
public void disableAllTracing()
public void clearTraces()
public java.util.Collection<Tracable> getTraceSet()
public int getNumTracables()
public void clear()
clear
in interface java.util.Collection<ModelComponent>
clear
in class ComponentList<ModelComponent>
public void prerender(RenderList list)
GLRenderable
prerender
in interface GLRenderable
prerender
in class RenderableModelBase
public void updateBounds(Point3d pmin, Point3d pmax)
GLRenderable
updateBounds
in interface GLRenderable
updateBounds
in class RenderableModelBase
pmin
- minimum pointpmax
- maximum pointpublic void render(GLRenderer renderer, int flags)
GLRenderable
render
in interface GLRenderable
render
in class RenderableModelBase
renderer
- renderer object which is used to perform the rendering. Provides pointers
to GL and GLU, along with helper functions.flags
- supplies flags that may be used to control different
aspects of the rendering. Flags are defined in GLRenderer
and currently include
GLRenderer.SELECTED
,
GLRenderer.VERTEX_COLORING
,
GLRenderer.HSV_COLOR_INTERPOLATION
,
GLRenderer.SORT_FACES
, and
GLRenderer.CLEAR_MESH_DISPLAY_LISTS
.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)
public 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
public 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 requestStop()
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
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 javax.swing.JMenuItem makeMenuItem(java.lang.String cmd, java.lang.String toolTip)
cmd
, this RootModel as an ActionListener, and
optional tool-tip text as specified by toolTip
.public void actionPerformed(java.awt.event.ActionEvent event)
getModelMenuItems()
.actionPerformed
in interface java.awt.event.ActionListener
public java.lang.Object[] getModelMenuItems()
null
(the default behavior), that is taken to
indicate that this RootModel has no application menu items and no "Model"
menu should be created. Otherwise, the method should return an array of
Objects, which should be items capable of being added to a JMenu,
including Component, JMenuItem, and String.null
if no such menu is to be created.makeMenuItem(java.lang.String, java.lang.String)
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
has a RootModel as an ancestor.