18 #ifndef QGSCOMPOSERMAPGRID_H
19 #define QGSCOMPOSERMAPGRID_H
72 void removeGrid(
const QString& gridId );
80 void moveGridUp(
const QString& gridId );
88 void moveGridDown(
const QString& gridId );
122 QList< QgsComposerMapGrid* >
asList()
const;
130 bool readXML(
const QDomElement& elem,
const QDomDocument& doc );
136 double maxGridExtension()
const;
206 DegreeMinuteSecondPadded
240 Q_DECLARE_FLAGS( FrameSideFlags, FrameSideFlag )
261 void draw( QPainter* painter );
268 bool writeXML( QDomElement& elem, QDomDocument & doc )
const;
275 bool readXML(
const QDomElement& itemElem,
const QDomDocument& doc );
293 void setBlendMode(
const QPainter::CompositionMode mode ) { mBlendMode = mode; }
299 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
307 double maxExtension()
const;
318 void setUnits(
const GridUnit unit );
333 void setIntervalX(
const double interval );
349 void setIntervalY(
const double interval );
365 void setOffsetX(
const double offset );
373 double offsetX()
const {
return mGridOffsetX; }
381 void setOffsetY(
const double offset );
389 double offsetY()
const {
return mGridOffsetY; }
400 void setStyle(
const GridStyle style );
430 void setGridLineWidth(
const double width );
439 void setGridLineColor(
const QColor& color );
553 void setAnnotationPosition(
const AnnotationPosition position,
const BorderSide border );
561 AnnotationPosition annotationPosition(
const BorderSide border )
const;
580 void setAnnotationDirection(
const AnnotationDirection direction,
const BorderSide border );
586 void setAnnotationDirection(
const AnnotationDirection direction );
593 AnnotationDirection annotationDirection(
const BorderSide border )
const;
630 void setFrameSideFlags(
const FrameSideFlags flags );
639 void setFrameSideFlag(
const FrameSideFlag flag,
bool on =
true );
648 FrameSideFlags frameSideFlags()
const;
658 bool testFrameSideFlag(
const FrameSideFlag flag )
const;
745 bool mTransformDirty;
748 GridStyle mGridStyle;
750 double mGridIntervalX;
752 double mGridIntervalY;
758 QFont mGridAnnotationFont;
760 QColor mGridAnnotationFontColor;
762 int mGridAnnotationPrecision;
764 bool mShowGridAnnotation;
767 AnnotationPosition mLeftGridAnnotationPosition;
769 AnnotationPosition mRightGridAnnotationPosition;
771 AnnotationPosition mTopGridAnnotationPosition;
773 AnnotationPosition mBottomGridAnnotationPosition;
776 double mAnnotationFrameDistance;
779 AnnotationDirection mLeftGridAnnotationDirection;
781 AnnotationDirection mRightGridAnnotationDirection;
783 AnnotationDirection mTopGridAnnotationDirection;
785 AnnotationDirection mBottomGridAnnotationDirection;
786 AnnotationFormat mGridAnnotationFormat;
787 FrameStyle mGridFrameStyle;
788 FrameSideFlags mGridFrameSides;
789 double mGridFrameWidth;
790 double mGridFramePenThickness;
791 QColor mGridFramePenColor;
792 QColor mGridFrameFillColor1;
793 QColor mGridFrameFillColor2;
803 QPainter::CompositionMode mBlendMode;
805 QList< QPair< double, QPolygonF > > mTransformedXLines;
806 QList< QPair< double, QPolygonF > > mTransformedYLines;
807 QList< QgsPoint > mTransformedIntersections;
808 QRectF mPrevPaintRect;
809 QPolygonF mPrevMapPolygon;
811 class QgsMapAnnotation
815 QPointF itemPosition;
820 void drawGridFrame( QPainter* p,
const QList< QPair< double, QLineF > >& hLines,
const QList< QPair< double, QLineF > >& vLines )
const;
826 void drawCoordinateAnnotations( QPainter* p,
const QList< QPair< double, QLineF > >& hLines,
const QList< QPair< double, QLineF > >& vLines )
const;
828 void drawCoordinateAnnotation( QPainter* p,
const QPointF& pos, QString annotationString,
const AnnotationCoordinate coordinateType )
const;
836 void drawAnnotation( QPainter* p,
const QPointF& pos,
int rotation,
const QString& annotationText )
const;
838 QString gridAnnotationString(
double value, AnnotationCoordinate coord )
const;
842 int xGridLines( QList< QPair< double, QLineF > >& lines )
const;
846 int yGridLines( QList< QPair< double, QLineF > >& lines )
const;
854 void drawGridLine(
const QPolygonF& line,
QgsRenderContext &context )
const;
856 void sortGridLinesOnBorders(
const QList< QPair< double, QLineF > >& hLines,
const QList< QPair< double, QLineF > >& vLines, QMap< double, double >& leftFrameEntries,
857 QMap< double, double >& rightFrameEntries, QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFrameEntries )
const;
859 void drawGridFrameBorder( QPainter* p,
const QMap< double, double >& borderPos, BorderSide border )
const;
865 BorderSide borderForLineCoord(
const QPointF& p,
const AnnotationCoordinate coordinateType )
const;
870 static QPolygonF trimLineToMap(
const QPolygonF& line,
const QgsRectangle& rect );
872 QPolygonF scalePolygon(
const QPolygonF &polygon,
const double scale )
const;
875 void drawGridCRSTransform(
QgsRenderContext &context,
double dotsPerMM, QList< QPair< double, QLineF > > &horizontalLines,
876 QList< QPair< double, QLineF > > &verticalLines );
878 void drawGridNoTransform(
QgsRenderContext &context,
double dotsPerMM, QList<QPair<double, QLineF> > &horizontalLines, QList<QPair<double, QLineF> > &verticalLines )
const;
880 void createDefaultGridLineSymbol();
882 void createDefaultGridMarkerSymbol();
884 void drawGridMarker(
const QPointF &point,
QgsRenderContext &context )
const;
886 void drawGridFrameZebraBorder( QPainter *p,
const QMap<double, double> &borderPos, BorderSide border )
const;
888 void drawGridFrameTicks( QPainter *p,
const QMap<double, double> &borderPos, BorderSide border )
const;
890 void drawGridFrameLineBorder( QPainter *p, BorderSide border )
const;
892 void calculateCRSTransformLines();
894 friend class TestQgsComposerMapGrid;
897 #endif // QGSCOMPOSERMAPGRID_H