Package org.opengis.geometry.primitive

Examples of org.opengis.geometry.primitive.Ring


            // MultiLineString.
            com.vividsolutions.jts.geom.MultiLineString mls =
                (com.vividsolutions.jts.geom.MultiLineString) jtsBoundary;
            int n = mls.getNumGeometries();
            CoordinateReferenceSystem crs = getCoordinateReferenceSystem();
            Ring exteriorRing = JTSUtils.linearRingToRing(
                (com.vividsolutions.jts.geom.LineString) mls.getGeometryN(0),
                crs);
            Ring [] interiorRings = new Ring[n-1];
            for (int i=1; i<n; i++) {
                interiorRings[n-1] = JTSUtils.linearRingToRing(
View Full Code Here


    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {50, 40}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {30, 50}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {10, 30}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {20, 10}));

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

    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {50, 40}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {30, 50}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {10, 30}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {20, 10}));

    Ring exteriorRing = tPrimFactory.createRingByDirectPositions(directPositionList);
    List<Ring> interiors = new ArrayList<Ring>();
   
    SurfaceBoundaryImpl surfaceBoundary1 = tPrimFactory.createSurfaceBoundary(exteriorRing, interiors );
   
    SurfaceImpl surface = tPrimFactory.createSurface(surfaceBoundary1);
   
    // ***** clone()
    SurfaceImpl surface2 = null;
    SurfaceImpl surface_bak = null;
    try {
      surface2 = surface.clone();
      surface_bak = surface.clone();
    } catch (CloneNotSupportedException e) {
      e.printStackTrace();
      fail();
    }
   
    // test setBoundary
    surface.setBoundary(surfaceBoundary1);
    assertTrue(surface.getBoundary().equals(surface2.getBoundary()));
   
    // test set/get Patches
    List<? extends SurfacePatch> triangleList = this._testTriangle1(aGeomFactory, tPrimFactory);
    List<SurfacePatch> surfacePatches1 = (List<SurfacePatch>)triangleList;
    surface.setPatches(surfacePatches1);
    List<? extends SurfacePatch> surfacePatches2 = surface.getPatches();
    assertTrue(surfacePatches1.equals(surfacePatches2));

    // test toString
    String toS = surface.toString();
    assertTrue(toS != null);
    assertTrue(toS.length() > 0);
   
    // test obj equals
    assertTrue(surface_bak.equals((Object) surface2));
    assertTrue(surface_bak.equals((Object) surface_bak));
    assertFalse(surface_bak.equals((Object) surfacePatches1));
    assertFalse(surface_bak.equals((Object) null));
    SurfaceImpl surface3 = tPrimFactory.createSurface(surfacePatches1);
    assertFalse(surface_bak.equals(surface3));
   
    // test some SurfaceBoundaryImpl methods now
    // test getDimension
    assertTrue(surfaceBoundary1.getDimension(null) == 1);

    // test toString
    String toS2 = surfaceBoundary1.toString();
    assertTrue(toS2 != null);
    assertTrue(toS2.length() > 0);
   
    // test obj equals
    assertTrue(surfaceBoundary1.equals((Object) tPrimFactory.createSurfaceBoundary(exteriorRing, interiors )));
    assertTrue(surfaceBoundary1.equals((Object) surfaceBoundary1));
    assertFalse(surfaceBoundary1.equals((Object) surfacePatches1));
    assertFalse(surfaceBoundary1.equals((Object) null));
    directPositionList.remove(directPositionList.size()-1);
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {15, 25}));
    directPositionList.add(aGeomFactory.createDirectPosition(new double[] {20, 10}));
    Ring exteriorRing2 = tPrimFactory.createRingByDirectPositions(directPositionList);
    SurfaceBoundaryImpl surfaceBoundary2 = tPrimFactory.createSurfaceBoundary(exteriorRing2, interiors );
    assertFalse(surfaceBoundary1.equals(surfaceBoundary2));
   
    // test more surfacepathces methods
    SurfacePatchImpl patch = (SurfacePatchImpl) surfacePatches1.get(0);
    assertNotNull(patch.getInterpolation());
                // Following is commented-out because we are supposed to have a TriangulatedSurface, not plain Surface.
                // This Surface is built above in this test case, so its seems to be something to fix in the test suite.
    //assertTrue(surface.equals(patch.getSurface()));
    assertNotNull(patch.getNumDerivativesOnBoundary());
   
   
   
//     create a list of connected directpositions
    List<Position> dps = new ArrayList<Position>();
    dps.add(aGeomFactory.createDirectPosition( new double[] {20, 10} ));
    dps.add(aGeomFactory.createDirectPosition( new double[] {40, 10} ));
    dps.add(aGeomFactory.createDirectPosition( new double[] {50, 40} ));
    dps.add(aGeomFactory.createDirectPosition( new double[] {30, 50} ));
    dps.add(aGeomFactory.createDirectPosition( new double[] {10, 30} ));
    dps.add(aGeomFactory.createDirectPosition( new double[] {20, 10} ));

//     create linestring from directpositions
    LineString line = aGeomFactory.createLineString(dps);

//     create curvesegments from line
    ArrayList<CurveSegment> segs = new ArrayList<CurveSegment>();
    segs.add(line);

//     Create list of OrientableCurves that make up the surface
    OrientableCurve curve = tPrimFactory.createCurve(segs);
    List<OrientableCurve> orientableCurves = new ArrayList<OrientableCurve>();
    orientableCurves.add(curve);

//     create the interior ring and a list of empty interior rings (holes)
    Ring extRing = tPrimFactory.createRing(orientableCurves);
    List<Ring> intRings = new ArrayList<Ring>();

//     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;
    while (iter.hasNext()) {
      Curve curve2 = (Curve) iter.next();
      List<? extends CurveSegment> segs2 = curve2.getSegments();
View Full Code Here

  private int locate(Coordinate p, SurfaceImpl aSurface) {

    // if (poly.isEmpty())
    // return Location.EXTERIOR;
    List<Ring> rings = aSurface.getBoundaryRings();
    Ring shell = rings.get(0);

    int shellLoc = locateInPolygonRing(p, shell);
    if (shellLoc == Location.EXTERIOR)
      return Location.EXTERIOR;
    if (shellLoc == Location.BOUNDARY)
      return Location.BOUNDARY;
    // now test if the point lies in or on the holes
    for (int i = 1; i < rings.size(); i++) {
      Ring hole = rings.get(i);
      int holeLoc = locateInPolygonRing(p, hole);
      if (holeLoc == Location.INTERIOR)
        return Location.EXTERIOR;
      if (holeLoc == Location.BOUNDARY)
        return Location.BOUNDARY;
View Full Code Here

    if (nextToken.equals(EMPTY)) {
      return new SurfaceImpl((SurfaceBoundary) null); //this.primitiveFactory.createSurface((SurfaceBoundary) null);
    }

    ArrayList<Ring> holes = new ArrayList<Ring>();
    Ring shell = this.readLinearRingText();
    nextToken = getNextCloserOrComma();
    while (nextToken.equals(COMMA)) {
      Ring hole = readLinearRingText();
      holes.add(hole);
      nextToken = getNextCloserOrComma();
    }
    SurfaceBoundary sfb = new SurfaceBoundaryImpl(crs,
        shell, holes); //this.primitiveFactory.createSurfaceBoundary(shell, holes);
View Full Code Here

    CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis( dimension );
   
    if( axis.getDirection() == AxisDirection.OTHER ){
      return processSegmentToPrimitive( bounds, segment, dimension+1 );
    }
    Ring ring = processBoundsToRing( bounds, segment, dimension );
    return processRingToPrimitive( bounds, ring, dimension+1 );       
  }
View Full Code Here

    }

  public SurfaceBoundary createSurfaceBoundary(OrientableCurve curve) throws MismatchedReferenceSystemException, MismatchedDimensionException {
      List<OrientableCurve> exterior = new ArrayList<OrientableCurve>(1);
      exterior.add( curve );
      Ring ring = createRing( exterior );
        return createSurfaceBoundary( ring );
    }
View Full Code Here

    // TODO auskommentiert; checken!
    // if (poly.isEmpty())
    // return false;

    List<Ring> rings = aSurface.getBoundaryRings();
    Ring shell = rings.get(0);

    // The point lies in the ring defined by the coordinatearray
    // representation of the exterior ring?
    // if not, return false
    if (!CGAlgorithms.isPointInRing(p, CoordinateArrays
View Full Code Here

    segments.add(lineString);   
    OrientableCurve curve = new CurveImpl(crs, segments);
    List<OrientableCurve> orientableCurves = new ArrayList<OrientableCurve>();
    orientableCurves.add(curve);
   
    Ring exterior = new RingImpl(orientableCurves);
    List<Ring> interiorList = new ArrayList<Ring>();

    SurfaceBoundaryImpl sb =
      new SurfaceBoundaryImpl(crs, exterior, interiorList);
    return new SurfaceImpl(sb);
View Full Code Here

    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {50, 40, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {30, 50, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {10, 30, 100}));
    directPositionList.add(tCoordFactory.createDirectPosition(new double[] {20, 10, 100}));

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

TOP

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

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.