Skip to content

Commit

Permalink
[3d] Have 3D View tab in vector layer properties (fixes #17595)
Browse files Browse the repository at this point in the history
(only when 3D support is enabled)
  • Loading branch information
wonder-sk committed Dec 6, 2017
1 parent 8ecae4f commit 7064704
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/app/qgsvectorlayerproperties.cpp
Expand Up @@ -79,6 +79,11 @@
#include "qgsrendererpropertiesdialog.h"
#include "qgsstyle.h"

#ifdef HAVE_3D
#include "qgsvectorlayer3drendererwidget.h"
#endif


QgsVectorLayerProperties::QgsVectorLayerProperties(
QgsVectorLayer *lyr,
QWidget *parent,
Expand Down Expand Up @@ -213,6 +218,15 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
mAttributesFormFrame->layout()->setMargin( 0 );
mAttributesFormFrame->layout()->addWidget( mAttributesFormPropertiesDialog );

#ifdef HAVE_3D
mVector3DWidget = new QgsVectorLayer3DRendererWidget( mLayer, QgisApp::instance()->mapCanvas(), mOptsPage_3DView );

mOptsPage_3DView->setLayout( new QVBoxLayout( mOptsPage_3DView ) );
mOptsPage_3DView->layout()->addWidget( mVector3DWidget );
#else
delete mOptsPage_3DView; // removes both the "3d view" list item and its page
#endif

syncToLayer();

if ( mLayer->dataProvider() )//enable spatial index button group if supported by provider
Expand Down Expand Up @@ -527,6 +541,10 @@ void QgsVectorLayerProperties::syncToLayer()
// set initial state for variable editor
updateVariableEditor();

#ifdef HAVE_3D
mVector3DWidget->setLayer( mLayer );
#endif

} // syncToLayer()

void QgsVectorLayerProperties::apply()
Expand Down Expand Up @@ -712,6 +730,10 @@ void QgsVectorLayerProperties::apply()
QMessageBox::warning( nullptr, tr( "Dependency cycle" ), tr( "This configuration introduces a cycle in data dependencies and will be ignored" ) );
}

#ifdef HAVE_3D
mVector3DWidget->apply();
#endif

// update symbology
emit refreshLegend( mLayer->id() );

Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsvectorlayerproperties.h
Expand Up @@ -45,6 +45,7 @@ class QgsMapLayerConfigWidgetFactory;
class QgsMapLayerConfigWidget;
class QgsMetadataWidget;
class QgsPanelWidget;
class QgsVectorLayer3DRendererWidget;

class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private Ui::QgsVectorLayerPropertiesBase, private QgsExpressionContextGenerator
{
Expand Down Expand Up @@ -237,6 +238,8 @@ class APP_EXPORT QgsVectorLayerProperties : public QgsOptionsDialogBase, private
QAction *mAuxiliaryLayerActionDeleteField = nullptr;
QAction *mAuxiliaryLayerActionAddField = nullptr;

QgsVectorLayer3DRendererWidget *mVector3DWidget = nullptr;

private slots:
void openPanel( QgsPanelWidget *panel );
};
Expand Down
13 changes: 13 additions & 0 deletions src/ui/qgsvectorlayerpropertiesbase.ui
Expand Up @@ -153,6 +153,18 @@
<normaloff>:/images/themes/default/propertyicons/labels.svg</normaloff>:/images/themes/default/propertyicons/labels.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>3D View</string>
</property>
<property name="toolTip">
<string>3D View</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/3d.svg</normaloff>:/images/themes/default/3d.svg</iconset>
</property>
</item>
<item>
<property name="text">
<string>Source Fields</string>
Expand Down Expand Up @@ -784,6 +796,7 @@ border-radius: 2px;</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_3DView"/>
<widget class="QWidget" name="mOptsPage_SourceFields">
<layout class="QVBoxLayout" name="verticalLayout_29">
<property name="leftMargin">
Expand Down

0 comments on commit 7064704

Please sign in to comment.