Search in sources :

Example 1 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class FemMuscleBeams method createControlPanel.

protected ControlPanel createControlPanel() {
    MechModel mech = (MechModel) models().get("mech");
    FemMuscleModel beamFibres = (FemMuscleModel) (mech.models().get("Fibre beam"));
    FemMuscleModel beamMaterial = (FemMuscleModel) (mech.models().get("Material beam"));
    ControlPanel panel = new ControlPanel("Muscle controls");
    panel.addLabel("Fibre beam:");
    for (MuscleBundle mb : beamFibres.getMuscleBundles()) {
        LabeledComponentBase comp = panel.addWidget(mb.getName(), mb, "excitation");
        comp.setLabelFontColor(mb.getRenderProps().getLineColor());
    }
    for (MuscleExciter mc : beamFibres.getMuscleExciters()) {
        panel.addWidget(mc.getName(), mc, "excitation");
    }
    panel.addWidget(new JSeparator());
    panel.addLabel("Material beam:");
    for (MuscleBundle mb : beamMaterial.getMuscleBundles()) {
        LabeledComponentBase comp = panel.addWidget(mb.getName(), mb, "excitation");
        comp.setLabelFontColor(mb.getRenderProps().getLineColor());
    }
    for (MuscleExciter mc : beamMaterial.getMuscleExciters()) {
        panel.addWidget(mc.getName(), mc, "excitation");
    }
    return panel;
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) LabeledComponentBase(maspack.widgets.LabeledComponentBase) JSeparator(javax.swing.JSeparator)

Example 2 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class MenuBarHandler method doAddControlPanel.

/**
 * add a control panel to the model
 */
private void doAddControlPanel() {
    RootModel root = myMain.getRootModel();
    int number = root.getControlPanels().nextComponentNumber();
    ControlPanel panel = new ControlPanel("panel " + number, "LiveUpdate Close");
    GuiUtils.locateVertically(panel.getFrame(), myMain.getFrame(), GuiUtils.CENTER);
    GuiUtils.locateHorizontally(panel.getFrame(), myMain.getFrame(), GuiUtils.RIGHT);
    root.addControlPanel(panel);
}
Also used : RootModel(artisynth.core.workspace.RootModel) ControlPanel(artisynth.core.gui.ControlPanel)

Example 3 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class InverseManager method isInversePanelVisible.

public static boolean isInversePanelVisible() {
    Main main = Main.getMain();
    ControlPanel inversePanel = main.getInverseManager().inverseControlPanel;
    return (inversePanel != null);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) Main(artisynth.core.driver.Main)

Example 4 with ControlPanel

use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.

the class FemBeamMech method addControlPanel.

public void addControlPanel(MechModel mechMod, FemModel3d femMod) {
    myControlPanel = new ControlPanel("options", "");
    FemControlPanel.addFemControls(myControlPanel, femMod, mechMod);
    addControlPanel(myControlPanel);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) FemControlPanel(artisynth.core.gui.FemControlPanel)

Example 5 with ControlPanel

use of artisynth.core.gui.ControlPanel 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)

Aggregations

ControlPanel (artisynth.core.gui.ControlPanel)35 FemControlPanel (artisynth.core.gui.FemControlPanel)10 Point (artisynth.core.mechmodels.Point)3 File (java.io.File)3 IOException (java.io.IOException)3 InternalErrorException (maspack.util.InternalErrorException)3 LabeledComponentBase (maspack.widgets.LabeledComponentBase)3 CollisionManager (artisynth.core.mechmodels.CollisionManager)2 MechModel (artisynth.core.mechmodels.MechModel)2 RigidBody (artisynth.core.mechmodels.RigidBody)2 WayPoint (artisynth.core.probes.WayPoint)2 RootModel (artisynth.core.workspace.RootModel)2 BooleanSelector (maspack.widgets.BooleanSelector)2 Main (artisynth.core.driver.Main)1 FemModel3d (artisynth.core.femmodels.FemModel3d)1 FemMuscleModel (artisynth.core.femmodels.FemMuscleModel)1 MuscleBundle (artisynth.core.femmodels.MuscleBundle)1 LinearAxialMuscle (artisynth.core.materials.LinearAxialMuscle)1 AxialSpring (artisynth.core.mechmodels.AxialSpring)1 Muscle (artisynth.core.mechmodels.Muscle)1