Search in sources :

Example 31 with ControlPanel

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

the class HydrostatModel method createExcitersPanel.

public void createExcitersPanel(String[] names) {
    exciterPanel = new ControlPanel("Exciters", "LiveUpdate");
    for (int i = 0; i < names.length; i++) {
        LabeledComponentBase c = exciterPanel.addWidget(names[i], this, "exciters/" + names[i] + ":excitation", 0.0, 1.0);
        if (c != null)
            c.setLabelFontColor(Color.getHSBColor((float) i / names.length, 1f, 1f));
    }
    exciterPanel.pack();
    exciterPanel.setVisible(true);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) LabeledComponentBase(maspack.widgets.LabeledComponentBase) Point(artisynth.core.mechmodels.Point)

Example 32 with ControlPanel

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

the class SinglePyramid method createControlPanel.

private void createControlPanel(FemModel3d mod) {
    ControlPanel panel = new ControlPanel("options");
    FemControlPanel.addFem3dControls(panel, mod, mod);
    panel.pack();
    addControlPanel(panel);
    panel.setVisible(true);
    Main.getMain().arrangeControlPanels(this);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) FemControlPanel(artisynth.core.gui.FemControlPanel)

Example 33 with ControlPanel

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

the class SingleQuadwedge method createControlPanel.

private void createControlPanel(FemModel3d mod) {
    ControlPanel panel = new ControlPanel("options");
    FemControlPanel.addFem3dControls(panel, mod, mod);
    panel.pack();
    addControlPanel(panel);
    panel.setVisible(true);
    Main.getMain().arrangeControlPanels(this);
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) FemControlPanel(artisynth.core.gui.FemControlPanel)

Example 34 with ControlPanel

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

the class RootModel method loadControlPanel.

public ControlPanel loadControlPanel(String filename) {
    ControlPanel panel = null;
    try {
        panel = (ControlPanel) ComponentUtils.loadComponent(new File(filename), this, ControlPanel.class);
    } catch (Exception e) {
        System.out.println("Error reading control panel file " + filename + ", error=" + e.getMessage());
    }
    if (panel != null && panel.numWidgets() > 0) {
        // panel.pack();
        // panel.setVisible (true);
        myControlPanels.add(panel);
        locateControlPanel(panel);
    }
    return panel;
}
Also used : ControlPanel(artisynth.core.gui.ControlPanel) File(java.io.File) NumericalException(maspack.matrix.NumericalException) InternalErrorException(maspack.util.InternalErrorException) IOException(java.io.IOException)

Example 35 with ControlPanel

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

the class SimpleCollide method createAndAddControlPanel.

ControlPanel createAndAddControlPanel(String name, ModelComponent comp) {
    ControlPanel panel = new ControlPanel(name);
    if (comp instanceof FemModel3d) {
        panel.addWidget(comp, "material");
        panel.addWidget(comp, "density");
        panel.addWidget(comp, "incompressible");
        panel.addWidget(comp, "volume");
    } else if (comp instanceof RigidBody) {
        panel.addWidget(comp, "position");
        panel.addWidget(comp, "orientation");
    } else {
        throw new InternalErrorException("No control panel code for components of type " + comp.getClass());
    }
    ControlPanel existingPanel = getControlPanels().get(name);
    if (existingPanel != null) {
        int idx = getControlPanels().indexOf(existingPanel);
        removeControlPanel(existingPanel);
        existingPanel.dispose();
        addControlPanel(panel, idx);
        Main.getMain().arrangeControlPanels(this);
    } else {
        addControlPanel(panel);
    }
    return panel;
}
Also used : FemModel3d(artisynth.core.femmodels.FemModel3d) ControlPanel(artisynth.core.gui.ControlPanel) RigidBody(artisynth.core.mechmodels.RigidBody) InternalErrorException(maspack.util.InternalErrorException)

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