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