Skip to content
Permalink
Browse files

[api] Add a Qgs3D singleton object, designed to collect other singlet…

…on-ish

objects in a central place

Copying the pattern setup by the QgsGui singleton container
  • Loading branch information
nyalldawson committed Jul 15, 2020
1 parent 27d3a4b commit bf7d746ae424c8cd3ac7c5c8e587292516db70d8
Showing with 138 additions and 0 deletions.
  1. +1 −0 python/3d/3d_auto.sip
  2. +45 −0 python/3d/auto_generated/qgs3d.sip.in
  3. +2 −0 src/3d/CMakeLists.txt
  4. +32 −0 src/3d/qgs3d.cpp
  5. +58 −0 src/3d/qgs3d.h
@@ -1,5 +1,6 @@
// Include auto-generated SIP files
%Include auto_generated/processing/qgs3dalgorithms.sip
%Include auto_generated/qgs3d.sip
%Include auto_generated/qgs3dmapsettings.sip
%Include auto_generated/qgs3dtypes.sip
%Include auto_generated/qgsabstractvectorlayer3drenderer.sip
@@ -0,0 +1,45 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgs3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class Qgs3D
{
%Docstring
Qgs3D is a singleton class containing various registries and other global members
related to 3D classes.

.. versionadded:: 3.16
%End

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



static Qgs3D *instance();
%Docstring
Returns a pointer to the singleton instance.
%End

~Qgs3D();

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

/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgs3d.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -2,6 +2,7 @@
# sources

SET(QGIS_3D_SRCS
qgs3d.cpp
qgsaabb.cpp
qgsabstract3dengine.cpp
qgsabstractvectorlayer3drenderer.cpp
@@ -73,6 +74,7 @@ SET(QGIS_3D_SRCS

SET(QGIS_3D_HDRS
processing/qgs3dalgorithms.h
qgs3d.h
qgs3danimationsettings.h
qgs3dmapscene.h
qgs3dmapsettings.h
@@ -0,0 +1,32 @@
/***************************************************************************
qgs3d.cpp
----------
begin : July 2020
copyright : (C) 2020 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. *
* *
***************************************************************************/

#include "qgs3d.h"

Qgs3D *Qgs3D::instance()
{
static Qgs3D *sInstance( new Qgs3D() );
return sInstance;
}

Qgs3D::~Qgs3D()
{
}

Qgs3D::Qgs3D()
{
}
@@ -0,0 +1,58 @@
/***************************************************************************
qgs3d.h
--------
begin : July 2020
copyright : (C) 2020 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 QGS3D_H
#define QGS3D_H

#include "qgis_3d.h"
#include "qgis_sip.h"

/**
* \ingroup gui
* Qgs3D is a singleton class containing various registries and other global members
* related to 3D classes.
* \since QGIS 3.16
*/
class _3D_EXPORT Qgs3D
{

public:

//! Qgs3D cannot be copied
Qgs3D( const Qgs3D &other ) = delete;

//! Qgs3D cannot be copied
Qgs3D &operator=( const Qgs3D &other ) = delete;

/**
* Returns a pointer to the singleton instance.
*/
static Qgs3D *instance();

~Qgs3D();

private:

Qgs3D();

#ifdef SIP_RUN
Qgs3D( const Qgs3D &other );
#endif

};

#endif // QGS3D_H

0 comments on commit bf7d746

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