QGIS API Documentation  3.17.0-Master (a84647cf30)
qgslayoutmapgridwidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutmapgridwidget.h
3  ----------------------
4  begin : October 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson 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 
18 #ifndef QGSLAYOUTMAPGRIDWIDGET_H
19 #define QGSLAYOUTMAPGRIDWIDGET_H
20 
21 // We don't want to expose this in the public API
22 #define SIP_NO_FILE
23 
24 #include "qgis_gui.h"
25 #include "ui_qgslayoutmapgridwidgetbase.h"
26 #include "qgslayoutitemwidget.h"
27 #include "qgslayoutitemmapgrid.h"
28 
36 class GUI_EXPORT QgsLayoutMapGridWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutMapGridWidgetBase
37 {
38  Q_OBJECT
39 
40  public:
43 
44  private slots:
45 
46  void setGridItems();
47  void mIntervalXSpinBox_editingFinished();
48  void mIntervalYSpinBox_editingFinished();
49  void mOffsetXSpinBox_valueChanged( double value );
50  void mOffsetYSpinBox_valueChanged( double value );
51  void mCrossWidthSpinBox_valueChanged( double val );
52  void mFrameWidthSpinBox_valueChanged( double val );
53  void mRotatedTicksGroupBox_toggled( bool checked );
54  void mRotatedTicksLengthModeComboBox_currentIndexChanged( int );
55  void mRotatedTicksThresholdSpinBox_valueChanged( double val );
56  void mRotatedTicksMarginToCornerSpinBox_valueChanged( double val );
57  void mRotatedAnnotationsGroupBox_toggled( bool checked );
58  void mRotatedAnnotationsLengthModeComboBox_currentIndexChanged( int );
59  void mRotatedAnnotationsThresholdSpinBox_valueChanged( double val );
60  void mRotatedAnnotationsMarginToCornerSpinBox_valueChanged( double val );
61  void mGridFrameMarginSpinBox_valueChanged( double val );
62  void mFrameStyleComboBox_currentIndexChanged( int );
63  void mGridFramePenSizeSpinBox_valueChanged( double d );
64  void mGridFramePenColorButton_colorChanged( const QColor &newColor );
65  void mGridFrameFill1ColorButton_colorChanged( const QColor &newColor );
66  void mGridFrameFill2ColorButton_colorChanged( const QColor &newColor );
67  void mGridTypeComboBox_currentIndexChanged( int );
68  void mapGridCrsChanged( const QgsCoordinateReferenceSystem &crs );
69  void mGridBlendComboBox_currentIndexChanged( int index );
70  void mCheckGridLeftSide_toggled( bool checked );
71  void mCheckGridRightSide_toggled( bool checked );
72  void mCheckGridTopSide_toggled( bool checked );
73  void mCheckGridBottomSide_toggled( bool checked );
74 
75  //frame divisions display
76  void mFrameDivisionsLeftComboBox_currentIndexChanged( int index );
77  void mFrameDivisionsRightComboBox_currentIndexChanged( int index );
78  void mFrameDivisionsTopComboBox_currentIndexChanged( int index );
79  void mFrameDivisionsBottomComboBox_currentIndexChanged( int index );
80 
81  void mDrawAnnotationGroupBox_toggled( bool state );
82  void mAnnotationFormatButton_clicked();
83 
84  //annotation display
85  void mAnnotationDisplayLeftComboBox_currentIndexChanged( int );
86  void mAnnotationDisplayRightComboBox_currentIndexChanged( int );
87  void mAnnotationDisplayTopComboBox_currentIndexChanged( int );
88  void mAnnotationDisplayBottomComboBox_currentIndexChanged( int );
89 
90  //annotation position
91  void mAnnotationPositionLeftComboBox_currentIndexChanged( int );
92  void mAnnotationPositionRightComboBox_currentIndexChanged( int );
93  void mAnnotationPositionTopComboBox_currentIndexChanged( int );
94  void mAnnotationPositionBottomComboBox_currentIndexChanged( int );
95 
96  //annotation direction
97  void mAnnotationDirectionComboBoxLeft_currentIndexChanged( int index );
98  void mAnnotationDirectionComboBoxRight_currentIndexChanged( int index );
99  void mAnnotationDirectionComboBoxTop_currentIndexChanged( int index );
100  void mAnnotationDirectionComboBoxBottom_currentIndexChanged( int index );
101 
102  void mAnnotationFormatComboBox_currentIndexChanged( int index );
103  void mCoordinatePrecisionSpinBox_valueChanged( int value );
104  void mDistanceToMapFrameSpinBox_valueChanged( double d );
105 
106  protected:
107 
108 
110  virtual void updateGuiElements();
111 
112  protected slots:
114  void populateDataDefinedButtons();
115 
116  private slots:
117 
119  void setGuiElementValues();
120  void lineSymbolChanged();
121  void markerSymbolChanged();
122  void gridEnabledToggled( bool active );
123  void intervalUnitChanged( int index );
124  void minIntervalChanged( double interval );
125  void maxIntervalChanged( double interval );
126  void annotationTextFormatChanged();
127  void onCrsChanged();
128 
129  private:
130  QPointer< QgsLayoutItemMap > mMap;
131  QPointer< QgsLayoutItemMapGrid > mMapGrid;
132  int mBlockAnnotationFormatUpdates = 0;
133 
135  void blockAllSignals( bool b );
136 
137  void handleChangedFrameDisplay( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::DisplayMode mode );
138  void handleChangedAnnotationDisplay( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::DisplayMode mode );
139  void handleChangedAnnotationPosition( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationPosition position );
140  void handleChangedAnnotationDirection( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationDirection direction );
141 
142  void insertFrameDisplayEntries( QComboBox *c );
143  void insertAnnotationDisplayEntries( QComboBox *c );
144  void insertAnnotationPositionEntries( QComboBox *c );
145  void insertAnnotationDirectionEntries( QComboBox *c );
146 
147  void initFrameDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display );
148  void initAnnotationPositionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationPosition pos );
149  void initAnnotationDirectionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationDirection dir );
150 
152  void toggleFrameControls( bool frameEnabled, bool frameFillEnabled, bool frameSizeEnabled, bool ticksRotationEnabled );
153 
155  bool hasPredefinedScales() const;
156 
157 };
158 
159 #endif //QGSLAYOUTMAPGRIDWIDGET_H
DisplayMode
Display settings for grid annotations and frames.
const QgsCoordinateReferenceSystem & crs
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
Layout graphical items for displaying a map.
An individual grid which is drawn above the map content in a QgsLayoutItemMap.
AnnotationDirection
Direction of grid annotations.
AnnotationPosition
Position for grid annotations.
BorderSide
Border sides for annotations.
A widget for configuring layout map grid items.
A base class for property widgets for layout items.
This class represents a coordinate reference system (CRS).