Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move QgsAnnotationItem to its own file
  • Loading branch information
nyalldawson committed Aug 5, 2020
1 parent ecf7664 commit c8e86ae
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 31 deletions.
47 changes: 47 additions & 0 deletions python/core/auto_generated/annotations/qgsannotationitem.sip.in
@@ -0,0 +1,47 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/annotations/qgsannotationitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsAnnotationItem
{
%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 "qgsannotationitem.h"
%End
public:

QgsAnnotationItem *clone();

QgsCoordinateReferenceSystem crs() const;

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

int zIndex() const;

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/annotations/qgsannotationitem.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
18 changes: 1 addition & 17 deletions python/core/auto_generated/annotations/qgsannotationlayer.sip.in
Expand Up @@ -10,7 +10,7 @@



class QgsAnnotationItem
class QgsAnnotationLayer : QgsMapLayer
{
%Docstring
*************************************************************************
Expand All @@ -23,22 +23,6 @@ the Free Software Foundation; either version 2 of the License, or *
**************************************************************************
%End

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

QgsAnnotationItem *clone();

QgsCoordinateReferenceSystem crs() const;

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

};

class QgsAnnotationLayer : QgsMapLayer
{

%TypeHeaderCode
#include "qgsannotationlayer.h"
%End
Expand Down
2 changes: 2 additions & 0 deletions python/core/core_auto.sip
Expand Up @@ -255,6 +255,8 @@
%Include auto_generated/./3d/qgsabstract3dsymbol.sip
%Include auto_generated/./3d/qgsabstract3drenderer.sip
%Include auto_generated/annotations/qgsannotation.sip
%Include auto_generated/annotations/qgsannotationitem.sip
%Include auto_generated/annotations/qgsannotationlayer.sip
%Include auto_generated/annotations/qgsannotationmanager.sip
%Include auto_generated/annotations/qgshtmlannotation.sip
%Include auto_generated/annotations/qgssvgannotation.sip
Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -125,6 +125,7 @@ SET(QGIS_CORE_SRCS
auth/qgsauthmethodregistry.cpp

annotations/qgsannotation.cpp
annotations/qgsannotationitem.cpp
annotations/qgsannotationlayer.cpp
annotations/qgsannotationlayerrenderer.cpp
annotations/qgsannotationmanager.cpp
Expand Down Expand Up @@ -1047,6 +1048,7 @@ SET(QGIS_CORE_HDRS
3d/qgsabstract3drenderer.h

annotations/qgsannotation.h
annotations/qgsannotationitem.h
annotations/qgsannotationlayer.h
annotations/qgsannotationlayerrenderer.h
annotations/qgsannotationmanager.h
Expand Down
17 changes: 17 additions & 0 deletions src/core/annotations/qgsannotationitem.cpp
@@ -0,0 +1,17 @@
/***************************************************************************
qgsannotationitem.cpp
------------------
copyright : (C) 2019 by Sandro Mani
email : smani at sourcepole dot ch
***************************************************************************/

/***************************************************************************
* *
* 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. *
* *
***************************************************************************/

#include "qgsannotationitem.h"
41 changes: 41 additions & 0 deletions src/core/annotations/qgsannotationitem.h
@@ -0,0 +1,41 @@
/***************************************************************************
qgsannotationitem.h
----------------
copyright : (C) 2019 by Sandro Mani
email : smani at sourcepole dot ch
***************************************************************************/

/***************************************************************************
* *
* 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 QGSANNOTATIONITEM_H
#define QGSANNOTATIONITEM_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsrendercontext.h"

class QgsFeedback;

class CORE_EXPORT QgsAnnotationItem
{
public:

QgsAnnotationItem *clone() { return nullptr; }

QgsCoordinateReferenceSystem crs() const { return QgsCoordinateReferenceSystem(); }

void render( QgsRenderContext &context, QgsFeedback *feedback ) {}

int zIndex() const { return 0; }

};

#endif // QGSANNOTATIONITEM_H
1 change: 1 addition & 0 deletions src/core/annotations/qgsannotationlayer.cpp
Expand Up @@ -16,6 +16,7 @@

#include "qgsannotationlayer.h"
#include "qgsannotationlayerrenderer.h"
#include "qgsannotationitem.h"
#include <QUuid>

QgsAnnotationLayer::QgsAnnotationLayer( const QString &name, const LayerOptions &options )
Expand Down
12 changes: 0 additions & 12 deletions src/core/annotations/qgsannotationlayer.h
Expand Up @@ -24,18 +24,6 @@

class QgsAnnotationItem;

class CORE_EXPORT QgsAnnotationItem
{
public:

QgsAnnotationItem *clone() { return nullptr; }

QgsCoordinateReferenceSystem crs() const { return QgsCoordinateReferenceSystem(); }

void render( QgsRenderContext &context, QgsFeedback *feedback ) {}

};

class CORE_EXPORT QgsAnnotationLayer : public QgsMapLayer
{
Q_OBJECT
Expand Down
2 changes: 1 addition & 1 deletion src/core/annotations/qgsannotationlayerrenderer.cpp
Expand Up @@ -31,7 +31,7 @@ QgsAnnotationLayerRenderer::QgsAnnotationLayerRenderer( QgsAnnotationLayer *laye
mItems << ( *it )->clone();
}

// std::sort( mItems.begin(), mItems.end(), []( QgsAnnotationItem * a, QgsAnnotationItem * b ) { return a->zIndex() < b->zIndex(); } );
std::sort( mItems.begin(), mItems.end(), []( QgsAnnotationItem * a, QgsAnnotationItem * b ) { return a->zIndex() < b->zIndex(); } ); //clazy:exclude=detaching-member
}

QgsAnnotationLayerRenderer::~QgsAnnotationLayerRenderer()
Expand Down
2 changes: 1 addition & 1 deletion src/core/annotations/qgsannotationlayerrenderer.h
Expand Up @@ -22,8 +22,8 @@
#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgsmaplayerrenderer.h"
#include "qgsannotationitem.h"

class QgsAnnotationItem;
class QgsAnnotationLayer;

class CORE_EXPORT QgsAnnotationLayerRenderer : public QgsMapLayerRenderer
Expand Down

0 comments on commit c8e86ae

Please sign in to comment.