int nDumped = 0;
    public void writeShapeFile(String shapeFileName, OMGraphicList graphics) {        OMGraphicList saveGraphics = new OMGraphicList();        try {            ShapeFile s = new ShapeFile(shapeFileName);            int nGraphics = graphics.size();            int nDumped = 0;            if (nGraphics > 0) {                OMGraphic omg = graphics.getOMGraphicAt(0);                if ((omg instanceof OMPoly)                        && (omg.getRenderType() == OMGraphic.RENDERTYPE_LATLON)) {                    int shapeType = ((OMPoly) omg).isPolygon() ? ShapeUtils.SHAPE_TYPE_POLYGON                            : ShapeUtils.SHAPE_TYPE_ARC;                    System.out.println("shapeType=" + shapeType);                    s.setShapeType(shapeType);                }            }            System.out.println(nGraphics + " candidates.");            for (int i = 0; i < nGraphics; i++) {                OMGraphic omg = graphics.getOMGraphicAt(i);                if ((omg instanceof OMPoly)                        && (omg.getRenderType() == OMGraphic.RENDERTYPE_LATLON)) {                    OMPoly poly = (OMPoly) omg;                    if (doThinning && maybeThrowAwayPoly(poly)) {                        continue;                    }                    saveGraphics.addOMGraphic(poly);                } else {                    System.out.println("Skipping candidate: "                            + omg.getClass().toString() + ", "                            + omg.getRenderType());                }            }            graphics = saveGraphics;            // join polylines            if (doThinning) {                nGraphics = graphics.size();                System.out.println(nGraphics + " candidates.");                graphics = joinCommonLines(graphics);            }            // save graphics            EsriShapeExport ese = new EsriShapeExport(graphics, (Projection)null, shapeFileName);            ese.export();            //            nGraphics = graphics.size();//            System.out.println("Dumping " + nGraphics + " graphics.");//            for (int i = 0; i < nGraphics; i++) {//                OMPoly poly = (OMPoly) graphics.getOMGraphicAt(i);//                float[] radians = poly.getLatLonArray();//                ESRIPolygonRecord epr = new ESRIPolygonRecord();//                epr.add(radians);//                epr.setPolygon(poly.isPolygon());//set POLYGON vs ARC//                s.add(epr);//                ++nDumped;//            }////            s.verify(true, true);//            s.verify(true, true);//            s.close();//            System.out.println("Wrote " + nDumped + " Graphics.");        } catch (java.io.IOException e) {            e.printStackTrace();        }    }