30 : mMapCanvas( canvas )
69 const QList<QgsPoint>& excludePoints )
78 if ( topologicalEditing == 0 )
101 if ( snappingTol < 0 )
111 QList<QgsSnapper::SnapLayer> snapLayers;
112 snapLayers.append( snapLayer );
134 if ( topologicalEditing == 0 )
136 if ( intersectionSnapping == 0 )
141 else if ( intersectionSnapping == 0 )
151 bool snappingDefinedInProject, ok;
158 if ( !( layerIdList.size() == enabledList.size() &&
159 layerIdList.size() == toleranceList.size() &&
160 layerIdList.size() == toleranceUnitList.size() &&
161 layerIdList.size() == snapToList.size() ) )
167 QList<QgsSnapper::SnapLayer> snapLayers;
171 if ( snappingDefinedInProject )
174 QStringList::const_iterator layerIt( layerIdList.constBegin() );
175 QStringList::const_iterator tolIt( toleranceList.constBegin() );
176 QStringList::const_iterator tolUnitIt( toleranceUnitList.constBegin() );
177 QStringList::const_iterator snapIt( snapToList.constBegin() );
178 QStringList::const_iterator enabledIt( enabledList.constBegin() );
179 for ( ; layerIt != layerIdList.constEnd(); ++layerIt, ++tolIt, ++tolUnitIt, ++snapIt, ++enabledIt )
181 if ( *enabledIt !=
"enabled" )
192 snapLayer.
mLayer = vlayer;
199 if ( *snapIt ==
"to_vertex" )
203 else if ( *snapIt ==
"to_segment" )
213 snapLayers.append( snapLayer );
224 if ( !currentVectorLayer )
227 snapLayer.
mLayer = currentVectorLayer;
231 QString defaultSnapString = settings.value(
"/qgis/digitizing/default_snap_mode",
"off" ).toString();
232 if ( defaultSnapString ==
"to segment" )
236 else if ( defaultSnapString ==
"to vertex and segment" )
240 else if ( defaultSnapString ==
"to vertex" )
253 snapLayers.append( snapLayer );
261 if ( intersectionSnapping != 1 )
264 QList<QgsSnappingResult> segments;
265 QList<QgsSnappingResult> points;
266 for ( QList<QgsSnappingResult>::const_iterator it = results.constBegin();
267 it != results.constEnd();
270 if ( it->snappedVertexNr == -1 )
273 segments.push_back( *it );
278 points.push_back( *it );
282 if ( segments.length() < 2 )
285 QList<QgsSnappingResult> myResults;
287 for ( QList<QgsSnappingResult>::const_iterator oSegIt = segments.constBegin();
288 oSegIt != segments.constEnd();
291 QgsDebugMsg( QString::number( oSegIt->beforeVertexNr ) );
293 QVector<QgsPoint> vertexPoints;
294 vertexPoints.append( oSegIt->beforeVertex );
295 vertexPoints.append( oSegIt->afterVertex );
299 for ( QList<QgsSnappingResult>::iterator iSegIt = segments.begin();
300 iSegIt != segments.end();
303 QVector<QgsPoint> vertexPoints;
304 vertexPoints.append( iSegIt->beforeVertex );
305 vertexPoints.append( iSegIt->afterVertex );
311 iSegIt->snappedVertex = intersectionPoint->
asPoint();
312 myResults.append( *iSegIt );
317 if ( myResults.length() > 0 )