Skip to content

Commit

Permalink
Python bindings for QGIS 3D library
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Oct 13, 2018
1 parent 94a7d9d commit 88cb831
Show file tree
Hide file tree
Showing 19 changed files with 760 additions and 6 deletions.
12 changes: 12 additions & 0 deletions python/3d/3d.sip.in
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Include auto-generated SIP files
%Include auto_generated/qgs3dutils.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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""
This folder is completed using sipify.pl script
It is not aimed to be manually edited
"""
37 changes: 37 additions & 0 deletions python/3d/auto_generated/qgs3dutils.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgs3dutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/







enum AltitudeClamping
{
AltClampAbsolute,
AltClampRelative,
AltClampTerrain,
};


enum AltitudeBinding
{
AltBindVertex,
AltBindCentroid,
};



/************************************************************************
* This file has been generated automatically from *
* *
* src/3d/qgs3dutils.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
80 changes: 80 additions & 0 deletions python/3d/auto_generated/qgsphongmaterialsettings.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/************************************************************************
* 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.

.. 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 *
************************************************************************/
98 changes: 98 additions & 0 deletions python/3d/auto_generated/qgsvectorlayer3drenderer.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/************************************************************************
* 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

.. 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 *
************************************************************************/
82 changes: 82 additions & 0 deletions python/3d/auto_generated/symbols/qgsabstract3dsymbol.sip.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/************************************************************************
* 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.

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

0 comments on commit 88cb831

Please sign in to comment.