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