Skip to content
Permalink
Browse files

Merge pull request #8181 from wonder-sk/py3d

Python bindings for QGIS 3D library
  • Loading branch information
wonder-sk committed Oct 15, 2018
2 parents 574c672 + 0f3088a commit 939a910cfc3e84d7d7b87b3e8b10801e661598ba
Showing with 1,002 additions and 136 deletions.
  1. +12 −0 python/3d/3d.sip.in
  2. +8 −0 python/3d/3d_auto.sip
  3. +27 −0 python/3d/__init__.py.in
  4. +4 −0 python/3d/auto_additions/__init__.py
  5. +56 −0 python/3d/auto_generated/qgs3dtypes.sip.in
  6. +85 −0 python/3d/auto_generated/qgsphongmaterialsettings.sip.in
  7. +103 −0 python/3d/auto_generated/qgsvectorlayer3drenderer.sip.in
  8. +87 −0 python/3d/auto_generated/symbols/qgsabstract3dsymbol.sip.in
  9. +116 −0 python/3d/auto_generated/symbols/qgsline3dsymbol.sip.in
  10. +119 −0 python/3d/auto_generated/symbols/qgspoint3dsymbol.sip.in
  11. +130 −0 python/3d/auto_generated/symbols/qgspolygon3dsymbol.sip.in
  12. +29 −0 python/CMakeLists.txt
  13. +10 −0 python/core/auto_generated/3d/qgsabstract3drenderer.sip.in
  14. +4 −4 scripts/prepare-commit.sh
  15. +2 −2 scripts/sipify.pl
  16. +1 −1 scripts/sipify_all.sh
  17. +1 −0 src/3d/CMakeLists.txt
  18. +1 −0 src/3d/qgs3dmapsettings.cpp
  19. +58 −0 src/3d/qgs3dtypes.h
  20. +38 −38 src/3d/qgs3dutils.cpp
  21. +16 −27 src/3d/qgs3dutils.h
  22. +4 −0 src/3d/qgsphongmaterialsettings.h
  23. +12 −2 src/3d/qgsvectorlayer3drenderer.h
  24. +3 −0 src/3d/symbols/qgsabstract3dsymbol.h
  25. +2 −0 src/3d/symbols/qgsline3dsymbol.cpp
  26. +11 −7 src/3d/symbols/qgsline3dsymbol.h
  27. +1 −1 src/3d/symbols/qgsline3dsymbol_p.cpp
  28. +1 −0 src/3d/symbols/qgspoint3dsymbol.cpp
  29. +8 −4 src/3d/symbols/qgspoint3dsymbol.h
  30. +2 −0 src/3d/symbols/qgspolygon3dsymbol.cpp
  31. +14 −10 src/3d/symbols/qgspolygon3dsymbol.h
  32. +12 −1 src/3d/symbols/qgspolygon3dsymbol_p.cpp
  33. +4 −4 src/app/3d/qgsline3dsymbolwidget.cpp
  34. +3 −3 src/app/3d/qgspoint3dsymbolwidget.cpp
  35. +6 −32 src/app/3d/qgspolygon3dsymbolwidget.cpp
  36. +12 −0 src/core/3d/qgsabstract3drenderer.h
@@ -0,0 +1,12 @@
%Module(name=qgis._3d,
keyword_arguments="All")

${DEFAULTDOCSTRINGSIGNATURE}

%Import core/core.sip

%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
%Import QtXml/QtXmlmod.sip

%Include ./3d_auto.sip
@@ -0,0 +1,8 @@
// Include auto-generated SIP files
%Include auto_generated/qgs3dtypes.sip
%Include auto_generated/qgsphongmaterialsettings.sip
%Include auto_generated/qgsvectorlayer3drenderer.sip
%Include auto_generated/symbols/qgsabstract3dsymbol.sip
%Include auto_generated/symbols/qgsline3dsymbol.sip
%Include auto_generated/symbols/qgspoint3dsymbol.sip
%Include auto_generated/symbols/qgspolygon3dsymbol.sip
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
__init__.py
---------------------
Date : May 2014
Copyright : (C) 2014 by Nathan Woodrow
Email : woodrow dot nathan 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. *
* *
***************************************************************************
"""

__author__ = 'Nathan Woodrow'
__date__ = 'May 2014'
__copyright__ = '(C) 2014, Nathan Woodrow'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'

from qgis.PyQt import QtCore
from qgis._3d import *
@@ -0,0 +1,4 @@
"""
This folder is completed using sipify.pl script
It is not aimed to be manually edited
"""
@@ -0,0 +1,56 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgs3dtypes.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/



class Qgs3DTypes
{
%Docstring
Defines enumerations and other auxiliary types for QGIS 3D

.. warning::

This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.

.. versionadded:: 3.4
%End

%TypeHeaderCode
#include "qgs3dtypes.h"
%End
public:
enum AltitudeClamping
{
AltClampAbsolute,
AltClampRelative,
AltClampTerrain,
};

enum AltitudeBinding
{
AltBindVertex,
AltBindCentroid,
};

enum CullingMode
{
NoCulling,
Front,
Back,
FrontAndBack
};
};

/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgs3dtypes.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,85 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsphongmaterialsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/





class QgsPhongMaterialSettings
{
%Docstring
Basic shading material used for rendering based on the Phong shading model
with three color components: ambient, diffuse and specular.

.. warning::

This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsphongmaterialsettings.h"
%End
public:
QgsPhongMaterialSettings();

QColor ambient() const;
%Docstring
Returns ambient color component
%End
QColor diffuse() const;
%Docstring
Returns diffuse color component
%End
QColor specular() const;
%Docstring
Returns specular color component
%End
float shininess() const;
%Docstring
Returns shininess of the surface
%End

void setAmbient( const QColor &ambient );
%Docstring
Sets ambient color component
%End
void setDiffuse( const QColor &diffuse );
%Docstring
Sets diffuse color component
%End
void setSpecular( const QColor &specular );
%Docstring
Sets specular color component
%End
void setShininess( float shininess );
%Docstring
Sets shininess of the surface
%End

void readXml( const QDomElement &elem );
%Docstring
Reads settings from a DOM element
%End
void writeXml( QDomElement &elem ) const;
%Docstring
Writes settings to a DOM element
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsphongmaterialsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,103 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsvectorlayer3drenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/









class QgsVectorLayer3DRendererMetadata : Qgs3DRendererAbstractMetadata
{
%Docstring
Metadata for vector layer 3D renderer to allow creation of its instances from XML

.. warning::

This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsvectorlayer3drenderer.h"
%End
public:
QgsVectorLayer3DRendererMetadata();

virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;

%Docstring
Creates an instance of a 3D renderer based on a DOM element with renderer configuration
%End
};


class QgsVectorLayer3DRenderer : QgsAbstract3DRenderer
{
%Docstring
3D renderer that renders all features of a vector layer with the same 3D symbol.
The appearance is completely defined by the symbol.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsvectorlayer3drenderer.h"
%End
public:
explicit QgsVectorLayer3DRenderer( QgsAbstract3DSymbol *s /Transfer/ = 0 );
%Docstring
Takes ownership of the symbol object
%End

void setLayer( QgsVectorLayer *layer );
%Docstring
Sets vector layer associated with the renderer
%End
QgsVectorLayer *layer() const;
%Docstring
Returns vector layer associated with the renderer
%End

void setSymbol( QgsAbstract3DSymbol *symbol /Transfer/ );
%Docstring
Sets 3D symbol associated with the renderer. Takes ownership of the symbol
%End
const QgsAbstract3DSymbol *symbol() const;
%Docstring
Returns 3D symbol associated with the renderer
%End

virtual QString type() const;
virtual QgsVectorLayer3DRenderer *clone() const /Factory/;


virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;

virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );

virtual void resolveReferences( const QgsProject &project );


private:
QgsVectorLayer3DRenderer( const QgsVectorLayer3DRenderer & );
QgsVectorLayer3DRenderer &operator=( const QgsVectorLayer3DRenderer & );
};


/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgsvectorlayer3drenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,87 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/symbols/qgsabstract3dsymbol.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/







class QgsAbstract3DSymbol
{
%Docstring
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.

3D symbol objects define appearance of GIS data.

.. warning::

This is not considered stable API, and may change in future QGIS releases. It is
exposed to the Python bindings as a tech preview only.

.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgsabstract3dsymbol.h"
%End
public:
virtual ~QgsAbstract3DSymbol();

virtual QString type() const = 0;
%Docstring
Returns identifier of symbol type. Each 3D symbol implementation should return a different type.
%End
virtual QgsAbstract3DSymbol *clone() const = 0 /Factory/;
%Docstring
Returns a new instance of the symbol with the same settings
%End

virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const = 0;
%Docstring
Writes symbol configuration to the given DOM element
%End
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
%Docstring
Reads symbol configuration from the given DOM element
%End

enum Property
{
PropertyHeight,
PropertyExtrusionHeight,
};

static const QgsPropertiesDefinition &propertyDefinitions();
%Docstring
Returns the symbol layer property definitions.
%End

QgsPropertyCollection &dataDefinedProperties();
%Docstring
Returns a reference to the symbol layer's property collection, used for data defined overrides.
%End


void setDataDefinedProperties( const QgsPropertyCollection &collection );
%Docstring
Sets the symbol layer's property collection, used for data defined overrides.
%End

protected:

};


/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/symbols/qgsabstract3dsymbol.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit 939a910

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