Skip to content

Commit

Permalink
Add point cloud classification codes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 2, 2020
1 parent ed0073d commit 55035a7
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
Expand Up @@ -103,6 +103,21 @@ in the metadata, and even for sources with statistical metadata only some ``stat
}
%End

static QMap< int, QString > lasClassificationCodes();
%Docstring
Returns the map of LAS classification code to untranslated string value, corresponding to the ASPRS Standard
Lidar Point Classes.

.. seealso:: :py:func:`translatedLasClassificationCodes`
%End

static QMap< int, QString > translatedLasClassificationCodes();
%Docstring
Returns the map of LAS classification code to translated string value, corresponding to the ASPRS Standard
Lidar Point Classes.

.. seealso:: :py:func:`lasClassificationCodes`
%End

};

Expand Down
75 changes: 75 additions & 0 deletions src/core/pointcloud/qgspointclouddataprovider.cpp
Expand Up @@ -18,6 +18,7 @@
#include "qgis.h"
#include "qgspointclouddataprovider.h"
#include "qgspointcloudindex.h"
#include <mutex>

QgsPointCloudDataProvider::QgsPointCloudDataProvider(
const QString &uri,
Expand All @@ -39,6 +40,80 @@ QgsPointCloudRenderer *QgsPointCloudDataProvider::createRenderer( const QVariant
return nullptr;
}

QMap<int, QString> QgsPointCloudDataProvider::lasClassificationCodes()
{
static QMap< int, QString > sCodes
{
{0, QStringLiteral( "Created, Never Classified" )},
{1, QStringLiteral( "Unclassified" )},
{2, QStringLiteral( "Ground" )},
{3, QStringLiteral( "Low Vegetation" )},
{4, QStringLiteral( "Medium Vegetation" )},
{5, QStringLiteral( "High Vegetation" )},
{6, QStringLiteral( "Building" )},
{7, QStringLiteral( "Low Point (Low Noise)" )},
{8, QStringLiteral( "Reserved" )},
{9, QStringLiteral( "Water" )},
{10, QStringLiteral( "Rail" )},
{11, QStringLiteral( "Road Surface" )},
{12, QStringLiteral( "Reserved" )},
{13, QStringLiteral( "Wire - Guard (Shield)" )},
{14, QStringLiteral( "Wire - Conductor (Phase)" )},
{15, QStringLiteral( "Transmission Tower" )},
{16, QStringLiteral( "Wire-Structure Connector (Insulator)" )},
{17, QStringLiteral( "Bridge Deck" )},
{18, QStringLiteral( "High Noise" )},
};

static std::once_flag initialized;
std::call_once( initialized, [ = ]( )
{
for ( int i = 19; i <= 63; ++i )
sCodes.insert( i, QStringLiteral( "Reserved" ) );
for ( int i = 64; i <= 255; ++i )
sCodes.insert( i, QStringLiteral( "User Definable" ) );
} );

return sCodes;
}

QMap<int, QString> QgsPointCloudDataProvider::translatedLasClassificationCodes()
{
static QMap< int, QString > sCodes
{
{0, QObject::tr( "Created, Never Classified" )},
{1, QObject::tr( "Unclassified" )},
{2, QObject::tr( "Ground" )},
{3, QObject::tr( "Low Vegetation" )},
{4, QObject::tr( "Medium Vegetation" )},
{5, QObject::tr( "High Vegetation" )},
{6, QObject::tr( "Building" )},
{7, QObject::tr( "Low Point (Noise)" )},
{8, QObject::tr( "Reserved" )},
{9, QObject::tr( "Water" )},
{10, QObject::tr( "Rail" )},
{11, QObject::tr( "Road Surface" )},
{12, QObject::tr( "Reserved" )},
{13, QObject::tr( "Wire - Guard (Shield)" )},
{14, QObject::tr( "Wire - Conductor (Phase)" )},
{15, QObject::tr( "Transmission Tower" )},
{16, QObject::tr( "Wire-Structure Connector (Insulator)" )},
{17, QObject::tr( "Bridge Deck" )},
{18, QObject::tr( "High Noise" )},
};

static std::once_flag initialized;
std::call_once( initialized, [ = ]( )
{
for ( int i = 19; i <= 63; ++i )
sCodes.insert( i, QObject::tr( "Reserved" ) );
for ( int i = 64; i <= 255; ++i )
sCodes.insert( i, QObject::tr( "User Definable" ) );
} );

return sCodes;
}

QVariant QgsPointCloudDataProvider::metadataStatistic( const QString &, QgsStatisticalSummary::Statistic ) const
{
return QVariant();
Expand Down
15 changes: 15 additions & 0 deletions src/core/pointcloud/qgspointclouddataprovider.h
Expand Up @@ -139,6 +139,21 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider
% End
#endif

/**
* Returns the map of LAS classification code to untranslated string value, corresponding to the ASPRS Standard
* Lidar Point Classes.
*
* \see translatedLasClassificationCodes()
*/
static QMap< int, QString > lasClassificationCodes();

/**
* Returns the map of LAS classification code to translated string value, corresponding to the ASPRS Standard
* Lidar Point Classes.
*
* \see lasClassificationCodes()
*/
static QMap< int, QString > translatedLasClassificationCodes();

};

Expand Down

0 comments on commit 55035a7

Please sign in to comment.