83 int addRingReturnCode = 5;
84 double xMin, yMin, xMax, yMax;
103 if ( addRingReturnCode == 0 )
112 return addRingReturnCode;
132 int errorCode = geometry.
addPart( points );
133 if ( errorCode == 0 )
158 int errorCode = geometry.
translate( dx, dy );
159 if ( errorCode == 0 )
173 double xMin, yMin, xMax, yMax;
176 int splitFunctionReturn;
177 int numberOfSplittedFeatures = 0;
182 if ( selectedIds.size() > 0 )
206 else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
224 QgsFeatureList::iterator select_it = featureList.begin();
225 for ( ; select_it != featureList.end(); ++select_it )
227 if ( !select_it->geometry() )
231 QList<QgsGeometry*> newGeometries;
232 QList<QgsPoint> topologyTestPoints;
234 splitFunctionReturn = select_it->geometry()->
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
235 if ( splitFunctionReturn == 0 )
241 for (
int i = 0; i < newGeometries.size(); ++i )
243 newGeometry = newGeometries.at( i );
253 if ( !defaultValue.isNull() )
255 newAttributes[ pkIdx ] = defaultValue;
259 newAttributes[ pkIdx ] = QVariant();
265 newFeatures.append( newFeature );
268 if ( topologicalEditing )
270 QList<QgsPoint>::const_iterator topol_it = topologyTestPoints.constBegin();
271 for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
276 ++numberOfSplittedFeatures;
278 else if ( splitFunctionReturn > 1 )
280 returnCode = splitFunctionReturn;
284 if ( numberOfSplittedFeatures == 0 && selectedIds.size() > 0 )
321 QgsPolyline::const_iterator line_it = theLine.constBegin();
322 for ( ; line_it != theLine.constEnd(); ++line_it )
339 for (
int i = 0; i < theMultiLine.size(); ++i )
341 QgsPolyline::const_iterator line_it = currentPolyline.constBegin();
342 for ( ; line_it != currentPolyline.constEnd(); ++line_it )
360 for (
int i = 0; i < thePolygon.size(); ++i )
362 currentRing = thePolygon.at( i );
363 QgsPolyline::const_iterator line_it = currentRing.constBegin();
364 for ( ; line_it != currentRing.constEnd(); ++line_it )
383 for (
int i = 0; i < theMultiPolygon.size(); ++i )
385 currentPolygon = theMultiPolygon.at( i );
386 for (
int j = 0; j < currentPolygon.size(); ++j )
388 currentRing = currentPolygon.at( j );
389 QgsPolyline::const_iterator line_it = currentRing.constBegin();
390 for ( ; line_it != currentRing.constEnd(); ++line_it )
413 QMultiMap<double, QgsSnappingResult> snapResults;
415 QMultiMap<double, QgsSnappingResult> vertexSnapResults;
417 QList<QgsSnappingResult> filteredSnapResults;
420 double threshold = 0.0000001;
436 QMultiMap<double, QgsSnappingResult>::const_iterator snap_it = snapResults.constBegin();
437 QMultiMap<double, QgsSnappingResult>::const_iterator vertex_snap_it;
438 for ( ; snap_it != snapResults.constEnd(); ++snap_it )
441 bool vertexAlreadyExists =
false;
447 vertex_snap_it = vertexSnapResults.constBegin();
448 for ( ; vertex_snap_it != vertexSnapResults.constEnd(); ++vertex_snap_it )
450 if ( snap_it.value().snappedAtGeometry == vertex_snap_it.value().snappedAtGeometry )
452 vertexAlreadyExists =
true;
456 if ( !vertexAlreadyExists )
458 filteredSnapResults.push_back( *snap_it );
474 QList<QgsSnappingResult>::const_iterator it = snapResults.constBegin();
475 for ( ; it != snapResults.constEnd(); ++it )
477 if ( it->snappedVertexNr == -1 )
479 layerPoint = it->snappedVertex;
480 if ( !
insertVertex( layerPoint.
x(), layerPoint.
y(), it->snappedAtGeometry, it->afterVertexNr ) )
494 if ( list.size() < 1 )
504 for ( QList<QgsPoint>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
506 if ( it->x() < xmin )
510 if ( it->x() > xmax )
514 if ( it->y() < ymin )
518 if ( it->y() > ymax )