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