Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.LinearRing


      Coordinate[] rotatedHole = rotationHole.toArray(new Coordinate[rotationHole.size()]);
      holes.add(gf.createLinearRing(rotatedHole));
    }

    Coordinate[] newCoords = rotationShell.toArray(new Coordinate[rotationShell.size()]);
    LinearRing shell = gf.createLinearRing(newCoords);

    LinearRing[] rings = holes.toArray(new LinearRing[holes.size()]);

    return gf.createPolygon(shell, rings);
  }
View Full Code Here


    Polygon[] polys = new Polygon[numFeatures];
    String[] attrValues = new String[numFeatures];

    for (int i = 0; i < polys.length; i++) {

      LinearRing ring1 = factory.createLinearRing(new Coordinate[] {
          new Coordinate(25 * i, 25 * i), new Coordinate(25 * i+25, 25 * i),
          new Coordinate(25 * i+25, 25 * i+25), new Coordinate(25 * i, 25 * i+25),
          new Coordinate(25 * i, 25 * i),

      });
 
View Full Code Here

        Polygon polygon = adapted.asPolygon();
        // get the hole rings, and check if any ring is never intersected by those
        // lines.
        for (int j = 0; j < polygon.getNumInteriorRing(); j++) {

            LinearRing holeRing = (LinearRing) polygon.getInteriorRingN(j);
            // create a polygonRing with the purpose off testing touch between
            // polygon-line.
            Polygon polygonRing = this.geomFactory.createPolygon((LinearRing) holeRing, null);
            boolean intersects = false;
            // check this ring with all the lines finding if they intersect.
View Full Code Here

            // calculate which one has the closest distance
            Set<Entry<LinearRing, Double>> entrySet = ringsDistance.entrySet();
            Iterator<Entry<LinearRing, Double>> iterator = entrySet.iterator();

            double minDistance = Double.MAX_VALUE;
            LinearRing candidateRing = null;

            while (iterator.hasNext()) {

                Entry<LinearRing, Double> eachEntry = iterator.next();
                Double distance = eachEntry.getValue();
View Full Code Here

                   if (i == positionToInsertOnRing) {
                       updatedHole.add(coorToInsert);
                   }
               }
               Coordinate[] modifiedRingCoords = updatedHole.toArray(new Coordinate[updatedHole.size()]);
               LinearRing modifiedRing = gf.createLinearRing(modifiedRingCoords);
               rings[nRing] = modifiedRing;
           }
       }

       // create the polygon.
       assert shellCoords != null : "there should be at least shell coordinates to build a polygon."; //$NON-NLS-1$
       LinearRing shellRing = gf.createLinearRing(shellCoords);
       Polygon newPolygon = gf.createPolygon(shellRing, rings);
      
       AdaptedPolygon rebuildedPolygon = new AdaptedPolygon(newPolygon);

       return rebuildedPolygon;
View Full Code Here

    /**
     * @return
     */
    private Geometry createReferenceGeom() {
        LinearRing ring = GeometryBuilder.create().safeCreateGeometry(LinearRing.class,
                shape.coordArray());
        GeometryFactory fac = new GeometryFactory();
        return fac.createPolygon(ring, new LinearRing[0]);

    }
View Full Code Here

        UserDetailsImpl readerDetails = new UserDetailsImpl("reader", "pwreader",
                new GrantedAuthority[] { new GrantedAuthorityImpl("READER") });
        readerDetails.setPersNr(4711);
        GeometryFactory fac = new GeometryFactory();
        LinearRing r = fac.createLinearRing(new Coordinate[] { new Coordinate(11, 11),
                new Coordinate(14, 11), new Coordinate(14, 14), new Coordinate(11, 14),
                new Coordinate(11, 11), });
        Polygon poly = fac.createPolygon(r, new LinearRing[] {});
        poly.setUserData("EPSG:4326");
        readerDetails.setGeometryRestriction(poly);
View Full Code Here

    } else if (geom instanceof Polygon) {
      Polygon line = (Polygon) geom;
      Coordinate[] exterior=decimate(line.getExteriorRing()).getCoordinates();
      forceClosed(exterior);
      if(exterior.length>3) {
        LinearRing ring=gFac.createLinearRing(exterior);
             
        final int numRings = line.getNumInteriorRing();       
        List<LinearRing> rings=new ArrayList<LinearRing>();
       
        for (int i = 0; i < numRings; i++) {
View Full Code Here

        new Coordinate(env.getMaxX(),env.getMinY()),
        new Coordinate(env.getMaxX(),env.getMaxY()),
        new Coordinate(env.getMinX(),env.getMaxY()),
        new Coordinate(env.getMinX(),env.getMinY())
    };
    LinearRing bbox=gFac.createLinearRing(coordinates);
    return gFac.createPolygon(bbox, new LinearRing[] {});
  }
View Full Code Here

                Coordinate[] coords = {
                        new Coordinate(hpad, vpad), new Coordinate(hpad, vpad + h),
                        new Coordinate(hpad + w, vpad + h), new Coordinate(hpad + w, vpad),
                        new Coordinate(hpad, vpad)
                    };
                LinearRing shell = geomFac.createLinearRing(coords);
                Polygon geom = geomFac.createPolygon(shell, null);

                try {
                    this.sampleRect = new LiteShape2(geom, null, null, false);
                } catch (Exception e) {
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.LinearRing

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.