Package org.opengis.geometry.primitive

Examples of org.opengis.geometry.primitive.PrimitiveFactory


        int numPoints = jtsLinearRing.getNumPoints();
        if (! jtsLinearRing.getCoordinateN(0).equals(jtsLinearRing.getCoordinateN(numPoints-1))) {
            throw new IllegalArgumentException("LineString must be a ring");
        }
        Hints hints = new Hints( Hints.CRS, crs );
        PrimitiveFactory pf = GeometryFactoryFinder.getPrimitiveFactory(hints);
        GeometryFactory gf = GeometryFactoryFinder.getGeometryFactory(hints);
       
        LineString ls = gf.createLineString(new ArrayList());
        List pointList = ls.getControlPoints();
        for (int i=0; i<numPoints; i++) {
            pointList.add(coordinateToDirectPosition(jtsLinearRing.getCoordinateN(i), crs));
        }
        Curve curve = pf.createCurve(new ArrayList());
        // Cast below can be removed when GeoAPI will be allowed to abandon Java 1.4 support.
        ((List) curve.getSegments()).add(ls);
        Ring result = pf.createRing(new ArrayList());
        // Cast below can be removed when GeoAPI will be allowed to abandon Java 1.4 support.
        ((List) result.getGenerators()).add(curve);
        return result;
    }
View Full Code Here


            final DirectPosition[][] interiorRingsPoints) {
       
        final CoordinateReferenceSystem crs = exteriorRingPoints[0].getCoordinateReferenceSystem();
        final BasicFactories commonFactory = BasicFactories.getDefault();
        final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(crs);
        final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs);
       
        final Ring exteriorRing = createRing(primitiveFactory, exteriorRingPoints);
       
        List interiorRingList = interiorRingsPoints.length == 0 ?
                Collections.EMPTY_LIST :
                    new ArrayList(interiorRingsPoints.length);
        for (int i = 0; i < interiorRingsPoints.length; i++) {
            final DirectPosition[] interiorRingPoints = interiorRingsPoints[i];
            interiorRingList.add(createRing(primitiveFactory,interiorRingPoints));
        }
       
        final SurfaceBoundary surfaceBoundary =
            primitiveFactory.createSurfaceBoundary(exteriorRing, interiorRingList);
       
        return geometryFactory.createPolygon(surfaceBoundary);
    }
View Full Code Here

    public static SurfaceBoundary createSurfaceBoundary(
            final DirectPosition[] exteriorRingPoints,
            final DirectPosition[][] interiorRingsPoints) {
        final CoordinateReferenceSystem crs = exteriorRingPoints[0].getCoordinateReferenceSystem();
        final BasicFactories commonFactory = BasicFactories.getDefault();
        final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs);
        return createSurfaceBoundary(primitiveFactory, exteriorRingPoints, interiorRingsPoints);
    }
View Full Code Here

    }
   
    public static Ring createRing(final DirectPosition[] points) {
        final CoordinateReferenceSystem crs = points[0].getCoordinateReferenceSystem();
        final BasicFactories commonFactory = BasicFactories.getDefault();
        final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs);
        return createRing(primitiveFactory, points);
    }
View Full Code Here

    }
   
    public static Curve createCurve(final DirectPosition[] points) {
        final CoordinateReferenceSystem crs = points[0].getCoordinateReferenceSystem();
        final BasicFactories commonFactory = BasicFactories.getDefault();
        final PrimitiveFactory primitiveFactory = commonFactory.getPrimitiveFactory(crs);
        return createCurve(primitiveFactory, points);
    }
View Full Code Here

TOP

Related Classes of org.opengis.geometry.primitive.PrimitiveFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.