Skip to content

Commit

Permalink
Dox, build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 5, 2020
1 parent fbad4e3 commit 6f90139
Show file tree
Hide file tree
Showing 11 changed files with 99 additions and 15 deletions.
74 changes: 73 additions & 1 deletion python/core/auto_generated/annotations/qgsannotationitem.sip.in
Expand Up @@ -15,7 +15,7 @@ class QgsAnnotationItem
%Docstring
Abstract base class for annotation items which are drawn with QgsAnnotationLayers.

.. versionadded:: 3.12
.. versionadded:: 3.16
%End

%TypeHeaderCode
Expand All @@ -24,6 +24,10 @@ Abstract base class for annotation items which are drawn with QgsAnnotationLayer
public:

QgsAnnotationItem( const QgsCoordinateReferenceSystem &crs );
%Docstring
Constructor for an annotation item, with the specified ``crs`` for storing
its geographic location.
%End


virtual ~QgsAnnotationItem();
Expand All @@ -39,6 +43,9 @@ Returns a unique (untranslated) string identifying the type of item.
%End

QgsCoordinateReferenceSystem crs() const;
%Docstring
Returns the CRS used for storing the location of the item.
%End

virtual void render( QgsRenderContext &context, QgsFeedback *feedback ) = 0;
%Docstring
Expand All @@ -54,6 +61,10 @@ Writes the item's state the an XML ``element``.
%End

int zIndex() const;
%Docstring
Returns the item's z index, which controls the order in which annotation items
are rendered in the layer.
%End

private:
QgsAnnotationItem( const QgsAnnotationItem &other );
Expand Down Expand Up @@ -89,6 +100,67 @@ class QgsMarkerItem : QgsAnnotationItem
QgsMarkerItem( const QgsMarkerItem &other );
};


class QgsLineStringItem : QgsAnnotationItem
{

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

QgsLineStringItem( const QgsLineString &linestring, const QgsCoordinateReferenceSystem &crs );
~QgsLineStringItem();

virtual QString type() const;

virtual void render( QgsRenderContext &context, QgsFeedback *feedback );

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

static QgsLineStringItem *create() /Factory/;
static QgsLineStringItem *createFromElement( const QDomElement &element, const QgsReadWriteContext &context ) /Factory/;

virtual QgsLineStringItem *clone() /Factory/;


const QgsLineSymbol *symbol() const;
void setSymbol( QgsLineSymbol *symbol /Transfer/ );

private:
QgsLineStringItem( const QgsLineStringItem &other );
};


class QgsPolygonItem : QgsAnnotationItem
{

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

QgsPolygonItem( const QgsPolygon &polygon, const QgsCoordinateReferenceSystem &crs );
~QgsPolygonItem();

virtual QString type() const;

virtual void render( QgsRenderContext &context, QgsFeedback *feedback );

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

static QgsPolygonItem *create() /Factory/;
static QgsPolygonItem *createFromElement( const QDomElement &element, const QgsReadWriteContext &context ) /Factory/;

virtual QgsPolygonItem *clone() /Factory/;


const QgsFillSymbol *symbol() const;
void setSymbol( QgsFillSymbol *symbol /Transfer/ );

private:
QgsPolygonItem( const QgsPolygonItem &other );
};
/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
Expand Up @@ -20,7 +20,7 @@ GUI behavior of QgsAnnotationItems.

In C++ you can use QgsAnnotationItemMetadata convenience class.

.. versionadded:: 3.12
.. versionadded:: 3.16
%End

%TypeHeaderCode
Expand Down Expand Up @@ -83,7 +83,7 @@ QgsAnnotationItemRegistry is not usually directly created, but rather accessed t
A companion class, :py:class:`QgsAnnotationItemGuiRegistry`, handles the GUI behavior
of annotation items.

.. versionadded:: 3.12
.. versionadded:: 3.16
%End

%TypeHeaderCode
Expand Down
Expand Up @@ -21,7 +21,7 @@ text items.
Annotation layers store a set of QgsAnnotationItem items, which are rendered according to the item's
z-order.

.. versionadded:: 3.12
.. versionadded:: 3.16
%End

%TypeHeaderCode
Expand Down
2 changes: 1 addition & 1 deletion python/core/auto_generated/qgsmaplayer.sip.in
Expand Up @@ -20,7 +20,7 @@ enum class QgsMapLayerType
RasterLayer,
PluginLayer,
MeshLayer,
VectorTileLayer
VectorTileLayer,
AnnotationLayer,
};

Expand Down
2 changes: 1 addition & 1 deletion src/core/annotations/qgsannotationitem.cpp
Expand Up @@ -265,7 +265,7 @@ void QgsPolygonItem::render( QgsRenderContext &context, QgsFeedback * )

QPolygonF exterior = mPolygon.exteriorRing()->asQPolygonF();
transformRing( exterior );
QList<QPolygonF> rings;
QVector<QPolygonF> rings;
rings.reserve( mPolygon.numInteriorRings() );
for ( int i = 0; i < mPolygon.numInteriorRings(); ++i )
{
Expand Down
15 changes: 13 additions & 2 deletions src/core/annotations/qgsannotationitem.h
Expand Up @@ -33,12 +33,16 @@ class QgsFillSymbol;
* \ingroup core
* Abstract base class for annotation items which are drawn with QgsAnnotationLayers.
*
* \since QGIS 3.12
* \since QGIS 3.16
*/
class CORE_EXPORT QgsAnnotationItem
{
public:

/**
* Constructor for an annotation item, with the specified \a crs for storing
* its geographic location.
*/
QgsAnnotationItem( const QgsCoordinateReferenceSystem &crs );

#ifndef SIP_RUN
Expand All @@ -60,7 +64,10 @@ class CORE_EXPORT QgsAnnotationItem
*/
virtual QString type() const = 0;

QgsCoordinateReferenceSystem crs() const { return QgsCoordinateReferenceSystem(); }
/**
* Returns the CRS used for storing the location of the item.
*/
QgsCoordinateReferenceSystem crs() const { return mCrs; }

/**
* Renders the item to the specified render \a context.
Expand All @@ -75,6 +82,10 @@ class CORE_EXPORT QgsAnnotationItem
*/
virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const = 0;

/**
* Returns the item's z index, which controls the order in which annotation items
* are rendered in the layer.
*/
int zIndex() const { return 0; }

private:
Expand Down
6 changes: 3 additions & 3 deletions src/core/annotations/qgsannotationitemregistry.h
Expand Up @@ -36,7 +36,7 @@ class QgsReadWriteContext;
* GUI behavior of QgsAnnotationItems.
*
* \note In C++ you can use QgsAnnotationItemMetadata convenience class.
* \since QGIS 3.12
* \since QGIS 3.16
*/
class CORE_EXPORT QgsAnnotationItemAbstractMetadata
{
Expand Down Expand Up @@ -102,7 +102,7 @@ typedef std::function<QgsAnnotationItem *()> QgsAnnotationItemDefaultCreateFunc
* \ingroup core
* Convenience metadata class that uses static functions to create annotation items and their configuration widgets.
* \note not available in Python bindings
* \since QGIS 3.12
* \since QGIS 3.16
*/
class CORE_EXPORT QgsAnnotationItemMetadata : public QgsAnnotationItemAbstractMetadata
{
Expand Down Expand Up @@ -155,7 +155,7 @@ class CORE_EXPORT QgsAnnotationItemMetadata : public QgsAnnotationItemAbstractMe
* A companion class, QgsAnnotationItemGuiRegistry, handles the GUI behavior
* of annotation items.
*
* \since QGIS 3.12
* \since QGIS 3.16
*/
class CORE_EXPORT QgsAnnotationItemRegistry : public QObject
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/annotations/qgsannotationlayer.h
Expand Up @@ -34,7 +34,7 @@ class QgsAnnotationItem;
* Annotation layers store a set of QgsAnnotationItem items, which are rendered according to the item's
* z-order.
*
* \since QGIS 3.12
* \since QGIS 3.16
*/
class CORE_EXPORT QgsAnnotationLayer : public QgsMapLayer
{
Expand All @@ -44,7 +44,7 @@ class CORE_EXPORT QgsAnnotationLayer : public QgsMapLayer

/**
* Setting options for loading annotation layers.
* \since QGIS 3.12
* \since QGIS 3.16
*/
struct LayerOptions
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/annotations/qgsannotationlayerrenderer.h
Expand Up @@ -31,7 +31,7 @@ class QgsAnnotationLayer;
* Implementation of threaded rendering for annotation layers.
*
* \note not available in Python bindings
* \since QGIS 3.12
* \since QGIS 3.16
*/
class CORE_EXPORT QgsAnnotationLayerRenderer : public QgsMapLayerRenderer
{
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsmapclippingutils.cpp
Expand Up @@ -149,6 +149,7 @@ QPainterPath QgsMapClippingUtils::calculatePainterClipRegion( const QList<QgsMap
case QgsMapLayerType::MeshLayer:
case QgsMapLayerType::RasterLayer:
case QgsMapLayerType::PluginLayer:
case QgsMapLayerType::AnnotationLayer:
// for these layer types, we ignore the region's featureClip behavior.
break;

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.h
Expand Up @@ -70,7 +70,7 @@ enum class QgsMapLayerType SIP_MONKEYPATCH_SCOPEENUM_UNNEST( QgsMapLayer, LayerT
RasterLayer,
PluginLayer,
MeshLayer, //!< Added in 3.2
VectorTileLayer //!< Added in 3.14
VectorTileLayer, //!< Added in 3.14
AnnotationLayer, //!< Contains freeform, georeferenced annotations. Added in QGIS 3.16
};

Expand Down

0 comments on commit 6f90139

Please sign in to comment.