Search in sources :

Example 81 with Coordinate

use of org.vcell.util.Coordinate in project vcell by virtualcell.

the class CurveTable method encodeCurve.

/**
 * Insert the method's description here.
 * Creation date: (7/28/00 6:01:29 PM)
 * @param shape java.awt.Shape
 */
public static String encodeCurve(cbit.vcell.geometry.Curve curve) {
    StringBuffer encodedVals = new StringBuffer();
    // CurveType
    encodedVals.append(curve.getClass().getName() + " ");
    // Curve open or closed
    encodedVals.append(curve.isClosed() + " ");
    if (curve instanceof ControlPointCurve) {
        ControlPointCurve cpc = (ControlPointCurve) curve;
        // ControlPointCount
        encodedVals.append(cpc.getControlPointCount() + " ");
        for (int c = 0; c < cpc.getControlPointCount(); c += 1) {
            Coordinate cpcCoord = cpc.getControlPoint(c);
            encodedVals.append(cpcCoord.getX() + " " + cpcCoord.getY() + " " + cpcCoord.getZ() + " ");
        }
    } else {
        throw new RuntimeException("Can't encode curvetype " + curve.getClass().getName());
    }
    /*else {
		double[] segments = new double[6];
		java.awt.geom.PathIterator pi = shape.getPathIterator(null);
		encodedVals.append(pi.getWindingRule() + " ");
		while (!pi.isDone()) {
			int segType = pi.currentSegment(segments);
			encodedVals.append(segType + " ");
			switch (segType) {
				case java.awt.geom.PathIterator.SEG_MOVETO :
					encodedVals.append(segments[0] + " " + segments[1] + " ");
					break;
				case java.awt.geom.PathIterator.SEG_LINETO :
					encodedVals.append(segments[0] + " " + segments[1] + " ");
					break;
				case java.awt.geom.PathIterator.SEG_QUADTO :
					encodedVals.append(segments[0] + " " + segments[1] + segments[2] + " " + segments[3] + " ");
					break;
				case java.awt.geom.PathIterator.SEG_CUBICTO :
					encodedVals.append(segments[0] + " " + segments[1] + segments[2] + " " + segments[3] + segments[4] + " " + segments[5] + " ");
					break;
				case java.awt.geom.PathIterator.SEG_CLOSE :
					//No points
					break;
			}
			pi.next();
		}
	}*/
    return encodedVals.toString();
}
Also used : Coordinate(org.vcell.util.Coordinate) ControlPointCurve(cbit.vcell.geometry.ControlPointCurve)

Aggregations

Coordinate (org.vcell.util.Coordinate)81 CoordinateIndex (org.vcell.util.CoordinateIndex)16 SampledCurve (cbit.vcell.geometry.SampledCurve)11 SinglePoint (cbit.vcell.geometry.SinglePoint)11 ControlPointCurve (cbit.vcell.geometry.ControlPointCurve)10 CurveSelectionInfo (cbit.vcell.geometry.CurveSelectionInfo)6 Expression (cbit.vcell.parser.Expression)6 CartesianMesh (cbit.vcell.solvers.CartesianMesh)6 Vector (java.util.Vector)6 Extent (org.vcell.util.Extent)6 VariableType (cbit.vcell.math.VariableType)5 ISize (org.vcell.util.ISize)5 AnalyticSubVolume (cbit.vcell.geometry.AnalyticSubVolume)4 Curve (cbit.vcell.geometry.Curve)4 SubVolume (cbit.vcell.geometry.SubVolume)4 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 Origin (org.vcell.util.Origin)4 VCImageUncompressed (cbit.image.VCImageUncompressed)3 Line (cbit.vcell.geometry.Line)3