Skip to content

Commit 4e6a87d

Browse files
author
mhugent
committedFeb 3, 2008
fix for bug where feature splitting was not possible if bounding box of split line was a line
git-svn-id: http://svn.osgeo.org/qgis/trunk@8100 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent bc200fe commit 4e6a87d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed
 

‎src/core/qgsvectorlayer.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1722,7 +1722,21 @@ int QgsVectorLayer::splitFeatures(const QList<QgsPoint>& splitLine, bool topolog
17221722

17231723
if(bBox.isEmpty())
17241724
{
1725-
return 2;
1725+
//if the bbox is a line, try to make a square out of it
1726+
if(!bBox.width() > 0.0 && bBox.height() > 0)
1727+
{
1728+
bBox.setXmin(bBox.xMin() - bBox.height()/2);
1729+
bBox.setXmax(bBox.xMax() + bBox.height()/2);
1730+
}
1731+
else if(!bBox.height() > 0.0 && bBox.width() > 0)
1732+
{
1733+
bBox.setYmin(bBox.yMin() - bBox.width()/2);
1734+
bBox.setYmax(bBox.yMax() + bBox.width()/2);
1735+
}
1736+
else
1737+
{
1738+
return 2;
1739+
}
17261740
}
17271741
featuresInRectangle(bBox, featureList);
17281742
}

0 commit comments

Comments
 (0)
Please sign in to comment.