84 int addRingReturnCode = 5;
85 double xMin, yMin, xMax, yMax;
104 if ( addRingReturnCode == 0 )
113 return addRingReturnCode;
134 if ( errorCode == 0 )
159 int errorCode = geometry.
translate( dx, dy );
160 if ( errorCode == 0 )
174 double xMin, yMin, xMax, yMax;
177 int splitFunctionReturn;
178 int numberOfSplittedFeatures = 0;
183 if ( selectedIds.size() > 0 )
207 else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
225 QgsFeatureList::iterator select_it = featureList.begin();
226 for ( ; select_it != featureList.end(); ++select_it )
228 if ( !select_it->geometry() )
232 QList<QgsGeometry*> newGeometries;
233 QList<QgsPoint> topologyTestPoints;
235 splitFunctionReturn = select_it->geometry()->
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
236 if ( splitFunctionReturn == 0 )
242 for (
int i = 0; i < newGeometries.size(); ++i )
244 newGeometry = newGeometries.at( i );
254 if ( !defaultValue.isNull() )
256 newAttributes[ pkIdx ] = defaultValue;
260 newAttributes[ pkIdx ] = QVariant();
266 newFeatures.append( newFeature );
269 if ( topologicalEditing )
271 QList<QgsPoint>::const_iterator topol_it = topologyTestPoints.constBegin();
272 for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
277 ++numberOfSplittedFeatures;
279 else if ( splitFunctionReturn > 1 )
281 returnCode = splitFunctionReturn;
285 if ( numberOfSplittedFeatures == 0 && selectedIds.size() > 0 )
304 double xMin, yMin, xMax, yMax;
307 int splitFunctionReturn;
308 int numberOfSplittedParts = 0;
313 if ( selectedIds.size() > 0 )
337 else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
356 foreach (
const QgsFeature& feat, featureList )
358 QList<QgsGeometry*> newGeometries;
359 QList<QgsPoint> topologyTestPoints;
360 splitFunctionReturn = feat.
geometry()->
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
361 if ( splitFunctionReturn == 0 )
364 for (
int i = 0; i < newGeometries.size(); ++i )
381 switch ( addPartRet )
398 if ( topologicalEditing )
400 QList<QgsPoint>::const_iterator topol_it = topologyTestPoints.constBegin();
401 for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
406 ++numberOfSplittedParts;
408 else if ( splitFunctionReturn > 1 )
410 returnCode = splitFunctionReturn;
413 qDeleteAll( newGeometries );
416 if ( numberOfSplittedParts == 0 && selectedIds.size() > 0 && returnCode == 0 )
448 QgsPolyline::const_iterator line_it = theLine.constBegin();
449 for ( ; line_it != theLine.constEnd(); ++line_it )
466 for (
int i = 0; i < theMultiLine.size(); ++i )
468 QgsPolyline::const_iterator line_it = currentPolyline.constBegin();
469 for ( ; line_it != currentPolyline.constEnd(); ++line_it )
487 for (
int i = 0; i < thePolygon.size(); ++i )
489 currentRing = thePolygon.at( i );
490 QgsPolyline::const_iterator line_it = currentRing.constBegin();
491 for ( ; line_it != currentRing.constEnd(); ++line_it )
510 for (
int i = 0; i < theMultiPolygon.size(); ++i )
512 currentPolygon = theMultiPolygon.at( i );
513 for (
int j = 0; j < currentPolygon.size(); ++j )
515 currentRing = currentPolygon.at( j );
516 QgsPolyline::const_iterator line_it = currentRing.constBegin();
517 for ( ; line_it != currentRing.constEnd(); ++line_it )
540 QMultiMap<double, QgsSnappingResult> snapResults;
542 QMultiMap<double, QgsSnappingResult> vertexSnapResults;
544 QList<QgsSnappingResult> filteredSnapResults;
547 double threshold = 0.0000001;
563 QMultiMap<double, QgsSnappingResult>::const_iterator snap_it = snapResults.constBegin();
564 QMultiMap<double, QgsSnappingResult>::const_iterator vertex_snap_it;
565 for ( ; snap_it != snapResults.constEnd(); ++snap_it )
568 bool vertexAlreadyExists =
false;
574 vertex_snap_it = vertexSnapResults.constBegin();
575 for ( ; vertex_snap_it != vertexSnapResults.constEnd(); ++vertex_snap_it )
577 if ( snap_it.value().snappedAtGeometry == vertex_snap_it.value().snappedAtGeometry )
579 vertexAlreadyExists =
true;
583 if ( !vertexAlreadyExists )
585 filteredSnapResults.push_back( *snap_it );
601 QList<QgsSnappingResult>::const_iterator it = snapResults.constBegin();
602 for ( ; it != snapResults.constEnd(); ++it )
604 if ( it->snappedVertexNr == -1 )
606 layerPoint = it->snappedVertex;
607 if ( !
insertVertex( layerPoint.
x(), layerPoint.
y(), it->snappedAtGeometry, it->afterVertexNr ) )
621 if ( list.size() < 1 )
631 for ( QList<QgsPoint>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
633 if ( it->x() < xmin )
637 if ( it->x() > xmax )
641 if ( it->y() < ymin )
645 if ( it->y() > ymax )