Search in sources :

Example 66 with SubVolume

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

the class Xmlproducer method getXML.

/**
 * This method returns a XML representation of a featureMapping object.
 * Creation date: (3/1/2001 8:16:57 PM)
 * @return Element
 * @param param cbit.vcell.mapping.FeatureMapping
 */
private Element getXML(FeatureMapping param) {
    // Allow null subvolumes
    // if (param.getSubVolume()==null) {	//5/92001
    // return null;
    // }
    Element feature = new Element(XMLTags.FeatureMappingTag);
    // Add atributes
    feature.setAttribute(XMLTags.FeatureAttrTag, mangle(param.getFeature().getName()));
    GeometryClass geometryClass = param.getGeometryClass();
    if (geometryClass != null) {
        feature.setAttribute(XMLTags.GeometryClassAttrTag, Xmlproducer.mangle(geometryClass.getName()));
        if (geometryClass instanceof SubVolume) {
            feature.setAttribute(XMLTags.SubVolumeAttrTag, Xmlproducer.mangle(geometryClass.getName()));
        }
    }
    // Add size
    if (param.getSizeParameter().getExpression() != null)
        feature.setAttribute(XMLTags.SizeTag, mangleExpression(param.getSizeParameter().getExpression()));
    // Add volume/unit_Area and volume/unit_vol if they exist
    if (param.getVolumePerUnitAreaParameter().getExpression() != null) {
        feature.setAttribute(XMLTags.VolumePerUnitAreaTag, mangleExpression(param.getVolumePerUnitAreaParameter().getExpression()));
    }
    if (param.getVolumePerUnitVolumeParameter().getExpression() != null) {
        feature.setAttribute(XMLTags.VolumePerUnitVolumeTag, mangleExpression(param.getVolumePerUnitVolumeParameter().getExpression()));
    }
    // write BoundariesyConditions
    Element boundariestypes = new Element(XMLTags.BoundariesTypesTag);
    // Xm
    boundariestypes.setAttribute(XMLTags.BoundaryAttrValueXm, param.getBoundaryConditionTypeXm().boundaryTypeStringValue());
    // Xp
    boundariestypes.setAttribute(XMLTags.BoundaryAttrValueXp, param.getBoundaryConditionTypeXp().boundaryTypeStringValue());
    // Ym
    boundariestypes.setAttribute(XMLTags.BoundaryAttrValueYm, param.getBoundaryConditionTypeYm().boundaryTypeStringValue());
    // Yp
    boundariestypes.setAttribute(XMLTags.BoundaryAttrValueYp, param.getBoundaryConditionTypeYp().boundaryTypeStringValue());
    // Zm
    boundariestypes.setAttribute(XMLTags.BoundaryAttrValueZm, param.getBoundaryConditionTypeZm().boundaryTypeStringValue());
    // Zp
    boundariestypes.setAttribute(XMLTags.BoundaryAttrValueZp, param.getBoundaryConditionTypeZp().boundaryTypeStringValue());
    // add boundaries to the feature
    feature.addContent(boundariestypes);
    return feature;
}
Also used : GeometryClass(cbit.vcell.geometry.GeometryClass) SubVolume(cbit.vcell.geometry.SubVolume) CompartmentSubVolume(cbit.vcell.geometry.CompartmentSubVolume) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume) Element(org.jdom.Element)

Example 67 with SubVolume

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

the class Xmlproducer method getXML.

private Element getXML(SurfaceClass param) {
    Element surfaceClassElement = new Element(XMLTags.SurfaceClassTag);
    // add atributes
    surfaceClassElement.setAttribute(XMLTags.NameAttrTag, mangle(param.getName()));
    SubVolume[] subvolArr = param.getAdjacentSubvolumes().toArray(new SubVolume[0]);
    Arrays.sort(subvolArr, new Comparator<SubVolume>() {

        public int compare(SubVolume o1, SubVolume o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    if (subvolArr.length > 0) {
        surfaceClassElement.setAttribute(XMLTags.SubVolume1RefAttrTag, subvolArr[0].getName());
    }
    if (subvolArr.length > 1) {
        surfaceClassElement.setAttribute(XMLTags.SubVolume2RefAttrTag, subvolArr[1].getName());
    }
    // If keyFlag is on print the Keyvalue
    if (param.getKey() != null && this.printKeysFlag) {
        surfaceClassElement.setAttribute(XMLTags.KeyValueAttrTag, param.getKey().toString());
    }
    return surfaceClassElement;
}
Also used : SubVolume(cbit.vcell.geometry.SubVolume) CompartmentSubVolume(cbit.vcell.geometry.CompartmentSubVolume) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume) Element(org.jdom.Element)

Example 68 with SubVolume

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

the class OutputFunctionsPanel method addFunction.

private void addFunction() throws Exception {
    String funcName = getFunctionNameTextField().getText();
    Expression funcExp = null;
    funcExp = new Expression(getFunctionExpressionTextField().getText());
    Domain domain = null;
    VariableType newFunctionVariableType = null;
    boolean bSpatial = simulationWorkspace.getSimulationOwner().getGeometry().getDimension() > 0;
    if (bSpatial) {
        Object selectedItem = getSubdomainComboBox().getSelectedItem();
        if (selectedItem instanceof GeometryClass) {
            GeometryClass geoClass = (GeometryClass) selectedItem;
            domain = new Domain(geoClass);
            if (selectedItem instanceof SubVolume) {
                newFunctionVariableType = VariableType.VOLUME;
            } else if (selectedItem instanceof SurfaceClass) {
                newFunctionVariableType = VariableType.MEMBRANE;
            }
        } else if (selectedItem instanceof VariableType) {
            newFunctionVariableType = (VariableType) selectedItem;
        } else {
            newFunctionVariableType = VariableType.UNKNOWN;
        }
    } else {
        newFunctionVariableType = VariableType.NONSPATIAL;
    }
    AnnotatedFunction tempFunction = new AnnotatedFunction(funcName, funcExp, domain, null, newFunctionVariableType, FunctionCategory.OUTPUTFUNCTION);
    VariableType vt = outputFunctionContext.computeFunctionTypeWRTExpression(tempFunction, funcExp);
    FunctionCategory category = FunctionCategory.OUTPUTFUNCTION;
    if (vt.equals(VariableType.POSTPROCESSING)) {
        category = FunctionCategory.POSTPROCESSFUNCTION;
    }
    AnnotatedFunction newFunction = new AnnotatedFunction(funcName, funcExp, domain, null, vt, category);
    outputFunctionContext.addOutputFunction(newFunction);
    setSelectedObjects(new Object[] { newFunction });
    enableDeleteFnButton();
}
Also used : GeometryClass(cbit.vcell.geometry.GeometryClass) VariableType(cbit.vcell.math.VariableType) Expression(cbit.vcell.parser.Expression) SurfaceClass(cbit.vcell.geometry.SurfaceClass) SubVolume(cbit.vcell.geometry.SubVolume) Domain(cbit.vcell.math.Variable.Domain) FunctionCategory(cbit.vcell.solver.AnnotatedFunction.FunctionCategory) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Example 69 with SubVolume

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

the class GeometrySubVolumePanel method moveSubvolumeFront.

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

                @Override
                public void run(Hashtable<String, Object> hashTable) throws Exception {
                    SubVolume selectedSubVolume = getSelectedSubVolume();
                    if (selectedSubVolume instanceof CSGObject) {
                        getGeometrySpec().bringForward((CSGObject) selectedSubVolume);
                    } else if (selectedSubVolume instanceof AnalyticSubVolume) {
                        getGeometrySpec().bringForward((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 70 with SubVolume

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

the class GeometrySubVolumePanel method refreshButtons.

/**
 * This method was created in VisualAge.
 */
private void refreshButtons() {
    boolean bHasGeometry = getGeometry() != null;
    boolean bHasGeomSpec = (bHasGeometry ? getGeometry().getGeometrySpec() != null : false);
    boolean bImageBased = (bHasGeomSpec ? getGeometry().getGeometrySpec().getImage() != null : false);
    addShapeButton.setEnabled(!bImageBased);
    SubVolume selectedSubVolume = getSelectedSubVolume();
    if (!bHasGeomSpec || getGeometry().getDimension() == 0) {
        getFrontButton().setEnabled(false);
        getBackButton().setEnabled(false);
        getDeleteButton().setEnabled(false);
        addShapeButton.setEnabled(false);
    } else if (selectedSubVolume == null) {
        getFrontButton().setEnabled(false);
        getBackButton().setEnabled(false);
        getDeleteButton().setEnabled(false);
    } else {
        GeometrySpec geometrySpec = getGeometry().getGeometrySpec();
        int numAnalyticOrCSGSubVolumes = geometrySpec.getNumAnalyticOrCSGSubVolumes();
        if (numAnalyticOrCSGSubVolumes > 1) {
            getFrontButton().setEnabled(geometrySpec.getSubVolumeIndex(selectedSubVolume) > 0);
            getBackButton().setEnabled(geometrySpec.getSubVolumeIndex(selectedSubVolume) < (numAnalyticOrCSGSubVolumes - 1));
        } else {
            getFrontButton().setEnabled(false);
            getBackButton().setEnabled(false);
        }
        if (selectedSubVolume instanceof ImageSubVolume || (!bImageBased && (geometrySpec.getNumSubVolumes() <= 1))) {
            getDeleteButton().setEnabled(false);
        } else {
            getDeleteButton().setEnabled(true);
        }
    }
}
Also used : GeometrySpec(cbit.vcell.geometry.GeometrySpec) SubVolume(cbit.vcell.geometry.SubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume) AnalyticSubVolume(cbit.vcell.geometry.AnalyticSubVolume) ImageSubVolume(cbit.vcell.geometry.ImageSubVolume)

Aggregations

SubVolume (cbit.vcell.geometry.SubVolume)84 SurfaceClass (cbit.vcell.geometry.SurfaceClass)42 Expression (cbit.vcell.parser.Expression)33 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)26 ImageSubVolume (cbit.vcell.geometry.ImageSubVolume)22 GeometryClass (cbit.vcell.geometry.GeometryClass)21 ArrayList (java.util.ArrayList)21 Geometry (cbit.vcell.geometry.Geometry)20 MathDescription (cbit.vcell.math.MathDescription)17 SpeciesContext (cbit.vcell.model.SpeciesContext)17 PropertyVetoException (java.beans.PropertyVetoException)17 CompartmentSubDomain (cbit.vcell.math.CompartmentSubDomain)16 CompartmentSubVolume (cbit.vcell.geometry.CompartmentSubVolume)15 Model (cbit.vcell.model.Model)15 ImageException (cbit.image.ImageException)14 VCImage (cbit.image.VCImage)14 Feature (cbit.vcell.model.Feature)14 Structure (cbit.vcell.model.Structure)14 MembraneSubDomain (cbit.vcell.math.MembraneSubDomain)13 ExpressionException (cbit.vcell.parser.ExpressionException)13