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;
}
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);
}
}
}
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();
}
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;
}
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();
}
Aggregations