Search in sources :

Example 1 with TracingProbePanel

use of artisynth.core.gui.editorManager.TracingProbePanel in project artisynth_core by artisynth.

the class SelectionPopup method addTracing.

private void addTracing(LinkedList<ModelComponent> selectedItems) {
    // RootModel root = myMain.getRootModel();
    // String name = null;
    // double startTime = myMain.getTimeSec();
    // double updateInterval = root.getMaxStepSizeSec();
    Traceable firstTraceable = null;
    for (ModelComponent comp : selectedItems) {
        if (comp instanceof Traceable) {
            firstTraceable = (Traceable) comp;
        }
    }
    if (firstTraceable == null) {
        throw new InternalErrorException("'Add tracing' called with no traceabled in selection");
    }
    TracingProbePanel panel = new TracingProbePanel(firstTraceable, getCommonTraceables(selectedItems));
    panel.pack();
    GuiUtils.locateRelative(panel, myLastBounds, 0.5, 0.5, 0, 0.5);
    // if (myTraceItemLoc != null)
    // { panel.setLocation (
    // myTraceItemLoc.x, myTraceItemLoc.y);
    // }
    panel.setVisible(true);
    if (panel.getReturnValue() == OptionPanel.OK_OPTION) {
        for (ModelComponent comp : selectedItems) {
            if (comp instanceof Traceable) {
                TracingProbe probe = panel.createProbe((Traceable) comp);
                myMain.getRootModel().addOutputProbe(probe);
            }
        }
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) TracingProbePanel(artisynth.core.gui.editorManager.TracingProbePanel) InternalErrorException(maspack.util.InternalErrorException) TracingProbe(artisynth.core.probes.TracingProbe) Traceable(artisynth.core.modelbase.Traceable)

Aggregations

TracingProbePanel (artisynth.core.gui.editorManager.TracingProbePanel)1 ModelComponent (artisynth.core.modelbase.ModelComponent)1 Traceable (artisynth.core.modelbase.Traceable)1 TracingProbe (artisynth.core.probes.TracingProbe)1 InternalErrorException (maspack.util.InternalErrorException)1