|
| 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 | +#include "ui_qgslayoutmapgridwidgetbase.h" |
| 22 | +#include "qgslayoutitemwidget.h" |
| 23 | +#include "qgslayoutitemmapgrid.h" |
| 24 | + |
| 25 | +/** |
| 26 | + * \ingroup app |
| 27 | + * Input widget for the configuration of QgsLayoutItemMapGrids |
| 28 | + * */ |
| 29 | +class QgsLayoutMapGridWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutMapGridWidgetBase |
| 30 | +{ |
| 31 | + Q_OBJECT |
| 32 | + |
| 33 | + public: |
| 34 | + explicit QgsLayoutMapGridWidget( QgsLayoutItemMapGrid *mapGrid, QgsLayoutItemMap *map ); |
| 35 | + |
| 36 | + public slots: |
| 37 | + |
| 38 | + void setGridItems(); |
| 39 | + void mGridLineStyleButton_clicked(); |
| 40 | + void mGridMarkerStyleButton_clicked(); |
| 41 | + void mIntervalXSpinBox_editingFinished(); |
| 42 | + void mIntervalYSpinBox_editingFinished(); |
| 43 | + void mOffsetXSpinBox_valueChanged( double value ); |
| 44 | + void mOffsetYSpinBox_valueChanged( double value ); |
| 45 | + void mCrossWidthSpinBox_valueChanged( double val ); |
| 46 | + void mFrameWidthSpinBox_valueChanged( double val ); |
| 47 | + void mFrameStyleComboBox_currentIndexChanged( const QString &text ); |
| 48 | + void mGridFramePenSizeSpinBox_valueChanged( double d ); |
| 49 | + void mGridFramePenColorButton_colorChanged( const QColor &newColor ); |
| 50 | + void mGridFrameFill1ColorButton_colorChanged( const QColor &newColor ); |
| 51 | + void mGridFrameFill2ColorButton_colorChanged( const QColor &newColor ); |
| 52 | + void mGridTypeComboBox_currentIndexChanged( const QString &text ); |
| 53 | + void mMapGridCRSButton_clicked(); |
| 54 | + void mMapGridUnitComboBox_currentIndexChanged( const QString &text ); |
| 55 | + void mGridBlendComboBox_currentIndexChanged( int index ); |
| 56 | + void mCheckGridLeftSide_toggled( bool checked ); |
| 57 | + void mCheckGridRightSide_toggled( bool checked ); |
| 58 | + void mCheckGridTopSide_toggled( bool checked ); |
| 59 | + void mCheckGridBottomSide_toggled( bool checked ); |
| 60 | + |
| 61 | + //frame divisions display |
| 62 | + void mFrameDivisionsLeftComboBox_currentIndexChanged( int index ); |
| 63 | + void mFrameDivisionsRightComboBox_currentIndexChanged( int index ); |
| 64 | + void mFrameDivisionsTopComboBox_currentIndexChanged( int index ); |
| 65 | + void mFrameDivisionsBottomComboBox_currentIndexChanged( int index ); |
| 66 | + |
| 67 | + void mDrawAnnotationGroupBox_toggled( bool state ); |
| 68 | + void mAnnotationFormatButton_clicked(); |
| 69 | + |
| 70 | + //annotation display |
| 71 | + void mAnnotationDisplayLeftComboBox_currentIndexChanged( const QString &text ); |
| 72 | + void mAnnotationDisplayRightComboBox_currentIndexChanged( const QString &text ); |
| 73 | + void mAnnotationDisplayTopComboBox_currentIndexChanged( const QString &text ); |
| 74 | + void mAnnotationDisplayBottomComboBox_currentIndexChanged( const QString &text ); |
| 75 | + |
| 76 | + //annotation position |
| 77 | + void mAnnotationPositionLeftComboBox_currentIndexChanged( const QString &text ); |
| 78 | + void mAnnotationPositionRightComboBox_currentIndexChanged( const QString &text ); |
| 79 | + void mAnnotationPositionTopComboBox_currentIndexChanged( const QString &text ); |
| 80 | + void mAnnotationPositionBottomComboBox_currentIndexChanged( const QString &text ); |
| 81 | + |
| 82 | + //annotation direction |
| 83 | + void mAnnotationDirectionComboBoxLeft_currentIndexChanged( int index ); |
| 84 | + void mAnnotationDirectionComboBoxRight_currentIndexChanged( int index ); |
| 85 | + void mAnnotationDirectionComboBoxTop_currentIndexChanged( int index ); |
| 86 | + void mAnnotationDirectionComboBoxBottom_currentIndexChanged( int index ); |
| 87 | + |
| 88 | + void mAnnotationFormatComboBox_currentIndexChanged( int index ); |
| 89 | + void mCoordinatePrecisionSpinBox_valueChanged( int value ); |
| 90 | + void mDistanceToMapFrameSpinBox_valueChanged( double d ); |
| 91 | + void mAnnotationFontColorButton_colorChanged( const QColor &color ); |
| 92 | + |
| 93 | + protected: |
| 94 | + |
| 95 | + //! Sets the current composer map values to the GUI elements |
| 96 | + virtual void updateGuiElements(); |
| 97 | + |
| 98 | + protected slots: |
| 99 | + //! Initializes data defined buttons to current atlas coverage layer |
| 100 | + void populateDataDefinedButtons(); |
| 101 | + |
| 102 | + private slots: |
| 103 | + |
| 104 | + //! Sets the GUI elements to the values of mPicture |
| 105 | + void setGuiElementValues(); |
| 106 | + |
| 107 | + void updateGridLineStyleFromWidget(); |
| 108 | + void cleanUpGridLineStyleSelector( QgsPanelWidget *container ); |
| 109 | + void updateGridMarkerStyleFromWidget(); |
| 110 | + void cleanUpGridMarkerStyleSelector( QgsPanelWidget *container ); |
| 111 | + void annotationFontChanged(); |
| 112 | + |
| 113 | + private: |
| 114 | + QgsLayoutItemMap *mMap = nullptr; |
| 115 | + QgsLayoutItemMapGrid *mMapGrid = nullptr; |
| 116 | + |
| 117 | + //! Blocks / unblocks the signals of all GUI elements |
| 118 | + void blockAllSignals( bool b ); |
| 119 | + |
| 120 | + void handleChangedFrameDisplay( QgsLayoutItemMapGrid::BorderSide border, const QgsLayoutItemMapGrid::DisplayMode mode ); |
| 121 | + void handleChangedAnnotationDisplay( QgsLayoutItemMapGrid::BorderSide border, const QString &text ); |
| 122 | + void handleChangedAnnotationPosition( QgsLayoutItemMapGrid::BorderSide border, const QString &text ); |
| 123 | + void handleChangedAnnotationDirection( QgsLayoutItemMapGrid::BorderSide border, QgsLayoutItemMapGrid::AnnotationDirection direction ); |
| 124 | + |
| 125 | + void insertFrameDisplayEntries( QComboBox *c ); |
| 126 | + void insertAnnotationDisplayEntries( QComboBox *c ); |
| 127 | + void insertAnnotationPositionEntries( QComboBox *c ); |
| 128 | + void insertAnnotationDirectionEntries( QComboBox *c ); |
| 129 | + |
| 130 | + void initFrameDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display ); |
| 131 | + void initAnnotationDisplayBox( QComboBox *c, QgsLayoutItemMapGrid::DisplayMode display ); |
| 132 | + void initAnnotationPositionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationPosition pos ); |
| 133 | + void initAnnotationDirectionBox( QComboBox *c, QgsLayoutItemMapGrid::AnnotationDirection dir ); |
| 134 | + |
| 135 | + void updateGridLineSymbolMarker(); |
| 136 | + void updateGridMarkerSymbolMarker(); |
| 137 | + |
| 138 | + //! Enables/disables grid frame related controls |
| 139 | + void toggleFrameControls( bool frameEnabled, bool frameFillEnabled, bool frameSizeEnabled ); |
| 140 | + |
| 141 | + //! Is there some predefined scales, globally or as project's options ? |
| 142 | + bool hasPredefinedScales() const; |
| 143 | + |
| 144 | +}; |
| 145 | + |
| 146 | +#endif //QGSLAYOUTMAPGRIDWIDGET_H |
0 commit comments