Java Code Examples for com.vividsolutions.jts.geom.Geometry#getBoundary()

The following examples show how to use com.vividsolutions.jts.geom.Geometry#getBoundary() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BufferResultMatcher.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
public boolean isBoundaryHausdorffDistanceInTolerance(Geometry actualBuffer, Geometry expectedBuffer, double distance)
{
	Geometry actualBdy = actualBuffer.getBoundary();
	Geometry expectedBdy = expectedBuffer.getBoundary();
	
   DiscreteHausdorffDistance haus = new DiscreteHausdorffDistance(actualBdy, expectedBdy);
   haus.setDensifyFraction(0.25);
   double maxDistanceFound = haus.orientedDistance();
   double expectedDistanceTol = Math.abs(distance) / MAX_HAUSDORFF_DISTANCE_FACTOR;
   if (expectedDistanceTol < MIN_DISTANCE_TOLERANCE)
   	expectedDistanceTol = MIN_DISTANCE_TOLERANCE;
   if (maxDistanceFound > expectedDistanceTol)
   	return false;
   return true;
}
 
Example 2
Source File: PreparedPolygonIntersectsStressTest.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
LineString createTestLine(Coordinate base, double size, int nPts)
  {
    GeometricShapeFactory gsf = new GeometricShapeFactory();
    gsf.setCentre(base);
    gsf.setSize(size);
    gsf.setNumPoints(nPts);
    Geometry circle = gsf.createCircle();
//    System.out.println(circle);
    return (LineString) circle.getBoundary();
  }
 
Example 3
Source File: StressTestHarness.java    From jts with GNU Lesser General Public License v2.1 5 votes vote down vote up
Geometry createRandomTestGeometry(Envelope env, double size, int nPts)
{
	double width = env.getWidth();
	double xOffset = width * Math.random();
	double yOffset = env.getHeight() * Math.random();
  Coordinate basePt = new Coordinate(
  				env.getMinX() + xOffset,
  				env.getMinY() + yOffset);
  Geometry test = createTestCircle(basePt, size, nPts);
  if (test instanceof Polygon && Math.random() > 0.5) {
  	test = test.getBoundary();
  }
  return test;
}
 
Example 4
Source File: ConstructionFunctions.java    From jts with GNU Lesser General Public License v2.1 votes vote down vote up
public static Geometry boundary(Geometry g) {      return g.getBoundary();  } 
Example 5
Source File: BoundaryFunctions.java    From jts with GNU Lesser General Public License v2.1 votes vote down vote up
public static Geometry boundary(Geometry g) {      return g.getBoundary();  }