bool
SingleSidedBufferResultMatcher::isBoundaryHausdorffDistanceInTolerance(
	const geom::Geometry& actualBuffer,
	const geom::Geometry& expectedBuffer, double distance)
{
	typedef std::auto_ptr<geom::Geometry> GeomPtr;

	using geos::algorithm::distance::DiscreteHausdorffDistance;

	GeomPtr actualBdy ( actualBuffer.clone() );
	GeomPtr expectedBdy ( expectedBuffer.clone() );

	DiscreteHausdorffDistance haus(*actualBdy, *expectedBdy);
	haus.setDensifyFraction(0.25);

	double maxDistanceFound = haus.orientedDistance();

	double expectedDistanceTol = fabs(distance) / MAX_HAUSDORFF_DISTANCE_FACTOR;
	if (expectedDistanceTol < MIN_DISTANCE_TOLERANCE)
	{
		expectedDistanceTol = MIN_DISTANCE_TOLERANCE;
	}

	if (maxDistanceFound > expectedDistanceTol)
	{
std::cerr << "maxDistanceFound: " << maxDistanceFound << " tolerated " << expectedDistanceTol << std::endl;
		return false;
	}

	return true;
}
Exemple #2
0
/* private */
void
SnapOverlayOp::removeCommonBits(const geom::Geometry& geom0,
                                const geom::Geometry& geom1,
				geom::GeomPtrPair& remGeom)
{
	cbr.reset(new precision::CommonBitsRemover());
	cbr->add(&geom0);
	cbr->add(&geom1);

	remGeom.first.reset( cbr->removeCommonBits(geom0.clone()) );
	remGeom.second.reset( cbr->removeCommonBits(geom1.clone()) );
}