Search in sources :

Example 16 with CSGObject

use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.

the class GeometrySubVolumePanel method deleteSubvolume.

/**
 * connEtoM1:  (DeleteButton.action.actionPerformed(java.awt.event.ActionEvent) --> Geometry.removeAnalyticSubVolume(Lcbit.vcell.geometry.AnalyticSubVolume;)V)
 * @param arg1 java.awt.event.ActionEvent
 */
/* WARNING: THIS METHOD WILL BE REGENERATED. */
private void deleteSubvolume() {
    try {
        if ((getSelectedSubVolume() != null)) {
            AsynchClientTask task1 = new AsynchClientTask("removing subdomain", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

                @Override
                public void run(Hashtable<String, Object> hashTable) throws Exception {
                    if (getSelectedSubVolume() instanceof AnalyticSubVolume) {
                        getGeometrySpec().removeAnalyticSubVolume((AnalyticSubVolume) getSelectedSubVolume());
                    } else if (getSelectedSubVolume() instanceof CSGObject) {
                        getGeometrySpec().removeCSGObject((CSGObject) getSelectedSubVolume());
                    }
                    getGeometry().precomputeAll(new GeometryThumbnailImageFactoryAWT());
                }
            };
            ClientTaskDispatcher.dispatch(GeometrySubVolumePanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1 }, false);
        }
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) CSGObject(cbit.vcell.geometry.CSGObject) CSGObject(cbit.vcell.geometry.CSGObject) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume)

Example 17 with CSGObject

use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.

the class GeometrySubVolumePanel method moveBack.

/**
 * connEtoM9:  (BackButton.action.actionPerformed(java.awt.event.ActionEvent) --> Geometry.sendBackward(Lcbit.vcell.geometry.AnalyticSubVolume;)V)
 * @param arg1 java.awt.event.ActionEvent
 */
private void moveBack() {
    try {
        if ((getSelectedSubVolume() != null)) {
            AsynchClientTask task1 = new AsynchClientTask("moving to back", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {

                @Override
                public void run(Hashtable<String, Object> hashTable) throws Exception {
                    SubVolume selectedSubVolume = getSelectedSubVolume();
                    if (selectedSubVolume instanceof CSGObject) {
                        getGeometrySpec().sendBackward((CSGObject) selectedSubVolume);
                    } else if (selectedSubVolume instanceof AnalyticSubVolume) {
                        getGeometrySpec().sendBackward((AnalyticSubVolume) selectedSubVolume);
                    }
                    getGeometry().precomputeAll(new GeometryThumbnailImageFactoryAWT());
                }
            };
            ClientTaskDispatcher.dispatch(GeometrySubVolumePanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1 }, false);
        }
    } catch (java.lang.Throwable ivjExc) {
        handleException(ivjExc);
    }
}
Also used : GeometryThumbnailImageFactoryAWT(cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT) AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) Hashtable(java.util.Hashtable) SubVolume(cbit.vcell.geometry.SubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume) CSGObject(cbit.vcell.geometry.CSGObject) CSGObject(cbit.vcell.geometry.CSGObject) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume)

Example 18 with CSGObject

use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.

the class CSGObjectPropertiesPanel method onSelectedObjectsChange.

@Override
protected void onSelectedObjectsChange(Object[] selectedObjects) {
    CSGObject csgObject = null;
    if (selectedObjects.length == 1 && selectedObjects[0] instanceof CSGObject) {
        csgObject = (CSGObject) selectedObjects[0];
    }
    setCSGObject(csgObject);
}
Also used : CSGObject(cbit.vcell.geometry.CSGObject)

Example 19 with CSGObject

use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.

the class CSGObjectTreeCellEditor method getTreeCellEditorComponent.

@Override
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row) {
    if (!(value instanceof BioModelNode)) {
        return null;
    }
    Object userObject = ((BioModelNode) value).getUserObject();
    CSGObjectTreeCellRenderer.CSGNodeLabel csgNodeLabel = new CSGObjectTreeCellRenderer.CSGNodeLabel();
    CSGObjectTreeCellRenderer.getCSGNodeLabel(userObject, csgNodeLabel);
    renderer.setOpenIcon(csgNodeLabel.icon);
    renderer.setClosedIcon(csgNodeLabel.icon);
    renderer.setLeafIcon(csgNodeLabel.icon);
    Component component = null;
    if (bRenaming) {
        realEditor = defaultCellEditor;
        component = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
        if (editingComponent instanceof JTextField) {
            String text = null;
            JTextField textField = (JTextField) editingComponent;
            if (userObject instanceof CSGObject) {
                text = ((CSGObject) userObject).getName();
            } else if (userObject instanceof CSGNode) {
                text = ((CSGNode) userObject).getName();
            }
            textField.setText(text);
        }
    } else {
        if (userObject instanceof CSGScale || userObject instanceof CSGTranslation) {
            realEditor = getVect3dCellEditor();
            Vect3d vect3d = null;
            if (userObject instanceof CSGScale) {
                vect3d = ((CSGScale) userObject).getScale();
            } else if (userObject instanceof CSGTranslation) {
                vect3d = ((CSGTranslation) userObject).getTranslation();
            }
            component = super.getTreeCellEditorComponent(tree, vect3d, isSelected, expanded, leaf, row);
        } else if (userObject instanceof CSGRotation) {
            realEditor = getRotationCellEditor();
            component = super.getTreeCellEditorComponent(tree, value, isSelected, expanded, leaf, row);
        }
    }
    return component;
}
Also used : CSGTranslation(cbit.vcell.geometry.CSGTranslation) CSGNode(cbit.vcell.geometry.CSGNode) BioModelNode(cbit.vcell.desktop.BioModelNode) JTextField(javax.swing.JTextField) CSGRotation(cbit.vcell.geometry.CSGRotation) CSGScale(cbit.vcell.geometry.CSGScale) Vect3d(cbit.vcell.render.Vect3d) CSGObject(cbit.vcell.geometry.CSGObject) Component(java.awt.Component) CSGObject(cbit.vcell.geometry.CSGObject)

Example 20 with CSGObject

use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.

the class CSGObjectTreeCellRenderer method getCSGNodeLabel.

static CSGNodeLabel getCSGNodeLabel(Object object, CSGNodeLabel csgNodeLabel) {
    if (object instanceof CSGObject) {
        CSGObject csgObject = (CSGObject) object;
        csgNodeLabel.text = csgObject.getName();
        java.awt.Color handleColor = new java.awt.Color(getColorMap()[csgObject.getHandle()]);
        csgNodeLabel.icon = new ColorIcon(15, 15, handleColor);
    } else if (object instanceof CSGNode) {
        CSGNode csgNode = (CSGNode) object;
        csgNodeLabel.text = csgNode.getName();
        if (csgNode instanceof CSGPrimitive) {
            CSGPrimitive csgPrimitive = (CSGPrimitive) csgNode;
            switch(csgPrimitive.getType()) {
                case CONE:
                    csgNodeLabel.icon = VCellIcons.csgConeIcon;
                    break;
                case CUBE:
                    csgNodeLabel.icon = VCellIcons.csgCubeIcon;
                    break;
                case CYLINDER:
                    csgNodeLabel.icon = VCellIcons.csgCylinderIcon;
                    break;
                case SPHERE:
                    csgNodeLabel.icon = VCellIcons.csgSphereIcon;
                    break;
            }
            return csgNodeLabel;
        }
        if (csgNode instanceof CSGSetOperator) {
            CSGSetOperator csgSetOperator = (CSGSetOperator) csgNode;
            switch(csgSetOperator.getOpType()) {
                case DIFFERENCE:
                    csgNodeLabel.icon = VCellIcons.csgSetDifferenceIcon;
                    break;
                case INTERSECTION:
                    csgNodeLabel.icon = VCellIcons.csgSetIntersectionIcon;
                    break;
                case UNION:
                    csgNodeLabel.icon = VCellIcons.csgSetUnionIcon;
                    break;
            }
        }
        if (csgNode instanceof CSGTransformation) {
            if (csgNode instanceof CSGRotation) {
                CSGRotation csgRotation = (CSGRotation) csgNode;
                Vect3d axis = csgRotation.getAxis();
                double radius = csgRotation.getRotationRadians();
                csgNodeLabel.text += ", radian=" + radius + ", axis=" + CSGObjectPropertiesPanel.getVect3dDescription(axis);
                csgNodeLabel.icon = VCellIcons.csgRotationIcon;
            } else if (csgNode instanceof CSGTranslation) {
                CSGTranslation csgTranslation = (CSGTranslation) csgNode;
                Vect3d translation = csgTranslation.getTranslation();
                csgNodeLabel.text += ", Translation=" + CSGObjectPropertiesPanel.getVect3dDescription(translation);
                csgNodeLabel.icon = VCellIcons.csgTranslationIcon;
            } else if (csgNode instanceof CSGScale) {
                CSGScale csgScale = (CSGScale) csgNode;
                Vect3d scale = csgScale.getScale();
                csgNodeLabel.text += ", Scale=" + CSGObjectPropertiesPanel.getVect3dDescription(scale);
                csgNodeLabel.icon = VCellIcons.csgScaleIcon;
            } else if (csgNode instanceof CSGHomogeneousTransformation) {
                csgNodeLabel.icon = null;
            }
        }
    }
    return null;
}
Also used : ColorIcon(org.vcell.util.gui.ColorIcon) CSGTranslation(cbit.vcell.geometry.CSGTranslation) CSGTransformation(cbit.vcell.geometry.CSGTransformation) CSGPrimitive(cbit.vcell.geometry.CSGPrimitive) CSGNode(cbit.vcell.geometry.CSGNode) CSGRotation(cbit.vcell.geometry.CSGRotation) Vect3d(cbit.vcell.render.Vect3d) CSGScale(cbit.vcell.geometry.CSGScale) CSGHomogeneousTransformation(cbit.vcell.geometry.CSGHomogeneousTransformation) CSGObject(cbit.vcell.geometry.CSGObject) CSGSetOperator(cbit.vcell.geometry.CSGSetOperator)

Aggregations

CSGObject (cbit.vcell.geometry.CSGObject)23 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)11 GeometryThumbnailImageFactoryAWT (cbit.vcell.geometry.GeometryThumbnailImageFactoryAWT)8 Expression (cbit.vcell.parser.Expression)7 CSGNode (cbit.vcell.geometry.CSGNode)6 CSGSetOperator (cbit.vcell.geometry.CSGSetOperator)6 SubVolume (cbit.vcell.geometry.SubVolume)6 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)5 BioModelNode (cbit.vcell.desktop.BioModelNode)5 CSGTransformation (cbit.vcell.geometry.CSGTransformation)5 Geometry (cbit.vcell.geometry.Geometry)5 ImageSubVolume (cbit.vcell.geometry.ImageSubVolume)5 Hashtable (java.util.Hashtable)5 BioModel (cbit.vcell.biomodel.BioModel)4 CSGPrimitive (cbit.vcell.geometry.CSGPrimitive)4 CSGScale (cbit.vcell.geometry.CSGScale)4 CSGTranslation (cbit.vcell.geometry.CSGTranslation)4 SimulationContext (cbit.vcell.mapping.SimulationContext)4 ImageException (cbit.image.ImageException)3 CSGRotation (cbit.vcell.geometry.CSGRotation)3