-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
eg QList::at() instead of QList:[], constFind instead of find, ...
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,13 +249,13 @@ void QgsSelectedFeature::deleteSelectedVertexes() | |
int count = 0; | ||
for ( int i = mVertexMap.size() - 1; i > -1 && nSelected > 0; i-- ) | ||
{ | ||
if ( mVertexMap[i]->isSelected() ) | ||
if ( mVertexMap.at( i )->isSelected() ) | ||
{ | ||
if ( topologicalEditing ) | ||
{ | ||
// snap from current vertex | ||
currentResultList.clear(); | ||
mVlayer->snapWithContext( mVertexMap[i]->pointV1(), ZERO_TOLERANCE, currentResultList, QgsSnapper::SnapToVertex ); | ||
mVlayer->snapWithContext( mVertexMap.at( i )->pointV1(), ZERO_TOLERANCE, currentResultList, QgsSnapper::SnapToVertex ); | ||
} | ||
|
||
// only last update should trigger the geometry update | ||
|
@@ -385,7 +385,7 @@ void QgsSelectedFeature::deleteVertexMap() | |
|
||
bool QgsSelectedFeature::isSelected( int vertexNr ) | ||
{ | ||
return mVertexMap[vertexNr]->isSelected(); | ||
return mVertexMap.at( vertexNr )->isSelected(); | ||
} | ||
|
||
QgsGeometry *QgsSelectedFeature::geometry() | ||
|
@@ -427,7 +427,7 @@ void QgsSelectedFeature::selectVertex( int vertexNr ) | |
if ( vertexNr < 0 || vertexNr >= mVertexMap.size() ) | ||
return; | ||
|
||
QgsVertexEntry *entry = mVertexMap[vertexNr]; | ||
QgsVertexEntry *entry = mVertexMap.at( vertexNr ); | ||
entry->setSelected(); | ||
|
||
emit selectionChanged(); | ||
|
@@ -438,7 +438,7 @@ void QgsSelectedFeature::deselectVertex( int vertexNr ) | |
if ( vertexNr < 0 || vertexNr >= mVertexMap.size() ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nyalldawson
Author
Collaborator
|
||
return; | ||
|
||
QgsVertexEntry *entry = mVertexMap[vertexNr]; | ||
QgsVertexEntry *entry = mVertexMap.at( vertexNr ); | ||
entry->setSelected( false ); | ||
|
||
emit selectionChanged(); | ||
|
@@ -448,7 +448,7 @@ void QgsSelectedFeature::deselectAllVertexes() | |
{ | ||
for ( int i = 0; i < mVertexMap.size(); i++ ) | ||
{ | ||
mVertexMap[i]->setSelected( false ); | ||
mVertexMap.at( i )->setSelected( false ); | ||
} | ||
emit selectionChanged(); | ||
} | ||
|
@@ -458,7 +458,7 @@ void QgsSelectedFeature::invertVertexSelection( int vertexNr ) | |
if ( vertexNr < 0 || vertexNr >= mVertexMap.size() ) | ||
return; | ||
|
||
QgsVertexEntry *entry = mVertexMap[vertexNr]; | ||
QgsVertexEntry *entry = mVertexMap.at( vertexNr ); | ||
|
||
bool selected = !entry->isSelected(); | ||
|
||
|
1 comment
on commit 18614e1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot!
Wouldn't it be nicer to use
value()
For places where a check previous to.at()
is done with a subsequentif( entry ) return;
?It's easier to read and we're sure not to forget the
i < 0
part.Mainly asking for your opinion, not asking you to change it