Skip to content

Commit

Permalink
Work on modernizing atlas
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 5, 2018
1 parent d62bc35 commit e169c21
Show file tree
Hide file tree
Showing 10 changed files with 602 additions and 8 deletions.
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Expand Up @@ -161,6 +161,7 @@
%Include composer/qgscomposermultiframecommand.sip
%Include composer/qgscomposertexttable.sip
%Include composer/qgspaperitem.sip
%Include layout/qgsabstractlayoutiterator.sip
%Include layout/qgslayoutaligner.sip
%Include layout/qgslayoutexporter.sip
%Include layout/qgslayoutgridsettings.sip
Expand Down
103 changes: 103 additions & 0 deletions python/core/layout/qgsabstractlayoutiterator.sip
@@ -0,0 +1,103 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgsabstractlayoutiterator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsAbstractLayoutIterator
{
%Docstring
*************************************************************************
*
This program is free software; you can redistribute it and/or modify *
it under the terms of the GNU General Public License as published by *
the Free Software Foundation; either version 2 of the License, or *
(at your option) any later version. *
*
**************************************************************************
%End

%TypeHeaderCode
#include "qgsabstractlayoutiterator.h"
%End
public:

virtual ~QgsAbstractLayoutIterator();

virtual bool beginRender() = 0;
%Docstring
Called when rendering begins, before iteration commences. Returns true if successful, false if no iteration
is available or required.

.. seealso:: :py:func:`endRender()`
%End

virtual bool endRender() = 0;
%Docstring
Ends the render, performing any required cleanup tasks.
%End

virtual int count() const = 0;
%Docstring
Returns the number of features to iterate over.
%End

virtual bool next() = 0;
%Docstring
Iterates to next feature, returning false if no more features exist to iterate over.

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`last()`

.. seealso:: :py:func:`first()`
%End

virtual bool previous() = 0;
%Docstring
Iterates to the previous feature, returning false if no previous feature exists.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`last()`

.. seealso:: :py:func:`first()`
%End

virtual bool last() = 0;
%Docstring
Seeks to the last feature, returning false if no feature was found.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`first()`
%End

virtual bool first() = 0;
%Docstring
Seeks to the first feature, returning false if no feature was found.

.. seealso:: :py:func:`next()`

.. seealso:: :py:func:`previous()`

.. seealso:: :py:func:`last()`
%End
};




/************************************************************************
* This file has been generated automatically from *
* *
* src/core/layout/qgsabstractlayoutiterator.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
44 changes: 43 additions & 1 deletion python/core/layout/qgslayoutatlas.sip
Expand Up @@ -8,7 +8,7 @@



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

int updateFeatures();
%Docstring
Requeries the current atlas coverage layer and applies filtering and sorting. Returns
number of matching features.
%End

virtual bool beginRender();

virtual bool endRender();

virtual int count() const;


public slots:

virtual bool next();

virtual bool previous();

virtual bool first();

virtual bool last();


signals:

void changed();
Expand All @@ -262,6 +284,26 @@ Emitted when atlas is enabled or disabled.
void coverageLayerChanged( QgsVectorLayer *layer );
%Docstring
Emitted when the coverage layer for the atlas changes.
%End

void messagePushed( const QString &message );
%Docstring
Is emitted when the atlas has an updated status bar ``message``.
%End

void numberFeaturesChanged( int numFeatures );
%Docstring
Emitted when the number of features for the atlas changes.
%End

void renderBegun();
%Docstring
Emitted when atlas rendering has begun.
%End

void renderEnded();
%Docstring
Emitted when atlas rendering has ended.
%End

};
Expand Down
10 changes: 10 additions & 0 deletions python/core/layout/qgslayoutcontext.sip
Expand Up @@ -90,6 +90,8 @@ Sets the current ``feature`` for evaluating the layout. This feature may
be used for altering an item's content and appearance for a report
or atlas layout.

Emits the changed() signal.

.. seealso:: :py:func:`feature()`
%End

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

Emits the changed() signal.

.. seealso:: :py:func:`layer()`
%End

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

.. seealso:: :py:func:`setFlags()`
%End

void changed();
%Docstring
Emitted certain settings in the context is changed, e.g. by setting a new feature or vector layer
for the context.
%End

};
Expand Down
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -1026,6 +1026,7 @@ SET(QGIS_CORE_HDRS
composer/qgscomposertexttable.h
composer/qgspaperitem.h

layout/qgsabstractlayoutiterator.h
layout/qgslayoutaligner.h
layout/qgslayoutexporter.h
layout/qgslayoutgridsettings.h
Expand Down
82 changes: 82 additions & 0 deletions src/core/layout/qgsabstractlayoutiterator.h
@@ -0,0 +1,82 @@
/***************************************************************************
qgsabstractlayoutiterator.h
---------------------------
begin : December 2017
copyright : (C) 2017 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSABSTRACTLAYOUTITERATOR_H
#define QGSABSTRACTLAYOUTITERATOR_H

#include "qgis_core.h"


class CORE_EXPORT QgsAbstractLayoutIterator
{

public:

virtual ~QgsAbstractLayoutIterator() = default;

/**
* Called when rendering begins, before iteration commences. Returns true if successful, false if no iteration
* is available or required.
* \see endRender()
*/
virtual bool beginRender() = 0;

/**
* Ends the render, performing any required cleanup tasks.
*/
virtual bool endRender() = 0;

/**
* Returns the number of features to iterate over.
*/
virtual int count() const = 0;

/**
* Iterates to next feature, returning false if no more features exist to iterate over.
* \see previous()
* \see last()
* \see first()
*/
virtual bool next() = 0;

/**
* Iterates to the previous feature, returning false if no previous feature exists.
* \see next()
* \see last()
* \see first()
*/
virtual bool previous() = 0;

/**
* Seeks to the last feature, returning false if no feature was found.
* \see next()
* \see previous()
* \see first()
*/
virtual bool last() = 0;

/**
* Seeks to the first feature, returning false if no feature was found.
* \see next()
* \see previous()
* \see last()
*/
virtual bool first() = 0;
};

#endif //QGSABSTRACTLAYOUTITERATOR_H



0 comments on commit e169c21

Please sign in to comment.