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