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 );
137 double maxGridExtension()
const;
149 void calculateMaxGridExtension(
double& top,
double& right,
double& bottom,
double& left )
const;
265 Q_DECLARE_FLAGS( FrameSideFlags, FrameSideFlag )
318 void setBlendMode(
const QPainter::CompositionMode mode ) { mBlendMode = mode; }
324 QPainter::CompositionMode
blendMode()
const {
return mBlendMode; }
332 double maxExtension();
345 void calculateMaxExtension(
double& top,
double& right,
double& bottom,
double& left );
356 void setUnits(
const GridUnit unit );
371 void setIntervalX(
const double interval );
387 void setIntervalY(
const double interval );
403 void setOffsetX(
const double offset );
411 double offsetX()
const {
return mGridOffsetX; }
419 void setOffsetY(
const double offset );
427 double offsetY()
const {
return mGridOffsetY; }
438 void setStyle(
const GridStyle style );
468 void setGridLineWidth(
const double width );
477 void setGridLineColor(
const QColor& color );
592 void setAnnotationDisplay(
const DisplayMode display,
const BorderSide border );
602 DisplayMode annotationDisplay(
const BorderSide border )
const;
610 void setAnnotationPosition(
const AnnotationPosition position,
const BorderSide border );
618 AnnotationPosition annotationPosition(
const BorderSide border )
const;
637 void setAnnotationDirection(
const AnnotationDirection direction,
const BorderSide border );
643 void setAnnotationDirection(
const AnnotationDirection direction );
650 AnnotationDirection annotationDirection(
const BorderSide border )
const;
702 void setFrameDivisions(
const DisplayMode divisions,
const BorderSide border );
710 DisplayMode frameDivisions(
const BorderSide border )
const;
719 void setFrameSideFlags(
const FrameSideFlags& flags );
728 void setFrameSideFlag(
const FrameSideFlag flag,
bool on =
true );
737 FrameSideFlags frameSideFlags()
const;
747 bool testFrameSideFlag(
const FrameSideFlag flag )
const;
837 GridExtension() : top( 0.0 ), right( 0.0 ), bottom( 0.0 ), left( 0.0 ) {}
845 bool mTransformDirty;
848 GridStyle mGridStyle;
850 double mGridIntervalX;
852 double mGridIntervalY;
858 QFont mGridAnnotationFont;
860 QColor mGridAnnotationFontColor;
862 int mGridAnnotationPrecision;
864 bool mShowGridAnnotation;
867 DisplayMode mLeftGridAnnotationDisplay;
869 DisplayMode mRightGridAnnotationDisplay;
871 DisplayMode mTopGridAnnotationDisplay;
873 DisplayMode mBottomGridAnnotationDisplay;
876 AnnotationPosition mLeftGridAnnotationPosition;
878 AnnotationPosition mRightGridAnnotationPosition;
880 AnnotationPosition mTopGridAnnotationPosition;
882 AnnotationPosition mBottomGridAnnotationPosition;
885 double mAnnotationFrameDistance;
888 AnnotationDirection mLeftGridAnnotationDirection;
890 AnnotationDirection mRightGridAnnotationDirection;
892 AnnotationDirection mTopGridAnnotationDirection;
894 AnnotationDirection mBottomGridAnnotationDirection;
895 AnnotationFormat mGridAnnotationFormat;
897 QString mGridAnnotationExpressionString;
900 FrameStyle mGridFrameStyle;
901 FrameSideFlags mGridFrameSides;
902 double mGridFrameWidth;
903 double mGridFramePenThickness;
904 QColor mGridFramePenColor;
905 QColor mGridFrameFillColor1;
906 QColor mGridFrameFillColor2;
910 DisplayMode mLeftFrameDivisions;
912 DisplayMode mRightFrameDivisions;
914 DisplayMode mTopFrameDivisions;
916 DisplayMode mBottomFrameDivisions;
925 QPainter::CompositionMode mBlendMode;
933 class QgsMapAnnotation
961 void drawCoordinateAnnotation(
QPainter* p,
const QPointF& pos,
QString annotationString,
const AnnotationCoordinate coordinateType, GridExtension* extension = 0 )
const;
969 void drawAnnotation(
QPainter* p,
const QPointF& pos,
int rotation,
const QString& annotationText )
const;
1001 BorderSide borderForLineCoord(
const QPointF& p,
const AnnotationCoordinate coordinateType )
const;
1016 void createDefaultGridLineSymbol();
1018 void createDefaultGridMarkerSymbol();
1026 void drawGridFrameLineBorder(
QPainter *p, BorderSide border,
double* extension = 0 )
const;
1028 void calculateCRSTransformLines();
1033 friend class TestQgsComposerMapGrid;
1036 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsComposerMapGrid::FrameSideFlags )
1038 #endif // QGSCOMPOSERMAPGRID_H
QColor frameFillColor1() const
Retrieves the first fill color for the grid frame.
A rectangle specified with double values.
const QgsMarkerSymbolV2 * markerSymbol() const
Gets the marker symbol used for drawing grid points.
double intervalX() const
Gets the interval between grid lines in the x-direction.
void setBlendMode(const QPainter::CompositionMode mode)
Sets the blending mode used for drawing the grid.
GridStyle
Grid drawing style.
virtual void draw(QPainter *painter)=0
Draws the item on to a painter.
const QgsLineSymbolV2 * lineSymbol() const
Gets the line symbol used for drawing grid lines.
void setFramePenSize(const double width)
Sets the width of the outline drawn in the grid frame.
A collection of grids which is drawn above the map content in a QgsComposerMap.
FrameStyle
Style for grid frame.
double annotationFrameDistance() const
Gets the distance between the map frame and annotations.
QColor frameFillColor2() const
Retrieves the second fill color for the grid frame.
void setAnnotationExpression(const QString &expression)
Sets the expression used for drawing grid annotations.
FrameStyle frameStyle() const
Gets the grid frame style.
void setAnnotationFont(const QFont &font)
Sets the font used for drawing grid annotations.
QColor framePenColor() const
Retrieves the color of the outline drawn in the grid frame.
AnnotationDirection
Direction of grid annotations.
QgsMarkerSymbolV2 * markerSymbol()
Gets the marker symbol used for drawing grid points.
AnnotationFormat annotationFormat() const
Gets the format for drawing grid annotations.
AnnotationFormat
Format for displaying grid annotations.
An item which is drawn inside a QgsComposerMap, eg a grid or map overview.
double intervalY() const
Gets the interval between grid lines in the y-direction.
void setCrossLength(const double length)
Sets the length of the cross segments drawn for the grid.
QFont annotationFont() const
Gets the font used for drawing grid annotations.
virtual QgsExpressionContext * createExpressionContext() const
Creates an expression context relating to the objects's current state.
QList< QgsComposerMapItem * > asList() const
Returns a list of QgsComposerMapItems contained by the stack.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
DisplayMode
Display settings for grid annotations and frames.
void setAnnotationFormat(const AnnotationFormat format)
Sets the format for drawing grid annotations.
AnnotationPosition
Position for grid annotations.
double offsetX() const
Gets the offset for grid lines in the x-direction.
void setAnnotationEnabled(const bool enabled)
Sets whether annotations should be shown for the grid.
QgsComposerMapItem & operator[](int idx)
Returns a reference to an item within the stack.
GridStyle style() const
Gets the grid's style, which controls how the grid is drawn over the map's contents.
FrameSideFlag
Flags for controlling which side of the map a frame is drawn on.
An individual grid which is drawn above the map content in a QgsComposerMap.
QgsLineSymbolV2 * lineSymbol()
Gets the line symbol used for drawing grid lines.
double offsetY() const
Gets the offset for grid lines in the y-direction.
double framePenSize() const
Retrieves the width of the outline drawn in the grid frame.
GridUnit units() const
Gets the units used for grid measurements such as the interval and offset for grid lines...
void setFrameWidth(const double width)
Sets the grid frame width.
void setAnnotationFontColor(const QColor &color)
Sets the font color used for drawing grid annotations.
Object representing map window.
BorderSide
Border sides for annotations.
void setFrameFillColor1(const QColor &color)
Sets the first fill color used for the grid frame.
void setFramePenColor(const QColor &color)
Sets the color of the outline drawn in the grid frame.
int annotationPrecision() const
Returns the coordinate precision for grid annotations.
QPainter::CompositionMode blendMode() const
Retrieves the blending mode used for drawing the grid.
QString annotationExpression() const
Returns the expression used for drawing grid annotations.
virtual bool enabled() const
Returns whether the item will be drawn.
QColor annotationFontColor() const
Gets the font color used for drawing grid annotations.
Contains information about the context of a rendering operation.
A collection of map items which are drawn above the map content in a QgsComposerMap.
Class for storing a coordinate reference system (CRS)
void setAnnotationPrecision(const int precision)
Sets the coordinate precision for grid annotations.
bool annotationEnabled() const
Gets whether annotations are shown for the grid.
double crossLength() const
Retrieves the length of the cross segments drawn for the grid.
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc) override
Sets map item state from a DOM document.
virtual bool usesAdvancedEffects() const
Returns true if the item is drawn using advanced effects, such as blend modes.
void setFrameFillColor2(const QColor &color)
Sets the second fill color used for the grid frame.
void setFrameStyle(const FrameStyle style)
Sets the grid frame style.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const override
Stores map item state in DOM element.
virtual bool readXML(const QDomElement &elem, const QDomDocument &doc)=0
Sets the item stack's state from a DOM document.
QgsCoordinateReferenceSystem crs() const
Retrieves the CRS for the grid.
GridUnit
Unit for grid values.
AnnotationCoordinate
Annotation coordinate type.
void setAnnotationFrameDistance(const double distance)
Sets the distance between the map frame and annotations.
double frameWidth() const
Gets the grid frame width.