Search in sources :

Example 1 with TransformationType

use of cbit.vcell.geometry.CSGTransformation.TransformationType in project vcell by virtualcell.

the class CSGObjectPropertiesPanel method getAddTransformationMenu.

private JMenu getAddTransformationMenu() {
    if (addTransformationMenu == null) {
        addTransformationMenu = new JMenu("Transformation");
        TransformationType[] values = CSGTransformation.TransformationType.values();
        int numTypes = values.length;
        addTranformationMenuItems = new JMenuItem[numTypes];
        for (int i = 0; i < numTypes; i++) {
            addTranformationMenuItems[i] = new JMenuItem(values[i].name().toLowerCase());
            addTranformationMenuItems[i].addActionListener(eventHandler);
            addTransformationMenu.add(addTranformationMenuItems[i]);
        }
    }
    return addTransformationMenu;
}
Also used : JMenuItem(javax.swing.JMenuItem) TransformationType(cbit.vcell.geometry.CSGTransformation.TransformationType) JMenu(javax.swing.JMenu) Point(java.awt.Point)

Example 2 with TransformationType

use of cbit.vcell.geometry.CSGTransformation.TransformationType in project vcell by virtualcell.

the class CSGObjectPropertiesPanel method getTransformMenu.

private JMenu getTransformMenu() {
    if (transformMenu == null) {
        transformMenu = new JMenu("Transform");
        TransformationType[] values = CSGTransformation.TransformationType.values();
        int numTypes = values.length;
        tranformMenuItems = new JMenuItem[numTypes];
        for (int i = 0; i < numTypes; i++) {
            tranformMenuItems[i] = new JMenuItem(values[i].name().toLowerCase());
            tranformMenuItems[i].addActionListener(eventHandler);
            transformMenu.add(tranformMenuItems[i]);
        }
    }
    return transformMenu;
}
Also used : JMenuItem(javax.swing.JMenuItem) TransformationType(cbit.vcell.geometry.CSGTransformation.TransformationType) JMenu(javax.swing.JMenu) Point(java.awt.Point)

Example 3 with TransformationType

use of cbit.vcell.geometry.CSGTransformation.TransformationType 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

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