Ejemplo n.º 1
0
 /**
  * Buffer polygons by buffering the individual boundary segments and either unioning or
  * differencing them.
  *
  * @param g
  * @param distance
  * @return the buffer geometry
  */
 public static Geometry bufferBySegments(Geometry g, double distance) {
   Geometry segs = LineHandlingFunctions.extractSegments(g);
   double posDist = Math.abs(distance);
   Geometry segBuf = bufferByComponents(segs, posDist);
   if (distance < 0.0) return g.difference(segBuf);
   return g.union(segBuf);
 }
Ejemplo n.º 2
0
 public static Geometry bufferByChains(Geometry g, double distance, int maxChainSize) {
   if (maxChainSize <= 0)
     throw new IllegalArgumentException(
         "Maximum Chain Size must be specified as an input parameter");
   Geometry segs = LineHandlingFunctions.extractChains(g, maxChainSize);
   double posDist = Math.abs(distance);
   Geometry segBuf = bufferByComponents(segs, posDist);
   if (distance < 0.0) return g.difference(segBuf);
   return g.union(segBuf);
 }