QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgslayoutitemmapgrid.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutitemmapgrid.h
3  ----------------------
4  begin : October 2017
5  copyright : (C) 2017 by Marco Hugentobler, Nyall Dawson
6  email : marco dot hugentobler at sourcepole dot ch
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 QGSLAYOUTITEMMAPGRID_H
19 #define QGSLAYOUTITEMMAPGRID_H
20 
21 #include "qgis_core.h"
22 #include "qgis_sip.h"
23 #include "qgslayoutitemmapitem.h"
24 #include "qgssymbol.h"
25 #include <QPainter>
26 
29 class QgsLayoutItemMap;
30 class QDomDocument;
31 class QDomElement;
32 class QPainter;
33 class QgsRenderContext;
34 
45 {
46  public:
47 
52 
61  void addGrid( QgsLayoutItemMapGrid *grid SIP_TRANSFER );
62 
69  void removeGrid( const QString &gridId );
70 
77  void moveGridUp( const QString &gridId );
78 
85  void moveGridDown( const QString &gridId );
86 
90  QgsLayoutItemMapGrid *grid( const QString &gridId ) const;
91 
95  QgsLayoutItemMapGrid *grid( int index ) const;
96 
101  QgsLayoutItemMapGrid &operator[]( int index );
102 
106  QList< QgsLayoutItemMapGrid * > asList() const;
107 
108  bool readXml( const QDomElement &elem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
109 
115  double maxGridExtension() const;
116 
123  void calculateMaxGridExtension( double &top, double &right, double &bottom, double &left ) const;
124 };
125 
126 //
127 // QgsLayoutItemMapGrid
128 //
129 
138 class CORE_EXPORT QgsLayoutItemMapGrid : public QgsLayoutItemMapItem
139 {
140 
141  Q_OBJECT
142 
143  public:
144 
148  enum GridUnit
149  {
151  MM,
152  CM,
154  };
155 
160  {
161  Solid = 0,
164  FrameAnnotationsOnly
165  };
166 
171  {
172  ShowAll = 0,
175  HideAll
176  };
177 
182  {
183  InsideMapFrame = 0,
185  };
186 
191  {
192  Horizontal = 0,
195  BoundaryDirection
196  };
197 
202  {
203  Decimal = 0,
211  CustomFormat
212  };
213 
218  {
222  Top
223  };
224 
229  {
230  NoFrame = 0,
238  };
239 
244  {
245  FrameLeft = 0x01,
246  FrameRight = 0x02,
247  FrameTop = 0x04,
248  FrameBottom = 0x08
249  };
250  Q_DECLARE_FLAGS( FrameSideFlags, FrameSideFlag )
251 
252 
256  {
257  Longitude = 0,
258  Latitude
259  };
260 
266  QgsLayoutItemMapGrid( const QString &name, QgsLayoutItemMap *map );
267 
268  void draw( QPainter *painter ) override;
269  bool writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
270  bool readXml( const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context ) override;
271 
276  void setCrs( const QgsCoordinateReferenceSystem &crs );
277 
282  QgsCoordinateReferenceSystem crs() const { return mCRS; }
283 
288  void setBlendMode( const QPainter::CompositionMode mode ) { mBlendMode = mode; }
289 
294  QPainter::CompositionMode blendMode() const { return mBlendMode; }
295 
296  bool usesAdvancedEffects() const override;
297 
302  double maxExtension() const;
303 
310  void calculateMaxExtension( double &top, double &right, double &bottom, double &left ) const;
311 
312  void setEnabled( bool enabled ) override;
313 
314  //
315  // GRID UNITS
316  //
317 
323  void setUnits( GridUnit unit );
324 
330  GridUnit units() const { return mGridUnit; }
331 
338  void setIntervalX( double interval );
339 
346  double intervalX() const { return mGridIntervalX; }
347 
354  void setIntervalY( double interval );
355 
362  double intervalY() const { return mGridIntervalY; }
363 
370  void setOffsetX( double offset );
371 
378  double offsetX() const { return mGridOffsetX; }
379 
386  void setOffsetY( double offset );
387 
394  double offsetY() const { return mGridOffsetY; }
395 
405  double minimumIntervalWidth() const { return mMinimumIntervalWidth; }
406 
416  void setMinimumIntervalWidth( double width );
417 
427  double maximumIntervalWidth() const { return mMaximumIntervalWidth; }
428 
438  void setMaximumIntervalWidth( double width );
439 
440  //
441  // GRID APPEARANCE
442  //
443 
449  void setStyle( GridStyle style );
450 
456  GridStyle style() const { return mGridStyle; }
457 
463  void setCrossLength( const double length );
464 
470  double crossLength() const { return mCrossLength; }
471 
479  void setGridLineWidth( double width );
480 
488  void setGridLineColor( const QColor &color );
489 
498  void setLineSymbol( QgsLineSymbol *symbol SIP_TRANSFER );
499 
508  const QgsLineSymbol *lineSymbol() const; SIP_SKIP
509 
517  QgsLineSymbol *lineSymbol();
518 
527  void setMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
528 
537  const QgsMarkerSymbol *markerSymbol() const; SIP_SKIP
538 
546  QgsMarkerSymbol *markerSymbol();
547 
548  //
549  // ANNOTATIONS
550  //
551 
556  void setAnnotationEnabled( const bool enabled ) { mShowGridAnnotation = enabled; }
557 
562  bool annotationEnabled() const { return mShowGridAnnotation; }
563 
568  void setAnnotationFont( const QFont &font ) { mGridAnnotationFont = font; }
569 
574  QFont annotationFont() const { return mGridAnnotationFont; }
575 
580  void setAnnotationFontColor( const QColor &color ) { mGridAnnotationFontColor = color; }
581 
586  QColor annotationFontColor() const { return mGridAnnotationFontColor; }
587 
593  void setAnnotationPrecision( const int precision ) { mGridAnnotationPrecision = precision; }
594 
600  int annotationPrecision() const { return mGridAnnotationPrecision; }
601 
609  void setAnnotationDisplay( DisplayMode display, BorderSide border );
610 
619  DisplayMode annotationDisplay( BorderSide border ) const;
620 
626  void setAnnotationPosition( AnnotationPosition position, BorderSide side );
627 
633  AnnotationPosition annotationPosition( BorderSide side ) const;
634 
639  void setAnnotationFrameDistance( const double distance );
640 
645  double annotationFrameDistance() const { return mAnnotationFrameDistance; }
646 
651  void setAnnotationDirection( AnnotationDirection direction, BorderSide side );
652 
657  void setAnnotationDirection( AnnotationDirection direction );
658 
664  AnnotationDirection annotationDirection( BorderSide border ) const;
665 
670  void setAnnotationFormat( const AnnotationFormat format ) { mGridAnnotationFormat = format; }
671 
676  AnnotationFormat annotationFormat() const { return mGridAnnotationFormat; }
677 
683  void setAnnotationExpression( const QString &expression ) { mGridAnnotationExpressionString = expression; mGridAnnotationExpression.reset(); }
684 
690  QString annotationExpression() const { return mGridAnnotationExpressionString; }
691 
692  //
693  // GRID FRAME
694  //
695 
700  void setFrameStyle( const FrameStyle style ) { mGridFrameStyle = style; }
701 
706  FrameStyle frameStyle() const { return mGridFrameStyle; }
707 
712  void setFrameDivisions( DisplayMode divisions, BorderSide side );
713 
718  DisplayMode frameDivisions( BorderSide side ) const;
719 
727  void setFrameSideFlags( QgsLayoutItemMapGrid::FrameSideFlags flags );
728 
737  void setFrameSideFlag( QgsLayoutItemMapGrid::FrameSideFlag flag, bool on = true );
738 
746  QgsLayoutItemMapGrid::FrameSideFlags frameSideFlags() const;
747 
757  bool testFrameSideFlag( FrameSideFlag flag ) const;
758 
765  void setFrameWidth( const double width );
766 
773  double frameWidth() const { return mGridFrameWidth; }
774 
781  void setFrameMargin( const double margin );
782 
789  double frameMargin() const { return mGridFrameMargin; }
790 
796  void setFramePenSize( const double width );
797 
803  double framePenSize() const { return mGridFramePenThickness; }
804 
812  void setFramePenColor( const QColor &color ) { mGridFramePenColor = color; }
813 
821  QColor framePenColor() const {return mGridFramePenColor;}
822 
829  void setFrameFillColor1( const QColor &color ) { mGridFrameFillColor1 = color; }
830 
837  QColor frameFillColor1() const { return mGridFrameFillColor1; }
838 
845  void setFrameFillColor2( const QColor &color ) { mGridFrameFillColor2 = color; }
846 
853  QColor frameFillColor2() const { return mGridFrameFillColor2; }
854 
856  bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
857  void refresh() override;
858 
859  private:
860 
861  QgsLayoutItemMapGrid() = delete;
862 
863  struct GridExtension
864  {
865  GridExtension() = default;
866  double top = 0.0;
867  double right = 0.0;
868  double bottom = 0.0;
869  double left = 0.0;
870  };
871 
873  mutable bool mTransformDirty = true;
874 
876  GridStyle mGridStyle = QgsLayoutItemMapGrid::Solid;
878  double mGridIntervalX = 0.0;
880  double mGridIntervalY = 0.0;
882  double mGridOffsetX = 0.0;
884  double mGridOffsetY = 0.0;
886  QFont mGridAnnotationFont;
888  QColor mGridAnnotationFontColor = Qt::black;
890  int mGridAnnotationPrecision = 3;
892  bool mShowGridAnnotation = false;
893 
895  DisplayMode mLeftGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
897  DisplayMode mRightGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
899  DisplayMode mTopGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
901  DisplayMode mBottomGridAnnotationDisplay = QgsLayoutItemMapGrid::ShowAll;
902 
904  AnnotationPosition mLeftGridAnnotationPosition = QgsLayoutItemMapGrid::OutsideMapFrame;
906  AnnotationPosition mRightGridAnnotationPosition = QgsLayoutItemMapGrid::OutsideMapFrame;
908  AnnotationPosition mTopGridAnnotationPosition = QgsLayoutItemMapGrid::OutsideMapFrame;
910  AnnotationPosition mBottomGridAnnotationPosition = QgsLayoutItemMapGrid::OutsideMapFrame;
911 
913  double mAnnotationFrameDistance = 1.0;
914 
916  AnnotationDirection mLeftGridAnnotationDirection = QgsLayoutItemMapGrid::Horizontal;
918  AnnotationDirection mRightGridAnnotationDirection = QgsLayoutItemMapGrid::Horizontal;
920  AnnotationDirection mTopGridAnnotationDirection = QgsLayoutItemMapGrid::Horizontal;
922  AnnotationDirection mBottomGridAnnotationDirection = QgsLayoutItemMapGrid::Horizontal;
923  AnnotationFormat mGridAnnotationFormat = QgsLayoutItemMapGrid::Decimal;
924 
925  QString mGridAnnotationExpressionString;
926  mutable std::unique_ptr< QgsExpression > mGridAnnotationExpression;
927 
928  FrameStyle mGridFrameStyle = QgsLayoutItemMapGrid::NoFrame;
929  FrameSideFlags mGridFrameSides;
930  double mGridFrameWidth = 2.0;
931  double mGridFramePenThickness = 0.3;
932  QColor mGridFramePenColor = QColor( 0, 0, 0 );
933  QColor mGridFrameFillColor1 = Qt::white;
934  QColor mGridFrameFillColor2 = Qt::black;
935  double mCrossLength = 3.0;
936  double mGridFrameMargin = 0.0;
937 
938  double mMinimumIntervalWidth = 50;
939  double mMaximumIntervalWidth = 100;
940 
942  DisplayMode mLeftFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
944  DisplayMode mRightFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
946  DisplayMode mTopFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
948  DisplayMode mBottomFrameDivisions = QgsLayoutItemMapGrid::ShowAll;
949 
950  std::unique_ptr< QgsLineSymbol > mGridLineSymbol;
951  std::unique_ptr< QgsMarkerSymbol > mGridMarkerSymbol;
952 
954 
955  GridUnit mGridUnit = MapUnit;
956 
957  QPainter::CompositionMode mBlendMode = QPainter::CompositionMode_SourceOver;
958 
959  mutable QList< QPair< double, QPolygonF > > mTransformedXLines;
960  mutable QList< QPair< double, QPolygonF > > mTransformedYLines;
961  mutable QList< QgsPointXY > mTransformedIntersections;
962  QRectF mPrevPaintRect;
963  mutable QPolygonF mPrevMapPolygon;
964 
965  bool mEvaluatedEnabled = true;
966  double mEvaluatedIntervalX = 0;
967  double mEvaluatedIntervalY = 0;
968  double mEvaluatedOffsetX = 0;
969  double mEvaluatedOffsetY = 0;
970  double mEvaluatedGridFrameWidth = 0;
971  double mEvaluatedGridFrameMargin = 0;
972  double mEvaluatedAnnotationFrameDistance = 0;
973  double mEvaluatedCrossLength = 0;
974  double mEvaluatedGridFrameLineThickness = 0;
975 
976  class QgsMapAnnotation
977  {
978  public:
979  double coordinate;
980  QPointF itemPosition;
982  };
983 
988  void drawGridFrame( QPainter *p, const QList< QPair< double, QLineF > > &hLines, const QList< QPair< double, QLineF > > &vLines, GridExtension *extension = nullptr ) const;
989 
999  void drawCoordinateAnnotations( QPainter *p, const QList< QPair< double, QLineF > > &hLines, const QList< QPair< double, QLineF > > &vLines, QgsExpressionContext &expressionContext, GridExtension *extension = nullptr ) const;
1000 
1005  void drawCoordinateAnnotation( QPainter *p, QPointF pos, const QString &annotationString, AnnotationCoordinate coordinateType, GridExtension *extension = nullptr ) const;
1006 
1014  void drawAnnotation( QPainter *p, QPointF pos, int rotation, const QString &annotationText ) const;
1015 
1016  QString gridAnnotationString( double value, AnnotationCoordinate coord, QgsExpressionContext &expressionContext ) const;
1017 
1021  int xGridLines( QList< QPair< double, QLineF > > &lines ) const;
1022 
1026  int yGridLines( QList< QPair< double, QLineF > > &lines ) const;
1027 
1028  int xGridLinesCrsTransform( const QgsRectangle &bbox, const QgsCoordinateTransform &t, QList< QPair< double, QPolygonF > > &lines ) const;
1029 
1030  int yGridLinesCrsTransform( const QgsRectangle &bbox, const QgsCoordinateTransform &t, QList< QPair< double, QPolygonF > > &lines ) const;
1031 
1032  void drawGridLine( const QLineF &line, QgsRenderContext &context ) const;
1033 
1034  void drawGridLine( const QPolygonF &line, QgsRenderContext &context ) const;
1035 
1036  void sortGridLinesOnBorders( const QList< QPair< double, QLineF > > &hLines, const QList< QPair< double, QLineF > > &vLines, QMap< double, double > &leftFrameEntries,
1037  QMap< double, double > &rightFrameEntries, QMap< double, double > &topFrameEntries, QMap< double, double > &bottomFrameEntries ) const;
1038 
1043  void drawGridFrameBorder( QPainter *p, const QMap< double, double > &borderPos, BorderSide border, double *extension = nullptr ) const;
1044 
1050  BorderSide borderForLineCoord( QPointF p, AnnotationCoordinate coordinateType ) const;
1051 
1053  int crsGridParams( QgsRectangle &crsRect, QgsCoordinateTransform &inverseTransform ) const;
1054 
1055  static QList<QPolygonF> trimLinesToMap( const QPolygonF &line, const QgsRectangle &rect );
1056 
1057  QPolygonF scalePolygon( const QPolygonF &polygon, double scale ) const;
1058 
1060  void drawGridCrsTransform( QgsRenderContext &context, double dotsPerMM, QList< QPair< double, QLineF > > &horizontalLines,
1061  QList< QPair< double, QLineF > > &verticalLines, bool calculateLinesOnly = false ) const;
1062 
1063  void drawGridNoTransform( QgsRenderContext &context, double dotsPerMM, QList<QPair<double, QLineF> > &horizontalLines, QList<QPair<double, QLineF> > &verticalLines, bool calculateLinesOnly = false ) const;
1064 
1065  void createDefaultGridLineSymbol();
1066 
1067  void createDefaultGridMarkerSymbol();
1068 
1069  void drawGridMarker( QPointF point, QgsRenderContext &context ) const;
1070 
1071  void drawGridFrameZebraBorder( QPainter *p, const QMap<double, double> &borderPos, BorderSide border, double *extension = nullptr ) const;
1072 
1073  void drawGridFrameTicks( QPainter *p, const QMap<double, double> &borderPos, BorderSide border, double *extension = nullptr ) const;
1074 
1075  void drawGridFrameLineBorder( QPainter *p, BorderSide border, double *extension = nullptr ) const;
1076 
1077  void calculateCrsTransformLines() const;
1078 
1079  bool shouldShowDivisionForSide( AnnotationCoordinate coordinate, BorderSide side ) const;
1080  bool shouldShowDivisionForDisplayMode( AnnotationCoordinate coordinate, DisplayMode mode ) const;
1081  void refreshDataDefinedProperties();
1082 
1084  double mapWidth() const;
1085 
1086  friend class TestQgsLayoutMapGrid;
1087 
1088 };
1089 
1090 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsLayoutItemMapGrid::FrameSideFlags )
1091 
1092 #endif // QGSLAYOUTITEMMAPGRID_H
QgsLayoutItemMapGrid::intervalX
double intervalX() const
Returns the interval between grid lines in the x-direction.
Definition: qgslayoutitemmapgrid.h:346
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:369
QgsLayoutItemMapItem::setEnabled
virtual void setEnabled(bool enabled)
Controls whether the item will be drawn.
Definition: qgslayoutitemmapitem.cpp:99
QgsLayoutItemMapGrid::Zebra
@ Zebra
Black/white pattern.
Definition: qgslayoutitemmapgrid.h:231
QgsLayoutItemMapGrid
An individual grid which is drawn above the map content in a QgsLayoutItemMap.
Definition: qgslayoutitemmapgrid.h:138
QgsLayoutItemMapGrid::InteriorTicks
@ InteriorTicks
Tick markers drawn inside map frame.
Definition: qgslayoutitemmapgrid.h:232
QgsLayoutItemMapGrid::VerticalDescending
@ VerticalDescending
Draw annotations vertically, descending.
Definition: qgslayoutitemmapgrid.h:194
QgsLayoutItemMapGrid::LongitudeOnly
@ LongitudeOnly
Show longitude/x annotations/divisions only.
Definition: qgslayoutitemmapgrid.h:174
QgsLayoutItemMapItemStack::readXml
virtual bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)=0
Sets the item stack's state from a DOM document, where element is a DOM node corresponding to a 'Layo...
QgsLayoutItemMapGrid::style
GridStyle style() const
Returns the grid's style, which controls how the grid is drawn over the map's contents.
Definition: qgslayoutitemmapgrid.h:456
QgsLayoutObject::refresh
virtual void refresh()
Refreshes the object, causing a recalculation of any property overrides.
Definition: qgslayoutobject.h:304
QgsLayoutItemMapGrid::DynamicPageSizeBased
@ DynamicPageSizeBased
Dynamically sized, based on a on-page size range.
Definition: qgslayoutitemmapgrid.h:153
QgsReadWriteContext
Definition: qgsreadwritecontext.h:34
QgsLayoutItemMapGrid::annotationExpression
QString annotationExpression() const
Returns the expression used for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:690
QgsLayoutItemMapGrid::OutsideMapFrame
@ OutsideMapFrame
Draw annotations outside the map frame.
Definition: qgslayoutitemmapgrid.h:184
QgsLayoutItemMapItem::draw
virtual void draw(QPainter *painter)=0
Draws the item on to a destination painter.
QgsLayoutItemMapItem::createExpressionContext
QgsExpressionContext createExpressionContext() const override
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Definition: qgslayoutitemmapitem.cpp:124
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsLayoutItemMapGrid::ExteriorTicks
@ ExteriorTicks
Tick markers drawn outside map frame.
Definition: qgslayoutitemmapgrid.h:233
QgsLayoutItemMapGrid::ShowAll
@ ShowAll
Show both latitude and longitude annotations/divisions.
Definition: qgslayoutitemmapgrid.h:172
QgsLayoutItemMapGrid::framePenColor
QColor framePenColor() const
Retrieves the color of the stroke drawn in the grid frame.
Definition: qgslayoutitemmapgrid.h:821
QgsLayoutItemMapGrid::setBlendMode
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blending mode used for drawing the grid.
Definition: qgslayoutitemmapgrid.h:288
QgsLayoutItemMapGrid::annotationFont
QFont annotationFont() const
Returns the font used for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:574
QgsLayoutItemMapGrid::FrameSideFlag
FrameSideFlag
Flags for controlling which side of the map a frame is drawn on.
Definition: qgslayoutitemmapgrid.h:243
QgsLayoutItemMapGrid::GridStyle
GridStyle
Grid drawing style.
Definition: qgslayoutitemmapgrid.h:159
QgsLayoutItemMapGrid::maximumIntervalWidth
double maximumIntervalWidth() const
Returns the maximum width (in millimeters) for grid segments.
Definition: qgslayoutitemmapgrid.h:427
QgsRenderContext
Definition: qgsrendercontext.h:57
QgsLayoutItemMapItem
An item which is drawn inside a QgsLayoutItemMap, e.g., a grid or map overview.
Definition: qgslayoutitemmapitem.h:33
QgsStyleEntityVisitorInterface
Definition: qgsstyleentityvisitor.h:33
QgsLayoutItemMapGrid::annotationFormat
AnnotationFormat annotationFormat() const
Returns the format for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:676
QgsLayoutItemMapItemStack
A collection of map items which are drawn above the map content in a QgsLayoutItemMap....
Definition: qgslayoutitemmapitem.h:230
QgsLayoutItemMapGrid::ZebraNautical
@ ZebraNautical
Black/white pattern, with nautical style diagonals on corners.
Definition: qgslayoutitemmapgrid.h:237
QgsLayoutItemMapGrid::setFramePenColor
void setFramePenColor(const QColor &color)
Sets the color of the stroke drawn in the grid frame.
Definition: qgslayoutitemmapgrid.h:812
QgsLayoutItemMapGrid::DegreeMinutePadded
@ DegreeMinutePadded
Degree/minutes, with minutes using leading zeros where required.
Definition: qgslayoutitemmapgrid.h:208
QgsLayoutItemMapGrid::intervalY
double intervalY() const
Returns the interval between grid lines in the y-direction.
Definition: qgslayoutitemmapgrid.h:362
QgsLayoutItemMapGrid::CM
@ CM
Grid units in centimeters.
Definition: qgslayoutitemmapgrid.h:152
QgsLayoutItemMapGrid::annotationPrecision
int annotationPrecision() const
Returns the coordinate precision for grid annotations, which is the number of decimal places shown wh...
Definition: qgslayoutitemmapgrid.h:600
QgsLayoutItemMapGrid::DisplayMode
DisplayMode
Display settings for grid annotations and frames.
Definition: qgslayoutitemmapgrid.h:170
QgsLayoutItemMapGrid::offsetX
double offsetX() const
Returns the offset for grid lines in the x-direction.
Definition: qgslayoutitemmapgrid.h:378
QgsRectangle
Definition: qgsrectangle.h:41
QgsLayoutItemMapGrid::InteriorExteriorTicks
@ InteriorExteriorTicks
Tick markers drawn both inside and outside the map frame.
Definition: qgslayoutitemmapgrid.h:234
QgsLayoutItemMapGrid::LatitudeOnly
@ LatitudeOnly
Show latitude/y annotations/divisions only.
Definition: qgslayoutitemmapgrid.h:173
QgsLayoutItemMapGrid::setAnnotationExpression
void setAnnotationExpression(const QString &expression)
Sets the expression used for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:683
precision
int precision
Definition: qgswfsgetfeature.cpp:103
QgsLayoutItemMapItemStack::operator[]
QgsLayoutItemMapItem & operator[](int index)
Returns a reference to an item at the specified index within the stack.
Definition: qgslayoutitemmapitem.cpp:237
SIP_SKIP
#define SIP_SKIP
Definition: qgis_sip.h:126
QgsLayoutItemMapGrid::crs
QgsCoordinateReferenceSystem crs() const
Retrieves the CRS for the grid.
Definition: qgslayoutitemmapgrid.h:282
QgsLayoutItemMapGrid::GridUnit
GridUnit
Unit for grid values.
Definition: qgslayoutitemmapgrid.h:148
QgsMarkerSymbol
Definition: qgssymbol.h:917
QgsLayoutItemMapGrid::AnnotationDirection
AnnotationDirection
Direction of grid annotations.
Definition: qgslayoutitemmapgrid.h:190
QgsLayoutItemMapGrid::MapUnit
@ MapUnit
Grid units follow map units.
Definition: qgslayoutitemmapgrid.h:150
qgis_sip.h
QgsLayoutItemMapGrid::setFrameFillColor1
void setFrameFillColor1(const QColor &color)
Sets the first fill color used for the grid frame.
Definition: qgslayoutitemmapgrid.h:829
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsLayoutItemMapGrid::LineBorderNautical
@ LineBorderNautical
Simple solid line frame, with nautical style diagonals on corners.
Definition: qgslayoutitemmapgrid.h:236
QgsLayoutItemMapGrid::DegreeMinuteSecondPadded
@ DegreeMinuteSecondPadded
Degree/minutes/seconds, with minutes using leading zeros where required.
Definition: qgslayoutitemmapgrid.h:210
QgsLineSymbol
Definition: qgssymbol.h:1117
QgsLayoutItemMapGrid::Right
@ Right
Right border.
Definition: qgslayoutitemmapgrid.h:220
QgsLayoutItemMapItem::readXml
virtual bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)
Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'Layout...
Definition: qgslayoutitemmapitem.cpp:55
QgsLayoutItemMapGrid::annotationFrameDistance
double annotationFrameDistance() const
Returns the distance between the map frame and annotations.
Definition: qgslayoutitemmapgrid.h:645
QgsLayoutItemMapGrid::AnnotationPosition
AnnotationPosition
Position for grid annotations.
Definition: qgslayoutitemmapgrid.h:181
QgsLayoutItemMapGrid::setAnnotationFormat
void setAnnotationFormat(const AnnotationFormat format)
Sets the format for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:670
QgsLayoutItemMapItem::usesAdvancedEffects
virtual bool usesAdvancedEffects() const
Returns true if the item is drawn using advanced effects, such as blend modes.
Definition: qgslayoutitemmapitem.cpp:109
QgsLayoutItemMapGrid::frameFillColor1
QColor frameFillColor1() const
Retrieves the first fill color for the grid frame.
Definition: qgslayoutitemmapgrid.h:837
QgsLayoutItemMapGrid::setAnnotationFont
void setAnnotationFont(const QFont &font)
Sets the font used for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:568
QgsLayoutItemMapGrid::BorderSide
BorderSide
Border sides for annotations.
Definition: qgslayoutitemmapgrid.h:217
QgsLayoutItemMapGrid::crossLength
double crossLength() const
Retrieves the length (in layout units) of the cross segments drawn for the grid.
Definition: qgslayoutitemmapgrid.h:470
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsLayoutItemMapItemStack::asList
QList< QgsLayoutItemMapItem * > asList() const
Returns a list of QgsLayoutItemMapItems contained by the stack.
Definition: qgslayoutitemmapitem.cpp:242
QgsLayoutItemMapGrid::Solid
@ Solid
Definition: qgslayoutitemmapgrid.h:161
QgsLayoutItemMapGrid::Bottom
@ Bottom
Bottom border.
Definition: qgslayoutitemmapgrid.h:221
QgsLayoutItemMapGrid::annotationFontColor
QColor annotationFontColor() const
Returns the font color used for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:586
QgsLayoutItemMapGrid::Cross
@ Cross
Draw line crosses at intersections of grid lines.
Definition: qgslayoutitemmapgrid.h:162
QgsLayoutItemMap
Layout graphical items for displaying a map.
Definition: qgslayoutitemmap.h:39
QgsLayoutItemMapGrid::setFrameStyle
void setFrameStyle(const FrameStyle style)
Sets the grid frame style.
Definition: qgslayoutitemmapgrid.h:700
QgsLayoutItemMapGrid::frameWidth
double frameWidth() const
Gets the grid frame width in layout units.
Definition: qgslayoutitemmapgrid.h:773
QgsLayoutItemMapGrid::units
GridUnit units() const
Returns the units used for grid measurements such as the interval and offset for grid lines.
Definition: qgslayoutitemmapgrid.h:330
QgsLayoutItemMapGrid::Horizontal
@ Horizontal
Draw annotations horizontally.
Definition: qgslayoutitemmapgrid.h:192
QgsLayoutItemMapGrid::frameFillColor2
QColor frameFillColor2() const
Retrieves the second fill color for the grid frame.
Definition: qgslayoutitemmapgrid.h:853
QgsLayoutItemMapGrid::Vertical
@ Vertical
Draw annotations vertically, ascending.
Definition: qgslayoutitemmapgrid.h:193
QgsLayoutItemMapGrid::DegreeMinute
@ DegreeMinute
Degree/minutes, use NSEW suffix.
Definition: qgslayoutitemmapgrid.h:204
QgsLayoutItemMapGrid::DecimalWithSuffix
@ DecimalWithSuffix
Decimal degrees, use NSEW suffix.
Definition: qgslayoutitemmapgrid.h:206
QgsLayoutItemMapGrid::DegreeMinuteNoSuffix
@ DegreeMinuteNoSuffix
Degree/minutes, use - for S/W coordinates.
Definition: qgslayoutitemmapgrid.h:207
QgsLayoutItemMapItem::writeXml
virtual bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMa...
Definition: qgslayoutitemmapitem.cpp:33
qgslayoutitemmapitem.h
QgsLayoutItemMapGrid::DegreeMinuteSecond
@ DegreeMinuteSecond
Degree/minutes/seconds, use NSEW suffix.
Definition: qgslayoutitemmapgrid.h:205
QgsLayoutItemMapGrid::NoFrame
@ NoFrame
Disable grid frame.
Definition: qgslayoutitemmapgrid.h:230
QgsLayoutItemMapGrid::AnnotationFormat
AnnotationFormat
Format for displaying grid annotations.
Definition: qgslayoutitemmapgrid.h:201
QgsLayoutItemMapGrid::DegreeMinuteSecondNoSuffix
@ DegreeMinuteSecondNoSuffix
Degree/minutes/seconds, use - for S/W coordinates.
Definition: qgslayoutitemmapgrid.h:209
QgsLayoutItemMapGrid::Decimal
@ Decimal
Decimal degrees, use - for S/W coordinates.
Definition: qgslayoutitemmapgrid.h:203
QgsLayoutItemMapGrid::setAnnotationFontColor
void setAnnotationFontColor(const QColor &color)
Sets the font color used for drawing grid annotations.
Definition: qgslayoutitemmapgrid.h:580
QgsLayoutItemMapGrid::frameMargin
double frameMargin() const
Sets the grid frame Margin (in layout units).
Definition: qgslayoutitemmapgrid.h:789
QgsLayoutItemMapGrid::frameStyle
FrameStyle frameStyle() const
Returns the grid frame style.
Definition: qgslayoutitemmapgrid.h:706
QgsLayoutItemMapGrid::setFrameFillColor2
void setFrameFillColor2(const QColor &color)
Sets the second fill color used for the grid frame.
Definition: qgslayoutitemmapgrid.h:845
QgsLayoutItemMapGrid::Markers
@ Markers
Draw markers at intersections of grid lines.
Definition: qgslayoutitemmapgrid.h:163
QgsCoordinateTransform
Definition: qgscoordinatetransform.h:52
QgsLayoutItemMapGrid::annotationEnabled
bool annotationEnabled() const
Returns whether annotations are shown for the grid.
Definition: qgslayoutitemmapgrid.h:562
QgsLayoutItemMapGridStack
A collection of grids which is drawn above the map content in a QgsLayoutItemMap. The grid stack cont...
Definition: qgslayoutitemmapgrid.h:44
QgsLayoutItemMapGrid::offsetY
double offsetY() const
Returns the offset for grid lines in the y-direction.
Definition: qgslayoutitemmapgrid.h:394
QgsLayoutItemMapItem::accept
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
Definition: qgslayoutitemmapitem.cpp:132
QgsLayoutItemMapGrid::LineBorder
@ LineBorder
Simple solid line frame.
Definition: qgslayoutitemmapgrid.h:235
qgssymbol.h
QgsLayoutItemMapGrid::AnnotationCoordinate
AnnotationCoordinate
Annotation coordinate type.
Definition: qgslayoutitemmapgrid.h:255
QgsLayoutItemMapGrid::blendMode
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the grid.
Definition: qgslayoutitemmapgrid.h:294
QgsLayoutItemMapGrid::minimumIntervalWidth
double minimumIntervalWidth() const
Returns the minimum width (in millimeters) for grid segments.
Definition: qgslayoutitemmapgrid.h:405
QgsLayoutItemMapGrid::setAnnotationEnabled
void setAnnotationEnabled(const bool enabled)
Sets whether annotations should be shown for the grid.
Definition: qgslayoutitemmapgrid.h:556
QgsLayoutItemMapGrid::setAnnotationPrecision
void setAnnotationPrecision(const int precision)
Sets the coordinate precision for grid annotations.
Definition: qgslayoutitemmapgrid.h:593
QgsLayoutItemMapItem::enabled
bool enabled() const
Returns whether the item will be drawn.
Definition: qgslayoutitemmapitem.cpp:104
QgsLayoutItemMapGrid::FrameStyle
FrameStyle
Style for grid frame.
Definition: qgslayoutitemmapgrid.h:228
QgsLayoutItemMapGrid::framePenSize
double framePenSize() const
Retrieves the width of the stroke drawn in the grid frame.
Definition: qgslayoutitemmapgrid.h:803
QgsLayoutItemMapGrid::Left
@ Left
Left border.
Definition: qgslayoutitemmapgrid.h:219
QgsLayoutItemMapGrid::MM
@ MM
Grid units in millimeters.
Definition: qgslayoutitemmapgrid.h:151