Skip to content
Permalink
Browse files

Split ept provider gui metadata from generic point cloud gui metadata

Things are much cleaner this way!
  • Loading branch information
nyalldawson committed Nov 6, 2020
1 parent f5a4880 commit 611fca9e491bce54f361aed6534e5c0b1a3ab5ba
@@ -335,6 +335,9 @@ SET(QGIS_GUI_SRCS
processing/models/qgsmodelviewtooltemporarymousepan.cpp
processing/models/qgsmodelviewtoolzoom.cpp

providers/qgspointcloudproviderguimetadata.cpp
providers/qgspointcloudsourceselect.cpp

providers/gdal/qgsgdalsourceselect.cpp
providers/gdal/qgsgdalguiprovider.cpp

@@ -347,9 +350,6 @@ SET(QGIS_GUI_SRCS
providers/ogr/qgsogritemguiprovider.cpp
providers/ogr/qgsgeopackageprojectstorageguiprovider.cpp

providers/ept/qgspointcloudsourceselect.cpp
providers/ept/qgseptproviderguimetadata.cpp

tableeditor/qgstableeditordialog.cpp
tableeditor/qgstableeditorformattingwidget.cpp
tableeditor/qgstableeditorwidget.cpp
@@ -1096,6 +1096,9 @@ SET(QGIS_GUI_HDRS
processing/models/qgsmodelviewtooltemporarymousepan.h
processing/models/qgsmodelviewtoolzoom.h

providers/qgspointcloudsourceselect.h
providers/qgspointcloudproviderguimetadata.h

providers/gdal/qgsgdalguiprovider.h
providers/gdal/qgsgdalsourceselect.h
providers/ogr/qgsgeopackageitemguiprovider.h
@@ -1107,9 +1110,6 @@ SET(QGIS_GUI_HDRS
providers/ogr/qgsogritemguiprovider.h
providers/ogr/qgsogrsourceselect.h

providers/ept/qgspointcloudsourceselect.h
providers/ept/qgseptproviderguimetadata.h

raster/qgscolorrampshaderwidget.h
raster/qgshillshaderendererwidget.h
raster/qgsmultibandcolorrendererwidget.h
@@ -1306,7 +1306,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/ogr
${CMAKE_SOURCE_DIR}/src/gui/processing
${CMAKE_SOURCE_DIR}/src/gui/processing/models
${CMAKE_SOURCE_DIR}/src/gui/providers/ept
${CMAKE_SOURCE_DIR}/src/gui/providers
${CMAKE_SOURCE_DIR}/src/gui/providers/gdal
${CMAKE_SOURCE_DIR}/src/gui/providers/ogr
${CMAKE_SOURCE_DIR}/src/gui/pointcloud
@@ -1370,11 +1370,17 @@ INCLUDE_DIRECTORIES(SYSTEM
)

IF (WITH_EPT)
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/gui/providers/ept
)

SET(QGIS_GUI_SRCS ${QGIS_GUI_SRCS}
providers/ept/qgseptdataitemguiprovider.cpp
providers/ept/qgseptproviderguimetadata.cpp
)
SET(QGIS_GUI_HDRS ${QGIS_GUI_HDRS}
providers/ept/qgseptdataitemguiprovider.h
providers/ept/qgseptproviderguimetadata.h
)
ENDIF (WITH_EPT)

@@ -16,49 +16,20 @@
***************************************************************************/

#include "qgsapplication.h"
#include "qgssourceselectprovider.h"
#include "qgspointcloudsourceselect.h"

#include "qgseptproviderguimetadata.h"

#ifdef HAVE_EPT
#include "qgseptdataitemguiprovider.h"
#endif

///@cond PRIVATE

class QgsEptSourceSelectProvider : public QgsSourceSelectProvider
{
public:

QString providerKey() const override { return QStringLiteral( "ept" ); }
QString text() const override { return QObject::tr( "Point Cloud" ); }
int ordering() const override { return QgsSourceSelectProvider::OrderLocalProvider + 25; }
QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddPointCloudLayer.svg" ) ); }
QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const override
{
return new QgsPointCloudSourceSelect( parent, fl, widgetMode );
}
};

QgsEptProviderGuiMetadata::QgsEptProviderGuiMetadata()
: QgsProviderGuiMetadata( QStringLiteral( "ept" ) )
{
}

#ifdef HAVE_EPT
QList<QgsDataItemGuiProvider *> QgsEptProviderGuiMetadata::dataItemGuiProviders()
{
return QList<QgsDataItemGuiProvider *>()
<< new QgsEptDataItemGuiProvider;
}
#endif

QList<QgsSourceSelectProvider *> QgsEptProviderGuiMetadata::sourceSelectProviders()
{
QList<QgsSourceSelectProvider *> providers;
providers << new QgsEptSourceSelectProvider;
return providers;
}

///@endcond
@@ -31,13 +31,7 @@ class QgsEptProviderGuiMetadata: public QgsProviderGuiMetadata
public:
QgsEptProviderGuiMetadata();

#ifdef HAVE_EPT
QList<QgsDataItemGuiProvider *> dataItemGuiProviders() override;
#endif

// for now we always include the "ept" provider source select provider, as it actually
// forms the generic point cloud source select widget
QList<QgsSourceSelectProvider *> sourceSelectProviders() override;
};

///@endcond
@@ -0,0 +1,51 @@
/***************************************************************************
qgspointcloudproviderguimetadata.cpp
--------------------
begin : October 2020
copyright : (C) 2020 by Peter Petrik
email : zilolv at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#include "qgsapplication.h"
#include "qgssourceselectprovider.h"
#include "qgspointcloudsourceselect.h"
#include "qgspointcloudproviderguimetadata.h"

///@cond PRIVATE

class QgsPointCloudSourceSelectProvider : public QgsSourceSelectProvider
{
public:

QString providerKey() const override { return QStringLiteral( "pointcloud" ); }
QString text() const override { return QObject::tr( "Point Cloud" ); }
int ordering() const override { return QgsSourceSelectProvider::OrderLocalProvider + 25; }
QIcon icon() const override { return QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddPointCloudLayer.svg" ) ); }
QgsAbstractDataSourceWidget *createDataSourceWidget( QWidget *parent = nullptr, Qt::WindowFlags fl = Qt::Widget, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::Embedded ) const override
{
return new QgsPointCloudSourceSelect( parent, fl, widgetMode );
}
};

QgsPointCloudProviderGuiMetadata::QgsPointCloudProviderGuiMetadata()
: QgsProviderGuiMetadata( QStringLiteral( "pointcloud" ) )
{
}

QList<QgsSourceSelectProvider *> QgsPointCloudProviderGuiMetadata::sourceSelectProviders()
{
QList<QgsSourceSelectProvider *> providers;
providers << new QgsPointCloudSourceSelectProvider;
return providers;
}

///@endcond
@@ -0,0 +1,47 @@
/***************************************************************************
qgspointcloudproviderguimetadata.h
--------------------
begin : October 2020
copyright : (C) 2020 by Peter Petrik
email : zilolv at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGPOINTCLOUDPROVIDERGUIMETADATA_H
#define QGPOINTCLOUDPROVIDERGUIMETADATA_H

///@cond PRIVATE
#define SIP_NO_FILE

#include <QList>
#include <QMainWindow>

#include "qgsproviderguimetadata.h"

/**
* \ingroup gui
* Provides a generic source select widget for point cloud providers.
*
* The generated widget is provider agnostic, and is not attached to any single individual
* provider but rather adapts to all available point cloud providers.
*
* \since QGIS 3.18
*/
class QgsPointCloudProviderGuiMetadata: public QgsProviderGuiMetadata
{
public:
QgsPointCloudProviderGuiMetadata();
QList<QgsSourceSelectProvider *> sourceSelectProviders() override;
};

///@endcond

#endif // QGPOINTCLOUDPROVIDERGUIMETADATA_H
@@ -25,7 +25,11 @@
#include "qgsgdalguiprovider.h"
#include "qgsogrguiprovider.h"
#include "qgsvectortileproviderguimetadata.h"
#include "qgspointcloudproviderguimetadata.h"

#ifdef HAVE_EPT
#include "qgseptproviderguimetadata.h"
#endif

#ifdef HAVE_STATIC_PROVIDERS
#include "qgswmsprovidergui.h"
@@ -71,8 +75,13 @@ void QgsProviderGuiRegistry::loadStaticProviders( )
QgsProviderGuiMetadata *vt = new QgsVectorTileProviderGuiMetadata();
mProviders[ vt->key() ] = vt;

QgsProviderGuiMetadata *cp = new QgsEptProviderGuiMetadata();
mProviders[ cp->key() ] = cp;
#ifdef HAVE_EPT
QgsProviderGuiMetadata *ept = new QgsEptProviderGuiMetadata();
mProviders[ ept->key() ] = ept;
#endif

QgsProviderGuiMetadata *pointcloud = new QgsPointCloudProviderGuiMetadata();
mProviders[ pointcloud->key() ] = pointcloud;

#ifdef HAVE_STATIC_PROVIDERS
QgsProviderGuiMetadata *wms = new QgsWmsProviderGuiMetadata();

0 comments on commit 611fca9

Please sign in to comment.
You can’t perform that action at this time.