Search in sources :

Example 1 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class ProbeInfo method setLargeDisplayVisible.

public NumericProbeDisplayLarge setLargeDisplayVisible(boolean visible) {
    Probe probe = getProbe();
    if (!(probe instanceof NumericProbeBase)) {
        return null;
    }
    // display large probe display
    if (visible) {
        if (largeDisplay == null) {
            largeDisplay = new NumericProbeDisplayLarge(probe, Integer.toString(getTrackNumber()));
            ;
            largeDisplay.addWindowListener(new WindowHandler());
            // position the large probe window to the left of the timeline window
            Point timelineLocation = myController.getLocation();
            Dimension timelineSize = myController.getSize();
            Point newLargeProbePosition = new Point(timelineLocation.x + timelineSize.width, timelineLocation.y);
            largeDisplay.setLocation(newLargeProbePosition);
        }
        largeDisplay.setVisible(true);
    } else {
        if (largeDisplay == null) {
            largeDisplay.setVisible(false);
        }
    }
    return largeDisplay;
}
Also used : NumericProbeBase(artisynth.core.probes.NumericProbeBase) Point(java.awt.Point) WayPoint(artisynth.core.probes.WayPoint) Dimension(java.awt.Dimension) NumericOutputProbe(artisynth.core.probes.NumericOutputProbe) WayPointProbe(artisynth.core.probes.WayPointProbe) Probe(artisynth.core.probes.Probe) NumericInputProbe(artisynth.core.probes.NumericInputProbe) NumericProbeDisplayLarge(artisynth.core.gui.NumericProbeDisplayLarge)

Example 2 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class TimelineController method selectionChanged.

public void selectionChanged(SelectionEvent e) {
    for (ModelComponent c : e.getAddedComponents()) {
        if (c instanceof Probe) {
            ProbeInfo info = myProbeMap.get((Probe) c);
            selectedProbes.add(info);
        }
    }
    for (ModelComponent c : e.getRemovedComponents()) {
        if (c instanceof Probe) {
            ProbeInfo info = myProbeMap.get((Probe) c);
            selectedProbes.remove(info);
        }
    }
}
Also used : ModelComponent(artisynth.core.modelbase.ModelComponent) Probe(artisynth.core.probes.Probe) WayPointProbe(artisynth.core.probes.WayPointProbe)

Example 3 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class TimelineController method updateProbes.

/**
 * Updates probes when probes are added or removed from the RootModel.
 */
public void updateProbes(RootModel root) {
    LinkedList<Probe> inList = new LinkedList<Probe>();
    for (int i = 0; i < myInTracks.size(); i++) {
        myInTracks.get(i).appendProbes(inList);
    }
    updateProbeChanges(root.getInputProbes(), inList);
    LinkedList<Probe> outList = new LinkedList<Probe>();
    for (int i = 0; i < myOutTracks.size(); i++) {
        myOutTracks.get(i).appendProbes(outList);
    }
    updateProbeChanges(root.getOutputProbes(), outList);
    for (int i = 0; i < myInTracks.size(); i++) {
        myInTracks.get(i).updateProbeData();
    }
    for (int i = 0; i < myOutTracks.size(); i++) {
        myOutTracks.get(i).updateProbeData();
    }
    refreshWayPoints(root);
    refreshProbeTrackDisplay();
    requestUpdateDisplay();
}
Also used : Probe(artisynth.core.probes.Probe) WayPointProbe(artisynth.core.probes.WayPointProbe) WayPoint(artisynth.core.probes.WayPoint)

Example 4 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class TimelineController method updateProbesAndWaypoints.

/**
 * Checks to see if the currently loaded probes and waypoints are consistent
 * with the root model, and updates them if necessary. This method is not
 * thread-safe.
 *
 * @return true if probes needed updating, false otherwise.
 */
public boolean updateProbesAndWaypoints(RootModel rootModel) {
    boolean updateWasNeeded = false;
    for (ProbeInfo info : myProbeMap.values()) {
        info.myMark = true;
    }
    for (Probe p : rootModel.getInputProbes()) {
        ProbeInfo info = myProbeMap.get(p);
        if (info != null) {
            info.myMark = false;
        } else {
            addProbe(p);
            updateWasNeeded = true;
        }
    }
    for (Probe p : rootModel.getOutputProbes()) {
        ProbeInfo info = myProbeMap.get(p);
        if (info != null) {
            info.myMark = false;
        } else {
            addProbe(p);
            updateWasNeeded = true;
        }
    }
    for (ProbeInfo info : myProbeMap.values()) {
        if (info.myMark == true) {
            removeProbe(info.getProbe());
            updateWasNeeded = true;
        }
    }
    if (refreshWayPoints(rootModel)) {
        updateWasNeeded = true;
    }
    return updateWasNeeded;
}
Also used : Probe(artisynth.core.probes.Probe) WayPointProbe(artisynth.core.probes.WayPointProbe)

Example 5 with Probe

use of artisynth.core.probes.Probe in project artisynth_core by artisynth.

the class Workspace method oldWriteProbes.

/**
 * write out the probes -- currently written out in a flat list -- should be
 * rewritten to match model file format, i.e. inputProbes = [ ... ]
 * outputProbes = [ ... ] waypoints = [ ... ]
 *
 * @param pw
 * @param fmt
 * @throws IOException
 */
// WS
private static void oldWriteProbes(PrintWriter pw, NumberFormat fmt, RootModel rootModel) throws IOException {
    if (fmt == null)
        fmt = new NumberFormat("%g");
    if (rootModel.getInputProbes().size() > 0 || rootModel.getOutputProbes().size() > 0 || rootModel.getWayPoints().size() > 0) {
        pw.println("[");
        IndentingPrintWriter.addIndentation(pw, 2);
        // write out the input probes
        for (Probe iprobe : rootModel.getInputProbes()) {
            pw.println(ClassAliases.getAliasOrName(iprobe.getClass()));
            iprobe.write(pw, fmt, rootModel);
        }
        // write out the output probes
        for (Probe oprobe : rootModel.getOutputProbes()) {
            pw.println(ClassAliases.getAliasOrName(oprobe.getClass()));
            oprobe.write(pw, fmt, rootModel);
        }
        // write way points
        pw.println(ClassAliases.getAliasOrName(rootModel.getWayPoints().getClass()));
        rootModel.getWayPoints().write(pw, fmt, rootModel);
        IndentingPrintWriter.removeIndentation(pw, 2);
        pw.println("]");
    } else {
        pw.println("[ ]");
    }
    pw.flush();
}
Also used : WayPointProbe(artisynth.core.probes.WayPointProbe) Probe(artisynth.core.probes.Probe)

Aggregations

Probe (artisynth.core.probes.Probe)16 WayPointProbe (artisynth.core.probes.WayPointProbe)11 NumericInputProbe (artisynth.core.probes.NumericInputProbe)5 TracingProbe (artisynth.core.probes.TracingProbe)5 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)4 WayPoint (artisynth.core.probes.WayPoint)4 RootModel (artisynth.core.workspace.RootModel)3 SelectionManager (artisynth.core.gui.selectionManager.SelectionManager)2 Controller (artisynth.core.modelbase.Controller)2 Model (artisynth.core.modelbase.Model)2 Monitor (artisynth.core.modelbase.Monitor)2 Point (java.awt.Point)2 InternalErrorException (maspack.util.InternalErrorException)2 FemModel3d (artisynth.core.femmodels.FemModel3d)1 NumericProbeDisplayLarge (artisynth.core.gui.NumericProbeDisplayLarge)1 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)1 NumericProbeEditor (artisynth.core.gui.probeEditor.NumericProbeEditor)1 MechModel (artisynth.core.mechmodels.MechModel)1 RigidBody (artisynth.core.mechmodels.RigidBody)1 CopyableComponent (artisynth.core.modelbase.CopyableComponent)1