1 /*************************************************************************** 2 qgsmeshlayerproperties.h 3 ------------------------ 4 begin : Jun 2018 5 copyright : (C) 2018 by Peter Petrik 6 email : zilolv at gmail dot com 7 ***************************************************************************/ 8 9 /*************************************************************************** 10 * * 11 * This program is free software; you can redistribute it and/or modify * 12 * it under the terms of the GNU General Public License as published by * 13 * the Free Software Foundation; either version 2 of the License, or * 14 * (at your option) any later version. * 15 * * 16 ***************************************************************************/ 17 #ifndef QGSMESHLAYERPROPERTIES_H 18 #define QGSMESHLAYERPROPERTIES_H 19 20 #include "ui_qgsmeshlayerpropertiesbase.h" 21 22 #include "qgsmaplayerstylemanager.h" 23 #include "qgsoptionsdialogbase.h" 24 #include "qgsguiutils.h" 25 #include "qgis_gui.h" 26 27 class QgsMapLayer; 28 class QgsMapCanvas; 29 class QgsMeshLayer; 30 class QgsRendererMeshPropertiesWidget; 31 class QgsMapLayerConfigWidget; 32 class QgsMeshLayer3DRendererWidget; 33 class QgsMeshStaticDatasetWidget; 34 class QgsMapLayerConfigWidgetFactory; 35 class QgsMetadataWidget; 36 37 /** 38 * \ingroup gui 39 * \class QgsMeshLayerProperties 40 * 41 * \brief Property sheet for a mesh map layer. 42 * Contains information, source and style tabs 43 * 44 * \since QGIS 3.16 in the GUI API 45 */ 46 class GUI_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private Ui::QgsMeshLayerPropertiesBase 47 { 48 Q_OBJECT 49 50 public: 51 52 /** 53 * \brief Constructor 54 * \param lyr Mesh map layer for which properties will be displayed 55 * \param canvas The map canvas 56 * \param parent The parent widget 57 * \param fl Window flags 58 */ 59 QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *canvas, QWidget *parent = nullptr, Qt::WindowFlags = QgsGuiUtils::ModalDialogFlags ); 60 61 /** 62 * Adds properties page from a factory 63 * 64 * \since QGIS 3.16 65 */ 66 void addPropertiesPageFactory( const QgsMapLayerConfigWidgetFactory *factory ); 67 68 protected slots: 69 void optionsStackedWidget_CurrentChanged( int index ) override SIP_SKIP ; 70 71 private slots: 72 //! Synchronizes widgets state with associated mesh layer 73 void syncToLayer(); 74 75 //!Applies the settings made in the dialog without closing the box 76 void apply(); 77 //! Synchronizes GUI state with associated mesh layer and trigger repaint 78 void syncAndRepaint(); 79 //! Changes layer coordinate reference system 80 void changeCrs( const QgsCoordinateReferenceSystem &crs ); 81 //! Loads the default style when appropriate button is pressed 82 void loadDefaultStyle(); 83 //! Saves the default style when appropriate button is pressed 84 void saveDefaultStyle(); 85 //! Loads a saved style when appropriate button is pressed 86 void loadStyle(); 87 //! Saves a style when appriate button is pressed 88 void saveStyleAs(); 89 //! Prepares style menu 90 void aboutToShowStyleMenu(); 91 //! Reloads temporal properties from the provider 92 void reloadTemporalProperties(); 93 //! \brief Called when cancel button is pressed 94 void onCancel(); 95 96 void onTimeReferenceChange(); 97 98 void urlClicked( const QUrl &url ); 99 void loadMetadata(); 100 void saveMetadataAs(); 101 102 private: 103 //! Pointer to the mesh styling widget 104 QgsRendererMeshPropertiesWidget *mRendererMeshPropertiesWidget = nullptr; 105 106 QList<QgsMapLayerConfigWidget *> mConfigWidgets; 107 108 //! Pointer to the mesh layer that this property dialog changes the behavior of. 109 QgsMeshLayer *mMeshLayer = nullptr; 110 111 //! Pointer to mesh 3d styling widget 112 QgsMeshLayer3DRendererWidget *mMesh3DWidget = nullptr; 113 114 /** 115 * Previous layer style. Used to reset style to previous state if new style 116 * was loaded but dialog is canceled. 117 */ 118 QgsMapLayerStyle mOldStyle; 119 120 QPushButton *mBtnStyle = nullptr; 121 QPushButton *mBtnMetadata = nullptr; 122 QAction *mActionLoadMetadata = nullptr; 123 QAction *mActionSaveMetadataAs = nullptr; 124 125 QgsMapCanvas *mCanvas = nullptr; 126 QgsMetadataWidget *mMetadataWidget = nullptr; 127 128 bool mIsMapSettingsTemporal = false; 129 130 friend class TestQgsMeshLayerPropertiesDialog; 131 132 void showHelp(); 133 134 QgsCoordinateReferenceSystem mBackupCrs; 135 }; 136 137 138 #endif // QGSMESHLAYERPROPERTIES_H 139