Search in sources :

Example 1 with MathModelChildSummary

use of org.vcell.util.document.MathModelChildSummary in project vcell by virtualcell.

the class MathModel method createMathModelChildSummary.

public MathModelChildSummary createMathModelChildSummary() {
    MathType modelType = getMathDescription().getMathType();
    String geoName = getMathDescription().getGeometry().getName();
    int geoDim = getMathDescription().getGeometry().getDimension();
    Simulation[] sims = getSimulations();
    String[] simNames = new String[sims.length];
    String[] simAnnots = new String[sims.length];
    for (int i = 0; i < sims.length; i += 1) {
        simNames[i] = sims[i].getName();
        simAnnots[i] = sims[i].getDescription();
    }
    return new MathModelChildSummary(modelType, geoName, geoDim, simNames, simAnnots);
}
Also used : MathModelChildSummary(org.vcell.util.document.MathModelChildSummary) Simulation(cbit.vcell.solver.Simulation) MathType(org.vcell.util.document.BioModelChildSummary.MathType)

Example 2 with MathModelChildSummary

use of org.vcell.util.document.MathModelChildSummary in project vcell by virtualcell.

the class MathModelMetaDataTreeModel method createVersionSubTree.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 2:41:43 PM)
 * @param mathModelNode cbit.vcell.desktop.BioModelNode
 * @param mathModelInfo cbit.vcell.mathmodel.MathModelInfo
 */
private BioModelNode createVersionSubTree(MathModelInfo mathModelInfo) throws DataAccessException {
    BioModelNode versionNode = new BioModelNode(mathModelInfo, true);
    // 
    if (mathModelInfo.getVersion().getAnnot() != null && mathModelInfo.getVersion().getAnnot().trim().length() > 0) {
        versionNode.add(new BioModelNode(new Annotation(mathModelInfo.getVersion().getAnnot()), false));
    }
    MathModelChildSummary mathModelChildSummary = mathModelInfo.getMathModelChildSummary();
    if (mathModelChildSummary == null) {
        versionNode.add(new BioModelNode("SUMMARY INFORMATION NOT AVAILABLE", false));
    } else {
        int geomDim = mathModelChildSummary.getGeometryDimension();
        String geomName = mathModelChildSummary.getGeometryName();
        MathType modelType = mathModelChildSummary.getModelType();
        // add model type tree node
        BioModelNode modelTypeNode = new BioModelNode(modelType, false);
        modelTypeNode.setRenderHint("type", "AppType");
        versionNode.add(modelTypeNode);
        BioModelNode geometryNode = null;
        if (geomDim > 0) {
            geometryNode = new BioModelNode(geomName + " (" + geomDim + "D)", false);
        } else {
            geometryNode = new BioModelNode(BioModelChildSummary.COMPARTMENTAL_GEO_STR, false);
        }
        geometryNode.setRenderHint("type", "Geometry");
        geometryNode.setRenderHint("dimension", new Integer(geomDim));
        versionNode.add(geometryNode);
        // 
        // add simulations to simulationContext
        // 
        String[] simNames = mathModelChildSummary.getSimulationNames();
        String[] simAnnot = mathModelChildSummary.getSimulationAnnotations();
        for (int j = 0; j < simNames.length; j++) {
            BioModelNode simNode = new BioModelNode(simNames[j], true);
            simNode.setRenderHint("type", "Simulation");
            versionNode.add(simNode);
            if (simAnnot[j] != null && simAnnot[j].trim().length() > 0) {
                simNode.add(new BioModelNode(new Annotation(simAnnot[j]), false));
            }
        }
    }
    return versionNode;
}
Also used : MathModelChildSummary(org.vcell.util.document.MathModelChildSummary) MathType(org.vcell.util.document.BioModelChildSummary.MathType)

Example 3 with MathModelChildSummary

use of org.vcell.util.document.MathModelChildSummary in project vcell by virtualcell.

the class ClientRequestManager method getGeometryFromDocumentSelection.

public Geometry getGeometryFromDocumentSelection(Component parentComponent, VCDocumentInfo vcDocumentInfo, boolean bClearVersion) throws Exception, UserCancelException {
    Geometry geom = null;
    if (vcDocumentInfo.getVersionType().equals(VersionableType.BioModelMetaData)) /*documentType == VCDocument.BIOMODEL_DOC*/
    {
        BioModelInfo bioModelInfo = getDocumentManager().getBioModelInfo(vcDocumentInfo.getVersion().getVersionKey());
        BioModelChildSummary bioModelChildSummary = bioModelInfo.getBioModelChildSummary();
        if (bioModelChildSummary != null && bioModelChildSummary.getSimulationContextNames() != null) {
            Vector<Integer> spatialV = new Vector<Integer>();
            for (int i = 0; i < bioModelChildSummary.getSimulationContextNames().length; i++) {
                if (bioModelChildSummary.getGeometryDimensions()[i] > 0) {
                    spatialV.add(i);
                }
            }
            if (spatialV.size() > 0) {
                String[] columnNames = new String[] { "Application", "Geometry", "Dimension" };
                String[][] rowData = new String[spatialV.size()][3];
                for (int i = 0; i < spatialV.size(); i++) {
                    rowData[i][0] = bioModelChildSummary.getSimulationContextNames()[spatialV.elementAt(i)];
                    rowData[i][1] = bioModelChildSummary.getGeometryNames()[spatialV.elementAt(i)];
                    rowData[i][2] = bioModelChildSummary.getGeometryDimensions()[spatialV.elementAt(i)] + "";
                }
                int[] selection = DialogUtils.showComponentOKCancelTableList(JOptionPane.getFrameForComponent(parentComponent), "Select Geometry", columnNames, rowData, ListSelectionModel.SINGLE_SELECTION);
                ModelGeometryOPResults modelGeometryOPResults = (ModelGeometryOPResults) getDocumentManager().getSessionManager().getUserMetaDbServer().doTestSuiteOP(new ModelGeometryOP((BioModelInfo) vcDocumentInfo, rowData[selection[0]][0]));
                geom = getDocumentManager().getGeometry(modelGeometryOPResults.getGeometryKey());
            // BioModel bioModel = getDocumentManager().getBioModel((BioModelInfo)vcDocumentInfo);
            // for (int i = 0; i < bioModel.getSimulationContexts().length; i++) {
            // if(bioModel.getSimulationContexts()[i].getName().equals(rowData[selection[0]][0])){
            // geom = bioModel.getSimulationContexts()[i].getGeometry();
            // break;
            // }
            // }
            } else {
                throw new Exception("BioModel '" + bioModelInfo.getVersion().getName() + "' contains no spatial geometries.");
            }
        } else {
            throw new Exception("BioModel '" + bioModelInfo.getVersion().getName() + "' contains no spatial geometries.");
        }
    } else if (vcDocumentInfo.getVersionType().equals(VersionableType.MathModelMetaData)) /*documentType == VCDocument.MATHMODEL_DOC*/
    {
        MathModelInfo mathModelInfo = getDocumentManager().getMathModelInfo(vcDocumentInfo.getVersion().getVersionKey());
        MathModelChildSummary mathModelChildSummary = mathModelInfo.getMathModelChildSummary();
        if (mathModelChildSummary != null) {
            if (mathModelChildSummary.getGeometryDimension() > 0) {
                ModelGeometryOPResults modelGeometryOPResults = (ModelGeometryOPResults) getDocumentManager().getSessionManager().getUserMetaDbServer().doTestSuiteOP(new ModelGeometryOP((MathModelInfo) vcDocumentInfo));
                geom = getDocumentManager().getGeometry(modelGeometryOPResults.getGeometryKey());
            // MathModel mathModel = getDocumentManager().getMathModel(mathModelInfo);
            // geom = mathModel.getMathDescription().getGeometry();
            } else {
                throw new Exception("MathModel '" + mathModelInfo.getVersion().getName() + "' contains no spatial geometry.");
            }
        } else {
            throw new Exception("MathModel '" + mathModelInfo.getVersion().getName() + "' contains no spatial geometry.");
        }
    } else if (vcDocumentInfo.getVersionType().equals(VersionableType.Geometry)) {
        geom = getDocumentManager().getGeometry((GeometryInfo) vcDocumentInfo);
        if (geom.getDimension() == 0) {
            throw new Exception("Error, Only spatial geometries allowed (dimension > 0).");
        }
    } else {
        throw new IllegalArgumentException("Error selecting geometry from document type " + vcDocumentInfo.getVersionType() + ". Must be BioModel,MathModel or Geometry.");
    }
    if (geom == null) {
        throw new Exception("error selecting geometry");
    }
    if (bClearVersion) {
        geom.clearVersion();
    }
    return geom;
}
Also used : BioModelChildSummary(org.vcell.util.document.BioModelChildSummary) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) ProgrammingException(org.vcell.util.ProgrammingException) GeometryException(cbit.vcell.geometry.GeometryException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) PropertyVetoException(java.beans.PropertyVetoException) ImageException(cbit.image.ImageException) UtilCancelException(org.vcell.util.UtilCancelException) DataFormatException(java.util.zip.DataFormatException) UserCancelException(org.vcell.util.UserCancelException) Geometry(cbit.vcell.geometry.Geometry) MathModelChildSummary(org.vcell.util.document.MathModelChildSummary) GeometryInfo(cbit.vcell.geometry.GeometryInfo) ModelGeometryOPResults(cbit.vcell.numericstest.ModelGeometryOPResults) Vector(java.util.Vector) ModelGeometryOP(cbit.vcell.numericstest.ModelGeometryOP)

Aggregations

MathModelChildSummary (org.vcell.util.document.MathModelChildSummary)3 MathType (org.vcell.util.document.BioModelChildSummary.MathType)2 ImageException (cbit.image.ImageException)1 Geometry (cbit.vcell.geometry.Geometry)1 GeometryException (cbit.vcell.geometry.GeometryException)1 GeometryInfo (cbit.vcell.geometry.GeometryInfo)1 ModelGeometryOP (cbit.vcell.numericstest.ModelGeometryOP)1 ModelGeometryOPResults (cbit.vcell.numericstest.ModelGeometryOPResults)1 Simulation (cbit.vcell.solver.Simulation)1 PropertyVetoException (java.beans.PropertyVetoException)1 IOException (java.io.IOException)1 Vector (java.util.Vector)1 DataFormatException (java.util.zip.DataFormatException)1 DataAccessException (org.vcell.util.DataAccessException)1 ProgrammingException (org.vcell.util.ProgrammingException)1 UserCancelException (org.vcell.util.UserCancelException)1 UtilCancelException (org.vcell.util.UtilCancelException)1 BioModelChildSummary (org.vcell.util.document.BioModelChildSummary)1 BioModelInfo (org.vcell.util.document.BioModelInfo)1 MathModelInfo (org.vcell.util.document.MathModelInfo)1