Skip to content

Commit 939a910

Browse files
authored
Merge pull request #8181 from wonder-sk/py3d
Python bindings for QGIS 3D library
2 parents 574c672 + 0f3088a commit 939a910

36 files changed

+1002
-136
lines changed

python/3d/3d.sip.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
%Module(name=qgis._3d,
2+
keyword_arguments="All")
3+
4+
${DEFAULTDOCSTRINGSIGNATURE}
5+
6+
%Import core/core.sip
7+
8+
%Import QtCore/QtCoremod.sip
9+
%Import QtGui/QtGuimod.sip
10+
%Import QtXml/QtXmlmod.sip
11+
12+
%Include ./3d_auto.sip

python/3d/3d_auto.sip

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Include auto-generated SIP files
2+
%Include auto_generated/qgs3dtypes.sip
3+
%Include auto_generated/qgsphongmaterialsettings.sip
4+
%Include auto_generated/qgsvectorlayer3drenderer.sip
5+
%Include auto_generated/symbols/qgsabstract3dsymbol.sip
6+
%Include auto_generated/symbols/qgsline3dsymbol.sip
7+
%Include auto_generated/symbols/qgspoint3dsymbol.sip
8+
%Include auto_generated/symbols/qgspolygon3dsymbol.sip

python/3d/__init__.py.in

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
__init__.py
6+
---------------------
7+
Date : May 2014
8+
Copyright : (C) 2014 by Nathan Woodrow
9+
Email : woodrow dot nathan at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Nathan Woodrow'
21+
__date__ = 'May 2014'
22+
__copyright__ = '(C) 2014, Nathan Woodrow'
23+
# This will get replaced with a git SHA1 when you do a git archive
24+
__revision__ = '$Format:%H$'
25+
26+
from qgis.PyQt import QtCore
27+
from qgis._3d import *
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""
2+
This folder is completed using sipify.pl script
3+
It is not aimed to be manually edited
4+
"""
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/qgs3dtypes.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
class Qgs3DTypes
12+
{
13+
%Docstring
14+
Defines enumerations and other auxiliary types for QGIS 3D
15+
16+
.. warning::
17+
18+
This is not considered stable API, and may change in future QGIS releases. It is
19+
exposed to the Python bindings as a tech preview only.
20+
21+
.. versionadded:: 3.4
22+
%End
23+
24+
%TypeHeaderCode
25+
#include "qgs3dtypes.h"
26+
%End
27+
public:
28+
enum AltitudeClamping
29+
{
30+
AltClampAbsolute,
31+
AltClampRelative,
32+
AltClampTerrain,
33+
};
34+
35+
enum AltitudeBinding
36+
{
37+
AltBindVertex,
38+
AltBindCentroid,
39+
};
40+
41+
enum CullingMode
42+
{
43+
NoCulling,
44+
Front,
45+
Back,
46+
FrontAndBack
47+
};
48+
};
49+
50+
/************************************************************************
51+
* This file has been generated automatically from *
52+
* *
53+
* src/3d/qgs3dtypes.h *
54+
* *
55+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
56+
************************************************************************/
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/qgsphongmaterialsettings.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
class QgsPhongMaterialSettings
14+
{
15+
%Docstring
16+
Basic shading material used for rendering based on the Phong shading model
17+
with three color components: ambient, diffuse and specular.
18+
19+
.. warning::
20+
21+
This is not considered stable API, and may change in future QGIS releases. It is
22+
exposed to the Python bindings as a tech preview only.
23+
24+
.. versionadded:: 3.0
25+
%End
26+
27+
%TypeHeaderCode
28+
#include "qgsphongmaterialsettings.h"
29+
%End
30+
public:
31+
QgsPhongMaterialSettings();
32+
33+
QColor ambient() const;
34+
%Docstring
35+
Returns ambient color component
36+
%End
37+
QColor diffuse() const;
38+
%Docstring
39+
Returns diffuse color component
40+
%End
41+
QColor specular() const;
42+
%Docstring
43+
Returns specular color component
44+
%End
45+
float shininess() const;
46+
%Docstring
47+
Returns shininess of the surface
48+
%End
49+
50+
void setAmbient( const QColor &ambient );
51+
%Docstring
52+
Sets ambient color component
53+
%End
54+
void setDiffuse( const QColor &diffuse );
55+
%Docstring
56+
Sets diffuse color component
57+
%End
58+
void setSpecular( const QColor &specular );
59+
%Docstring
60+
Sets specular color component
61+
%End
62+
void setShininess( float shininess );
63+
%Docstring
64+
Sets shininess of the surface
65+
%End
66+
67+
void readXml( const QDomElement &elem );
68+
%Docstring
69+
Reads settings from a DOM element
70+
%End
71+
void writeXml( QDomElement &elem ) const;
72+
%Docstring
73+
Writes settings to a DOM element
74+
%End
75+
76+
};
77+
78+
79+
/************************************************************************
80+
* This file has been generated automatically from *
81+
* *
82+
* src/3d/qgsphongmaterialsettings.h *
83+
* *
84+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
85+
************************************************************************/
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/qgsvectorlayer3drenderer.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
15+
16+
17+
class QgsVectorLayer3DRendererMetadata : Qgs3DRendererAbstractMetadata
18+
{
19+
%Docstring
20+
Metadata for vector layer 3D renderer to allow creation of its instances from XML
21+
22+
.. warning::
23+
24+
This is not considered stable API, and may change in future QGIS releases. It is
25+
exposed to the Python bindings as a tech preview only.
26+
27+
.. versionadded:: 3.0
28+
%End
29+
30+
%TypeHeaderCode
31+
#include "qgsvectorlayer3drenderer.h"
32+
%End
33+
public:
34+
QgsVectorLayer3DRendererMetadata();
35+
36+
virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;
37+
38+
%Docstring
39+
Creates an instance of a 3D renderer based on a DOM element with renderer configuration
40+
%End
41+
};
42+
43+
44+
class QgsVectorLayer3DRenderer : QgsAbstract3DRenderer
45+
{
46+
%Docstring
47+
3D renderer that renders all features of a vector layer with the same 3D symbol.
48+
The appearance is completely defined by the symbol.
49+
50+
.. versionadded:: 3.0
51+
%End
52+
53+
%TypeHeaderCode
54+
#include "qgsvectorlayer3drenderer.h"
55+
%End
56+
public:
57+
explicit QgsVectorLayer3DRenderer( QgsAbstract3DSymbol *s /Transfer/ = 0 );
58+
%Docstring
59+
Takes ownership of the symbol object
60+
%End
61+
62+
void setLayer( QgsVectorLayer *layer );
63+
%Docstring
64+
Sets vector layer associated with the renderer
65+
%End
66+
QgsVectorLayer *layer() const;
67+
%Docstring
68+
Returns vector layer associated with the renderer
69+
%End
70+
71+
void setSymbol( QgsAbstract3DSymbol *symbol /Transfer/ );
72+
%Docstring
73+
Sets 3D symbol associated with the renderer. Takes ownership of the symbol
74+
%End
75+
const QgsAbstract3DSymbol *symbol() const;
76+
%Docstring
77+
Returns 3D symbol associated with the renderer
78+
%End
79+
80+
virtual QString type() const;
81+
virtual QgsVectorLayer3DRenderer *clone() const /Factory/;
82+
83+
84+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
85+
86+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
87+
88+
virtual void resolveReferences( const QgsProject &project );
89+
90+
91+
private:
92+
QgsVectorLayer3DRenderer( const QgsVectorLayer3DRenderer & );
93+
QgsVectorLayer3DRenderer &operator=( const QgsVectorLayer3DRenderer & );
94+
};
95+
96+
97+
/************************************************************************
98+
* This file has been generated automatically from *
99+
* *
100+
* src/3d/qgsvectorlayer3drenderer.h *
101+
* *
102+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
103+
************************************************************************/
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/symbols/qgsabstract3dsymbol.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
15+
class QgsAbstract3DSymbol
16+
{
17+
%Docstring
18+
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
19+
20+
3D symbol objects define appearance of GIS data.
21+
22+
.. warning::
23+
24+
This is not considered stable API, and may change in future QGIS releases. It is
25+
exposed to the Python bindings as a tech preview only.
26+
27+
.. versionadded:: 3.0
28+
%End
29+
30+
%TypeHeaderCode
31+
#include "qgsabstract3dsymbol.h"
32+
%End
33+
public:
34+
virtual ~QgsAbstract3DSymbol();
35+
36+
virtual QString type() const = 0;
37+
%Docstring
38+
Returns identifier of symbol type. Each 3D symbol implementation should return a different type.
39+
%End
40+
virtual QgsAbstract3DSymbol *clone() const = 0 /Factory/;
41+
%Docstring
42+
Returns a new instance of the symbol with the same settings
43+
%End
44+
45+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const = 0;
46+
%Docstring
47+
Writes symbol configuration to the given DOM element
48+
%End
49+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
50+
%Docstring
51+
Reads symbol configuration from the given DOM element
52+
%End
53+
54+
enum Property
55+
{
56+
PropertyHeight,
57+
PropertyExtrusionHeight,
58+
};
59+
60+
static const QgsPropertiesDefinition &propertyDefinitions();
61+
%Docstring
62+
Returns the symbol layer property definitions.
63+
%End
64+
65+
QgsPropertyCollection &dataDefinedProperties();
66+
%Docstring
67+
Returns a reference to the symbol layer's property collection, used for data defined overrides.
68+
%End
69+
70+
71+
void setDataDefinedProperties( const QgsPropertyCollection &collection );
72+
%Docstring
73+
Sets the symbol layer's property collection, used for data defined overrides.
74+
%End
75+
76+
protected:
77+
78+
};
79+
80+
81+
/************************************************************************
82+
* This file has been generated automatically from *
83+
* *
84+
* src/3d/symbols/qgsabstract3dsymbol.h *
85+
* *
86+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
87+
************************************************************************/

0 commit comments

Comments
 (0)