Skip to content

Commit ccad38b

Browse files
committed
[composer] Clean up QgsComposerMap api, add docs and missing sip bindings for composer overviews
1 parent 2671d67 commit ccad38b

20 files changed

+1557
-681
lines changed

python/core/composer/qgscomposermap.sip

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,21 @@ class QgsComposerMap : QgsComposerItem
511511
* @note introduced in QGIS 2.5
512512
*/
513513
QgsComposerMapGrid* grid();
514+
515+
/**Returns the map item's overview stack, which is used to control how over
516+
* are drawn over the map's contents.
517+
* @returns pointer to overview stack
518+
* @see overview()
519+
* @note introduced in QGIS 2.5
520+
*/
521+
QgsComposerMapOverviewStack* overviews();
522+
523+
/**Returns the map item's first overview. This is a convenience function.
524+
* @returns pointer to first overview for map item
525+
* @see overviews()
526+
* @note introduced in QGIS 2.5
527+
*/
528+
QgsComposerMapOverview* overview();
514529

515530
/**In case of annotations, the bounding rectangle can be larger than the map item rectangle
516531
@note this function was added in version 1.4*/
@@ -559,29 +574,56 @@ class QgsComposerMap : QgsComposerItem
559574
double mapUnitsToMM() const;
560575

561576
/**Sets overview frame map. -1 disables the overview frame
562-
@note: this function was added in version 1.9*/
563-
void setOverviewFrameMap( int mapId );
577+
* @note: this function was added in version 1.9
578+
* @deprecated use overview()->setFrameMap() or overviews() instead
579+
*/
580+
void setOverviewFrameMap( int mapId ) /Deprecated/;
581+
564582
/**Returns id of overview frame (or -1 if no overfiew frame)
565-
@note: this function was added in version 1.9*/
566-
int overviewFrameMapId() const;
583+
* @note: this function was added in version 1.9
584+
* @deprecated use overview()->frameMapId() or overviews() instead
585+
*/
586+
int overviewFrameMapId() const /Deprecated/;
587+
588+
/**
589+
* @deprecated use overview()->setFrameSymbol() or overviews() instead
590+
*/
591+
void setOverviewFrameMapSymbol( QgsFillSymbolV2* symbol ) /Deprecated/;
567592

568-
void setOverviewFrameMapSymbol( QgsFillSymbolV2* symbol /Transfer/ );
569-
QgsFillSymbolV2* overviewFrameMapSymbol();
593+
/**
594+
* @deprecated use overview()->frameSymbol() or overviews() instead
595+
*/
596+
QgsFillSymbolV2* overviewFrameMapSymbol() /Deprecated/;
570597

571-
/** Returns the overview's blending mode */
572-
QPainter::CompositionMode overviewBlendMode() const;
573-
/** Sets the overview's blending mode*/
574-
void setOverviewBlendMode( QPainter::CompositionMode blendMode );
598+
/** Returns the overview's blending mode
599+
* @deprecated use overview()->blendMode() or overviews() instead
600+
*/
601+
QPainter::CompositionMode overviewBlendMode() const /Deprecated/;
575602

576-
/** Returns true if the overview frame is inverted */
577-
bool overviewInverted() const;
578-
/** Sets the overview's inversion mode*/
579-
void setOverviewInverted( bool inverted );
603+
/** Sets the overview's blending mode
604+
* @deprecated use overview()->setBlendMode() or overviews() instead
605+
*/
606+
void setOverviewBlendMode( QPainter::CompositionMode blendMode ) /Deprecated/;
580607

581-
/** Returns true if the extent is forced to center on the overview */
608+
/** Returns true if the overview frame is inverted
609+
* @deprecated use overview()->inverted() or overviews() instead
610+
*/
611+
bool overviewInverted() const /Deprecated/;
612+
613+
/** Sets the overview's inversion mode
614+
* @deprecated use overview()->setInverted() or overviews() instead
615+
*/
616+
void setOverviewInverted( bool inverted ) /Deprecated/;
617+
618+
/** Returns true if the extent is forced to center on the overview
619+
* @deprecated use overview()->centered() or overviews() instead
620+
*/
582621
bool overviewCentered() const;
583-
/** Set the overview's centering mode */
584-
void setOverviewCentered( bool centered );
622+
623+
/** Set the overview's centering mode
624+
* @deprecated use overview()->setCentered() or overviews() instead
625+
*/
626+
void setOverviewCentered( bool centered ) /Deprecated/;
585627

586628
/**Sets mId to a number not yet used in the composition. mId is kept if it is not in use.
587629
Usually, this function is called before adding the composer map to the composition*/
@@ -693,7 +735,7 @@ class QgsComposerMap : QgsComposerItem
693735
/**Transforms map coordinates to item coordinates (considering rotation and move offset)*/
694736
QPointF mapToItemCoords( const QPointF& mapCoords ) const;
695737

696-
void connectMapOverviewSignals();
738+
void connectMapOverviewSignals() /Deprecated/;
697739

698740
signals:
699741
void extentChanged();

python/core/composer/qgscomposermapgrid.sip

Lines changed: 6 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* \note added in QGIS 2.5
77
* \see QgsComposerMapGrid
88
*/
9-
class QgsComposerMapGridStack
9+
class QgsComposerMapGridStack : QgsComposerMapItemStack
1010
{
1111
%TypeHeaderCode
1212
#include <qgscomposermapgrid.h>
@@ -47,11 +47,11 @@ class QgsComposerMapGridStack
4747
*/
4848
void moveGridUp( const QString& gridId );
4949

50-
/**Moves a grid up the stack, causing it to be rendered above other grids
51-
* @param gridId id for the QgsComposerMapGrid to move up
50+
/**Moves a grid down the stack, causing it to be rendered below other grids
51+
* @param gridId id for the QgsComposerMapGrid to move down
5252
* @note after moving a grid within the stack, update() should be
5353
* called for the QgsComposerMap to redraw the map with the new grid stack order
54-
* @see moveGridDown
54+
* @see moveGridUp
5555
*/
5656
void moveGridDown( const QString& gridId );
5757

@@ -89,20 +89,6 @@ class QgsComposerMapGridStack
8989
*/
9090
QList< QgsComposerMapGrid* > asList() const;
9191

92-
93-
/**Returns the number of grids in the stack
94-
* @returns number of grids in the stack
95-
*/
96-
int size() const;
97-
98-
/**Stores the state of the grid stack in a DOM node
99-
* @param elem is DOM element corresponding to a 'ComposerMap' tag
100-
* @param doc DOM document
101-
* @returns true if write was successful
102-
* @see readXML
103-
*/
104-
bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
105-
10692
/**Sets the grid stack's state from a DOM document
10793
* @param elem is DOM node corresponding to 'a ComposerMap' tag
10894
* @param doc DOM document
@@ -111,23 +97,12 @@ class QgsComposerMapGridStack
11197
*/
11298
bool readXML( const QDomElement& elem, const QDomDocument& doc );
11399

114-
/**Draws the grids from the stack on a specified painter
115-
* @param painter destination QPainter
116-
*/
117-
void drawGrids( QPainter* painter );
118-
119100
/**Calculates the maximum distance grids within the stack extend
120101
* beyond the QgsComposerMap's item rect
121102
* @returns maximum grid extension
122103
*/
123104
double maxGridExtension() const;
124105

125-
/**Returns whether any grids within the stack contain advanced effects,
126-
* such as blending modes
127-
* @returns true if grid stack contains advanced effects
128-
*/
129-
bool containsAdvancedEffects() const;
130-
131106
};
132107

133108
/**\ingroup MapComposer
@@ -137,7 +112,7 @@ class QgsComposerMapGridStack
137112
* \note added in QGIS 2.5
138113
* \see QgsComposerMapGridStack
139114
*/
140-
class QgsComposerMapGrid
115+
class QgsComposerMapGrid : QgsComposerMapItem
141116
{
142117
%TypeHeaderCode
143118
#include <qgscomposermapgrid.h>
@@ -248,7 +223,7 @@ class QgsComposerMapGrid
248223
/**Draws a grid
249224
* @param painter destination QPainter
250225
*/
251-
void drawGrid( QPainter* painter ) const;
226+
void draw( QPainter* painter ) const;
252227

253228
/**Stores grid state in DOM element
254229
* @param elem is DOM element corresponding to a 'ComposerMap' tag
@@ -264,48 +239,6 @@ class QgsComposerMapGrid
264239
*/
265240
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
266241

267-
/**Sets composer map for the grid
268-
* @param map composer map
269-
* @see composerMap
270-
*/
271-
void setComposerMap( QgsComposerMap* map );
272-
273-
/**Get composer map for the grid
274-
* @returns composer map
275-
* @see setComposerMap
276-
*/
277-
const QgsComposerMap* composerMap() const;
278-
279-
/**Sets the friendly display name for the grid
280-
* @param name display name
281-
* @see name
282-
*/
283-
void setName( const QString& name );
284-
285-
/**Get friendly display name for the grid
286-
* @returns display name
287-
* @see setName
288-
*/
289-
QString name() const;
290-
291-
/**Get the unique id for the grid
292-
* @returns unique id
293-
* @see name
294-
*/
295-
QString id() const;
296-
297-
/**Controls whether the grid will be drawn
298-
* @param enabled set to true to enable drawing of the grid
299-
* @see enabled
300-
*/
301-
void setEnabled( const bool enabled );
302-
303-
/**Returns whether the grid will be drawn
304-
* @returns true if grid will be drawn on the map
305-
* @see setEnabled
306-
*/
307-
bool enabled() const;
308-
309242
/**Sets the CRS for the grid.
310243
* @param crs coordinate reference system for grid
311244
* @see crs

0 commit comments

Comments
 (0)