Skip to content

Commit a09fbc0

Browse files
committedJul 8, 2014
Port possibility to have several grids / crs in composer map from QGIS Enterprise to master
1 parent e1385c1 commit a09fbc0

10 files changed

+2533
-801
lines changed
 

‎src/app/composer/qgscomposermapwidget.cpp

Lines changed: 613 additions & 452 deletions
Large diffs are not rendered by default.

‎src/app/composer/qgscomposermapwidget.h

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,39 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
5656
void on_mYMinLineEdit_editingFinished();
5757
void on_mYMaxLineEdit_editingFinished();
5858

59+
void on_mAtlasMarginRadio_toggled( bool checked );
60+
61+
void on_mAtlasCheckBox_toggled( bool checked );
62+
void on_mAtlasMarginSpinBox_valueChanged( int value );
63+
void on_mAtlasFixedScaleRadio_toggled( bool checked );
64+
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );
65+
66+
void on_mAddGridPushButton_clicked();
67+
void on_mRemoveGridPushButton_clicked();
68+
void on_mGridUpButton_clicked();
69+
void on_mGridDownButton_clicked();
70+
71+
QgsComposerMapGrid* currentGrid();
5972
void on_mGridCheckBox_toggled( bool state );
73+
void on_mGridListWidget_currentItemChanged( QListWidgetItem* current, QListWidgetItem* previous );
74+
void on_mGridListWidget_itemChanged( QListWidgetItem* item );
75+
void setGridItemsEnabled( bool enabled );
76+
void setGridItems( const QgsComposerMapGrid* grid );
77+
void blockGridItemsSignals( bool block );
78+
void updateLineSymbolMarker( const QgsComposerMapGrid* grid );
79+
void on_mGridLineStyleButton_clicked();
6080
void on_mIntervalXSpinBox_editingFinished();
6181
void on_mIntervalYSpinBox_editingFinished();
62-
void on_mOffsetXSpinBox_editingFinished();
63-
void on_mOffsetYSpinBox_editingFinished();
64-
void on_mGridLineStyleButton_clicked();
82+
void on_mOffsetXSpinBox_valueChanged( double value );
83+
void on_mOffsetYSpinBox_valueChanged( double value );
84+
void on_mCrossWidthSpinBox_valueChanged( double val );
85+
void on_mFrameWidthSpinBox_valueChanged( double val );
86+
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
6587
void on_mGridTypeComboBox_currentIndexChanged( const QString& text );
66-
void on_mCrossWidthSpinBox_valueChanged( double d );
67-
void on_mGridBlendComboBox_currentIndexChanged( int index );
68-
void on_mAnnotationFontButton_clicked();
69-
void on_mAnnotationFontColorButton_colorChanged( const QColor& newFontColor );
70-
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
71-
72-
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
88+
void on_mMapGridCRSButton_clicked();
89+
void on_mMapGridUnitComboBox_currentIndexChanged( const QString& text );
7390

91+
void on_mDrawAnnotationGroupBox_toggled( bool state );
7492
//annotation position
7593
void on_mAnnotationPositionLeftComboBox_currentIndexChanged( const QString& text );
7694
void on_mAnnotationPositionRightComboBox_currentIndexChanged( const QString& text );
@@ -83,22 +101,11 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
83101
void on_mAnnotationDirectionComboBoxTop_currentIndexChanged( const QString& text );
84102
void on_mAnnotationDirectionComboBoxBottom_currentIndexChanged( const QString& text );
85103

86-
void on_mDrawAnnotationCheckableGroupBox_toggled( bool state );
104+
void on_mAnnotationFormatComboBox_currentIndexChanged( int index );
87105
void on_mCoordinatePrecisionSpinBox_valueChanged( int value );
88-
89-
void on_mFrameStyleComboBox_currentIndexChanged( const QString& text );
90-
void on_mFrameWidthSpinBox_valueChanged( double d );
91-
void on_mGridFramePenSizeSpinBox_valueChanged( double d );
92-
void on_mGridFramePenColorButton_colorChanged( const QColor& newColor );
93-
void on_mGridFrameFill1ColorButton_colorChanged( const QColor& newColor );
94-
void on_mGridFrameFill2ColorButton_colorChanged( const QColor& newColor );
95-
96-
void on_mAtlasMarginRadio_toggled( bool checked );
97-
98-
void on_mAtlasCheckBox_toggled( bool checked );
99-
void on_mAtlasMarginSpinBox_valueChanged( int value );
100-
void on_mAtlasFixedScaleRadio_toggled( bool checked );
101-
void on_mAtlasPredefinedScaleRadio_toggled( bool checked );
106+
void on_mDistanceToMapFrameSpinBox_valueChanged( double d );
107+
void on_mAnnotationFontButton_clicked();
108+
void on_mAnnotationFontColorButton_clicked();
102109

103110
protected:
104111
void showEvent( QShowEvent * event );
@@ -149,9 +156,6 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
149156
/**Updates the map combo box with the current composer map ids*/
150157
void refreshMapComboBox();
151158

152-
/**Enables/disables grid frame related controls*/
153-
void toggleFrameControls( bool frameEnabled );
154-
155159
/**Enables or disables the atlas margin and predefined scales radio depending on the atlas coverage layer type*/
156160
void toggleAtlasScalingOptionsByLayerType();
157161

@@ -161,6 +165,9 @@ class QgsComposerMapWidget: public QgsComposerItemBaseWidget, private Ui::QgsCom
161165
/**Is there some predefined scales, globally or as project's options ?*/
162166
bool hasPredefinedScales() const;
163167

168+
QListWidgetItem* addGridListItem( const QString& id, const QString& name );
169+
170+
void loadGridEntries();
164171
};
165172

166173
#endif

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ SET(QGIS_CORE_SRCS
168168
composer/qgscomposerlegenditem.cpp
169169
composer/qgscomposerpicture.cpp
170170
composer/qgscomposermap.cpp
171+
composer/qgscomposermapgrid.cpp
171172
composer/qgscomposertable.cpp
172173
composer/qgscomposertablecolumn.cpp
173174
composer/qgscomposerattributetable.cpp

‎src/core/composer/qgscomposeritem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,12 +863,13 @@ void QgsComposerItem::setEffectsEnabled( bool effectsEnabled )
863863
mEffect->setEnabled( effectsEnabled );
864864
}
865865

866-
void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const
866+
void QgsComposerItem::drawText( QPainter* p, double x, double y, const QString& text, const QFont& font, const QColor& c ) const
867867
{
868868
QFont textFont = scaledFontPixelSize( font );
869869

870870
p->save();
871871
p->setFont( textFont );
872+
p->setPen( c );
872873
double scaleFactor = 1.0 / FONT_WORKAROUND_SCALE;
873874
p->scale( scaleFactor, scaleFactor );
874875
p->drawText( QPointF( x * FONT_WORKAROUND_SCALE, y * FONT_WORKAROUND_SCALE ), text );

‎src/core/composer/qgscomposeritem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ class CORE_EXPORT QgsComposerItem: public QObject, public QGraphicsRectItem
378378

379379
/**Draws Text. Takes care about all the composer specific issues (calculation to pixel, scaling of font and painter
380380
to work around the Qt font bug)*/
381-
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font ) const;
381+
void drawText( QPainter* p, double x, double y, const QString& text, const QFont& font, const QColor& c = QColor( 0, 0, 0 ) ) const;
382382

383383
/**Like the above, but with a rectangle for multiline text
384384
* @param p painter to use

‎src/core/composer/qgscomposermap.cpp

Lines changed: 174 additions & 166 deletions
Large diffs are not rendered by default.

‎src/core/composer/qgscomposermap.h

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <QGraphicsRectItem>
2525

2626
class QgsComposition;
27+
class QgsComposerMapGrid;
2728
class QgsMapRenderer;
2829
class QgsMapToPixel;
2930
class QDomNode;
@@ -104,6 +105,12 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
104105
Top
105106
};
106107

108+
enum AnnotationCoordinate
109+
{
110+
Longitude = 0,
111+
Latitude
112+
};
113+
107114
/** Scaling modes used for the serial rendering (atlas)
108115
*/
109116
enum AtlasScalingMode
@@ -530,6 +537,23 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
530537
*/
531538
QPolygonF visibleExtentPolygon() const;
532539

540+
/**Adds new map grid (takes ownership)*/
541+
void addGrid( QgsComposerMapGrid* grid );
542+
void removeGrid( const QString& name );
543+
void moveGridUp( const QString& name );
544+
void moveGridDown( const QString& name );
545+
const QgsComposerMapGrid* constMapGrid( const QString& id ) const;
546+
QgsComposerMapGrid* mapGrid( const QString& id ) const;
547+
QList< const QgsComposerMapGrid* > mapGrids() const;
548+
549+
int gridCount() const { return mGrids.size(); }
550+
551+
/**Returns extent that considers rotation and shift with mOffsetX / mOffsetY*/
552+
QPolygonF transformedMapPolygon() const;
553+
554+
/**Transforms map coordinates to item coordinates (considering rotation and move offset)*/
555+
QPointF mapToItemCoords( const QPointF& mapCoords ) const;
556+
533557
signals:
534558
void extentChanged();
535559

@@ -552,12 +576,6 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
552576

553577
private:
554578

555-
enum AnnotationCoordinate
556-
{
557-
Longitude = 0,
558-
Latitude
559-
};
560-
561579
/**Unique identifier*/
562580
int mId;
563581

@@ -623,6 +641,9 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
623641
/**Removes layer ids from mLayerSet that are no longer present in the qgis main map*/
624642
void syncLayerSet();
625643

644+
void removeGrids();
645+
void drawGrids( QPainter* p );
646+
626647
/**True if coordinate grid has to be displayed*/
627648
bool mGridEnabled;
628649
/**Solid or crosses*/
@@ -683,6 +704,7 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
683704
QGraphicsView* mMapCanvas;
684705
/**True if annotation items, rubber band, etc. from the main canvas should be displayed*/
685706
bool mDrawCanvasItems;
707+
QList< QgsComposerMapGrid* > mGrids;
686708

687709
/**Adjusts an extent rectangle to match the provided item width and height, so that extent
688710
* center of extent remains the same */
@@ -724,8 +746,6 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
724746
int yGridLines( QList< QPair< double, QLineF > >& lines ) const;
725747
/**Returns extent that considers mOffsetX / mOffsetY (during content move)*/
726748
QgsRectangle transformedExtent() const;
727-
/**Returns extent that considers rotation and shift with mOffsetX / mOffsetY*/
728-
QPolygonF transformedMapPolygon() const;
729749
double maxExtension() const;
730750

731751
/** mapPolygon variant using a given extent */
@@ -737,8 +757,6 @@ class CORE_EXPORT QgsComposerMap : public QgsComposerItem
737757
@param xShift in: shift in x direction (in item units), out: xShift in map units
738758
@param yShift in: shift in y direction (in item units), out: yShift in map units*/
739759
void transformShift( double& xShift, double& yShift ) const;
740-
/**Transforms map coordinates to item coordinates (considering rotation and move offset)*/
741-
QPointF mapToItemCoords( const QPointF& mapCoords ) const;
742760
/**Returns the item border of a point (in item coordinates)*/
743761
Border borderForLineCoord( const QPointF& p ) const;
744762

‎src/core/composer/qgscomposermapgrid.cpp

Lines changed: 1246 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
/***************************************************************************
2+
qgscomposermapgrid.h
3+
--------------------
4+
begin : December 2013
5+
copyright : (C) 2013 by Marco Hugentobler
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 QGSCOMPOSERMAPGRID_H
19+
#define QGSCOMPOSERMAPGRID_H
20+
21+
#include "qgscoordinatereferencesystem.h"
22+
#include "qgscomposermap.h"
23+
#include <QString>
24+
25+
class QgsCoordinateTransform;
26+
class QgsLineSymbolV2;
27+
class QDomDocument;
28+
class QDomElement;
29+
class QPainter;
30+
31+
class CORE_EXPORT QgsComposerMapGrid
32+
{
33+
public:
34+
35+
enum GridUnit
36+
{
37+
MapUnit,
38+
MM,
39+
CM
40+
};
41+
42+
QgsComposerMapGrid( const QString& name, QgsComposerMap* map );
43+
~QgsComposerMapGrid();
44+
45+
/** \brief Reimplementation of QCanvasItem::paint*/
46+
void drawGrid( QPainter* painter ) const;
47+
48+
/**Draws grid if CRS is different to map CRS*/
49+
void drawGridCRSTransform( QPainter* painter ) const;
50+
51+
/** stores state in Dom element
52+
* @param elem is Dom element corresponding to 'ComposerMap' tag
53+
* @param doc Dom document
54+
*/
55+
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
56+
57+
/** sets state from Dom document
58+
* @param itemElem is Dom node corresponding to item tag
59+
* @param doc is Dom document
60+
*/
61+
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
62+
63+
//setters and getters
64+
void setComposerMap( QgsComposerMap* map );
65+
const QgsComposerMap* composerMap() const { return mComposerMap; }
66+
67+
void setName( const QString& name ) { mName = name; }
68+
QString name() const { return mName; }
69+
70+
QString id() const { return mUuid; }
71+
72+
/**Enables a coordinate grid that is shown on top of this composermap.
73+
@note this function was added in version 1.4*/
74+
void setGridEnabled( bool enabled ) {mGridEnabled = enabled;}
75+
bool gridEnabled() const { return mGridEnabled; }
76+
77+
/**Sets coordinate grid style to solid or cross
78+
@note this function was added in version 1.4*/
79+
void setGridStyle( QgsComposerMap::GridStyle style ) {mGridStyle = style;}
80+
QgsComposerMap::GridStyle gridStyle() const { return mGridStyle; }
81+
82+
/**Sets coordinate interval in x-direction for composergrid.
83+
@note this function was added in version 1.4*/
84+
void setGridIntervalX( double interval ) { mGridIntervalX = interval;}
85+
double gridIntervalX() const { return mGridIntervalX; }
86+
87+
/**Sets coordinate interval in y-direction for composergrid.
88+
@note this function was added in version 1.4*/
89+
void setGridIntervalY( double interval ) { mGridIntervalY = interval;}
90+
double gridIntervalY() const { return mGridIntervalY; }
91+
92+
/**Sets x-coordinate offset for composer grid
93+
@note this function was added in version 1.4*/
94+
void setGridOffsetX( double offset ) { mGridOffsetX = offset; }
95+
double gridOffsetX() const { return mGridOffsetX; }
96+
97+
/**Sets y-coordinate offset for composer grid
98+
@note this function was added in version 1.4*/
99+
void setGridOffsetY( double offset ) { mGridOffsetY = offset; }
100+
double gridOffsetY() const { return mGridOffsetY; }
101+
102+
/**Sets the pen to draw composer grid
103+
@note this function was added in version 1.4*/
104+
void setGridPen( const QPen& p );
105+
QPen gridPen() const;
106+
107+
/**Sets with of grid pen
108+
@note this function was added in version 1.4*/
109+
void setGridPenWidth( double w );
110+
111+
/**Sets the color of the grid pen
112+
@note this function was added in version 1.4*/
113+
void setGridPenColor( const QColor& c );
114+
115+
/**Sets font for grid annotations
116+
@note this function was added in version 1.4*/
117+
void setGridAnnotationFont( const QFont& f ) { mGridAnnotationFont = f; }
118+
QFont gridAnnotationFont() const { return mGridAnnotationFont; }
119+
120+
void setGridAnnotationFontColor( const QColor& c ) { mGridAnnotationFontColor = c; }
121+
QColor gridAnnotationFontColor() const { return mGridAnnotationFontColor; }
122+
123+
/**Sets coordinate precision for grid annotations
124+
@note this function was added in version 1.4*/
125+
void setGridAnnotationPrecision( int p ) {mGridAnnotationPrecision = p;}
126+
int gridAnnotationPrecision() const {return mGridAnnotationPrecision;}
127+
128+
/**Sets flag if grid annotation should be shown
129+
@note this function was added in version 1.4*/
130+
void setShowGridAnnotation( bool show ) {mShowGridAnnotation = show;}
131+
bool showGridAnnotation() const {return mShowGridAnnotation;}
132+
133+
void setGridAnnotationPosition( QgsComposerMap::GridAnnotationPosition p, QgsComposerMap::Border border );
134+
QgsComposerMap::GridAnnotationPosition gridAnnotationPosition( QgsComposerMap::Border border ) const;
135+
136+
/**Sets distance between map frame and annotations
137+
@note this function was added in version 1.4*/
138+
void setAnnotationFrameDistance( double d ) {mAnnotationFrameDistance = d;}
139+
double annotationFrameDistance() const {return mAnnotationFrameDistance;}
140+
141+
void setGridAnnotationDirection( QgsComposerMap::GridAnnotationDirection d, QgsComposerMap::Border border );
142+
QgsComposerMap::GridAnnotationDirection gridAnnotationDirection( QgsComposerMap::Border border ) const;
143+
144+
/**Sets grid annotation direction. Can be horizontal, vertical, direction of axis and horizontal and vertical
145+
@note provides compatibility with 1.8 version*/
146+
void setGridAnnotationDirection( QgsComposerMap::GridAnnotationDirection d );
147+
QgsComposerMap::GridAnnotationDirection gridAnnotationDirection() const;
148+
149+
void setGridAnnotationFormat( QgsComposerMap::GridAnnotationFormat f ) { mGridAnnotationFormat = f; }
150+
QgsComposerMap::GridAnnotationFormat gridAnnotationFormat() const { return mGridAnnotationFormat; }
151+
152+
/**Set grid frame style (NoGridFrame or Zebra)
153+
@note: this function was added in version 1.9*/
154+
void setGridFrameStyle( QgsComposerMap::GridFrameStyle style ) { mGridFrameStyle = style; }
155+
QgsComposerMap::GridFrameStyle gridFrameStyle() const { return mGridFrameStyle; }
156+
157+
/**Set grid frame width
158+
@note: this function was added in version 1.9*/
159+
void setGridFrameWidth( double w ) { mGridFrameWidth = w; }
160+
double gridFrameWidth() const { return mGridFrameWidth; }
161+
162+
/**Sets length of the cros segments (if grid style is cross)
163+
@note this function was added in version 1.4*/
164+
void setCrossLength( double l ) {mCrossLength = l;}
165+
double crossLength() const {return mCrossLength;}
166+
167+
void setGridLineSymbol( QgsLineSymbolV2* symbol );
168+
const QgsLineSymbolV2* gridLineSymbol() const { return mGridLineSymbol; }
169+
QgsLineSymbolV2* gridLineSymbol() { return mGridLineSymbol; }
170+
171+
void setCrs( const QgsCoordinateReferenceSystem& crs ) { mCRS = crs; }
172+
QgsCoordinateReferenceSystem crs() const { return mCRS; }
173+
174+
void setGridUnit( GridUnit u ) { mGridUnit = u; }
175+
GridUnit gridUnit() const { return mGridUnit; }
176+
177+
double maxExtension() const;
178+
179+
private:
180+
QgsComposerMapGrid(); //forbidden
181+
182+
QgsComposerMap* mComposerMap;
183+
QString mName;
184+
QString mUuid;
185+
186+
/**True if coordinate grid has to be displayed*/
187+
bool mGridEnabled;
188+
/**Solid or crosses*/
189+
QgsComposerMap::GridStyle mGridStyle;
190+
/**Grid line interval in x-direction (map units)*/
191+
double mGridIntervalX;
192+
/**Grid line interval in y-direction (map units)*/
193+
double mGridIntervalY;
194+
/**Grid line offset in x-direction*/
195+
double mGridOffsetX;
196+
/**Grid line offset in y-direction*/
197+
double mGridOffsetY;
198+
/**Font for grid line annotation*/
199+
QFont mGridAnnotationFont;
200+
/**Font color for grid coordinates*/
201+
QColor mGridAnnotationFontColor;
202+
/**Digits after the dot*/
203+
int mGridAnnotationPrecision;
204+
/**True if coordinate values should be drawn*/
205+
bool mShowGridAnnotation;
206+
207+
/**Annotation position for left map side (inside / outside / not shown)*/
208+
QgsComposerMap::GridAnnotationPosition mLeftGridAnnotationPosition;
209+
/**Annotation position for right map side (inside / outside / not shown)*/
210+
QgsComposerMap::GridAnnotationPosition mRightGridAnnotationPosition;
211+
/**Annotation position for top map side (inside / outside / not shown)*/
212+
QgsComposerMap::GridAnnotationPosition mTopGridAnnotationPosition;
213+
/**Annotation position for bottom map side (inside / outside / not shown)*/
214+
QgsComposerMap::GridAnnotationPosition mBottomGridAnnotationPosition;
215+
216+
/**Distance between map frame and annotation*/
217+
double mAnnotationFrameDistance;
218+
219+
/**Annotation direction on left side ( horizontal or vertical )*/
220+
QgsComposerMap::GridAnnotationDirection mLeftGridAnnotationDirection;
221+
/**Annotation direction on right side ( horizontal or vertical )*/
222+
QgsComposerMap::GridAnnotationDirection mRightGridAnnotationDirection;
223+
/**Annotation direction on top side ( horizontal or vertical )*/
224+
QgsComposerMap::GridAnnotationDirection mTopGridAnnotationDirection;
225+
/**Annotation direction on bottom side ( horizontal or vertical )*/
226+
QgsComposerMap::GridAnnotationDirection mBottomGridAnnotationDirection;
227+
QgsComposerMap::GridAnnotationFormat mGridAnnotationFormat;
228+
QgsComposerMap::GridFrameStyle mGridFrameStyle;
229+
double mGridFrameWidth;
230+
double mCrossLength;
231+
232+
QgsLineSymbolV2* mGridLineSymbol;
233+
234+
QgsCoordinateReferenceSystem mCRS;
235+
236+
GridUnit mGridUnit;
237+
238+
/**Draws the map grid*/
239+
void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ) const;
240+
/**Draw coordinates for mGridAnnotationType Coordinate
241+
@param p drawing painter
242+
@param hLines horizontal coordinate lines in item coordinates
243+
@param vLines vertical coordinate lines in item coordinates*/
244+
void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ) const;
245+
void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString annotationString ) const;
246+
/**Draws a single annotation
247+
@param p drawing painter
248+
@param pos item coordinates where to draw
249+
@param rotation text rotation
250+
@param annotationText the text to draw*/
251+
void drawAnnotation( QPainter* p, const QPointF& pos, int rotation, const QString& annotationText ) const;
252+
QString gridAnnotationString( double value, QgsComposerMap::AnnotationCoordinate coord ) const;
253+
/**Returns the grid lines with associated coordinate value
254+
@return 0 in case of success*/
255+
int xGridLines( QList< QPair< double, QLineF > >& lines ) const;
256+
/**Returns the grid lines for the y-coordinates. Not vertical in case of rotation
257+
@return 0 in case of success*/
258+
int yGridLines( QList< QPair< double, QLineF > >& lines ) const;
259+
int xGridLinesCRSTransform( const QgsRectangle& bbox, const QgsCoordinateTransform& t, QList< QPair< double, QPolygonF > >& lines ) const;
260+
int yGridLinesCRSTransform( const QgsRectangle& bbox, const QgsCoordinateTransform& t, QList< QPair< double, QPolygonF > >& lines ) const;
261+
void drawGridLine( const QLineF& line, QPainter* p ) const;
262+
void drawGridLine( const QPolygonF& line, QPainter* p ) const;
263+
void sortGridLinesOnBorders( const QList< QPair< double, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines, QMap< double, double >& leftFrameEntries,
264+
QMap< double, double >& rightFrameEntries, QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFrameEntries ) const;
265+
void drawGridFrameBorder( QPainter* p, const QMap< double, double >& borderPos, QgsComposerMap::Border border ) const;
266+
/**Returns the item border of a point (in item coordinates)*/
267+
QgsComposerMap::Border borderForLineCoord( const QPointF& p ) const;
268+
/**Get parameters for drawing grid in CRS different to map CRS*/
269+
int crsGridParams( QgsRectangle& crsRect, QgsCoordinateTransform& inverseTransform ) const;
270+
static QPolygonF trimLineToMap( const QPolygonF& line, const QgsRectangle& rect );
271+
};
272+
273+
#endif // QGSCOMPOSERMAPGRID_H

‎src/ui/qgscomposermapwidgetbase.ui

Lines changed: 160 additions & 143 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.