2626
2727class QgsCoordinateReferenceSystem ;
2828class QgsMapLayerModel ;
29+ class QgsMapLayer ;
2930
3031/* * \ingroup gui
3132 * Collapsible group box for configuration of extent, typically for a save operation.
@@ -43,8 +44,8 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui::
4344 Q_PROPERTY ( QString titleBase READ titleBase WRITE setTitleBase )
4445
4546 public:
46- explicit QgsExtentGroupBox ( QWidget *parent SIP_TRANSFERTHIS = 0 );
4747
48+ // ! Available states for the current extent selection in the widget
4849 enum ExtentState
4950 {
5051 OriginalExtent, // !< Layer's extent
@@ -53,58 +54,124 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui::
5354 ProjectLayerExtent, // !< Extent taken from a layer within the project
5455 };
5556
56- // ! Setup original extent - should be called as part of initialization
57+ /* *
58+ * Constructor for QgsExtentGroupBox.
59+ */
60+ explicit QgsExtentGroupBox ( QWidget *parent SIP_TRANSFERTHIS = 0 );
61+
62+ /* *
63+ * Sets the original extent and coordinate reference system for the widget. This should be called as part of initialization.
64+ * \see originalExtent()
65+ * \see originalCrs()
66+ */
5767 void setOriginalExtent ( const QgsRectangle &originalExtent, const QgsCoordinateReferenceSystem &originalCrs );
5868
69+ /* *
70+ * Returns the original extent set for the widget.
71+ * \see setOriginalExtent()
72+ * \see originalCrs()
73+ */
5974 QgsRectangle originalExtent () const { return mOriginalExtent ; }
60- const QgsCoordinateReferenceSystem &originalCrs () const { return mOriginalCrs ; }
6175
62- // ! Setup current extent - should be called as part of initialization (or whenever current extent changes)
76+ /* *
77+ * Returns the original coordinate reference system set for the widget.
78+ * \see originalExtent()
79+ * \see setOriginalExtent()
80+ */
81+ QgsCoordinateReferenceSystem originalCrs () const { return mOriginalCrs ; }
82+
83+ /* *
84+ * Sets the current extent to show in the widget - should be called as part of initialization (or whenever current extent changes).
85+ * \see currentExtent()
86+ * \see currentCrs()
87+ */
6388 void setCurrentExtent ( const QgsRectangle ¤tExtent, const QgsCoordinateReferenceSystem ¤tCrs );
6489
90+ /* *
91+ * Returns the current extent set for the widget.
92+ * \see setCurrentExtent()
93+ * \see currentCrs()
94+ */
6595 QgsRectangle currentExtent () const { return mCurrentExtent ; }
66- const QgsCoordinateReferenceSystem ¤tCrs () const { return mCurrentCrs ; }
6796
68- // ! Set the output CRS - may need to be used for transformation from original/current extent.
69- // ! Should be called as part of initialization and whenever the the output CRS is changed
97+ /* *
98+ * Returns the coordinate reference system for the current extent set for the widget.
99+ * \see setCurrentExtent()
100+ * \see currentExtent()
101+ */
102+ QgsCoordinateReferenceSystem currentCrs () const { return mCurrentCrs ; }
103+
104+ /* *
105+ * Sets the output CRS - may need to be used for transformation from original/current extent.
106+ * Should be called as part of initialization and whenever the the output CRS is changed.
107+ */
70108 void setOutputCrs ( const QgsCoordinateReferenceSystem &outputCrs );
71109
72- // ! Get the resulting extent - in output CRS coordinates
110+ /* *
111+ * Returns the extent shown in the widget - in output CRS coordinates.
112+ */
73113 QgsRectangle outputExtent () const ;
74114
115+ /* *
116+ * Returns the currently selected state for the widget's extent.
117+ */
75118 QgsExtentGroupBox::ExtentState extentState () const { return mExtentState ; }
76119
77- // ! Set base part of title of the group box (will be appended with extent state)
78- // ! \since QGIS 2.12
120+ /* *
121+ * Sets the base part of \a title of the group box (will be appended with extent state)
122+ * \since QGIS 2.12
123+ * \see titleBase()
124+ */
79125 void setTitleBase ( const QString &title );
80- // ! Set base part of title of the group box (will be appended with extent state)
81- // ! \since QGIS 2.12
126+
127+ /* *
128+ * Returns the base part of title of the group box (will be appended with extent state).
129+ * \since QGIS 2.12
130+ * \see setTitleBase()
131+ */
82132 QString titleBase () const ;
83133
84134 public slots:
85- // ! set output extent to be the same as original extent (may be transformed to output CRS)
135+
136+ /* *
137+ * Sets the output extent to be the same as original extent (may be transformed to output CRS).
138+ */
86139 void setOutputExtentFromOriginal ();
87140
88- // ! set output extent to be the same as current extent (may be transformed to output CRS)
141+ /* *
142+ * Sets the output extent to be the same as current extent (may be transformed to output CRS).
143+ */
89144 void setOutputExtentFromCurrent ();
90145
91- // ! set output extent to custom extent (may be transformed to output CRS)
146+ /* *
147+ * Sets the output extent to a custom extent (may be transformed to output CRS).
148+ */
92149 void setOutputExtentFromUser ( const QgsRectangle &extent, const QgsCoordinateReferenceSystem &crs );
93150
151+ /* *
152+ * Sets the output extent to match a \a layer's extent (may be transformed to output CRS).
153+ * \since QGIS 3.0
154+ */
155+ void setOutputExtentFromLayer ( const QgsMapLayer *layer );
156+
94157 signals:
95- // ! emitted when extent is changed
158+
159+ /* *
160+ * Emitted when the widget's extent is changed.
161+ */
96162 void extentChanged ( const QgsRectangle &r );
97163
98- protected slots:
164+ private slots:
99165
100166 void on_mXMinLineEdit_textEdited ( const QString & ) { setOutputExtentFromLineEdit (); }
101167 void on_mXMaxLineEdit_textEdited ( const QString & ) { setOutputExtentFromLineEdit (); }
102168 void on_mYMinLineEdit_textEdited ( const QString & ) { setOutputExtentFromLineEdit (); }
103169 void on_mYMaxLineEdit_textEdited ( const QString & ) { setOutputExtentFromLineEdit (); }
104170
105171 void groupBoxClicked ();
172+ void layerMenuAboutToShow ();
106173
107- protected :
174+ private :
108175 void setOutputExtent ( const QgsRectangle &r, const QgsCoordinateReferenceSystem &srcCrs, QgsExtentGroupBox::ExtentState state );
109176 void setOutputExtentFromLineEdit ();
110177 void updateTitle ();
@@ -122,12 +189,6 @@ class GUI_EXPORT QgsExtentGroupBox : public QgsCollapsibleGroupBox, private Ui::
122189 QgsRectangle mOriginalExtent ;
123190 QgsCoordinateReferenceSystem mOriginalCrs ;
124191
125- private slots:
126-
127- void layerMenuAboutToShow ();
128-
129- private:
130-
131192 QMenu *mLayerMenu = nullptr ;
132193 QgsMapLayerModel *mMapLayerModel = nullptr ;
133194 QList< QAction * > mMenuActions ;
0 commit comments