Skip to content
Permalink
Browse files

create a core interface for QgsMapCanvas

  • Loading branch information
3nids committed Nov 2, 2018
1 parent 5ae2bae commit 79c5b35a3925336e01e9ac1a6a75fd32eb3b8cdd
@@ -0,0 +1,42 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmapcanvasinterface.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class QgsMapCanvasInterface
{
%Docstring
The QgsMapCanvasInterface class provides a simple interface to access
core components of a map canvas.

.. versionadded:: 3.6
%End

%TypeHeaderCode
#include "qgsmapcanvasinterface.h"
%End
public:
explicit QgsMapCanvasInterface();
%Docstring
Constructor of QgsMapCanvasInterface
%End
virtual ~QgsMapCanvasInterface();

virtual const QgsMapSettings &mapSettings() const = 0 /KeepReference/;
%Docstring
Returns the map settings
%End
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmapcanvasinterface.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -67,6 +67,7 @@
%Include auto_generated/qgslegendsettings.sip
%Include auto_generated/qgslegendstyle.sip
%Include auto_generated/qgslogger.sip
%Include auto_generated/qgsmapcanvasinterface.sip
%Include auto_generated/qgsmapdecoration.sip
%Include auto_generated/qgsmaphittest.sip
%Include auto_generated/qgsmaplayerdependency.sip
@@ -18,7 +18,7 @@



class QgsMapCanvas : QGraphicsView
class QgsMapCanvas : QGraphicsView, QgsMapCanvasInterface
{
%Docstring
Map canvas is a class for displaying all GIS data types on a canvas.
@@ -65,7 +65,8 @@ empty string before setLayers() calls can be made.

void setCurrentLayer( QgsMapLayer *layer );

const QgsMapSettings &mapSettings() const /KeepReference/;
virtual const QgsMapSettings &mapSettings() const ${SIP_FINAL} /KeepReference/;

%Docstring
Gets access to properties used for map rendering

@@ -888,6 +888,7 @@ SET(QGIS_CORE_HDRS
qgslegendsettings.h
qgslegendstyle.h
qgslogger.h
qgsmapcanvasinterface.h
qgsmapdecoration.h
qgsmaplayerref.h
qgsmaphittest.h
@@ -0,0 +1,25 @@
#ifndef QGSMAPCANVASINTERFACE_H
#define QGSMAPCANVASINTERFACE_H

#include "qgis_core.h"
#include "qgis_sip.h"

class QgsMapSettings;

/**
* The QgsMapCanvasInterface class provides a simple interface to access
* core components of a map canvas.
* \since QGIS 3.6
*/
class CORE_EXPORT QgsMapCanvasInterface
{
public:
//! Constructor of QgsMapCanvasInterface
explicit QgsMapCanvasInterface() = default;
virtual ~QgsMapCanvasInterface() = default;

//! Returns the map settings
virtual const QgsMapSettings &mapSettings() const = 0 SIP_KEEPREFERENCE;
};

#endif // QGSMAPCANVASINTERFACE_H
@@ -26,6 +26,7 @@
#include "qgsfeatureid.h"
#include "qgsgeometry.h"
#include "qgis.h"
#include "qgsmapcanvasinterface.h"

#include <QDomDocument>
#include <QGraphicsView>
@@ -71,7 +72,7 @@ class QgsMapCanvasAnnotationItem;
* Map canvas is a class for displaying all GIS data types on a canvas.
*/

class GUI_EXPORT QgsMapCanvas : public QGraphicsView
class GUI_EXPORT QgsMapCanvas : public QGraphicsView, public QgsMapCanvasInterface
{

#ifdef SIP_RUN
@@ -119,7 +120,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
* Gets access to properties used for map rendering
* \since QGIS 2.4
*/
const QgsMapSettings &mapSettings() const SIP_KEEPREFERENCE;
const QgsMapSettings &mapSettings() const FINAL SIP_KEEPREFERENCE;

/**
* sets destination coordinate reference system

0 comments on commit 79c5b35

Please sign in to comment.
You can’t perform that action at this time.