Skip to content

Commit e169c21

Browse files
committedJan 5, 2018
Work on modernizing atlas
1 parent d62bc35 commit e169c21

10 files changed

+602
-8
lines changed
 

‎python/core/core_auto.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
%Include composer/qgscomposermultiframecommand.sip
162162
%Include composer/qgscomposertexttable.sip
163163
%Include composer/qgspaperitem.sip
164+
%Include layout/qgsabstractlayoutiterator.sip
164165
%Include layout/qgslayoutaligner.sip
165166
%Include layout/qgslayoutexporter.sip
166167
%Include layout/qgslayoutgridsettings.sip
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/layout/qgsabstractlayoutiterator.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
class QgsAbstractLayoutIterator
12+
{
13+
%Docstring
14+
*************************************************************************
15+
*
16+
This program is free software; you can redistribute it and/or modify *
17+
it under the terms of the GNU General Public License as published by *
18+
the Free Software Foundation; either version 2 of the License, or *
19+
(at your option) any later version. *
20+
*
21+
**************************************************************************
22+
%End
23+
24+
%TypeHeaderCode
25+
#include "qgsabstractlayoutiterator.h"
26+
%End
27+
public:
28+
29+
virtual ~QgsAbstractLayoutIterator();
30+
31+
virtual bool beginRender() = 0;
32+
%Docstring
33+
Called when rendering begins, before iteration commences. Returns true if successful, false if no iteration
34+
is available or required.
35+
36+
.. seealso:: :py:func:`endRender()`
37+
%End
38+
39+
virtual bool endRender() = 0;
40+
%Docstring
41+
Ends the render, performing any required cleanup tasks.
42+
%End
43+
44+
virtual int count() const = 0;
45+
%Docstring
46+
Returns the number of features to iterate over.
47+
%End
48+
49+
virtual bool next() = 0;
50+
%Docstring
51+
Iterates to next feature, returning false if no more features exist to iterate over.
52+
53+
.. seealso:: :py:func:`previous()`
54+
55+
.. seealso:: :py:func:`last()`
56+
57+
.. seealso:: :py:func:`first()`
58+
%End
59+
60+
virtual bool previous() = 0;
61+
%Docstring
62+
Iterates to the previous feature, returning false if no previous feature exists.
63+
64+
.. seealso:: :py:func:`next()`
65+
66+
.. seealso:: :py:func:`last()`
67+
68+
.. seealso:: :py:func:`first()`
69+
%End
70+
71+
virtual bool last() = 0;
72+
%Docstring
73+
Seeks to the last feature, returning false if no feature was found.
74+
75+
.. seealso:: :py:func:`next()`
76+
77+
.. seealso:: :py:func:`previous()`
78+
79+
.. seealso:: :py:func:`first()`
80+
%End
81+
82+
virtual bool first() = 0;
83+
%Docstring
84+
Seeks to the first feature, returning false if no feature was found.
85+
86+
.. seealso:: :py:func:`next()`
87+
88+
.. seealso:: :py:func:`previous()`
89+
90+
.. seealso:: :py:func:`last()`
91+
%End
92+
};
93+
94+
95+
96+
97+
/************************************************************************
98+
* This file has been generated automatically from *
99+
* *
100+
* src/core/layout/qgsabstractlayoutiterator.h *
101+
* *
102+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
103+
************************************************************************/

‎python/core/layout/qgslayoutatlas.sip

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010

11-
class QgsLayoutAtlas : QObject, QgsLayoutSerializableObject
11+
class QgsLayoutAtlas : QObject, QgsAbstractLayoutIterator, QgsLayoutSerializableObject
1212
{
1313
%Docstring
1414
Class used to render an Atlas, iterating over geometry features.
@@ -245,8 +245,30 @@ will be set to the expression error.
245245
.. seealso:: :py:func:`setFilterFeatures()`
246246
%End
247247

248+
int updateFeatures();
249+
%Docstring
250+
Requeries the current atlas coverage layer and applies filtering and sorting. Returns
251+
number of matching features.
252+
%End
253+
254+
virtual bool beginRender();
255+
256+
virtual bool endRender();
257+
258+
virtual int count() const;
259+
260+
248261
public slots:
249262

263+
virtual bool next();
264+
265+
virtual bool previous();
266+
267+
virtual bool first();
268+
269+
virtual bool last();
270+
271+
250272
signals:
251273

252274
void changed();
@@ -262,6 +284,26 @@ Emitted when atlas is enabled or disabled.
262284
void coverageLayerChanged( QgsVectorLayer *layer );
263285
%Docstring
264286
Emitted when the coverage layer for the atlas changes.
287+
%End
288+
289+
void messagePushed( const QString &message );
290+
%Docstring
291+
Is emitted when the atlas has an updated status bar ``message``.
292+
%End
293+
294+
void numberFeaturesChanged( int numFeatures );
295+
%Docstring
296+
Emitted when the number of features for the atlas changes.
297+
%End
298+
299+
void renderBegun();
300+
%Docstring
301+
Emitted when atlas rendering has begun.
302+
%End
303+
304+
void renderEnded();
305+
%Docstring
306+
Emitted when atlas rendering has ended.
265307
%End
266308

267309
};

‎python/core/layout/qgslayoutcontext.sip

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ Sets the current ``feature`` for evaluating the layout. This feature may
9090
be used for altering an item's content and appearance for a report
9191
or atlas layout.
9292

93+
Emits the changed() signal.
94+
9395
.. seealso:: :py:func:`feature()`
9496
%End
9597

@@ -113,6 +115,8 @@ Returns the vector layer associated with the layout's context.
113115
%Docstring
114116
Sets the vector ``layer`` associated with the layout's context.
115117

118+
Emits the changed() signal.
119+
116120
.. seealso:: :py:func:`layer()`
117121
%End
118122

@@ -220,6 +224,12 @@ If ``layer`` is -1, all item layers should be rendered.
220224
Emitted whenever the context's ``flags`` change.
221225

222226
.. seealso:: :py:func:`setFlags()`
227+
%End
228+
229+
void changed();
230+
%Docstring
231+
Emitted certain settings in the context is changed, e.g. by setting a new feature or vector layer
232+
for the context.
223233
%End
224234

225235
};

‎src/core/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ SET(QGIS_CORE_HDRS
10261026
composer/qgscomposertexttable.h
10271027
composer/qgspaperitem.h
10281028

1029+
layout/qgsabstractlayoutiterator.h
10291030
layout/qgslayoutaligner.h
10301031
layout/qgslayoutexporter.h
10311032
layout/qgslayoutgridsettings.h
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/***************************************************************************
2+
qgsabstractlayoutiterator.h
3+
---------------------------
4+
begin : December 2017
5+
copyright : (C) 2017 by Nyall Dawson
6+
email : nyall dot dawson at gmail dot com
7+
***************************************************************************/
8+
/***************************************************************************
9+
* *
10+
* This program is free software; you can redistribute it and/or modify *
11+
* it under the terms of the GNU General Public License as published by *
12+
* the Free Software Foundation; either version 2 of the License, or *
13+
* (at your option) any later version. *
14+
* *
15+
***************************************************************************/
16+
#ifndef QGSABSTRACTLAYOUTITERATOR_H
17+
#define QGSABSTRACTLAYOUTITERATOR_H
18+
19+
#include "qgis_core.h"
20+
21+
22+
class CORE_EXPORT QgsAbstractLayoutIterator
23+
{
24+
25+
public:
26+
27+
virtual ~QgsAbstractLayoutIterator() = default;
28+
29+
/**
30+
* Called when rendering begins, before iteration commences. Returns true if successful, false if no iteration
31+
* is available or required.
32+
* \see endRender()
33+
*/
34+
virtual bool beginRender() = 0;
35+
36+
/**
37+
* Ends the render, performing any required cleanup tasks.
38+
*/
39+
virtual bool endRender() = 0;
40+
41+
/**
42+
* Returns the number of features to iterate over.
43+
*/
44+
virtual int count() const = 0;
45+
46+
/**
47+
* Iterates to next feature, returning false if no more features exist to iterate over.
48+
* \see previous()
49+
* \see last()
50+
* \see first()
51+
*/
52+
virtual bool next() = 0;
53+
54+
/**
55+
* Iterates to the previous feature, returning false if no previous feature exists.
56+
* \see next()
57+
* \see last()
58+
* \see first()
59+
*/
60+
virtual bool previous() = 0;
61+
62+
/**
63+
* Seeks to the last feature, returning false if no feature was found.
64+
* \see next()
65+
* \see previous()
66+
* \see first()
67+
*/
68+
virtual bool last() = 0;
69+
70+
/**
71+
* Seeks to the first feature, returning false if no feature was found.
72+
* \see next()
73+
* \see previous()
74+
* \see last()
75+
*/
76+
virtual bool first() = 0;
77+
};
78+
79+
#endif //QGSABSTRACTLAYOUTITERATOR_H
80+
81+
82+

0 commit comments

Comments
 (0)