File tree 3 files changed +24
-4
lines changed
3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -516,14 +516,16 @@ void QgsMapToolNodeTool::canvasReleaseEvent( QgsMapMouseEvent* e )
516
516
mSelectedFeature ->deselectAllVertexes ();
517
517
}
518
518
519
+ QVector< int > toSelect;
519
520
for ( int i = 0 ; i < vertexMap.size (); i++ )
520
521
{
521
- if ( r.contains ( vertexMap[i] ->pointV1 () ) )
522
+ if ( r.contains ( vertexMap. at ( i ) ->pointV1 () ) )
522
523
{
523
- // inverting selection is enough because all were deselected if ctrl is not pressed
524
- mSelectedFeature ->invertVertexSelection ( i );
524
+ toSelect << i;
525
525
}
526
526
}
527
+ // inverting selection is enough because all were deselected if ctrl is not pressed
528
+ mSelectedFeature ->invertVertexSelection ( toSelect );
527
529
}
528
530
}
529
531
Original file line number Diff line number Diff line change @@ -482,6 +482,19 @@ void QgsSelectedFeature::invertVertexSelection( int vertexNr )
482
482
emit selectionChanged ();
483
483
}
484
484
485
+ void QgsSelectedFeature::invertVertexSelection ( QVector<int > vertexIndices )
486
+ {
487
+ Q_FOREACH ( int index , vertexIndices )
488
+ {
489
+ if ( index < 0 || index >= mVertexMap .size () )
490
+ continue ;
491
+
492
+ QgsVertexEntry *entry = mVertexMap .at ( index );
493
+ entry->setSelected ( !entry->isSelected () );
494
+ }
495
+ emit selectionChanged ();
496
+ }
497
+
485
498
void QgsSelectedFeature::updateVertexMarkersPosition ()
486
499
{
487
500
Q_FOREACH ( QgsVertexEntry* vertexEntry, mVertexMap )
Original file line number Diff line number Diff line change @@ -85,10 +85,15 @@ class QgsSelectedFeature: public QObject
85
85
/* *
86
86
* Inverts selection of vertex with number
87
87
* @param vertexNr number of vertex which is to be inverted
88
- * @param invert flag if vertex selection should be inverted or not
89
88
*/
90
89
void invertVertexSelection ( int vertexNr );
91
90
91
+ /* *
92
+ * Inverts selection of a set of vertices at once.
93
+ * @param vertexIndices list of vertex indices to invert whether or not they are selected
94
+ */
95
+ void invertVertexSelection (QVector<int > vertexIndices );
96
+
92
97
/* *
93
98
* Tells if vertex is selected
94
99
* @param vertexNr number of vertex for which we are getting info
You can’t perform that action at this time.
0 commit comments