use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.
the class RootModel method mergeAllControlPanels.
public void mergeAllControlPanels(boolean combine) {
JFrame frame = getMainFrame();
if (frame == null) {
// ArtiSynth is running in batch mode, so do nothing
return;
}
if (myControlPanelsFrame == null) {
createControlPanelsFrame();
}
if (!myControlPanels.isEmpty()) {
for (ControlPanel panel : myControlPanels) {
Container contentPane = panel.getFrame().getContentPane();
if (combine) {
myControlPanelTabs.addTab(panel.getFrame().getTitle(), contentPane);
} else {
panel.getFrame().setContentPane(contentPane);
}
panel.setVisible(!combine);
}
myControlPanelsFrame.pack();
if (myControlPanelTabs.getTabCount() == 0) {
myControlPanelsFrame.setVisible(false);
} else if (!myControlPanelsFrame.isVisible()) {
Point loc = frame.getLocation();
myControlPanelsFrame.setLocation(loc.x + frame.getWidth(), loc.y);
myControlPanelsFrame.setVisible(true);
}
}
}
use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.
the class PointModel method attach.
@Override
public void attach(DriverInterface driver) {
super.attach(driver);
if (getControlPanels().size() == 0) {
ControlPanel panel = new ControlPanel("activations", "");
for (AxialSpring s : model.axialSprings()) {
if (s instanceof Muscle) {
Muscle m = (Muscle) s;
String name = (m.getName() == null ? "m" + m.getNumber() : m.getName().toUpperCase());
panel.addWidget(name, m, "excitation", 0.0, 1.0);
}
}
addControlPanel(panel);
}
}
use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.
the class FemFrictionBeam method build.
public void build(String[] args) {
double feml = 0.1;
double femw = 0.05;
double plateh = 0.01;
myMech = new MechModel("mech");
myFem = FemFactory.createHexGrid(null, feml, femw, femw, 6, 3, 3);
myFem.setName("fem");
myFem.setDensity(1000);
myMech.addModel(myFem);
myPlate = RigidBody.createBox("plate", 2 * feml, feml, plateh, 1000);
myMech.addRigidBody(myPlate);
myPlate.setDynamic(false);
myPlate.setPose(new RigidTransform3d(0, 0, -(femw + plateh) / 2));
RenderProps.setPointStyle(myFem, Renderer.PointStyle.SPHERE);
RenderProps.setPointRadius(myFem, 0.001);
RenderProps.setPointColor(myFem, Color.GREEN);
myMech.setCollisionBehavior(myFem, myPlate, true, myMu);
myMech.transformGeometry(new RigidTransform3d(0, 0, 0, 0, 1, 0, Math.toRadians(myAngle)));
addModel(myMech);
ControlPanel panel = new ControlPanel("controls");
panel.addWidget(this, "friction");
panel.addWidget(this, "angle");
panel.addWidget(myMech, "integrator");
panel.addWidget(myMech, "maxStepSize");
addControlPanel(panel);
Main.getMain().arrangeControlPanels(this);
}
use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.
the class FemMuscleArm method addControlPanel.
public void addControlPanel() {
panel = new ControlPanel("Muscle Control", "");
panel.addWidget("Activation", model, "models/muscle:excitation", 0.0, 1.0);
panel.addWidget("Muscle-Arm Collision", this, "collisions");
addControlPanel(panel);
}
use of artisynth.core.gui.ControlPanel in project artisynth_core by artisynth.
the class HydrostatModel method createBundlesPanel.
public void createBundlesPanel(String[] names) {
bundlesPanel = new ControlPanel("Bundles", "LiveUpdate");
for (int i = 0; i < names.length; i++) {
LabeledComponentBase c = bundlesPanel.addWidget(names[i], this, "bundles/" + names[i] + ":excitation", 0.0, 1.0);
if (c != null)
c.setLabelFontColor(Color.getHSBColor((float) i / names.length, 1f, 1f));
}
bundlesPanel.pack();
bundlesPanel.setVisible(true);
}
Aggregations