use of maspack.widgets.EnumSelector in project artisynth_core by artisynth.
the class GeometryInertiaPanel method createInertiaWidgets.
// Called once at panel creation time to create and add the widgets needed
// for controlling the inertia.
protected void createInertiaWidgets() {
myInertiaMethodSelector = new EnumSelector("set inertia by", InertiaMethod.values());
myInertiaMethodSelector.addValueChangeListener(this);
addWidget(myInertiaMethodSelector);
myDensityField = new DoubleField("density", 1, "%.6g");
myDensityField.addValueChangeListener(this);
myDensityField.setGUIVoidEnabled(true);
myDensityField.setStretchable(true);
myDensityField.addValueCheckListener(new PositiveValueCheck());
addWidget(myDensityField);
myMassField = new DoubleField("mass");
myMassField.addValueChangeListener(this);
myMassField.setStretchable(true);
myMassField.addValueCheckListener(new PositiveValueCheck());
addWidget(myMassField);
myInertiaField = new SymmetricMatrix3dField("rotational inertia");
myInertiaField.setFormat("%.5g");
myInertiaField.addValueChangeListener(this);
myInertiaField.setStretchable(true);
addWidget(myInertiaField);
myCOMField = new VectorField("center of mass", new Point3d(), "%.5g");
myCOMField.setResultHolder(new Point3d());
myCOMField.addValueChangeListener(this);
myCOMField.setStretchable(true);
addWidget(myCOMField);
// if myOriginalInertia was not set from widgets, then this will
// default to the identity inertia
// setInertiaWidgets (myOriginalInertia);
}
use of maspack.widgets.EnumSelector in project artisynth_core by artisynth.
the class FemModel3dAgent method createGeometryPanel.
private void createGeometryPanel() {
geometryPanel = new LabeledComponentPanel();
geometryPanel.setLayout(new BoxLayout(geometryPanel, BoxLayout.Y_AXIS));
meshSelector = new EnumSelector("mesh type", FemMeshType.Grid, FemMeshType.values());
meshSelector.addValueChangeListener(this);
geometryPanel.addWidget(meshSelector);
createMeshPropPanel();
geometryPanel.addWidget(meshPropPanel);
elemSelector = new EnumSelector("element type", FemElementType.Tet, FemElementType.values());
elemSelector.addValueChangeListener(this);
geometryPanel.addWidget(elemSelector);
updateElemSelector();
if (mySettings != null && elemSelector.isEnabledAll() && mySettings.elemType != null) {
elemSelector.maskValueChangeListeners(true);
elemSelector.setValue(mySettings.elemType);
elemSelector.maskValueChangeListeners(false);
}
addWidget(geometryPanel);
geometryPanel.setBorder(GuiUtils.createTitledPanelBorder("Geometry"));
}
use of maspack.widgets.EnumSelector in project artisynth_core by artisynth.
the class FemModel3dAgent method updateElemSelector.
private void updateElemSelector() {
FemMeshType value = (FemMeshType) meshSelector.getValue();
geometryPanel.removeWidget(elemSelector);
if (value == FemMeshType.AnsysMesh || value == FemMeshType.TetgenMesh || value == FemMeshType.UCDMesh || value == FemMeshType.SurfaceMesh || value == FemMeshType.Sphere) {
elemSelector.setEnabledAll(false);
} else if (value == FemMeshType.Grid) {
elemSelector = new EnumSelector("element type", FemElementType.values());
} else if (value == FemMeshType.Tube || value == FemMeshType.Torus || value == FemMeshType.Extrusion) {
elemSelector = new EnumSelector("element type", new FemElementType[] { FemElementType.Tet, FemElementType.Hex, FemElementType.QuadTet, FemElementType.QuadHex });
}
elemSelector.addValueChangeListener(this);
geometryPanel.addWidget(elemSelector);
}
use of maspack.widgets.EnumSelector in project artisynth_core by artisynth.
the class GeometryInertiaPanel method createGeometrySelector.
protected void createGeometrySelector() {
myGeometrySelector = new EnumSelector("geometry type", GeometryType.values());
addWidget(myGeometrySelector);
myGeometrySelector.addValueChangeListener(this);
}
Aggregations