Search in sources :

Example 6 with CSGNode

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

the class XmlReader method getCSGRotation.

private CSGRotation getCSGRotation(Element param) throws XmlParseException {
    String name = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
    String rotateXStr = unMangle(param.getAttributeValue(XMLTags.CSGRotationXTag));
    String rotateYStr = unMangle(param.getAttributeValue(XMLTags.CSGRotationYTag));
    String rotateZStr = unMangle(param.getAttributeValue(XMLTags.CSGRotationZTag));
    String rotationAngleStr = unMangle(param.getAttributeValue(XMLTags.CSGRotationAngleInRadiansTag));
    Vect3d rotationAxis = new Vect3d(Double.parseDouble(rotateXStr), Double.parseDouble(rotateYStr), Double.parseDouble(rotateZStr));
    CSGRotation csgRotation = new CSGRotation(name, rotationAxis, Double.parseDouble(rotationAngleStr));
    // Retrieve CSGNode - CSGRotation element should have one child
    Object[] elements = param.getChildren().toArray();
    if (elements.length > 1) {
        throw new XmlParseException("CSGRotation element cannot have more than one child element");
    }
    CSGNode csgChildNode = getCSGNode((Element) elements[0]);
    csgRotation.setChild(csgChildNode);
    return csgRotation;
}
Also used : CSGNode(cbit.vcell.geometry.CSGNode) VolumeRegionObject(cbit.vcell.mapping.spatial.VolumeRegionObject) PointObject(cbit.vcell.mapping.spatial.PointObject) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) SurfaceRegionObject(cbit.vcell.mapping.spatial.SurfaceRegionObject) CSGObject(cbit.vcell.geometry.CSGObject) CSGRotation(cbit.vcell.geometry.CSGRotation) Vect3d(cbit.vcell.render.Vect3d)

Example 7 with CSGNode

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

the class XmlReader method getCSGSetOperator.

private CSGSetOperator getCSGSetOperator(Element param) throws XmlParseException {
    String name = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
    String operatorTypeStr = unMangle(param.getAttributeValue(XMLTags.CSGSetOperatorTypeTag));
    // ---Create the new CSGSetOperator object ---
    OperatorType type = CSGSetOperator.OperatorType.valueOf(operatorTypeStr);
    CSGSetOperator csgSetOperator = new CSGSetOperator(name, type);
    List<Element> children = param.getChildren();
    Iterator<Element> iterator = children.iterator();
    int count = 0;
    while (iterator.hasNext()) {
        Element tempElement = iterator.next();
        CSGNode csgNode = getCSGNode(tempElement);
        csgSetOperator.addChild(csgNode);
    }
    return csgSetOperator;
}
Also used : Element(org.jdom.Element) CSGNode(cbit.vcell.geometry.CSGNode) CSGSetOperator(cbit.vcell.geometry.CSGSetOperator) OperatorType(cbit.vcell.geometry.CSGSetOperator.OperatorType)

Example 8 with CSGNode

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

the class XmlReader method getCSGNode.

private CSGNode getCSGNode(Element param) throws XmlParseException {
    String nodeNameString = param.getName();
    CSGNode csgNode = null;
    if (nodeNameString != null) {
        if (nodeNameString.equalsIgnoreCase(XMLTags.CSGPrimitiveTag)) {
            // Process CSGPrimitive
            csgNode = getCSGPrimitive(param);
        } else if (nodeNameString.equalsIgnoreCase(XMLTags.CSGPseudoPrimitiveTag)) {
            // Process CSGPseudoPrimitive
            csgNode = getCSGPseudoPrimitive(param);
        } else if (nodeNameString.equalsIgnoreCase(XMLTags.CSGSetOperatorTag)) {
            // Process CSGSetOperator
            csgNode = getCSGSetOperator(param);
        } else if (nodeNameString.equalsIgnoreCase(XMLTags.CSGHomogeneousTransformationTag)) {
            // Process CSGHomogeneousTransformation
            csgNode = getCSGHomogeneousTransformation(param);
        } else if (nodeNameString.equalsIgnoreCase(XMLTags.CSGRotationTag)) {
            // Process CSGRotation
            csgNode = getCSGRotation(param);
        } else if (nodeNameString.equalsIgnoreCase(XMLTags.CSGScaleTag)) {
            // Process CSGScale
            csgNode = getCSGScale(param);
        } else if (nodeNameString.equalsIgnoreCase(XMLTags.CSGTranslationTag)) {
            // Process CSGTranslation
            csgNode = getCSGTranslation(param);
        } else {
            // Throw an exception
            throw new XmlParseException("Parse Error! Unknown CSGNode type : " + nodeNameString);
        }
    } else {
        throw new XmlParseException("CSGNode : cannot be null");
    }
    return csgNode;
}
Also used : CSGNode(cbit.vcell.geometry.CSGNode)

Example 9 with CSGNode

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

the class XmlReader method getCSGScale.

private CSGScale getCSGScale(Element param) throws XmlParseException {
    String name = unMangle(param.getAttributeValue(XMLTags.NameAttrTag));
    String scaleXStr = unMangle(param.getAttributeValue(XMLTags.CSGScaleXTag));
    String scaleYStr = unMangle(param.getAttributeValue(XMLTags.CSGScaleYTag));
    String scaleZStr = unMangle(param.getAttributeValue(XMLTags.CSGScaleZTag));
    Vect3d scaleAxis = new Vect3d(Double.parseDouble(scaleXStr), Double.parseDouble(scaleYStr), Double.parseDouble(scaleZStr));
    CSGScale csgScale = new CSGScale(name, scaleAxis);
    // Retrieve CSGNode - CSGScale element should have one child
    Object[] elements = param.getChildren().toArray();
    if (elements.length > 1) {
        throw new XmlParseException("CSGScale element cannot have more than one child element");
    }
    CSGNode csgChildNode = getCSGNode((Element) elements[0]);
    csgScale.setChild(csgChildNode);
    return csgScale;
}
Also used : CSGNode(cbit.vcell.geometry.CSGNode) VolumeRegionObject(cbit.vcell.mapping.spatial.VolumeRegionObject) PointObject(cbit.vcell.mapping.spatial.PointObject) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) SurfaceRegionObject(cbit.vcell.mapping.spatial.SurfaceRegionObject) CSGObject(cbit.vcell.geometry.CSGObject) Vect3d(cbit.vcell.render.Vect3d) CSGScale(cbit.vcell.geometry.CSGScale)

Example 10 with CSGNode

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

the class Xmlproducer method getXML.

private Element getXML(CSGSetOperator param) {
    Element csgSetOperatorElement = new Element(XMLTags.CSGSetOperatorTag);
    csgSetOperatorElement.setAttribute(XMLTags.NameAttrTag, mangle(param.getName()));
    csgSetOperatorElement.setAttribute(XMLTags.CSGSetOperatorTypeTag, mangle(param.getOpType().name()));
    ArrayList<CSGNode> setOpChildren = param.getChildren();
    Element csgNodeElement = null;
    for (CSGNode setOpNode : setOpChildren) {
        csgNodeElement = getXML(setOpNode);
        csgSetOperatorElement.addContent(csgNodeElement);
    }
    return csgSetOperatorElement;
}
Also used : Element(org.jdom.Element) CSGNode(cbit.vcell.geometry.CSGNode)

Aggregations

CSGNode (cbit.vcell.geometry.CSGNode)13 CSGObject (cbit.vcell.geometry.CSGObject)9 CSGSetOperator (cbit.vcell.geometry.CSGSetOperator)5 Vect3d (cbit.vcell.render.Vect3d)5 CSGRotation (cbit.vcell.geometry.CSGRotation)4 CSGScale (cbit.vcell.geometry.CSGScale)4 CSGTransformation (cbit.vcell.geometry.CSGTransformation)4 CSGTranslation (cbit.vcell.geometry.CSGTranslation)4 PointObject (cbit.vcell.mapping.spatial.PointObject)4 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)4 SurfaceRegionObject (cbit.vcell.mapping.spatial.SurfaceRegionObject)4 VolumeRegionObject (cbit.vcell.mapping.spatial.VolumeRegionObject)4 BioModelNode (cbit.vcell.desktop.BioModelNode)3 CSGHomogeneousTransformation (cbit.vcell.geometry.CSGHomogeneousTransformation)2 CSGPrimitive (cbit.vcell.geometry.CSGPrimitive)2 ArrayList (java.util.ArrayList)2 TreeNode (javax.swing.tree.TreeNode)2 Element (org.jdom.Element)2 VCCGeomFeature (org.vcell.solver.comsol.model.VCCGeomFeature)2 VCCDifference (org.vcell.solver.comsol.model.VCCGeomFeature.VCCDifference)2