Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Geometry.buffer()


    GeometryFactory factory = new GeometryFactory(precisionModel, polygons[0].getSRID());

    Geometry temp = factory.createGeometry(polygons[0]);
    for (int i = 1; i < polygons.length; i++) {
      Geometry polygon = factory.createGeometry(polygons[i]);
      temp = temp.union(polygon.buffer(Math.pow(10.0, -(precision - 1))));
    }
    if (temp instanceof Polygon) {
      MultiPolygon mp = factory.createMultiPolygon(new Polygon[] { (Polygon) temp });
      response.setGeometry(converter.toDto(mp));
    } else if (temp instanceof MultiPolygon && temp.getNumGeometries() != 0
View Full Code Here


    Envelope envelope = new Envelope(0, 1, 0, 1);
    Geometry orig = JTS.toGeometry(envelope);
    Geometry m2 = geoservice.transform(orig, "EPSG:4326", "EPSG:900913");
    // equality check on buffer, JTS equals does not do the trick !
    Assert.assertTrue(m.buffer(0.01).contains(m2));
    Assert.assertTrue(m2.buffer(0.01).contains(m));
  }

  private List<String> getIdsFromModel(Map<String, Object> model) {
    Object o = model.get(RestController.FEATURE_COLLECTION);
    Assert.assertTrue(o instanceof List<?>);
View Full Code Here

      // guaranteed
      // to be over the line as it was produced by intersecting both lines
      // so we're using little buffer to determine if the point lies over the
      // segment
      Geometry lineSegment = gf.createLineString(segment);
      lineSegment = lineSegment.buffer(DELTA_DISTANCE, 2);
      Point point = gf.createPoint(pointInLine);
      Geometry intersection = lineSegment.intersection(point);
      if (point.equals(intersection)) {
        return segment[0];
      }
View Full Code Here

                        {
                            logger.error("Invalid line end style");
                            throw new XPathException("Invalid line end style");
                        }
                    }
                    geometry = geometry.buffer(distance, quadrantSegments, endCapStyle);
                }
            } else if (isCalledAs("getBbox")) {
                if (args[0].isEmpty())
                    result = Sequence.EMPTY_SEQUENCE;
                else {
View Full Code Here

  public static Geometry buffer(Geometry geometry, String inSR, String outSR,
      String bufferSR, double distance) throws Exception {

    Geometry geo = geometry;
    geo = project(geo, inSR, bufferSR);
    geo = geo.buffer(distance);
    geo = project(geo, bufferSR, outSR);

    return geo;
  }
View Full Code Here

   
    if (mapArea instanceof Polygon)
    {
      Polygon originalArea = (Polygon)mapArea;
      // NB: the buffer method always returns a polygonal result.
      Polygon expandedArea = (Polygon)mapArea.buffer( getOffTheMapDistance(), DEFAULT_CAP_EDGES, DEFAULT_BUFFER_CAP_TYPE );
     
      GeometryFactory geometryFactory = mapArea.getFactory();
      LinearRing expandedAreaBoundary = geometryFactory.createLinearRing( expandedArea.getExteriorRing().getCoordinates() );
      LinearRing originalAreaBoundary = geometryFactory.createLinearRing( originalArea.getExteriorRing().getCoordinates() );
     
View Full Code Here

      throw new UnsupportedOperationException( "Multi-polygon map bounds are not supported by the Just-Off-The-Map generator." );
    }
    else // point, line, multi-point, multi-line
    {
      // These are 1D shapes that are infinitely thin. Therefore no need to cut out the original shape.
      this.justOffTheMapArea = mapArea.buffer( getOffTheMapDistance(), DEFAULT_CAP_EDGES, DEFAULT_BUFFER_CAP_TYPE );
    }
  }
 
}
View Full Code Here

       
        AffineTransformation t = obj.getTranslate();
       
        // currently not used --> always 0
        if(lp.outline_offset != 0)
            shell = shell.buffer(-lp.outline_offset);
       
        Geometry infillArea = shell.buffer(-lp.infill_offset);
       
        // outlines
        lines = getOutlines(shell, lp);
View Full Code Here

            Coordinate[] coordArray = new Coordinate[coords.size()];
            ConvexHull hull = new ConvexHull(coords.toArray(coordArray), GeometryUtils.getGeometryFactory());
            Geometry geom = hull.getConvexHull();
            // buffer components which are mere lines so that they do not disappear.
            if (geom instanceof LineString) {
                geom = geom.buffer(0.01); // ~10 meters
            } else if (geom instanceof Point) {
                geom = geom.buffer(0.05); // ~50 meters, so that it shows up
            }

            geoms.add(geom);
View Full Code Here

            Geometry geom = hull.getConvexHull();
            // buffer components which are mere lines so that they do not disappear.
            if (geom instanceof LineString) {
                geom = geom.buffer(0.01); // ~10 meters
            } else if (geom instanceof Point) {
                geom = geom.buffer(0.05); // ~50 meters, so that it shows up
            }

            geoms.add(geom);
            if (mainComponentSize < coordArray.length) {
                mainComponentIndex = component;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.