QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
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 "ui_qgslayoutmapgridwidgetbase.h"
25
26#include "qgis_gui.h"
28#include "qgslayoutitemwidget.h"
29
37class GUI_EXPORT QgsLayoutMapGridWidget : public QgsLayoutItemBaseWidget, private Ui::QgsLayoutMapGridWidgetBase
38{
39 Q_OBJECT
40
41 public:
44
45 private slots:
46
47 void setGridItems();
48 void mIntervalXSpinBox_editingFinished();
49 void mIntervalYSpinBox_editingFinished();
50 void mOffsetXSpinBox_valueChanged( double value );
51 void mOffsetYSpinBox_valueChanged( double value );
52 void mCrossWidthSpinBox_valueChanged( double val );
53 void mFrameWidthSpinBox_valueChanged( double val );
54 void mRotatedTicksGroupBox_toggled( bool checked );
55 void mRotatedTicksLengthModeComboBox_currentIndexChanged( int );
56 void mRotatedTicksThresholdSpinBox_valueChanged( double val );
57 void mRotatedTicksMarginToCornerSpinBox_valueChanged( double val );
58 void mRotatedAnnotationsGroupBox_toggled( bool checked );
59 void mRotatedAnnotationsLengthModeComboBox_currentIndexChanged( int );
60 void mRotatedAnnotationsThresholdSpinBox_valueChanged( double val );
61 void mRotatedAnnotationsMarginToCornerSpinBox_valueChanged( double val );
62 void mGridFrameMarginSpinBox_valueChanged( double val );
63 void mFrameStyleComboBox_currentIndexChanged( int );
64 void mGridFramePenSizeSpinBox_valueChanged( double d );
65 void mGridFramePenColorButton_colorChanged( const QColor &newColor );
66 void mGridFrameFill1ColorButton_colorChanged( const QColor &newColor );
67 void mGridFrameFill2ColorButton_colorChanged( const QColor &newColor );
68 void mGridTypeComboBox_currentIndexChanged( int );
69 void mapGridCrsChanged( const QgsCoordinateReferenceSystem &crs );
70 void mGridBlendComboBox_currentIndexChanged( int index );
71 void mCheckGridLeftSide_toggled( bool checked );
72 void mCheckGridRightSide_toggled( bool checked );
73 void mCheckGridTopSide_toggled( bool checked );
74 void mCheckGridBottomSide_toggled( bool checked );
75
76 //frame divisions display
77 void mFrameDivisionsLeftComboBox_currentIndexChanged( int index );
78 void mFrameDivisionsRightComboBox_currentIndexChanged( int index );
79 void mFrameDivisionsTopComboBox_currentIndexChanged( int index );
80 void mFrameDivisionsBottomComboBox_currentIndexChanged( int index );
81
82 void mDrawAnnotationGroupBox_toggled( bool state );
83 void mAnnotationFormatButton_clicked();
84
85 //annotation display
86 void mAnnotationDisplayLeftComboBox_currentIndexChanged( int );
87 void mAnnotationDisplayRightComboBox_currentIndexChanged( int );
88 void mAnnotationDisplayTopComboBox_currentIndexChanged( int );
89 void mAnnotationDisplayBottomComboBox_currentIndexChanged( int );
90
91 //annotation position
92 void mAnnotationPositionLeftComboBox_currentIndexChanged( int );
93 void mAnnotationPositionRightComboBox_currentIndexChanged( int );
94 void mAnnotationPositionTopComboBox_currentIndexChanged( int );
95 void mAnnotationPositionBottomComboBox_currentIndexChanged( int );
96
97 //annotation direction
98 void mAnnotationDirectionComboBoxLeft_currentIndexChanged( int index );
99 void mAnnotationDirectionComboBoxRight_currentIndexChanged( int index );
100 void mAnnotationDirectionComboBoxTop_currentIndexChanged( int index );
101 void mAnnotationDirectionComboBoxBottom_currentIndexChanged( int index );
102
103 void mAnnotationFormatComboBox_currentIndexChanged( int index );
104 void mCoordinatePrecisionSpinBox_valueChanged( int value );
105 void mDistanceToMapFrameSpinBox_valueChanged( double d );
106
107 protected:
109 virtual void updateGuiElements();
110
111 protected slots:
114
115 private slots:
116
118 void setGuiElementValues();
119 void lineSymbolChanged();
120 void markerSymbolChanged();
121 void gridEnabledToggled( bool active );
122 void intervalUnitChanged( int index );
123 void minIntervalChanged( double interval );
124 void maxIntervalChanged( double interval );
125 void annotationTextFormatChanged();
126 void onCrsChanged();
127
128 private:
129 QPointer<QgsLayoutItemMap> mMap;
130 QPointer<QgsLayoutItemMapGrid> mMapGrid;
131 int mBlockAnnotationFormatUpdates = 0;
132
134 void blockAllSignals( bool b );
135
136 void handleChangedFrameDisplay( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::DisplayMode mode );
137 void handleChangedAnnotationDisplay( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::DisplayMode mode );
138 void handleChangedAnnotationPosition( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationPosition position );
139 void handleChangedAnnotationDirection( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationDirection direction );
140
141 void insertFrameDisplayEntries( QComboBox *c );
142 void insertAnnotationDisplayEntries( QComboBox *c );
143 void insertAnnotationPositionEntries( QComboBox *c );
144 void insertAnnotationDirectionEntries( QComboBox *c );
145
146 void initFrameDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display );
147 void initAnnotationPositionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationPosition pos );
148 void initAnnotationDirectionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationDirection dir );
149
151 void toggleFrameControls( bool frameEnabled, bool frameFillEnabled, bool frameSizeEnabled, bool ticksRotationEnabled );
152
154 bool hasPredefinedScales() const;
155};
156
157#endif //QGSLAYOUTMAPGRIDWIDGET_H
Represents a coordinate reference system (CRS).
QgsLayoutItemBaseWidget(QWidget *parent SIP_TRANSFERTHIS, QgsLayoutObject *layoutObject)
Constructor for QgsLayoutItemBaseWidget, linked with the specified layoutObject.
An individual grid which is drawn above the map content in a QgsLayoutItemMap.
AnnotationPosition
Position for grid annotations.
DisplayMode
Display settings for grid annotations and frames.
AnnotationDirection
Direction of grid annotations.
BorderSide
Border sides for annotations.
Layout graphical items for displaying a map.
void populateDataDefinedButtons()
Initializes data defined buttons to current atlas coverage layer.
virtual void updateGuiElements()
Sets the current composer map values to the GUI elements.
QgsLayoutMapGridWidget(QgsLayoutItemMapGrid *mapGrid, QgsLayoutItemMap *map)
constructor
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