|
| 1 | +/*************************************************************************** |
| 2 | + qgscomposermapgridwidget.h |
| 3 | + ---------------------- |
| 4 | + begin : October 2016 |
| 5 | + copyright : (C) 2016 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 QGSCOMPOSERMAPGRIDWIDGET_H |
| 19 | +#define QGSCOMPOSERMAPGRIDWIDGET_H |
| 20 | + |
| 21 | +#include "ui_qgscomposermapgridwidgetbase.h" |
| 22 | +#include "qgscomposeritemwidget.h" |
| 23 | +#include "qgscomposermapgrid.h" |
| 24 | + |
| 25 | +/** \ingroup app |
| 26 | + * Input widget for the configuration of QgsComposerMapGrids |
| 27 | + * */ |
| 28 | +class QgsComposerMapGridWidget: public QgsComposerItemBaseWidget, private Ui::QgsComposerMapGridWidgetBase |
| 29 | +{ |
| 30 | + Q_OBJECT |
| 31 | + |
| 32 | + public: |
| 33 | + explicit QgsComposerMapGridWidget( QgsComposerMapGrid* mapGrid, QgsComposerMap* composerMap ); |
| 34 | + virtual ~QgsComposerMapGridWidget(); |
| 35 | + |
| 36 | + public slots: |
| 37 | + |
| 38 | + void setGridItems(); |
| 39 | + void on_mGridLineStyleButton_clicked(); |
| 40 | + void on_mGridMarkerStyleButton_clicked(); |
| 41 | + void on_mIntervalXSpinBox_editingFinished(); |
| 42 | + void on_mIntervalYSpinBox_editingFinished(); |
| 43 | + void on_mOffsetXSpinBox_valueChanged( double value ); |
| 44 | + void on_mOffsetYSpinBox_valueChanged( double value ); |
| 45 | + void on_mCrossWidthSpinBox_valueChanged( double val ); |
| 46 | + void on_mFrameWidthSpinBox_valueChanged( double val ); |
| 47 | + void on_mFrameStyleComboBox_currentIndexChanged( const QString& text ); |
| 48 | + void on_mGridFramePenSizeSpinBox_valueChanged( double d ); |
| 49 | + void on_mGridFramePenColorButton_colorChanged( const QColor& newColor ); |
| 50 | + void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor ); |
| 51 | + void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor ); |
| 52 | + void on_mGridTypeComboBox_currentIndexChanged( const QString& text ); |
| 53 | + void on_mMapGridCRSButton_clicked(); |
| 54 | + void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text ); |
| 55 | + void on_mGridBlendComboBox_currentIndexChanged( int index ); |
| 56 | + void on_mCheckGridLeftSide_toggled( bool checked ); |
| 57 | + void on_mCheckGridRightSide_toggled( bool checked ); |
| 58 | + void on_mCheckGridTopSide_toggled( bool checked ); |
| 59 | + void on_mCheckGridBottomSide_toggled( bool checked ); |
| 60 | + |
| 61 | + //frame divisions display |
| 62 | + void on_mFrameDivisionsLeftComboBox_currentIndexChanged( int index ); |
| 63 | + void on_mFrameDivisionsRightComboBox_currentIndexChanged( int index ); |
| 64 | + void on_mFrameDivisionsTopComboBox_currentIndexChanged( int index ); |
| 65 | + void on_mFrameDivisionsBottomComboBox_currentIndexChanged( int index ); |
| 66 | + |
| 67 | + void on_mDrawAnnotationGroupBox_toggled( bool state ); |
| 68 | + void on_mAnnotationFormatButton_clicked(); |
| 69 | + |
| 70 | + //annotation display |
| 71 | + void on_mAnnotationDisplayLeftComboBox_currentIndexChanged( const QString& text ); |
| 72 | + void on_mAnnotationDisplayRightComboBox_currentIndexChanged( const QString& text ); |
| 73 | + void on_mAnnotationDisplayTopComboBox_currentIndexChanged( const QString& text ); |
| 74 | + void on_mAnnotationDisplayBottomComboBox_currentIndexChanged( const QString& text ); |
| 75 | + |
| 76 | + //annotation position |
| 77 | + void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text ); |
| 78 | + void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text ); |
| 79 | + void on_mAnnotationPositionTopComboBox_currentIndexChanged( const QString& text ); |
| 80 | + void on_mAnnotationPositionBottomComboBox_currentIndexChanged( const QString& text ); |
| 81 | + |
| 82 | + //annotation direction |
| 83 | + void on_mAnnotationDirectionComboBoxLeft_currentIndexChanged( int index ); |
| 84 | + void on_mAnnotationDirectionComboBoxRight_currentIndexChanged( int index ); |
| 85 | + void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( int index ); |
| 86 | + void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( int index ); |
| 87 | + |
| 88 | + void on_mAnnotationFormatComboBox_currentIndexChanged( int index ); |
| 89 | + void on_mCoordinatePrecisionSpinBox_valueChanged( int value ); |
| 90 | + void on_mDistanceToMapFrameSpinBox_valueChanged( double d ); |
| 91 | + void on_mAnnotationFontButton_clicked(); |
| 92 | + void on_mAnnotationFontColorButton_colorChanged( const QColor &color ); |
| 93 | + |
| 94 | + protected: |
| 95 | + |
| 96 | + /** Sets the current composer map values to the GUI elements*/ |
| 97 | + virtual void updateGuiElements(); |
| 98 | + |
| 99 | + protected slots: |
| 100 | + /** Initializes data defined buttons to current atlas coverage layer*/ |
| 101 | + void populateDataDefinedButtons(); |
| 102 | + |
| 103 | + private slots: |
| 104 | + |
| 105 | + /** Sets the GUI elements to the values of mPicture*/ |
| 106 | + void setGuiElementValues(); |
| 107 | + |
| 108 | + void updateGridLineStyleFromWidget(); |
| 109 | + void cleanUpGridLineStyleSelector( QgsPanelWidget* container ); |
| 110 | + void updateGridMarkerStyleFromWidget(); |
| 111 | + void cleanUpGridMarkerStyleSelector( QgsPanelWidget* container ); |
| 112 | + |
| 113 | + private: |
| 114 | + QgsComposerMap* mComposerMap; |
| 115 | + QgsComposerMapGrid* mComposerMapGrid; |
| 116 | + |
| 117 | + /** Blocks / unblocks the signals of all GUI elements*/ |
| 118 | + void blockAllSignals( bool b ); |
| 119 | + |
| 120 | + void handleChangedFrameDisplay( QgsComposerMapGrid::BorderSide border, const QgsComposerMapGrid::DisplayMode mode ); |
| 121 | + void handleChangedAnnotationDisplay( QgsComposerMapGrid::BorderSide border, const QString& text ); |
| 122 | + void handleChangedAnnotationPosition( QgsComposerMapGrid::BorderSide border, const QString& text ); |
| 123 | + void handleChangedAnnotationDirection( QgsComposerMapGrid::BorderSide border, QgsComposerMapGrid::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, QgsComposerMapGrid::DisplayMode display ); |
| 131 | + void initAnnotationDisplayBox( QComboBox* c, QgsComposerMapGrid::DisplayMode display ); |
| 132 | + void initAnnotationPositionBox( QComboBox* c, QgsComposerMapGrid::AnnotationPosition pos ); |
| 133 | + void initAnnotationDirectionBox( QComboBox* c, QgsComposerMapGrid::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 //QGSCOMPOSERMAPGRIDWIDGET_H |
0 commit comments