use of artisynth.core.probes.TracingProbe in project artisynth_core by artisynth.
the class TracingProbePanel method getPrototypeProbe.
protected TracingProbe getPrototypeProbe(String traceableName) {
TracingProbe tmpProbe = TracingProbe.create(myTraceable, traceableName);
Class<?> type = tmpProbe.getClass();
TracingProbe comp = myPrototypeMap.get(type);
if (comp == null) {
// look for prototype as the last instance in the
// container
RootModel root = myMain.getRootModel();
for (Probe probe : root.getOutputProbes()) {
if (type.isAssignableFrom(probe.getClass())) {
comp = (TracingProbe) probe;
}
}
if (comp == null || !(comp instanceof CopyableComponent)) {
comp = tmpProbe;
// try {
// comp = (TracingProbe)type.newInstance();
// }
// catch (Exception e) {
// throw new InternalErrorException (
// "cannot create no-args instance of " + type);
// }
initializePrototype(comp);
} else {
comp = (TracingProbe) ((CopyableComponent) comp).copy(0, null);
}
myPrototypeMap.put(type, comp);
}
return comp;
}
use of artisynth.core.probes.TracingProbe 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);
}
}
}
}
use of artisynth.core.probes.TracingProbe in project artisynth_core by artisynth.
the class RootModel method clearTracing.
public void clearTracing(Traceable tr) {
TracingProbe tp = getTracingProbe(tr, "position");
if (tp != null) {
tp.getNumericList().clear();
tp.setData(tp.getStartTime());
tp.setData(tp.getStopTime());
rerender();
}
}
use of artisynth.core.probes.TracingProbe in project artisynth_core by artisynth.
the class RootModel method disableTracing.
public boolean disableTracing(Traceable tr) {
TracingProbe tp = getTracingProbe(tr, "position");
if (tp != null) {
removeOutputProbe(tp);
rerender();
return true;
} else {
return false;
}
}
use of artisynth.core.probes.TracingProbe in project artisynth_core by artisynth.
the class RootModel method clearTraces.
public void clearTraces() {
Collection<TracingProbe> tprobes = getTracingProbes();
for (TracingProbe tp : tprobes) {
tp.getNumericList().clear();
tp.setData(tp.getStartTime());
tp.setData(tp.getStopTime());
}
rerender();
}
Aggregations