Search in sources :

Example 1 with Controller

use of artisynth.core.modelbase.Controller in project artisynth_core by artisynth.

the class RootModel method dispose.

public void dispose() {
    for (Model m : myModels) {
        m.dispose();
    }
    for (Controller c : myControllers) {
        c.dispose();
    }
    for (Monitor m : myMonitors) {
        m.dispose();
    }
    // This dispose code not needed since dispose will now be called
    // be the control panel remove handler
    // for (ControlPanel cp : myControlPanels) {
    // cp.dispose();
    // }
    myControlPanels.removeAll();
    if (myControlPanelsFrame != null) {
        myControlPanelsFrame.setVisible(false);
        myControlPanelTabs.removeAll();
    }
}
Also used : Monitor(artisynth.core.modelbase.Monitor) Model(artisynth.core.modelbase.Model) Controller(artisynth.core.modelbase.Controller)

Example 2 with Controller

use of artisynth.core.modelbase.Controller in project artisynth_core by artisynth.

the class RootModel method prerender.

// implementations for Renderable
public void prerender(RenderList list) {
    for (Controller c : myControllers) {
        if (c instanceof Renderable) {
            list.addIfVisible((Renderable) c);
        }
    }
    for (Model m : myModels) {
        if (m instanceof Renderable) {
            list.addIfVisible((Renderable) m);
        }
    }
    for (Monitor m : myMonitors) {
        if (m instanceof Renderable) {
            list.addIfVisible((Renderable) m);
        }
    }
    list.addIfVisible(myOutputProbes);
    list.addIfVisible(myInputProbes);
    list.addIfVisible(myRenderables);
}
Also used : Renderable(maspack.render.Renderable) IsRenderable(maspack.render.IsRenderable) Monitor(artisynth.core.modelbase.Monitor) Model(artisynth.core.modelbase.Model) Controller(artisynth.core.modelbase.Controller)

Example 3 with Controller

use of artisynth.core.modelbase.Controller in project artisynth_core by artisynth.

the class InverseManager method findInverseController.

public static TrackingController findInverseController() {
    TrackingController ic = null;
    RootModel root = Main.getMain().getRootModel();
    for (Controller c : root.getControllers()) {
        if (c instanceof TrackingController) {
            ic = (TrackingController) c;
            break;
        }
    }
    return ic;
}
Also used : RootModel(artisynth.core.workspace.RootModel) Controller(artisynth.core.modelbase.Controller)

Example 4 with Controller

use of artisynth.core.modelbase.Controller in project artisynth_core by artisynth.

the class RootModel method initialize.

/**
 * {@inheritDoc}
 */
public void initialize(double t) {
    if (!myModelInfoValid) {
        updateModelInfo();
        myModelInfoValid = true;
    }
    for (Probe p : myInputProbes) {
        p.initialize(t);
    }
    for (Controller c : myControllers) {
        c.initialize(t);
    }
    for (Iterator<Model> it = myModels.iterator(); it.hasNext(); ) {
        it.next().initialize(t);
    }
    for (Monitor m : myMonitors) {
        m.initialize(t);
    }
    for (Probe p : myOutputProbes) {
        p.initialize(t);
    }
}
Also used : Monitor(artisynth.core.modelbase.Monitor) Model(artisynth.core.modelbase.Model) Probe(artisynth.core.probes.Probe) TracingProbe(artisynth.core.probes.TracingProbe) WayPointProbe(artisynth.core.probes.WayPointProbe) Controller(artisynth.core.modelbase.Controller)

Example 5 with Controller

use of artisynth.core.modelbase.Controller in project artisynth_core by artisynth.

the class RootModel method updateModelInfo.

private void updateModelInfo() {
    myRootInfo = new ModelInfo(this);
    // rebuild modelinfo, removing info for deleted models
    // and adding info for new models.
    LinkedHashMap<Model, ModelInfo> newinfo = new LinkedHashMap<Model, ModelInfo>();
    for (int i = 0; i < myModels.size(); i++) {
        // add model info for any new models
        Model model = myModels.get(i);
        ModelInfo info = myModelInfo.get(model);
        if (info != null) {
            info.clear();
        } else {
            info = new ModelInfo(model);
        }
        newinfo.put(model, info);
    }
    myModelInfo = newinfo;
    myRootInfo.clear();
    for (int i = 0; i < myMonitors.size(); i++) {
        Monitor mon = myMonitors.get(i);
        ModelInfo info = getModelInfo(mon);
        info.monitors.add(mon);
    }
    for (int i = 0; i < myControllers.size(); i++) {
        Controller ctl = myControllers.get(i);
        ModelInfo info = getModelInfo(ctl);
        info.controllers.add(ctl);
    }
    for (int i = 0; i < myInputProbes.size(); i++) {
        Probe p = myInputProbes.get(i);
        ModelInfo info = getModelInfo(p);
        info.inputProbes.add(p);
    }
    for (int i = 0; i < myOutputProbes.size(); i++) {
        Probe p = myOutputProbes.get(i);
        ModelInfo info = getModelInfo(p);
        info.outputProbes.add(p);
    }
    for (ModelInfo info : myModelInfo.values()) {
        info.createState();
    }
    myRootInfo.createState();
    myRootInfo.outputProbes.add(myWayPoints);
}
Also used : Monitor(artisynth.core.modelbase.Monitor) Model(artisynth.core.modelbase.Model) Controller(artisynth.core.modelbase.Controller) Probe(artisynth.core.probes.Probe) TracingProbe(artisynth.core.probes.TracingProbe) WayPointProbe(artisynth.core.probes.WayPointProbe) Point(java.awt.Point) WayPoint(artisynth.core.probes.WayPoint)

Aggregations

Controller (artisynth.core.modelbase.Controller)5 Model (artisynth.core.modelbase.Model)4 Monitor (artisynth.core.modelbase.Monitor)4 Probe (artisynth.core.probes.Probe)2 TracingProbe (artisynth.core.probes.TracingProbe)2 WayPointProbe (artisynth.core.probes.WayPointProbe)2 WayPoint (artisynth.core.probes.WayPoint)1 RootModel (artisynth.core.workspace.RootModel)1 Point (java.awt.Point)1 IsRenderable (maspack.render.IsRenderable)1 Renderable (maspack.render.Renderable)1