Skip to content

Commit

Permalink
Improvement to feature splitting: if there is a selection, the split …
Browse files Browse the repository at this point in the history
…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@8063 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Jan 28, 2008
1 parent a07b328 commit 08d2c25
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 08d2c25

Please sign in to comment.