Search in sources :

Example 1 with DoubleFieldSlider

use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.

the class FemControlPanel method addExcitersToPanel.

public static void addExcitersToPanel(ControlPanel panel, FemMuscleModel fem) {
    for (MuscleExciter mex : fem.getMuscleExciters()) {
        DoubleFieldSlider slider = (DoubleFieldSlider) panel.addWidget(mex.getName(), fem, "exciters/" + mex.getNumber() + ":excitation", 0, 1);
        slider.setRoundingTolerance(0.00001);
        slider.getLabel().setForeground(FemControlPanel.getMuscleExciterColor(mex.getNumber()));
    }
}
Also used : MuscleExciter(artisynth.core.mechmodels.MuscleExciter) DoubleFieldSlider(maspack.widgets.DoubleFieldSlider)

Example 2 with DoubleFieldSlider

use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.

the class FemControlPanel method addBundlesToPanel.

public static void addBundlesToPanel(ControlPanel panel, FemMuscleModel fem, boolean reColor) {
    int ncolors = PlotTraceInfo.numPalatteColors();
    ComponentList<MuscleBundle> bundles = fem.getMuscleBundles();
    for (int i = 0; i < bundles.size(); ++i) {
        MuscleBundle bundle = bundles.get(i);
        DoubleFieldSlider slider = (DoubleFieldSlider) panel.addWidget(bundle.getName(), fem, "bundles/" + bundle.getNumber() + ":excitation", 0, 1);
        if (slider == null)
            continue;
        slider.setRoundingTolerance(0.00001);
        if (reColor) {
            slider.getLabel().setForeground(PlotTraceInfo.getPaletteColors()[i % ncolors]);
            RenderProps.setLineColor(bundles.get(i), PlotTraceInfo.getPaletteColors()[i % ncolors]);
            RenderProps.setFaceColor(bundles.get(i), PlotTraceInfo.getPaletteColors()[i % ncolors]);
        } else {
            if (bundles.get(i).getRenderProps() != null) {
                slider.getLabel().setForeground(bundles.get(i).getRenderProps().getLineColor());
            }
        }
    }
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) Point(java.awt.Point) DoubleFieldSlider(maspack.widgets.DoubleFieldSlider)

Example 3 with DoubleFieldSlider

use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.

the class FemMuscleDemo method createMusclePanel.

public void createMusclePanel() {
    ControlPanel myControlPanel = new ControlPanel("options", "LiveUpdate");
    FemControlPanel.addMuscleControls(myControlPanel, tissue, myModel);
    myControlPanel.addWidget(tissue, "profile");
    ComponentList<MuscleBundle> muscles = ((FemMuscleModel) tissue).getMuscleBundles();
    for (int i = 0; i < muscles.size(); ++i) {
        DoubleFieldSlider slider = (DoubleFieldSlider) myControlPanel.addWidget("activation [N per Muscle]", this, "models/FemBeam/models/fem/bundles/" + i + ":excitation", 0, 1);
        slider.setRoundingTolerance(0.00001);
        slider.getLabel().setForeground(getMuscleColor(i));
        BooleanSelector checkBox = (BooleanSelector) PropertyWidget.create("", muscles.get(i), "renderProps.visible");
        checkBox.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent e) {
                rerender();
            }
        });
        slider.add(checkBox);
    }
    for (int i = 0; i < muscles.size(); ++i) {
        BooleanSelector selector = (BooleanSelector) myControlPanel.addWidget("fibres active", this, "models/FemBeam/models/fem/bundles/" + i + ":fibresActive");
        selector.getLabel().setForeground(getMuscleColor(i));
        BooleanSelector checkBox = (BooleanSelector) PropertyWidget.create("", muscles.get(i).getFibres(), "renderProps.visible");
        checkBox.addValueChangeListener(new ValueChangeListener() {

            public void valueChange(ValueChangeEvent e) {
                rerender();
            }
        });
        selector.add(checkBox);
    }
    addControlPanel(myControlPanel);
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) ValueChangeEvent(maspack.widgets.ValueChangeEvent) ValueChangeListener(maspack.widgets.ValueChangeListener) BooleanSelector(maspack.widgets.BooleanSelector) ControlPanel(artisynth.core.gui.ControlPanel) FemControlPanel(artisynth.core.gui.FemControlPanel) FemMuscleModel(artisynth.core.femmodels.FemMuscleModel) Point(artisynth.core.mechmodels.Point) DoubleFieldSlider(maspack.widgets.DoubleFieldSlider)

Example 4 with DoubleFieldSlider

use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.

the class TubeDemo method addControlPanel.

protected void addControlPanel() {
    // MechModel mechMod, FemModel3d femMod) {
    ControlPanel myControlPanel = new ControlPanel("options", "");
    DoubleFieldSlider ymSlider = (DoubleFieldSlider) myControlPanel.addWidget(this, "youngsModulus", 1000, 1600000);
    ymSlider.setRoundingTolerance(10000);
    myControlPanel.addWidget(this, "poissonsRatio", -1, 0.5);
    // myControlPanel.addWidget (mod, "density", 100, 5000);
    // myControlPanel.addWidget (mod, "particleDamping", 0, 200);
    // myControlPanel.addWidget (mod, "stiffnessDamping", 0, 1);
    // myControlPanel.addWidget (mod, "integrator");
    // myControlPanel.addWidget (mod, "matrixSolver");
    // myControlPanel.addWidget (mod, "maxStepSize");
    myControlPanel.addWidget(this, "warping");
    myControlPanel.addWidget(this, "amplitude");
    myControlPanel.addWidget(this, "frequency");
    addControlPanel(myControlPanel);
}
Also used : DoubleFieldSlider(maspack.widgets.DoubleFieldSlider)

Example 5 with DoubleFieldSlider

use of maspack.widgets.DoubleFieldSlider in project artisynth_core by artisynth.

the class SpongeDemo method addControls.

protected void addControls(ControlPanel panel) {
    FemControlPanel.addMuscleControls(panel, sponge, sponge);
    panel.addWidget(sponge, "profile");
    if (sponge.getMuscleBundles().size() > 0) {
        ComponentList<MuscleBundle> muscles = ((SpongeModel) sponge).getMuscleBundles();
        for (int i = 0; i < muscles.size(); ++i) {
            // sponge.getMuscleList().get(i).setName(String.valueOf(i));
            DoubleFieldSlider slider = (DoubleFieldSlider) panel.addWidget("excitation [N]", sponge, "bundles/" + i + ":excitation", 0, 1);
            slider.setRoundingTolerance(0.001);
            int idx = i % NumericProbePanel.colorList.length;
            slider.getLabel().setForeground(NumericProbePanel.colorList[idx]);
        }
    }
    panel.addWidget(new JSeparator());
    panel.addWidget("gang 0-2", sponge, "exciters/gang:excitation");
    panel.addWidget("all muscles", sponge, "exciters/all:excitation");
}
Also used : MuscleBundle(artisynth.core.femmodels.MuscleBundle) Point(java.awt.Point) JSeparator(javax.swing.JSeparator) DoubleFieldSlider(maspack.widgets.DoubleFieldSlider)

Aggregations

DoubleFieldSlider (maspack.widgets.DoubleFieldSlider)5 MuscleBundle (artisynth.core.femmodels.MuscleBundle)3 Point (java.awt.Point)2 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 ControlPanel (artisynth.core.gui.ControlPanel)1 FemControlPanel (artisynth.core.gui.FemControlPanel)1 MuscleExciter (artisynth.core.mechmodels.MuscleExciter)1 Point (artisynth.core.mechmodels.Point)1 JSeparator (javax.swing.JSeparator)1 BooleanSelector (maspack.widgets.BooleanSelector)1 ValueChangeEvent (maspack.widgets.ValueChangeEvent)1 ValueChangeListener (maspack.widgets.ValueChangeListener)1