105 int addRingReturnCode = 5;
106 double xMin, yMin, xMax, yMax;
125 if ( addRingReturnCode == 0 )
134 return addRingReturnCode;
155 if ( errorCode == 0 )
180 int errorCode = geometry.
translate( dx, dy );
181 if ( errorCode == 0 )
195 double xMin, yMin, xMax, yMax;
198 int splitFunctionReturn;
199 int numberOfSplittedFeatures = 0;
204 if ( selectedIds.size() > 0 )
228 else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
236 double bufferDistance = 0.000001;
238 bufferDistance = 0.00000001;
256 QList<QgsGeometry*> newGeometries;
257 QList<QgsPoint> topologyTestPoints;
259 splitFunctionReturn = feat.
geometry()->
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
260 if ( splitFunctionReturn == 0 )
266 for (
int i = 0; i < newGeometries.size(); ++i )
268 newGeometry = newGeometries.at( i );
278 if ( !defaultValue.isNull() )
280 newAttributes[ pkIdx ] = defaultValue;
284 newAttributes[ pkIdx ] = QVariant();
290 newFeatures.append( newFeature );
293 if ( topologicalEditing )
295 QList<QgsPoint>::const_iterator topol_it = topologyTestPoints.constBegin();
296 for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
301 ++numberOfSplittedFeatures;
303 else if ( splitFunctionReturn > 1 )
305 returnCode = splitFunctionReturn;
309 if ( numberOfSplittedFeatures == 0 && selectedIds.size() > 0 )
328 double xMin, yMin, xMax, yMax;
331 int splitFunctionReturn;
332 int numberOfSplittedParts = 0;
360 else if ( bBox.
height() == 0.0 && bBox.
width() > 0 )
368 double bufferDistance = 0.000001;
370 bufferDistance = 0.00000001;
386 QList<QgsGeometry*> newGeometries;
387 QList<QgsPoint> topologyTestPoints;
388 splitFunctionReturn = feat.
geometry()->
splitGeometry( splitLine, newGeometries, topologicalEditing, topologyTestPoints );
389 if ( splitFunctionReturn == 0 )
392 for (
int i = 0; i < newGeometries.size(); ++i )
409 switch ( addPartRet )
426 if ( topologicalEditing )
428 QList<QgsPoint>::const_iterator topol_it = topologyTestPoints.constBegin();
429 for ( ; topol_it != topologyTestPoints.constEnd(); ++topol_it )
434 ++numberOfSplittedParts;
436 else if ( splitFunctionReturn > 1 )
438 returnCode = splitFunctionReturn;
441 qDeleteAll( newGeometries );
476 QgsPolyline::const_iterator line_it = theLine.constBegin();
477 for ( ; line_it != theLine.constEnd(); ++line_it )
494 for (
int i = 0; i < theMultiLine.size(); ++i )
496 QgsPolyline::const_iterator line_it = currentPolyline.constBegin();
497 for ( ; line_it != currentPolyline.constEnd(); ++line_it )
515 for (
int i = 0; i < thePolygon.size(); ++i )
517 currentRing = thePolygon.at( i );
518 QgsPolyline::const_iterator line_it = currentRing.constBegin();
519 for ( ; line_it != currentRing.constEnd(); ++line_it )
538 for (
int i = 0; i < theMultiPolygon.size(); ++i )
540 currentPolygon = theMultiPolygon.at( i );
541 for (
int j = 0; j < currentPolygon.size(); ++j )
543 currentRing = currentPolygon.at( j );
544 QgsPolyline::const_iterator line_it = currentRing.constBegin();
545 for ( ; line_it != currentRing.constEnd(); ++line_it )
568 QMultiMap<double, QgsSnappingResult> snapResults;
570 QMultiMap<double, QgsSnappingResult> vertexSnapResults;
572 QList<QgsSnappingResult> filteredSnapResults;
575 double threshold = 0.0000001;
591 QMultiMap<double, QgsSnappingResult>::const_iterator snap_it = snapResults.constBegin();
592 QMultiMap<double, QgsSnappingResult>::const_iterator vertex_snap_it;
593 for ( ; snap_it != snapResults.constEnd(); ++snap_it )
596 bool vertexAlreadyExists =
false;
602 vertex_snap_it = vertexSnapResults.constBegin();
603 for ( ; vertex_snap_it != vertexSnapResults.constEnd(); ++vertex_snap_it )
605 if ( snap_it.value().snappedAtGeometry == vertex_snap_it.value().snappedAtGeometry )
607 vertexAlreadyExists =
true;
611 if ( !vertexAlreadyExists )
613 filteredSnapResults.push_back( *snap_it );
629 QList<QgsSnappingResult>::const_iterator it = snapResults.constBegin();
630 for ( ; it != snapResults.constEnd(); ++it )
632 if ( it->snappedVertexNr == -1 )
634 layerPoint = it->snappedVertex;
635 if ( !
insertVertex( layerPoint.
x(), layerPoint.
y(), it->snappedAtGeometry, it->afterVertexNr ) )
649 if ( list.size() < 1 )
659 for ( QList<QgsPoint>::const_iterator it = list.constBegin(); it != list.constEnd(); ++it )
661 if ( it->x() < xmin )
665 if ( it->x() > xmax )
669 if ( it->y() < ymin )
673 if ( it->y() > ymax )