Search in sources :

Example 1 with EnumSelector

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);
}
Also used : VectorField(maspack.widgets.VectorField) SymmetricMatrix3dField(maspack.widgets.SymmetricMatrix3dField) EnumSelector(maspack.widgets.EnumSelector) DoubleField(maspack.widgets.DoubleField)

Example 2 with EnumSelector

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"));
}
Also used : BoxLayout(javax.swing.BoxLayout) EnumSelector(maspack.widgets.EnumSelector) LabeledComponentPanel(maspack.widgets.LabeledComponentPanel)

Example 3 with EnumSelector

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);
}
Also used : FemElementType(artisynth.core.femmodels.FemFactory.FemElementType) EnumSelector(maspack.widgets.EnumSelector)

Example 4 with EnumSelector

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);
}
Also used : EnumSelector(maspack.widgets.EnumSelector)

Aggregations

EnumSelector (maspack.widgets.EnumSelector)4 FemElementType (artisynth.core.femmodels.FemFactory.FemElementType)1 BoxLayout (javax.swing.BoxLayout)1 DoubleField (maspack.widgets.DoubleField)1 LabeledComponentPanel (maspack.widgets.LabeledComponentPanel)1 SymmetricMatrix3dField (maspack.widgets.SymmetricMatrix3dField)1 VectorField (maspack.widgets.VectorField)1