use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.
the class SubVolumeTable method getSQLValueList.
/**
* This method was created in VisualAge.
* @return java.lang.String
* @param key KeyValue
* @param modelName java.lang.String
*/
public String getSQLValueList(InsertHashtable hash, KeyValue key, Geometry geom, SubVolume sv, KeyValue geomKey, int ordinalValue) throws DataAccessException {
StringBuffer buffer = new StringBuffer();
buffer.append("(");
buffer.append(key + ",");
buffer.append("'" + sv.getName() + "',");
if (sv instanceof ImageSubVolume) {
ImageSubVolume isv = (ImageSubVolume) sv;
KeyValue pixelClassKey = hash.getDatabaseKey(isv.getPixelClass());
if (pixelClassKey == null) {
pixelClassKey = isv.getPixelClass().getKey();
}
if (pixelClassKey == null) {
throw new DataAccessException("can't get a KeyValue for pixelClass while inserting an imageSubVolume");
}
buffer.append(pixelClassKey + ",");
} else {
buffer.append("null" + ",");
}
// buffer.append(geom.getKey() + ",");
buffer.append(geomKey + ",");
if (sv instanceof AnalyticSubVolume) {
buffer.append("'" + TokenMangler.getSQLEscapedString(((AnalyticSubVolume) sv).getExpression().infix()) + "',");
} else if (sv instanceof CSGObject) {
Xmlproducer producer = new Xmlproducer(true);
buffer.append("'" + TokenMangler.getSQLEscapedString(XmlUtil.xmlToString(producer.getXML((CSGObject) sv))) + "',");
} else {
buffer.append("null" + ",");
}
buffer.append(sv.getHandle() + ",");
buffer.append(ordinalValue + ")");
return buffer.toString();
}
use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.
the class SubVolumeTable method getAnalyticOrCompartmentSubVolume.
/**
* This method was created in VisualAge.
* @return Model
* @param rset ResultSet
* @param log SessionLog
*/
public SubVolume getAnalyticOrCompartmentSubVolume(KeyValue key, ResultSet rset) throws SQLException, ExpressionException, DataAccessException {
// KeyValue key = new KeyValue(rset.getBigDecimal(id.toString(),0));
String svName = rset.getString(name.toString());
int handleValue = rset.getInt(handle.toString());
String expString = rset.getString(expression.toString());
if (rset.wasNull()) {
return new CompartmentSubVolume(key, handleValue);
} else {
try {
if (expString.startsWith("<") && expString.endsWith(">")) {
String xmlStr = TokenMangler.getSQLRestoredString(expString);
XmlReader xmlReader = new XmlReader(true);
Element csgObjElement = (XmlUtil.stringToXML(xmlStr, null)).getRootElement();
try {
CSGObject csgObject = xmlReader.getCSGObject(csgObjElement, key);
return csgObject;
} catch (Exception e1) {
e1.printStackTrace(System.out);
throw new DataAccessException(e1.getMessage(), e1);
}
}
Expression exp = new Expression(expString);
return new AnalyticSubVolume(key, svName, exp, handleValue);
} catch (Exception e) {
e.printStackTrace(System.out);
throw new DataAccessException(e.getMessage(), e);
}
}
}
use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.
the class MathModelEditor method setRightBottomPanelOnSelection.
@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
if (selections == null) {
return;
}
JComponent bottomComponent = rightBottomEmptyPanel;
int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
boolean bShowInDatabaseProperties = false;
if (selections != null && selections.length == 1) {
Object singleSelection = selections[0];
if (singleSelection == mathModel) {
bottomComponent = mathModelEditorAnnotationPanel;
} else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderNode folderNode = (DocumentEditorTreeFolderNode) singleSelection;
if (folderNode.getFolderClass() == DocumentEditorTreeFolderClass.MATH_ANNOTATION_NODE) {
bottomComponent = mathModelEditorAnnotationPanel;
} else if (folderNode.getFolderClass() == DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE) {
bottomComponent = simulationSummaryPanel;
}
} else if (singleSelection instanceof BioModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof MathModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = mathModelMetaDataPanel;
} else if (singleSelection instanceof GeometryInfo) {
bShowInDatabaseProperties = true;
bottomComponent = geometryMetaDataPanel;
} else if (singleSelection instanceof Simulation) {
bottomComponent = simulationSummaryPanel;
} else if (singleSelection instanceof CSGObject) {
bottomComponent = csgObjectPropertiesPanel;
csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
}
}
if (bShowInDatabaseProperties) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel) {
break;
}
}
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
}
}
if (rightSplitPane.getBottomComponent() != rightBottomTabbedPane) {
rightSplitPane.setBottomComponent(rightBottomTabbedPane);
}
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
rightBottomTabbedPane.repaint();
}
rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
use of cbit.vcell.geometry.CSGObject 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);
}
}
use of cbit.vcell.geometry.CSGObject in project vcell by virtualcell.
the class GeometrySubVolumePanel method addSubVolume.
private void addSubVolume(final SubVolume subVolume) {
AsynchClientTask task1 = new AsynchClientTask("adding subdomain", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
if (subVolume instanceof AnalyticSubVolume) {
getGeometrySpec().addSubVolume((AnalyticSubVolume) subVolume, true);
} else if (subVolume instanceof CSGObject) {
getGeometrySpec().addSubVolume((CSGObject) subVolume, true);
}
getGeometry().precomputeAll(new GeometryThumbnailImageFactoryAWT());
}
};
AsynchClientTask task2 = new AsynchClientTask("adding subdomain", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
DocumentEditorSubPanel.setTableSelections(new Object[] { subVolume }, ivjScrollPaneTable, ivjgeometrySubVolumeTableModel);
}
};
ClientTaskDispatcher.dispatch(GeometrySubVolumePanel.this, new Hashtable<String, Object>(), new AsynchClientTask[] { task1, task2 }, true, false, false, null, true);
}
Aggregations