Package org.opengis.geometry.primitive

Examples of org.opengis.geometry.primitive.Surface


   
    // Build Ring then SurfaceBoundary then Surface
    RingImpl exteriors = (RingImpl) primitiveFactory.createRing(curveList);
    List<Ring> interiors = new ArrayList<Ring>();
    SurfaceBoundary sboundary = primitiveFactory.createSurfaceBoundary(exteriors, interiors);
    Surface surface1 = primitiveFactory.createSurface(sboundary);
    Surface surface2 = (SurfaceImpl) surface1.transform(crs2);
   
    // create expected result
    PositionFactory expectedPosF2 = new PositionFactoryImpl(crs2, new PrecisionModel());
    PrimitiveFactory expectedPrimF2 = new PrimitiveFactoryImpl(crs2, expectedPosF2);
    GeometryFactory ExpectedGeomF2 = new GeometryFactoryImpl(crs2, expectedPosF2);
   
    List<Position> expectedPoints = new ArrayList<Position>();
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187127.9999999998, 396026.99999999825} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1188245.0000000007, 396027.0000000039} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1188245.0000000005, 395268.0000000018} ));
    expectedPoints.add(expectedPrimF2.createPoint( new double[]{1187128.000000001, 395268.0000000004} ));
        LineString expectedLineString = ExpectedGeomF2.createLineString(expectedPoints);
        List expectedCurveSegmentList = Collections.singletonList(expectedLineString);
       
        CurveImpl expectedCurve = (CurveImpl) expectedPrimF2.createCurve(expectedCurveSegmentList);
       
    /* Build Ring from Curve */
    ArrayList<OrientableCurve> expectedCurveList = new ArrayList<OrientableCurve>();
    expectedCurveList.add(expectedCurve);
   
    // Build Ring then SurfaceBoundary then Surface
    RingImpl exteriors2 = (RingImpl) expectedPrimF2.createRing(expectedCurveList);
    List<Ring> interiors2 = new ArrayList<Ring>();
    SurfaceBoundary sboundary2 = expectedPrimF2.createSurfaceBoundary(exteriors2, interiors2);
    Surface expectedSurface = expectedPrimF2.createSurface(sboundary2);
       
    //System.out.println(surface1);
    //System.out.println(surface2);
    //System.out.println(expectedSurface);
   
View Full Code Here


        String nextToken = getNextEmptyOrOpener(tokenizer);       
        if (nextToken.equals(EMPTY)) {
          return null;
        }
        MultiPrimitive multi = geometryFactory.createMultiPrimitive();
        Surface surface  = readPolygonText(tokenizer);
        //multi.getElements().add(surface);
        Set elements = multi.getElements();
        elements.add(surface);
        nextToken = getNextCloserOrComma(tokenizer);
        while (nextToken.equals(COMMA)) {
View Full Code Here

    Iterator<Primitive> surfIter = tmpSurfaces.iterator();
   
    if (!surfIter.hasNext())
      return null;
   
    Surface actSurf = (Surface) surfIter.next();
    /* Use envelope of the first Curve as base for the new envelope */
    EnvelopeImpl rEnv = new EnvelopeImpl(actSurf.getEnvelope());
    //EnvelopeImpl rEnv = this.getFeatGeometryFactory().getGeometryFactoryImpl().createEnvelope(actSurf.getEnvelope());
   
    /* Add envelopes of the other Curves */
    while (surfIter.hasNext()) {
      actSurf = (Surface) surfIter.next();
      rEnv.expand(actSurf.getEnvelope());
    }

    return rEnv;
  }
View Full Code Here

   
    SurfacePatch firstPatch = patches.get(0);
    if (patches.size() == 1)
      return (SurfaceBoundaryImpl) firstPatch.getBoundary();

    Surface firstPatchSurface = new SurfaceImpl(firstPatch.getBoundary());
    Set<OrientableSurface> surfaceList = new HashSet<OrientableSurface>();
   
    for (int i=1; i<patches.size(); i++) {
      SurfacePatch nextPatch = patches.get(i);
      surfaceList.add(new SurfaceImpl(nextPatch.getBoundary()));
    }
   
    MultiSurface ms = new MultiSurfaceImpl(getCoordinateReferenceSystem(), surfaceList);
    TransfiniteSet unionResultSurface = firstPatchSurface.union(ms);
    if (! (unionResultSurface instanceof SurfaceImpl))
      throw new IllegalArgumentException("Surface patches are not continuous");
   
    return (SurfaceBoundaryImpl) ((SurfaceImpl)unionResultSurface).getBoundary();
  }
View Full Code Here

     * @see org.opengis.geometry.primitive.PrimitiveFactory#createSurface(org.opengis.geometry.primitive.SurfaceBoundary)
     */
    public Surface createSurface(final SurfaceBoundary boundary) {
        // For now, our implementation has to assume that the boundary is a
        // polygon.
        Surface result = new SurfaceImpl(crs);
        Polygon poly = geomFact.createPolygon(boundary);
        // PENDING(jdc): the following line is 1.5 specific.
        // the result.getPatches() list is a generic list with a type of "? extends SurfacePatch"
        // we can compile without the generic if we cast down to List, but why do we need the cast?
        // Polygon extends SurfacePatch, so in theory this should work...
        //((List<SurfacePatch>) result.getPatches()).add(poly);
        ((List)result.getPatches()).add(poly);
        return result;
    }
View Full Code Here

   
    List<? extends SurfacePatch> triangleList = this._testTriangle1(aGeomFactory, tPrimFactory);
   
    List<SurfacePatch> surfacePatches1 = (List<SurfacePatch>)triangleList;

    Surface surface1 = tPrimFactory.createSurface(surfacePatches1);
   
    //System.out.print("\n******************* SURFACE GENERATED BY SURFACEPATCHES");
    this.testSurfaces((SurfaceImpl) surface1);
   

View Full Code Here

    Ring exteriorRing = tPrimFactory.createRingByDirectPositions(directPositionList);
    List<Ring> interiors = new ArrayList<Ring>();
   
    SurfaceBoundaryImpl surfaceBoundary1 = tPrimFactory.createSurfaceBoundary(exteriorRing, interiors );
   
    Surface surface2 = tPrimFactory.createSurface(surfaceBoundary1);
   
    //System.out.print("\n******************* SURFACE GENERATED BY SURFACEBOUNDARY");

   
    this.testSurfaces((SurfaceImpl) surface2);
   
    // ***** clone()
    SurfaceImpl surface3 = null;
    try {
      surface3 = (SurfaceImpl) surface2.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
    }
    assertTrue(surface2 != surface3);
    this.testSurfaces((SurfaceImpl) surface3);
   
    // ***** getRepresentativePoint()
    double[] dp = surface2.getRepresentativePoint().getCoordinate();
    assertTrue(dp[0] == 20);
    assertTrue(dp[1] == 10);

    assertTrue(surface2.equals(surface3));
   
    return surface2;

  }
View Full Code Here

//     create the surfaceboundary from the rings
    SurfaceBoundary sb = tPrimFactory.createSurfaceBoundary(extRing, intRings);
       
//     create the surface
    Surface surface22 = tPrimFactory.createSurface(sb);   
   
    // get rings
    SurfaceBoundary sb2 = (SurfaceBoundary) surface22.getBoundary();
    Ring exterior = sb2.getExterior();
    List<Ring> interiors2 = sb2.getInteriors();
    Collection<? extends Primitive> extCurve = exterior.getElements();
    Iterator<? extends Primitive> iter = extCurve.iterator();
    PointArray samplePoints = null;
View Full Code Here

    Ring exteriorRing = tPrimFactory.createRingByDirectPositions(directPositionList);
    List<Ring> interiors = new ArrayList<Ring>();
   
    SurfaceBoundaryImpl surfaceBoundary1 = tPrimFactory.createSurfaceBoundary(exteriorRing, interiors );
   
    Surface surface2 = tPrimFactory.createSurface(surfaceBoundary1);
   
    return surface2;
  }
View Full Code Here

    Ring exteriorRing = tPrimFactory.createRingByDirectPositions(directPositionList);
    List<Ring> interiors = new ArrayList<Ring>();
   
    SurfaceBoundaryImpl surfaceBoundary1 = tPrimFactory.createSurfaceBoundary(exteriorRing, interiors );
   
    Surface surface2 = tPrimFactory.createSurface(surfaceBoundary1);
   
    return surface2;
  }
View Full Code Here

TOP

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

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.