Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add 3d renderer icon to mesh properties panel too
  • Loading branch information
PeterPetrik committed Jan 28, 2019
1 parent 1f8708f commit e78e0be
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 34 deletions.
26 changes: 26 additions & 0 deletions src/app/mesh/qgsmeshlayerproperties.cpp
Expand Up @@ -32,6 +32,9 @@
#include "qgsrenderermeshpropertieswidget.h"
#include "qgssettings.h"
#include "qgsproviderregistry.h"
#ifdef HAVE_3D
#include "qgsmeshlayer3drendererwidget.h"
#endif

#include <QFileDialog>
#include <QMessageBox>
Expand Down Expand Up @@ -62,6 +65,15 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *

connect( mMeshLayer, &QgsMeshLayer::dataChanged, this, &QgsMeshLayerProperties::syncAndRepaint );

#ifdef HAVE_3D
mVector3DWidget = new QgsMeshLayer3DRendererWidget( mMeshLayer, 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

// update based on lyr's current state
syncToLayer();

Expand Down Expand Up @@ -127,6 +139,13 @@ void QgsMeshLayerProperties::syncToLayer()
* Styling Tab
*/
mRendererMeshPropertiesWidget->syncToLayer();

/*
* 3D View Tab
*/
#ifdef HAVE_3D
mVector3DWidget->setLayer( mMeshLayer );
#endif
}

void QgsMeshLayerProperties::addDataset()
Expand Down Expand Up @@ -178,6 +197,13 @@ void QgsMeshLayerProperties::apply()
*/
mRendererMeshPropertiesWidget->apply();

/*
* 3D View Tab
*/
#ifdef HAVE_3D
mVector3DWidget->apply();
#endif

//make sure the layer is redrawn
mMeshLayer->triggerRepaint();

Expand Down
6 changes: 5 additions & 1 deletion src/app/mesh/qgsmeshlayerproperties.h
Expand Up @@ -27,6 +27,7 @@ class QgsMapLayer;
class QgsMapCanvas;
class QgsMeshLayer;
class QgsRendererMeshPropertiesWidget;
class QgsMeshLayer3DRendererWidget;

/**
* Property sheet for a mesh map layer.
Expand Down Expand Up @@ -63,9 +64,12 @@ class APP_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U
//! Pointer to the mesh styling widget
QgsRendererMeshPropertiesWidget *mRendererMeshPropertiesWidget = nullptr;

//! \brief Pointer to the mesh layer that this property dilog changes the behavior of.
//! Pointer to the mesh layer that this property dilog changes the behavior of.
QgsMeshLayer *mMeshLayer = nullptr;

//! Pointer to mesh 3d styling widget
QgsMeshLayer3DRendererWidget *mVector3DWidget = nullptr;

friend class TestQgsMeshLayerPropertiesDialog;
};

Expand Down
48 changes: 15 additions & 33 deletions src/ui/mesh/qgsmeshlayerpropertiesbase.ui
Expand Up @@ -122,6 +122,15 @@
<normaloff>:/images/themes/default/propertyicons/symbology.svg</normaloff>:/images/themes/default/propertyicons/symbology.svg</iconset>
</property>
</item>
<item>
<property name="text">
<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>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -161,7 +170,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<widget class="QWidget" name="mOptsPage_Information">
<layout class="QVBoxLayout" name="verticalLayout_20">
Expand Down Expand Up @@ -197,8 +206,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>261</width>
<height>144</height>
<width>270</width>
<height>175</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
Expand Down Expand Up @@ -328,8 +337,8 @@ border-radius: 2px;</string>
<rect>
<x>0</x>
<y>0</y>
<width>100</width>
<height>30</height>
<width>634</width>
<height>711</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10"/>
Expand All @@ -338,6 +347,7 @@ border-radius: 2px;</string>
</item>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_3DView"/>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -417,34 +427,6 @@ border-radius: 2px;</string>
</tabstops>
<resources>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
</resources>
<connections>
<connection>
Expand Down

0 comments on commit e78e0be

Please sign in to comment.