Skip to content
Permalink
Browse files
Improvement to feature splitting: if there is a selection, the split …
…tool only considers the selected features. If not, all the features intersecting the bounding box of the split line are considered

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8063 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 28, 2008
1 parent 65ba495 commit f3e30c3e130f688d0df1cc8f40dcfad4985302b3
Showing with 21 additions and 13 deletions.
  1. +21 −13 src/core/qgsvectorlayer.cpp
@@ -1704,24 +1704,32 @@ int QgsVectorLayer::splitFeatures(const QList<QgsPoint>& splitLine, bool topolog
int returnCode = 0;
int splitFunctionReturn; //return code of QgsGeometry::splitGeometry

if(boundingBoxFromPointList(splitLine, xMin, yMin, xMax, yMax) == 0)
QgsFeatureList featureList;
const QgsFeatureIds selectedIds = selectedFeaturesIds();

if(selectedIds.size() > 0)//consider only the selected features if there is a selection
{
bBox.setXmin(xMin); bBox.setYmin(yMin); bBox.setXmax(xMax); bBox.setYmax(yMax);
featureList = selectedFeatures();
}
else
else //else consider all the feature that intersect the bounding box of the split line
{
return 1;
if(boundingBoxFromPointList(splitLine, xMin, yMin, xMax, yMax) == 0)
{
bBox.setXmin(xMin); bBox.setYmin(yMin); bBox.setXmax(xMax); bBox.setYmax(yMax);
}
else
{
return 1;
}

if(bBox.isEmpty())
{
return 2;
}
featuresInRectangle(bBox, featureList);
}

if(bBox.isEmpty())
{
return 2;
}

QList<QgsFeature> featureList;
featuresInRectangle(bBox, featureList);
QList<QgsFeature>::iterator select_it = featureList.begin();

QgsFeatureList::iterator select_it = featureList.begin();
for(; select_it != featureList.end(); ++select_it)
{
QList<QgsGeometry*> newGeometries;

0 comments on commit f3e30c3

Please sign in to comment.