Debug.message( "omgraphic", "OMSpline: null projection in generate!");
Debug.message("omspline", "OMSpline: null projection in generate!");
    public boolean generate(Projection proj) {	int i, j, npts;	shape = null;	if (proj == null) {	    Debug.message(		"omgraphic",		"OMSpline: null projection in generate!");	    return false;	}	// HACK : isPolygon is not updated when DrawingTool asks for closing	NatCubicSpline spline = isClosed() ? natCubicClosed : natCubic;	//		NatCubicSpline spline = isPolygon() ? natCubicClosed : natCubic;	// HACK : should use something else than nsegs	spline.setSteps(nsegs);	int[][] splinePoints;	switch (renderType) {	case RENDERTYPE_XY :	    if (xs == null) {		Debug.message(		    "omgraphic",		    "OMSpline x/y rendertype null coordinates");		return false;	    }	    // spline creation	    splinePoints = spline.calc(xs, ys);	    // Need to keep these around for the LabeledOMSpline	    xpoints = new int[1][0];	    xpoints[0] = splinePoints[0];	    ypoints = new int[1][0];	    ypoints[0] = splinePoints[1];	    if (doShapes) {		createShape();	    }	    break;	case RENDERTYPE_OFFSET :	    if (xs == null) {		Debug.message(		    "omgraphic",		    "OMSpline offset rendertype null coordinates");		return false;	    }	    npts = xs.length;	    int[] _x = new int[npts];	    int[] _y = new int[npts];	    // forward project the radian point	    Point origin = proj.forward(lat, lon, new Point(0, 0), true);	    //radians	    if (coordMode == COORDMODE_ORIGIN) {		for (i = 0; i < npts; i++) {		    _x[i] = xs[i] + origin.x;		    _y[i] = ys[i] + origin.y;		}	    }	    else { // CModePrevious offset deltas		_x[0] = xs[0] + origin.x;		_y[0] = ys[0] + origin.y;		for (i = 1; i < npts; i++) {		    _x[i] = xs[i] + _x[i - 1];		    _y[i] = ys[i] + _y[i - 1];		}	    }	    // spline creation	    splinePoints = spline.calc(_x, _y);	    // Need to keep these around for the LabeledOMSpline	    xpoints = new int[1][0];	    xpoints[0] = splinePoints[0];	    ypoints = new int[1][0];	    ypoints[0] = splinePoints[1];	    if (doShapes) {		createShape();	    }	    break;	case RENDERTYPE_LATLON :	    ArrayList vector = null;	    // spline creation ; precision 1e-8 rad = 0.002"	    float[] splinellpts = spline.calc(rawllpts, 1e-8f);	    // polygon/polyline project the polygon/polyline.	    // Vertices should already be in radians.	    vector =		proj.forwardPoly(splinellpts, lineType, nsegs, isPolygon);	    int size = vector.size();	    if (!doShapes) {		xpoints = new int[(int) (size / 2)][0];		ypoints = new int[xpoints.length][0];	    }	    // We could call create shape, but this is more efficient.	    for (i = 0, j = 0; i < size; i += 2, j++) {		if (doShapes) {		    GeneralPath gp =			createShape(			    (int[]) vector.get(i),			    (int[]) vector.get(i + 1),			    isPolygon);		    if (shape == null) {			shape = gp;		    }		    else {			((GeneralPath) shape).append(gp, false);		    }		}		else {		    xpoints[j] = (int[]) vector.get(i);		    ypoints[j] = (int[]) vector.get(i + 1);		}	    }	    break;	case RENDERTYPE_UNKNOWN :	    Debug.error("OMSpline.generate: invalid RenderType");	    return false;	}	setNeedToRegenerate(false);	return true;    }