use of cbit.vcell.geometry.CurveRenderer in project vcell by virtualcell.
the class PDEDataContextPanel method updateContours.
/**
* Insert the method's description here.
* Creation date: (11/9/2000 4:14:39 PM)
*/
private void updateContours() {
//
if (getPdeDataContext() == null || getPdeDataContext().getDataIdentifier() == null) {
return;
}
// Remove previous curves
CurveRenderer curveRenderer = getImagePlaneManagerPanel().getCurveRenderer();
if (contoursAndValues != null) {
java.util.Enumeration<SampledCurve> keysEnum = contoursAndValues.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = keysEnum.nextElement();
curveRenderer.removeCurve(curve);
}
}
//
contoursAndValues = null;
boolean hasValues = false;
if (meshDisplayAdapter != null) {
VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
if (variableType.equals(VariableType.VOLUME)) {
// Get curves with no values for overlay on volume Data
contoursAndValues = meshDisplayAdapter.getCurvesFromContours(null);
} else if (variableType.equals(VariableType.CONTOUR)) {
// get curves with values
contoursAndValues = meshDisplayAdapter.getCurvesFromContours(getPdeDataContext().getDataValues());
hasValues = true;
}
}
// Add new curves to curveRenderer
if (contoursAndValues != null) {
java.util.Enumeration<SampledCurve> keysEnum = contoursAndValues.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = (Curve) keysEnum.nextElement();
//
curveRenderer.addCurve(curve);
//
curveRenderer.renderPropertyEditable(curve, false);
curveRenderer.renderPropertySelectable(curve, hasValues);
if (hasValues) {
curveRenderer.renderPropertySubSelectionType(curve, CurveRenderer.SUBSELECTION_SEGMENT);
} else {
curveRenderer.renderPropertyLineWidthMultiplier(curve, 3);
}
}
}
}
use of cbit.vcell.geometry.CurveRenderer in project vcell by virtualcell.
the class PDEDataContextPanel method updateMembraneCurves.
/**
* Insert the method's description here.
* Creation date: (10/22/00 3:15:49 PM)
*/
private void updateMembraneCurves() {
//
if (getPdeDataContext() == null || getPdeDataContext().getDataIdentifier() == null) {
return;
}
int normalAxis = getImagePlaneManagerPanel().getImagePlaneManager().getNormalAxis();
int slice = getImagePlaneManagerPanel().getImagePlaneManager().getSlice();
// Remove previous curves
CurveRenderer curveRenderer = getImagePlaneManagerPanel().getCurveRenderer();
if (membranesAndIndexes != null) {
java.util.Enumeration<SampledCurve> keysEnum = membranesAndIndexes.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = keysEnum.nextElement();
curveRenderer.removeCurve(curve);
}
}
//
membranesAndIndexes = null;
boolean hasValues = false;
if (meshDisplayAdapter != null) {
// Get new curves for slice and normalAxis
VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
if (variableType.equals(VariableType.VOLUME) || variableType.equals(VariableType.VOLUME_REGION)) {
// Turn off showing Membrane values over mouse
// getImagePlaneManagerPanel().setCurveValueProvider(null);
//
// GET CURVES WITH NO VALUES FOR OVERLAY ON VOLUME DATA
membranesAndIndexes = meshDisplayAdapter.getCurvesAndMembraneIndexes(normalAxis, slice);
} else if (variableType.equals(VariableType.MEMBRANE)) {
// Turn on showing Membrane values over mouse
// getImagePlaneManagerPanel().setCurveValueProvider(this);
//
// GET CURVES WITH VALUES
membranesAndIndexes = meshDisplayAdapter.getCurvesAndMembraneIndexes(normalAxis, slice);
hasValues = true;
} else if (variableType.equals(VariableType.MEMBRANE_REGION)) {
// Turn on showing Membrane values over mouse
// getImagePlaneManagerPanel().setCurveValueProvider(this);
//
// GET CURVES WITH REGIONIDS
membranesAndIndexes = meshDisplayAdapter.getCurvesAndMembraneIndexes(normalAxis, slice);
/*
//RegionID values
double[] regionValues = getPdeDataContext().getDataValues();
java.util.Iterator regionIDCurveValues = membranesAndValues.values().iterator();
//convert RegionID to value
while(regionIDCurveValues.hasNext()){
java.util.Vector regionIDValues = (java.util.Vector)regionIDCurveValues.next();
for(int i = 0;i < regionIDValues.size();i+= 1){
int regionID = (int)(((Double)(regionIDValues.elementAt(i))).doubleValue());
Double decodedRegionValue = new Double(regionValues[regionID]);
regionIDValues.setElementAt(decodedRegionValue,i);
}
}
*/
hasValues = true;
}
}
// Add new curves to curveRenderer
if (membranesAndIndexes != null) {
java.util.Enumeration<SampledCurve> keysEnum = membranesAndIndexes.keys();
while (keysEnum.hasMoreElements()) {
Curve curve = keysEnum.nextElement();
//
curveRenderer.addCurve(curve);
//
curveRenderer.renderPropertyEditable(curve, false);
curveRenderer.renderPropertySelectable(curve, false);
if (!hasValues) {
curveRenderer.renderPropertyLineWidthMultiplier(curve, 3);
}
// getImagePlaneManagerPanel().getCurveRenderer().renderPropertySelectable(curve, hasValues);
// if (hasValues) {
// getImagePlaneManagerPanel().getCurveRenderer().renderPropertySubSelectionType(curve, cbit.vcell.geometry.gui.CurveRenderer.SUBSELECTION_SEGMENT);
// }else{
// getImagePlaneManagerPanel().getCurveRenderer().renderPropertyLineWidthMultiplier(curve,3);
// }
}
}
//
refreshColorCurves();
//
// Set visibility of curve samplers
Curve[] curves = curveRenderer.getAllCurves();
if (curves != null && curves.length > 0) {
for (int i = 0; i < curves.length; i += 1) {
if (membranesAndIndexes == null || !membranesAndIndexes.containsKey(curves[i])) {
boolean isCurveValidDataSampler = isValidDataSampler(curves[i]);
curveRenderer.renderPropertyVisible(curves[i], isCurveValidDataSampler);
curveRenderer.renderPropertyEditable(curves[i], (membraneSamplerCurves != null && membraneSamplerCurves.contains(curves[i]) ? false : true));
}
}
}
// See if we should keep selection
if (curveRenderer.getSelection() != null) {
CurveSelectionInfo csi = curveRenderer.getSelection();
curveRenderer.selectNothing();
if (isValidDataSampler(csi.getCurve())) {
curveRenderer.setSelection(csi);
}
}
//
//
fireDataSamplers();
}
use of cbit.vcell.geometry.CurveRenderer in project vcell by virtualcell.
the class CurveEditorTool method setCurveRenderer.
/**
* Sets the curveRenderer property (cbit.vcell.geometry.gui.CurveRenderer) value.
* @param curveRenderer The new value for the property.
* @see #getCurveRenderer
*/
public void setCurveRenderer(CurveRenderer curveRenderer) {
CurveRenderer oldValue = fieldCurveRenderer;
fieldCurveRenderer = curveRenderer;
firePropertyChange("curveRenderer", oldValue, curveRenderer);
checkConfiguration();
}
use of cbit.vcell.geometry.CurveRenderer in project vcell by virtualcell.
the class PDEDataContextPanel method fireDataSamplers.
/**
* Insert the method's description here.
* Creation date: (7/6/2003 7:42:59 PM)
* @param curve cbit.vcell.geometry.Curve
*/
private void fireDataSamplers() {
// fire "dataSamplers" if there are any
boolean bTimeDataSamplerVisible = false;
boolean bSpatialDataSamplerVisible = false;
CurveRenderer cr = getImagePlaneManagerPanel().getCurveRenderer();
if (cr != null) {
Curve[] curves = getImagePlaneManagerPanel().getCurveRenderer().getAllCurves();
if (curves != null && curves.length > 0) {
for (int i = 0; i < curves.length; i += 1) {
if (membranesAndIndexes == null || !membranesAndIndexes.containsKey(curves[i])) {
boolean isCurveValidDataSampler = isValidDataSampler(curves[i]);
bTimeDataSamplerVisible = bTimeDataSamplerVisible || (isCurveValidDataSampler && curves[i] instanceof SinglePoint);
bSpatialDataSamplerVisible = bSpatialDataSamplerVisible || (isCurveValidDataSampler && !(curves[i] instanceof SinglePoint)) && cr.getSelection() != null && cr.getSelection().getCurve() == curves[i];
}
}
}
}
//
firePropertyChange("timeDataSamplers", !bTimeDataSamplerVisible, bTimeDataSamplerVisible);
firePropertyChange("spatialDataSamplers", !bSpatialDataSamplerVisible, bSpatialDataSamplerVisible);
}
use of cbit.vcell.geometry.CurveRenderer in project vcell by virtualcell.
the class PDEDataContextPanel method isAddControlPointOK.
/**
* Insert the method's description here.
* Creation date: (7/4/2003 6:10:48 PM)
*/
public boolean isAddControlPointOK(int tool, Coordinate wc, Curve addedToThisCurve) {
//
CurveRenderer curveR = getImagePlaneManagerPanel().getCurveRenderer();
VariableType variableType = getPdeDataContext().getDataIdentifier().getVariableType();
if (variableType.equals(VariableType.POSTPROCESSING) || variableType.equals(VariableType.VOLUME) || variableType.equals(VariableType.VOLUME_REGION)) {
return true;
}
if (variableType.equals(VariableType.MEMBRANE) || variableType.equals(VariableType.MEMBRANE_REGION)) {
CurveSelectionInfo[] closeCSI = curveR.getCloseCurveSelectionInfos(wc);
if (closeCSI != null && closeCSI.length > 0) {
for (int i = 0; i < closeCSI.length; i += 1) {
if (tool == CurveEditorTool.TOOL_POINT && addedToThisCurve instanceof SinglePoint && membranesAndIndexes != null && membranesAndIndexes.containsKey(closeCSI[i].getCurve())) {
return true;
} else if (tool == CurveEditorTool.TOOL_LINE && addedToThisCurve instanceof CurveSelectionCurve) {
Curve sourceCurve = ((CurveSelectionCurve) (addedToThisCurve)).getSourceCurveSelectionInfo().getCurve();
if (sourceCurve == closeCSI[i].getCurve()) {
if (membranesAndIndexes != null && membranesAndIndexes.containsKey(sourceCurve)) {
return true;
}
}
}
}
}
}
return false;
}
Aggregations