src/main/java/com/esri/core/geometry/ogc/OGCGeometry.java
private OGCGeometry simplifyBunch_(GeometryCursor gc) {
        // Combines geometries into multipoint, polyline, and polygon types,
        // simplifying them and unioning them,
        // then produces OGCGeometry from the result.
        // Can produce OGCConcreteGoemetryCollection
        MultiPoint dstMultiPoint = null;
        ArrayDeque<Geometry> dstPolylines = new ArrayDeque<>();
        ArrayDeque<Geometry> dstPolygons = new ArrayDeque<>();
        for (com.esri.core.geometry.Geometry g = gc.next(); g != null; g = gc
                .next()) {
            switch (g.getType()) {
                case Point:
                    if (dstMultiPoint == null)
                        dstMultiPoint = new MultiPoint();
                    dstMultiPoint.add((Point) g);
                    break;
                case MultiPoint:
                    if (dstMultiPoint == null)
                        dstMultiPoint = new MultiPoint();
                    dstMultiPoint.add((MultiPoint) g, 0, -1);
                    break;
                case Polyline:
                    dstPolylines.add((Polyline) g.copy());
                    break;
                case Polygon:
                    dstPolygons.add((Polygon) g.copy());
                    break;
                default:
                    throw new UnsupportedOperationException();
            }
        }

        ArrayDeque<Geometry> result = new ArrayDeque<>(3);
        if (dstMultiPoint != null) {
            Geometry resMP = OperatorSimplifyOGC.local().execute(dstMultiPoint,
                    esriSR, true, null);
            result.add(resMP);
        }

        if (dstPolylines.size() > 0) {
            if (dstPolylines.size() == 1) {
                Geometry resMP = OperatorSimplifyOGC.local().execute(dstPolylines.pop(), esriSR, true, null);
                result.add(resMP);
            } else {
                GeometryCursor res = OperatorUnion.local().execute(new SimpleGeometryCursor(dstPolylines), esriSR, null);
                Geometry resPolyline = res.next();
                Geometry resMP = OperatorSimplifyOGC.local().execute(
                        resPolyline, esriSR, true, null);
                result.add(resMP);
            }
        }

        if (dstPolygons.size() > 0) {
            if (dstPolygons.size() == 1) {
                Geometry resMP = OperatorSimplifyOGC.local().execute(dstPolygons.pop(), esriSR, true, null);
                result.add(resMP);
            } else {
                GeometryCursor res = OperatorUnion.local().execute(new SimpleGeometryCursor(dstPolygons), esriSR, null);
                Geometry resPolygon = res.next();
                Geometry resMP = OperatorSimplifyOGC.local().execute(
                        resPolygon, esriSR, true, null);
                result.add(resMP);
            }
        }

        return OGCGeometry.createFromEsriCursor(new SimpleGeometryCursor(result), esriSR);
    }
// it produces a single OGCGeometry.
it produces a single OGCGeometry.
it produces a single OGCGeometry .
private OGCGeometry simplifyBunch_(GeometryCursor gc) {
        MultiPoint dstMultiPoint = null;
        ArrayDeque<Geometry> dstPolylines = new ArrayDeque<>();
        ArrayDeque<Geometry> dstPolygons = new ArrayDeque<>();
        for (com.esri.core.geometry.Geometry g = gc.next(); g != null; g = gc
                .next()) {
            switch (g.getType()) {
                case Point:
                    if (dstMultiPoint == null)
                        dstMultiPoint = new MultiPoint();
                    dstMultiPoint.add((Point) g);
                    break;
                case MultiPoint:
                    if (dstMultiPoint == null)
                        dstMultiPoint = new MultiPoint();
                    dstMultiPoint.add((MultiPoint) g, 0, -1);
                    break;
                case Polyline:
                    dstPolylines.add((Polyline) g.copy());
                    break;
                case Polygon:
                    dstPolygons.add((Polygon) g.copy());
                    break;
                default:
                    throw new UnsupportedOperationException();
            }
        }
        ArrayDeque<Geometry> result = new ArrayDeque<>(3);
        if (dstMultiPoint != null) {
            Geometry resMP = OperatorSimplifyOGC.local().execute(dstMultiPoint,
                    esriSR, true, null);
            result.add(resMP);
        }
        if (dstPolylines.size() > 0) {
            if (dstPolylines.size() == 1) {
                Geometry resMP = OperatorSimplifyOGC.local().execute(dstPolylines.pop(), esriSR, true, null);
                result.add(resMP);
            } else {
                GeometryCursor res = OperatorUnion.local().execute(new SimpleGeometryCursor(dstPolylines), esriSR, null);
                Geometry resPolyline = res.next();
                Geometry resMP = OperatorSimplifyOGC.local().execute(
                        resPolyline, esriSR, true, null);
                result.add(resMP);
            }
        }
        if (dstPolygons.size() > 0) {
            if (dstPolygons.size() == 1) {
                Geometry resMP = OperatorSimplifyOGC.local().execute(dstPolygons.pop(), esriSR, true, null);
                result.add(resMP);
            } else {
                GeometryCursor res = OperatorUnion.local().execute(new SimpleGeometryCursor(dstPolygons), esriSR, null);
                Geometry resPolygon = res.next();
                Geometry resMP = OperatorSimplifyOGC.local().execute(
                        resPolygon, esriSR, true, null);
                result.add(resMP);
            }
        }
        return OGCGeometry.createFromEsriCursor(new SimpleGeometryCursor(result), esriSR);
    }
private OGCGeometry simplifyBunch_ ( GeometryCursor gc ) { MultiPoint dstMultiPoint = null ; ArrayDeque < Geometry > dstPolylines = new ArrayDeque < > ( ) ; ArrayDeque < Geometry > dstPolygons = new ArrayDeque < > ( ) ; for ( com . esri . core . geometry . Geometry g = gc . next ( ) ; g != null ; g = gc . next ( ) ) { switch ( g . getType ( ) ) { case Point : if ( dstMultiPoint == null ) dstMultiPoint = new MultiPoint ( ) ; dstMultiPoint . add ( ( Point ) g ) ; break ; case MultiPoint : if ( dstMultiPoint == null ) dstMultiPoint = new MultiPoint ( ) ; dstMultiPoint . add ( ( MultiPoint ) g , 0 , - 1 ) ; break ; case Polyline : dstPolylines . add ( ( Polyline ) g . copy ( ) ) ; break ; case Polygon : dstPolygons . add ( ( Polygon ) g . copy ( ) ) ; break ; default : throw new UnsupportedOperationException ( ) ; } } ArrayDeque < Geometry > result = new ArrayDeque < > ( 3 ) ; if ( dstMultiPoint != null ) { Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( dstMultiPoint , esriSR , true , null ) ; result . add ( resMP ) ; } if ( dstPolylines . size ( ) > 0 ) { if ( dstPolylines . size ( ) == 1 ) { Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( dstPolylines . pop ( ) , esriSR , true , null ) ; result . add ( resMP ) ; } else { GeometryCursor res = OperatorUnion . local ( ) . execute ( new SimpleGeometryCursor ( dstPolylines ) , esriSR , null ) ; Geometry resPolyline = res . next ( ) ; Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( resPolyline , esriSR , true , null ) ; result . add ( resMP ) ; } } if ( dstPolygons . size ( ) > 0 ) { if ( dstPolygons . size ( ) == 1 ) { Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( dstPolygons . pop ( ) , esriSR , true , null ) ; result . add ( resMP ) ; } else { GeometryCursor res = OperatorUnion . local ( ) . execute ( new SimpleGeometryCursor ( dstPolygons ) , esriSR , null ) ; Geometry resPolygon = res . next ( ) ; Geometry resMP = OperatorSimplifyOGC . local ( ) . execute ( resPolygon , esriSR , true , null ) ; result . add ( resMP ) ; } } return OGCGeometry . createFromEsriCursor ( new SimpleGeometryCursor ( result ) , esriSR ) ; }
it produces a single OGCGeometry.
it produces a single OGCGeometry .
// Combines geometries into multipoint, polyline, and polygon types, // simplifying them and unioning them, // then produces OGCGeometry from the result. // Can produce OGCConcreteGoemetryCollection