Skip to content

Commit

Permalink
Improvement to polygon splitting
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8034 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 23, 2008
1 parent 407d2e0 commit 82894b6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/core/qgsgeometry.cpp
Expand Up @@ -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]);
}
Expand Down

0 comments on commit 82894b6

Please sign in to comment.