Skip to content

Commit

Permalink
Merge pull request #8181 from wonder-sk/py3d
Browse files Browse the repository at this point in the history
Python bindings for QGIS 3D library
  • Loading branch information
wonder-sk committed Oct 15, 2018
2 parents 574c672 + 0f3088a commit 939a910
Show file tree
Hide file tree
Showing 36 changed files with 1,002 additions and 136 deletions.
12 changes: 12 additions & 0 deletions python/3d/3d.sip.in
@@ -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
8 changes: 8 additions & 0 deletions python/3d/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
27 changes: 27 additions & 0 deletions python/3d/__init__.py.in
@@ -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 *
4 changes: 4 additions & 0 deletions python/3d/auto_additions/__init__.py
@@ -0,0 +1,4 @@
"""
This folder is completed using sipify.pl script
It is not aimed to be manually edited
"""
56 changes: 56 additions & 0 deletions python/3d/auto_generated/qgs3dtypes.sip.in
@@ -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 *
************************************************************************/
85 changes: 85 additions & 0 deletions python/3d/auto_generated/qgsphongmaterialsettings.sip.in
@@ -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 *
************************************************************************/
103 changes: 103 additions & 0 deletions python/3d/auto_generated/qgsvectorlayer3drenderer.sip.in
@@ -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 *
************************************************************************/
87 changes: 87 additions & 0 deletions python/3d/auto_generated/symbols/qgsabstract3dsymbol.sip.in
@@ -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.