Skip to content

Commit

Permalink
Kill QList::toSet() (proof we need a qt6 build test)
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Jul 17, 2021
1 parent c801957 commit 4a9c43d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/core/mesh/qgsmesheditor.cpp
Expand Up @@ -14,6 +14,7 @@
* * * *
***************************************************************************/ ***************************************************************************/


#include "qgis.h"
#include "qgsmesheditor.h" #include "qgsmesheditor.h"
#include "qgsmeshdataprovider.h" #include "qgsmeshdataprovider.h"
#include "qgstriangularmesh.h" #include "qgstriangularmesh.h"
Expand Down Expand Up @@ -403,7 +404,7 @@ QgsMeshEditingError QgsMeshEditor::removeVertices( const QList<int> &verticesToR
{ {
QSet<int> concernedNativeFaces; QSet<int> concernedNativeFaces;
for ( const int vi : std::as_const( verticesIndexes ) ) for ( const int vi : std::as_const( verticesIndexes ) )
concernedNativeFaces.unite( mTopologicalMesh.facesAroundVertex( vi ).toSet() ); concernedNativeFaces.unite( qgis::listToSet( mTopologicalMesh.facesAroundVertex( vi ) ) );


error = mTopologicalMesh.canFacesBeRemoved( concernedNativeFaces.values() ); error = mTopologicalMesh.canFacesBeRemoved( concernedNativeFaces.values() );
if ( error.errorType != Qgis::MeshEditingErrorType::NoError ) if ( error.errorType != Qgis::MeshEditingErrorType::NoError )
Expand Down
12 changes: 7 additions & 5 deletions src/core/mesh/qgstopologicalmesh.cpp
Expand Up @@ -13,6 +13,8 @@
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/

#include "qgis.h"
#include "qgstopologicalmesh.h" #include "qgstopologicalmesh.h"
#include "qgsmesheditor.h" #include "qgsmesheditor.h"
#include "qgsmessagelog.h" #include "qgsmessagelog.h"
Expand Down Expand Up @@ -475,7 +477,7 @@ QSet<int> QgsTopologicalMesh::concernedFacesBy( const QList<int> faceIndexes ) c
{ {
const QgsMeshFace &face = mMesh->face( faceIndex ); const QgsMeshFace &face = mMesh->face( faceIndex );
for ( int i = 0; i < face.count(); ++i ) for ( int i = 0; i < face.count(); ++i )
faces.unite( facesAroundVertex( face.at( i ) ).toSet() ); faces.unite( qgis::listToSet( facesAroundVertex( face.at( i ) ) ) );
} }
return faces; return faces;
} }
Expand Down Expand Up @@ -983,7 +985,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::removeVertices( const QList<int>
QSet<int> facesIndex; QSet<int> facesIndex;
//Search for associated faces //Search for associated faces
for ( int vertexIndex : vertices ) for ( int vertexIndex : vertices )
facesIndex.unite( facesAroundVertex( vertexIndex ).toSet() ); facesIndex.unite( qgis::listToSet( facesAroundVertex( vertexIndex ) ) );


// remove the faces // remove the faces
Changes changes = removeFaces( facesIndex.values() ); Changes changes = removeFaces( facesIndex.values() );
Expand Down Expand Up @@ -1252,7 +1254,7 @@ QList<int> QgsTopologicalMesh::facesAroundVertex( int vertexIndex ) const


QgsMeshEditingError QgsTopologicalMesh::canFacesBeRemoved( const QList<int> facesIndexes ) QgsMeshEditingError QgsTopologicalMesh::canFacesBeRemoved( const QList<int> facesIndexes )
{ {
QSet<int> removedFaces = facesIndexes.toSet(); QSet<int> removedFaces = qgis::listToSet( facesIndexes );
QSet<int> concernedFaces = concernedFacesBy( facesIndexes ); QSet<int> concernedFaces = concernedFacesBy( facesIndexes );


for ( const int f : std::as_const( removedFaces ) ) for ( const int f : std::as_const( removedFaces ) )
Expand All @@ -1276,7 +1278,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::removeFaces( const QList<int> fa
changes.mFacesToRemove.resize( facesIndexesToRemove.count() ); changes.mFacesToRemove.resize( facesIndexesToRemove.count() );
changes.mFacesNeighborhoodToRemove.resize( facesIndexesToRemove.count() ); changes.mFacesNeighborhoodToRemove.resize( facesIndexesToRemove.count() );


QSet<int> indexSet = facesIndexesToRemove.toSet(); QSet<int> indexSet = qgis::listToSet( facesIndexesToRemove );
QSet<int> threatedVertex; QSet<int> threatedVertex;


for ( int i = 0; i < facesIndexesToRemove.count(); ++i ) for ( int i = 0; i < facesIndexesToRemove.count(); ++i )
Expand Down Expand Up @@ -1821,7 +1823,7 @@ QgsTopologicalMesh::Changes QgsTopologicalMesh::changeXYValue( const QList<int>
changes.mChangeCoordinateVerticesIndexes.append( verticesIndexes.at( i ) ); changes.mChangeCoordinateVerticesIndexes.append( verticesIndexes.at( i ) );
changes.mOldXYValues.append( mMesh->vertices.at( verticesIndexes.at( i ) ) ); changes.mOldXYValues.append( mMesh->vertices.at( verticesIndexes.at( i ) ) );
changes.mNewXYValues.append( newValues.at( i ) ); changes.mNewXYValues.append( newValues.at( i ) );
concernedFace.unite( facesAroundVertex( verticesIndexes.at( i ) ).toSet() ); concernedFace.unite( qgis::listToSet( facesAroundVertex( verticesIndexes.at( i ) ) ) );
} }


changes.mNativeFacesIndexesGeometryChanged = concernedFace.values(); changes.mNativeFacesIndexesGeometryChanged = concernedFace.values();
Expand Down

0 comments on commit 4a9c43d

Please sign in to comment.