Skip to content
Permalink
Browse files

Register 3d widgets on startup

  • Loading branch information
nyalldawson committed Jul 22, 2020
1 parent 368a58b commit 0ed6ff59060f9303fdb0ccaa419bb4ce6364e9d4
@@ -40,6 +40,11 @@ QgsLine3DSymbolWidget::QgsLine3DSymbolWidget( QWidget *parent )
connect( widgetMaterial, &QgsPhongMaterialWidget::changed, this, &QgsLine3DSymbolWidget::changed );
}

Qgs3DSymbolWidget *QgsLine3DSymbolWidget::create( QgsVectorLayer * )
{
return new QgsLine3DSymbolWidget();
}

void QgsLine3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVectorLayer * )
{
const QgsLine3DSymbol *lineSymbol = dynamic_cast< const QgsLine3DSymbol *>( symbol );
@@ -29,6 +29,8 @@ class QgsLine3DSymbolWidget : public Qgs3DSymbolWidget, private Ui::Line3DSymbol
public:
explicit QgsLine3DSymbolWidget( QWidget *parent = nullptr );

static Qgs3DSymbolWidget *create( QgsVectorLayer *layer );

void setSymbol( const QgsAbstract3DSymbol *symbol, QgsVectorLayer *layer ) override;
QgsAbstract3DSymbol *symbol() override;

@@ -74,6 +74,11 @@ QgsPoint3DSymbolWidget::QgsPoint3DSymbolWidget( QWidget *parent )
connect( spinTY, static_cast<void ( QDoubleSpinBox::* )( double )>( &QDoubleSpinBox::valueChanged ), spinBillboardHeight, &QDoubleSpinBox::setValue );
}

Qgs3DSymbolWidget *QgsPoint3DSymbolWidget::create( QgsVectorLayer * )
{
return new QgsPoint3DSymbolWidget();
}

void QgsPoint3DSymbolWidget::onOverwriteMaterialChecked( int state )
{
if ( state == Qt::Checked )
@@ -29,6 +29,8 @@ class QgsPoint3DSymbolWidget : public Qgs3DSymbolWidget, private Ui::Point3DSymb
public:
explicit QgsPoint3DSymbolWidget( QWidget *parent = nullptr );

static Qgs3DSymbolWidget *create( QgsVectorLayer *layer );

void setSymbol( const QgsAbstract3DSymbol *symbol, QgsVectorLayer *layer ) override;
QgsAbstract3DSymbol *symbol() override;

@@ -46,6 +46,11 @@ QgsPolygon3DSymbolWidget::QgsPolygon3DSymbolWidget( QWidget *parent )
widgetMaterial->activateTexturingUI( true );
}

Qgs3DSymbolWidget *QgsPolygon3DSymbolWidget::create( QgsVectorLayer * )
{
return new QgsPolygon3DSymbolWidget();
}

void QgsPolygon3DSymbolWidget::setSymbol( const QgsAbstract3DSymbol *symbol, QgsVectorLayer *layer )
{
const QgsPolygon3DSymbol *polygonSymbol = dynamic_cast< const QgsPolygon3DSymbol * >( symbol );
@@ -28,6 +28,8 @@ class QgsPolygon3DSymbolWidget : public Qgs3DSymbolWidget, private Ui::Polygon3D
public:
explicit QgsPolygon3DSymbolWidget( QWidget *parent = nullptr );

static Qgs3DSymbolWidget *create( QgsVectorLayer *layer );

void setSymbol( const QgsAbstract3DSymbol *symbol, QgsVectorLayer *layer ) override;
QgsAbstract3DSymbol *symbol() override;

@@ -108,9 +108,13 @@
#include "qgslayoutitem3dmap.h"
#include "processing/qgs3dalgorithms.h"
#include "qgs3dmaptoolmeasureline.h"
#include "qgs3dsymbolregistry.h"
#include "layout/qgslayout3dmapwidget.h"
#include "layout/qgslayoutviewrubberband.h"
#include "qgsvectorlayer3drendererwidget.h"
#include "qgspoint3dsymbolwidget.h"
#include "qgsline3dsymbolwidget.h"
#include "qgspolygon3dsymbolwidget.h"
#endif

#ifdef HAVE_GEOREFERENCER
@@ -12653,6 +12657,11 @@ void QgisApp::init3D()
#ifdef HAVE_3D
// initialize 3D registries
Qgs3D::initialize();

dynamic_cast< Qgs3DSymbolMetadata * >( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "point" ) ) )->setWidgetFunction( QgsPoint3DSymbolWidget::create );
dynamic_cast< Qgs3DSymbolMetadata * >( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "line" ) ) )->setWidgetFunction( QgsLine3DSymbolWidget::create );
dynamic_cast< Qgs3DSymbolMetadata * >( QgsApplication::symbol3DRegistry()->symbolMetadata( QStringLiteral( "polygon" ) ) )->setWidgetFunction( QgsPolygon3DSymbolWidget::create );

#else
mActionNew3DMapCanvas->setVisible( false );
#endif

0 comments on commit 0ed6ff5

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