Package org.opengis.geometry.primitive

Examples of org.opengis.geometry.primitive.Curve


            for (int i=0; i<numPoints; i++) {
                pointList.add(coordinateToDirectPosition(jtsLineString.getCoordinateN(i), crs));
            }
            ArrayList segments = new ArrayList();
            segments.add(ls);
            Curve result = pf.createCurve(segments);
            return result;
       
        } else if (geomType.equalsIgnoreCase("LinearRing")) {
            Ring result = linearRingToRing(
                    (com.vividsolutions.jts.geom.LinearRing) jtsGeom, crs);
            return result;
       
        } else if (geomType.equalsIgnoreCase("Polygon")) {
            com.vividsolutions.jts.geom.Polygon jtsPolygon =
                (com.vividsolutions.jts.geom.Polygon) jtsGeom;
            Ring externalRing = linearRingToRing(
                    (com.vividsolutions.jts.geom.LinearRing) jtsPolygon.getExteriorRing(),
                    crs);
            int n = jtsPolygon.getNumInteriorRing();
            ArrayList internalRings = new ArrayList();
            for (int i=0; i<n; i++) {
                internalRings.add(linearRingToRing(
                    (com.vividsolutions.jts.geom.LinearRing) jtsPolygon.getInteriorRingN(i),
                    crs));
            }
            SurfaceBoundary boundary = pf.createSurfaceBoundary(externalRing,
                    internalRings);
            Polygon polygon = gf.createPolygon(boundary);
            ArrayList patches = new ArrayList();
            patches.add(polygon);
            PolyhedralSurface result = gf.createPolyhedralSurface(patches);
            return result;
       
        } else if (geomType.equalsIgnoreCase("GeometryCollection") ||
                geomType.equalsIgnoreCase("MultiPoint") ||
                geomType.equalsIgnoreCase("MultiLineString") ||
                geomType.equalsIgnoreCase("MultiPolygon")) {
            com.vividsolutions.jts.geom.GeometryCollection jtsCollection =
                (com.vividsolutions.jts.geom.GeometryCollection) jtsGeom;
            int n = jtsCollection.getNumGeometries();
            MultiPrimitive result = gf.createMultiPrimitive();
            Set elements = result.getElements();
            for (int i=0; i<n; i++) {
                //result.getElements().add(jtsToGo1(jtsCollection.getGeometryN(i), crs));
                elements.add(jtsToGo1(jtsCollection.getGeometryN(i), crs));
            }
            return result;
View Full Code Here


        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

    public static DirectPosition[] getDirectPositions(final Ring ring) {
        final List directPositionList = new ArrayList();
        // Cast below can be removed when GeoAPI will be allowed to abandon Java 1.4 support.
        final List/*<Curve>*/ generators = (List) ring.getGenerators();
        for (int i = 0; i < generators.size(); i++) {
            final Curve curve = (Curve) generators.get(i);
            final List/*<CurveSegments>*/ segments = curve.getSegments();
            for (int j = 0; j < segments.size(); j++) {
                final CurveSegment curveSegment = (CurveSegment) segments.get(j);
                if (curveSegment instanceof LineString) {
                    final LineString lineString = (LineString) curveSegment;
                    final DirectPosition[] positions = getDirectPositions(lineString);
View Full Code Here

        final BasicFactories commonFactory = BasicFactories.getDefault();
        final GeometryFactory geometryFactory = commonFactory.getGeometryFactory(primitiveFactory.getCoordinateReferenceSystem());
       
        final List curveSegmentList = Collections.singletonList(createLineString(geometryFactory, points));
       
        final Curve curve = primitiveFactory.createCurve(curveSegmentList);
        return curve;
    }
View Full Code Here

             DirectPosition point1 = points.getDirectPosition( start, null );
             DirectPosition point2 = points.getDirectPosition( end, null );
             LineSegment segment = geometryFactory.createLineSegment( point1, point2 );
             segmentList.add( segment );
         }
         Curve curve = primitiveFactory.createCurve( segmentList );
         curves.add( curve);
         Ring ring = primitiveFactory.createRing( curves );
         SurfaceBoundary boundary = primitiveFactory.createSurfaceBoundary(ring,new ArrayList());
         SurfaceImpl surface = (SurfaceImpl) primitiveFactory.createSurface(boundary);
        
View Full Code Here

    List<Ring> interiors2 = sb2.getInteriors();
    Collection<? extends Primitive> extCurve = exterior.getElements();
    Iterator<? extends Primitive> iter = extCurve.iterator();
    PointArray samplePoints = null;
    while (iter.hasNext()) {
      Curve curve2 = (Curve) iter.next();
      List<? extends CurveSegment> segs2 = curve2.getSegments();
      Iterator<? extends CurveSegment> iter2 = segs2.iterator();
      while (iter2.hasNext()) {
        if (samplePoints == null) {
          samplePoints = iter2.next().getSamplePoints();
        }
View Full Code Here

        String WKT = "LINESTRING (60 380, 60 20, 200 400, 280 20, 360 400, 420 20, 500 400, 580 20, 620 400)";
       
        Object geometry = parser.parse( WKT );
        assertNotNull( geometry );
        assertTrue( geometry instanceof Curve);
        Curve linestring = (Curve) geometry;         
    }
View Full Code Here

        String WKT = "LINESTRING (80 360, 520 360, 520 40, 120 40, 120 300, 460 300, 460 100, 200 100, 200 240, 400 240, 400 140, 560 0)";
       
        Object geometry = parser.parse( WKT );
        assertNotNull( geometry );
        assertTrue( geometry instanceof Curve);
        Curve linestring = (Curve) geometry;         
    }
View Full Code Here

  public Solid createSolid(SolidBoundary boundary) throws MismatchedReferenceSystemException, MismatchedDimensionException {
    return getPrimitiveFactory().createSolid(boundary);
  }

    public SurfaceBoundary createSurfaceBoundary(PointArray points ) throws MismatchedReferenceSystemException, MismatchedDimensionException {
        Curve curve = createCurve( points );
        return createSurfaceBoundary( curve);
    }
View Full Code Here

TOP

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

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.