Skip to content
Permalink
Browse files
Improvement to polygon splitting
git-svn-id: http://svn.osgeo.org/qgis/trunk@8034 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 23, 2008
1 parent 34c7bdf commit 94a05c94cdb102f504578709edb29e94190cc3ad
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/core/qgsgeometry.cpp
@@ -4583,10 +4583,16 @@ int QgsGeometry::splitPolygonGeometry(GEOS_GEOM::LineString* splitLine, QList<Qg
//include in result if yes
QList<GEOS_GEOM::Geometry*> testedGeometries;
GEOS_GEOM::Geometry* intersectGeometry = 0;

//ratio intersect geometry / geometry. This should be close to 1
//if the polygon belongs to the input geometry

double areaRatio = 0.0;
for(unsigned int i = 0; i < polygons->size(); ++i)
{
intersectGeometry = mGeos->intersection((*polygons)[i]);
if(intersectGeometry->getArea() > 0.00000000001)
areaRatio = intersectGeometry->getArea() / (*polygons)[i]->getArea();
if(areaRatio > 0.99 && areaRatio < 1.01)
{
testedGeometries.push_back((*polygons)[i]);
}

0 comments on commit 94a05c9

Please sign in to comment.