Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add hash for QgsTileXYZ
  • Loading branch information
nyalldawson committed May 9, 2023
1 parent 171baf0 commit cfe09ee
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/core/qgstiles.h
Expand Up @@ -70,6 +70,21 @@ class CORE_EXPORT QgsTileXYZ
int mZoomLevel = -1;
};

/**
* Returns a hash for a tile \a id.
*
* \since QGIS 3.32
*/
CORE_EXPORT inline uint qHash( QgsTileXYZ id ) SIP_SKIP
{
return id.column() + id.row() + id.zoomLevel();

const uint h1 = qHash( static_cast< quint64 >( id.column( ) ) );
const uint h2 = qHash( static_cast< quint64 >( id.row() ) );
const uint h3 = qHash( static_cast< quint64 >( id.zoomLevel() ) );
return h1 ^ ( h2 << 1 ) ^ ( h3 );
}


/**
* \ingroup core
Expand Down

0 comments on commit cfe09ee

Please sign in to comment.