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);
}
}
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);
}
}
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);
}
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;
}
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;
}
Aggregations