Search in sources :

Example 11 with NumericProbeVariable

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

the class OutputNumericProbeEditor method renameProperty.

/**
 * renames the current property by: a.) changing the name in myVariables b.)
 * updating this change in all drivers
 */
public void renameProperty(String oldname, String newname) {
    // first, rename the property in the variables list.
    try {
        NumericProbeVariable var = myVariables.get(oldname);
        // System.out.println(var.getDimension());
        myVariables.remove(oldname);
        myVariables.put(newname, var);
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    // then, rename it for each driver.
    for (NumericProbeDriver driver : myDrivers) {
        if (driver.isValid()) {
            driver.renameVariable(oldname, newname);
            System.out.println(oldname + " changed to " + newname);
            int id = myDrivers.indexOf(driver);
            getEqPane(id).setEqText(driver.getExpression());
            getEqPane(id).updateAppearance();
            System.out.println("setting driver " + id + " expression to " + driver.getExpression());
        }
    }
// System.out.println("Done renaming of Property");
}
Also used : NumericProbeDriver(artisynth.core.probes.NumericProbeDriver) NumericProbeVariable(artisynth.core.probes.NumericProbeVariable)

Example 12 with NumericProbeVariable

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

the class OutputNumericProbeEditor method addBlankOutputProperty.

private void addBlankOutputProperty() {
    // GUI components:
    String propname = getUniqueVariableName(OUTPUT_PREFIX);
    AddPropertyPane newPropPane = new AddPropertyPane(this);
    newPropPane.setPropNameField(propname);
    newPropPane.setPropNameEnabled(true);
    addPropertyGUI(newPropPane);
    // Data components:
    myProperties.add(myProperties.size(), null);
    NumericProbeVariable variable = new NumericProbeVariable(1);
    myVariables.put(propname, variable);
}
Also used : NumericProbeVariable(artisynth.core.probes.NumericProbeVariable)

Aggregations

NumericProbeVariable (artisynth.core.probes.NumericProbeVariable)12 NumericProbeDriver (artisynth.core.probes.NumericProbeDriver)7 Property (maspack.properties.Property)4 IOException (java.io.IOException)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 AddComponentsCommand (artisynth.core.gui.editorManager.AddComponentsCommand)2 ArrayList (java.util.ArrayList)2 NumericConverter (maspack.properties.NumericConverter)2 Displayable (artisynth.core.gui.Displayable)1 Timeline (artisynth.core.gui.Timeline)1 ModelComponent (artisynth.core.modelbase.ModelComponent)1 NumericInputProbe (artisynth.core.probes.NumericInputProbe)1 NumericOutputProbe (artisynth.core.probes.NumericOutputProbe)1 CompositeProperty (maspack.properties.CompositeProperty)1 DoubleInterval (maspack.util.DoubleInterval)1