Search in sources :

Example 1 with PrimitiveType

use of cbit.vcell.geometry.CSGPrimitive.PrimitiveType in project vcell by virtualcell.

the class CSGObjectPropertiesPanel method getAddPrimitiveMenu.

private JMenu getAddPrimitiveMenu() {
    if (addPrimitiveMenu == null) {
        addPrimitiveMenu = new JMenu("Primitive Geometry");
        PrimitiveType[] values = CSGPrimitive.PrimitiveType.values();
        int numTypes = values.length;
        addPrimitiveMenuItems = new JMenuItem[numTypes];
        for (int i = 0; i < numTypes; i++) {
            addPrimitiveMenuItems[i] = new JMenuItem(values[i].name().toLowerCase());
            addPrimitiveMenuItems[i].addActionListener(eventHandler);
            addPrimitiveMenu.add(addPrimitiveMenuItems[i]);
        }
    }
    return addPrimitiveMenu;
}
Also used : PrimitiveType(cbit.vcell.geometry.CSGPrimitive.PrimitiveType) JMenuItem(javax.swing.JMenuItem) JMenu(javax.swing.JMenu) Point(java.awt.Point)

Example 2 with PrimitiveType

use of cbit.vcell.geometry.CSGPrimitive.PrimitiveType in project vcell by virtualcell.

the class XmlReader method getCSGPrimitive.

private CSGPrimitive getCSGPrimitive(Element param) {
    String name = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
    String primitiveTypeStr = unMangle(param.getAttributeValue(XMLTags.CSGPrimitiveTypeTag));
    // ---Create the new CSGPrimitive object ---
    PrimitiveType type = CSGPrimitive.PrimitiveType.valueOf(primitiveTypeStr);
    CSGPrimitive csgPrimitive = new CSGPrimitive(name, type);
    return csgPrimitive;
}
Also used : CSGPrimitive(cbit.vcell.geometry.CSGPrimitive) PrimitiveType(cbit.vcell.geometry.CSGPrimitive.PrimitiveType)

Example 3 with PrimitiveType

use of cbit.vcell.geometry.CSGPrimitive.PrimitiveType in project vcell by virtualcell.

the class CSGObjectPropertiesPanel method menuItemClicked.

private void menuItemClicked(Object source) {
    boolean bGeometryChanged = false;
    boolean bFoundClickedMenuItem = false;
    Object objectToBeSelected = null;
    if (!bFoundClickedMenuItem) {
        PrimitiveType[] values = CSGPrimitive.PrimitiveType.values();
        int numTypes = values.length;
        for (int i = 0; i < numTypes; i++) {
            if (source == addPrimitiveMenuItems[i]) {
                bFoundClickedMenuItem = true;
                CSGPrimitive csgPrimitive = new CSGPrimitive(csgObject.getFreeName(values[i]), values[i]);
                objectToBeSelected = csgPrimitive;
                bGeometryChanged = addNode(csgPrimitive);
                break;
            }
        }
    }
    if (!bFoundClickedMenuItem) {
        OperatorType[] values = CSGSetOperator.OperatorType.values();
        int numTypes = values.length;
        for (int i = 0; i < numTypes; i++) {
            if (source == addSetOperatorMenuItems[i]) {
                bFoundClickedMenuItem = true;
                CSGSetOperator csgSetOperator = new CSGSetOperator(csgObject.getFreeName(values[i]), values[i]);
                objectToBeSelected = csgSetOperator;
                bGeometryChanged = addNode(csgSetOperator);
                break;
            }
        }
    }
    if (!bFoundClickedMenuItem) {
        TransformationType[] values = CSGTransformation.TransformationType.values();
        int numTypes = values.length;
        for (int i = 0; i < numTypes; i++) {
            if (source == addTranformationMenuItems[i]) {
                bFoundClickedMenuItem = true;
                CSGTransformation csgTransformation = createNewCSGTransformation(values[i]);
                objectToBeSelected = csgTransformation;
                bGeometryChanged = addNode(csgTransformation);
                break;
            }
        }
    }
    if (!bFoundClickedMenuItem) {
        TransformationType[] values = CSGTransformation.TransformationType.values();
        int numTypes = values.length;
        for (int i = 0; i < numTypes; i++) {
            if (source == tranformMenuItems[i]) {
                bFoundClickedMenuItem = true;
                CSGTransformation csgTransformation = createNewCSGTransformation(values[i]);
                objectToBeSelected = csgTransformation;
                bGeometryChanged = transformOrApplySetOperator(csgTransformation);
                break;
            }
        }
    }
    if (!bFoundClickedMenuItem) {
        OperatorType[] values = CSGSetOperator.OperatorType.values();
        int numTypes = values.length;
        for (int i = 0; i < numTypes; i++) {
            if (source == applySetOperatorMenuItems[i]) {
                bFoundClickedMenuItem = true;
                CSGSetOperator csgSetOperator = new CSGSetOperator(csgObject.getFreeName(values[i]), values[i]);
                objectToBeSelected = csgSetOperator;
                bGeometryChanged = transformOrApplySetOperator(csgSetOperator);
                break;
            }
        }
    }
    if (!bGeometryChanged) {
        return;
    }
    updateCSGObject(objectToBeSelected);
}
Also used : CSGTransformation(cbit.vcell.geometry.CSGTransformation) CSGPrimitive(cbit.vcell.geometry.CSGPrimitive) CSGObject(cbit.vcell.geometry.CSGObject) PrimitiveType(cbit.vcell.geometry.CSGPrimitive.PrimitiveType) CSGSetOperator(cbit.vcell.geometry.CSGSetOperator) TransformationType(cbit.vcell.geometry.CSGTransformation.TransformationType) Point(java.awt.Point) OperatorType(cbit.vcell.geometry.CSGSetOperator.OperatorType)

Aggregations

PrimitiveType (cbit.vcell.geometry.CSGPrimitive.PrimitiveType)3 CSGPrimitive (cbit.vcell.geometry.CSGPrimitive)2 Point (java.awt.Point)2 CSGObject (cbit.vcell.geometry.CSGObject)1 CSGSetOperator (cbit.vcell.geometry.CSGSetOperator)1 OperatorType (cbit.vcell.geometry.CSGSetOperator.OperatorType)1 CSGTransformation (cbit.vcell.geometry.CSGTransformation)1 TransformationType (cbit.vcell.geometry.CSGTransformation.TransformationType)1 JMenu (javax.swing.JMenu)1 JMenuItem (javax.swing.JMenuItem)1