Skip to content

Commit 88cb831

Browse files
committedOct 13, 2018
Python bindings for QGIS 3D library
1 parent 94a7d9d commit 88cb831

19 files changed

+760
-6
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/qgs3dutils.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 *

‎python/3d/auto_additions/__init__.py

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: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/qgs3dutils.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
15+
enum AltitudeClamping
16+
{
17+
AltClampAbsolute,
18+
AltClampRelative,
19+
AltClampTerrain,
20+
};
21+
22+
23+
enum AltitudeBinding
24+
{
25+
AltBindVertex,
26+
AltBindCentroid,
27+
};
28+
29+
30+
31+
/************************************************************************
32+
* This file has been generated automatically from *
33+
* *
34+
* src/3d/qgs3dutils.h *
35+
* *
36+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
37+
************************************************************************/
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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+
.. versionadded:: 3.0
20+
%End
21+
22+
%TypeHeaderCode
23+
#include "qgsphongmaterialsettings.h"
24+
%End
25+
public:
26+
QgsPhongMaterialSettings();
27+
28+
QColor ambient() const;
29+
%Docstring
30+
Returns ambient color component
31+
%End
32+
QColor diffuse() const;
33+
%Docstring
34+
Returns diffuse color component
35+
%End
36+
QColor specular() const;
37+
%Docstring
38+
Returns specular color component
39+
%End
40+
float shininess() const;
41+
%Docstring
42+
Returns shininess of the surface
43+
%End
44+
45+
void setAmbient( const QColor &ambient );
46+
%Docstring
47+
Sets ambient color component
48+
%End
49+
void setDiffuse( const QColor &diffuse );
50+
%Docstring
51+
Sets diffuse color component
52+
%End
53+
void setSpecular( const QColor &specular );
54+
%Docstring
55+
Sets specular color component
56+
%End
57+
void setShininess( float shininess );
58+
%Docstring
59+
Sets shininess of the surface
60+
%End
61+
62+
void readXml( const QDomElement &elem );
63+
%Docstring
64+
Reads settings from a DOM element
65+
%End
66+
void writeXml( QDomElement &elem ) const;
67+
%Docstring
68+
Writes settings to a DOM element
69+
%End
70+
71+
};
72+
73+
74+
/************************************************************************
75+
* This file has been generated automatically from *
76+
* *
77+
* src/3d/qgsphongmaterialsettings.h *
78+
* *
79+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
80+
************************************************************************/
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
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+
.. versionadded:: 3.0
23+
%End
24+
25+
%TypeHeaderCode
26+
#include "qgsvectorlayer3drenderer.h"
27+
%End
28+
public:
29+
QgsVectorLayer3DRendererMetadata();
30+
31+
virtual QgsAbstract3DRenderer *createRenderer( QDomElement &elem, const QgsReadWriteContext &context ) /Factory/;
32+
33+
%Docstring
34+
Creates an instance of a 3D renderer based on a DOM element with renderer configuration
35+
%End
36+
};
37+
38+
39+
class QgsVectorLayer3DRenderer : QgsAbstract3DRenderer
40+
{
41+
%Docstring
42+
3D renderer that renders all features of a vector layer with the same 3D symbol.
43+
The appearance is completely defined by the symbol.
44+
45+
.. versionadded:: 3.0
46+
%End
47+
48+
%TypeHeaderCode
49+
#include "qgsvectorlayer3drenderer.h"
50+
%End
51+
public:
52+
explicit QgsVectorLayer3DRenderer( QgsAbstract3DSymbol *s /Transfer/ = 0 );
53+
%Docstring
54+
Takes ownership of the symbol object
55+
%End
56+
57+
void setLayer( QgsVectorLayer *layer );
58+
%Docstring
59+
Sets vector layer associated with the renderer
60+
%End
61+
QgsVectorLayer *layer() const;
62+
%Docstring
63+
Returns vector layer associated with the renderer
64+
%End
65+
66+
void setSymbol( QgsAbstract3DSymbol *symbol /Transfer/ );
67+
%Docstring
68+
Sets 3D symbol associated with the renderer. Takes ownership of the symbol
69+
%End
70+
const QgsAbstract3DSymbol *symbol() const;
71+
%Docstring
72+
Returns 3D symbol associated with the renderer
73+
%End
74+
75+
virtual QString type() const;
76+
virtual QgsVectorLayer3DRenderer *clone() const /Factory/;
77+
78+
79+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
80+
81+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
82+
83+
virtual void resolveReferences( const QgsProject &project );
84+
85+
86+
private:
87+
QgsVectorLayer3DRenderer( const QgsVectorLayer3DRenderer & );
88+
QgsVectorLayer3DRenderer &operator=( const QgsVectorLayer3DRenderer & );
89+
};
90+
91+
92+
/************************************************************************
93+
* This file has been generated automatically from *
94+
* *
95+
* src/3d/qgsvectorlayer3drenderer.h *
96+
* *
97+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
98+
************************************************************************/
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
.. versionadded:: 3.0
23+
%End
24+
25+
%TypeHeaderCode
26+
#include "qgsabstract3dsymbol.h"
27+
%End
28+
public:
29+
virtual ~QgsAbstract3DSymbol();
30+
31+
virtual QString type() const = 0;
32+
%Docstring
33+
Returns identifier of symbol type. Each 3D symbol implementation should return a different type.
34+
%End
35+
virtual QgsAbstract3DSymbol *clone() const = 0 /Factory/;
36+
%Docstring
37+
Returns a new instance of the symbol with the same settings
38+
%End
39+
40+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const = 0;
41+
%Docstring
42+
Writes symbol configuration to the given DOM element
43+
%End
44+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
45+
%Docstring
46+
Reads symbol configuration from the given DOM element
47+
%End
48+
49+
enum Property
50+
{
51+
PropertyHeight,
52+
PropertyExtrusionHeight,
53+
};
54+
55+
static const QgsPropertiesDefinition &propertyDefinitions();
56+
%Docstring
57+
Returns the symbol layer property definitions.
58+
%End
59+
60+
QgsPropertyCollection &dataDefinedProperties();
61+
%Docstring
62+
Returns a reference to the symbol layer's property collection, used for data defined overrides.
63+
%End
64+
65+
66+
void setDataDefinedProperties( const QgsPropertyCollection &collection );
67+
%Docstring
68+
Sets the symbol layer's property collection, used for data defined overrides.
69+
%End
70+
71+
protected:
72+
73+
};
74+
75+
76+
/************************************************************************
77+
* This file has been generated automatically from *
78+
* *
79+
* src/3d/symbols/qgsabstract3dsymbol.h *
80+
* *
81+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
82+
************************************************************************/
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/symbols/qgsline3dsymbol.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
class QgsLine3DSymbol : QgsAbstract3DSymbol
14+
{
15+
%Docstring
16+
3D symbol that draws linestring geometries as planar polygons (created from lines using a buffer with given thickness).
17+
18+
.. versionadded:: 3.0
19+
%End
20+
21+
%TypeHeaderCode
22+
#include "qgsline3dsymbol.h"
23+
%End
24+
public:
25+
QgsLine3DSymbol();
26+
%Docstring
27+
Constructor for QgsLine3DSymbol
28+
%End
29+
30+
virtual QString type() const;
31+
virtual QgsAbstract3DSymbol *clone() const /Factory/;
32+
33+
34+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
35+
36+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
37+
38+
39+
AltitudeClamping altitudeClamping() const;
40+
%Docstring
41+
Returns method that determines altitude (whether to clamp to feature to terrain)
42+
%End
43+
void setAltitudeClamping( AltitudeClamping altClamping );
44+
%Docstring
45+
Sets method that determines altitude (whether to clamp to feature to terrain)
46+
%End
47+
48+
AltitudeBinding altitudeBinding() const;
49+
%Docstring
50+
Returns method that determines how altitude is bound to individual vertices
51+
%End
52+
void setAltitudeBinding( AltitudeBinding altBinding );
53+
%Docstring
54+
Sets method that determines how altitude is bound to individual vertices
55+
%End
56+
57+
float width() const;
58+
%Docstring
59+
Returns width of the line symbol (in map units)
60+
%End
61+
void setWidth( float width );
62+
%Docstring
63+
Sets width of the line symbol (in map units)
64+
%End
65+
66+
float height() const;
67+
%Docstring
68+
Returns height (altitude) of the symbol (in map units)
69+
%End
70+
void setHeight( float height );
71+
%Docstring
72+
Sets height (altitude) of the symbol (in map units)
73+
%End
74+
75+
float extrusionHeight() const;
76+
%Docstring
77+
Returns extrusion height (in map units)
78+
%End
79+
void setExtrusionHeight( float extrusionHeight );
80+
%Docstring
81+
Sets extrusion height (in map units)
82+
%End
83+
84+
bool renderAsSimpleLines() const;
85+
%Docstring
86+
Returns whether the renderer will render data with simple lines (otherwise it uses buffer)
87+
%End
88+
void setRenderAsSimpleLines( bool enabled );
89+
%Docstring
90+
Sets whether the renderer will render data with simple lines (otherwise it uses buffer)
91+
%End
92+
93+
QgsPhongMaterialSettings material() const;
94+
%Docstring
95+
Returns material used for shading of the symbol
96+
%End
97+
void setMaterial( const QgsPhongMaterialSettings &material );
98+
%Docstring
99+
Sets material used for shading of the symbol
100+
%End
101+
102+
};
103+
104+
105+
/************************************************************************
106+
* This file has been generated automatically from *
107+
* *
108+
* src/3d/symbols/qgsline3dsymbol.h *
109+
* *
110+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
111+
************************************************************************/
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/symbols/qgspoint3dsymbol.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
class QgsPoint3DSymbol : QgsAbstract3DSymbol
14+
{
15+
%Docstring
16+
3D symbol that draws point geometries as 3D objects using one of the predefined shapes.
17+
18+
.. versionadded:: 3.0
19+
%End
20+
21+
%TypeHeaderCode
22+
#include "qgspoint3dsymbol.h"
23+
%End
24+
public:
25+
QgsPoint3DSymbol();
26+
%Docstring
27+
Constructor for QgsPoint3DSymbol.
28+
%End
29+
30+
virtual QString type() const;
31+
virtual QgsAbstract3DSymbol *clone() const /Factory/;
32+
33+
34+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
35+
36+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
37+
38+
39+
AltitudeClamping altitudeClamping() const;
40+
%Docstring
41+
Returns method that determines altitude (whether to clamp to feature to terrain)
42+
%End
43+
void setAltitudeClamping( AltitudeClamping altClamping );
44+
%Docstring
45+
Sets method that determines altitude (whether to clamp to feature to terrain)
46+
%End
47+
48+
QgsPhongMaterialSettings material() const;
49+
%Docstring
50+
Returns material used for shading of the symbol
51+
%End
52+
void setMaterial( const QgsPhongMaterialSettings &material );
53+
%Docstring
54+
Sets material used for shading of the symbol
55+
%End
56+
57+
enum Shape
58+
{
59+
Cylinder,
60+
Sphere,
61+
Cone,
62+
Cube,
63+
Torus,
64+
Plane,
65+
ExtrudedText,
66+
Model,
67+
};
68+
69+
static Shape shapeFromString( const QString &shape );
70+
%Docstring
71+
Returns shape enum value from a string
72+
%End
73+
static QString shapeToString( Shape shape );
74+
%Docstring
75+
Returns string from a shape enum value
76+
%End
77+
78+
Shape shape() const;
79+
%Docstring
80+
Returns 3D shape for points
81+
%End
82+
void setShape( Shape shape );
83+
%Docstring
84+
Sets 3D shape for points
85+
%End
86+
87+
QVariantMap shapeProperties() const;
88+
%Docstring
89+
Returns a key-value dictionary of point shape properties
90+
%End
91+
void setShapeProperties( const QVariantMap &properties );
92+
%Docstring
93+
Sets a key-value dictionary of point shape properties
94+
%End
95+
96+
QMatrix4x4 transform() const;
97+
%Docstring
98+
Returns transform for individual objects represented by the symbol
99+
%End
100+
void setTransform( const QMatrix4x4 &transform );
101+
%Docstring
102+
Sets transform for individual objects represented by the symbol
103+
%End
104+
105+
};
106+
107+
108+
/************************************************************************
109+
* This file has been generated automatically from *
110+
* *
111+
* src/3d/symbols/qgspoint3dsymbol.h *
112+
* *
113+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
114+
************************************************************************/
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/3d/symbols/qgspolygon3dsymbol.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
class QgsPolygon3DSymbol : QgsAbstract3DSymbol
14+
{
15+
%Docstring
16+
3D symbol that draws polygon geometries as planar polygons, optionally extruded (with added walls).
17+
18+
.. versionadded:: 3.0
19+
%End
20+
21+
%TypeHeaderCode
22+
#include "qgspolygon3dsymbol.h"
23+
%End
24+
public:
25+
QgsPolygon3DSymbol();
26+
%Docstring
27+
Constructor for QgsPolygon3DSymbol
28+
%End
29+
30+
virtual QString type() const;
31+
virtual QgsAbstract3DSymbol *clone() const /Factory/;
32+
33+
34+
virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
35+
36+
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
37+
38+
39+
AltitudeClamping altitudeClamping() const;
40+
%Docstring
41+
Returns method that determines altitude (whether to clamp to feature to terrain)
42+
%End
43+
void setAltitudeClamping( AltitudeClamping altClamping );
44+
%Docstring
45+
Sets method that determines altitude (whether to clamp to feature to terrain)
46+
%End
47+
48+
AltitudeBinding altitudeBinding() const;
49+
%Docstring
50+
Returns method that determines how altitude is bound to individual vertices
51+
%End
52+
void setAltitudeBinding( AltitudeBinding altBinding );
53+
%Docstring
54+
Sets method that determines how altitude is bound to individual vertices
55+
%End
56+
57+
float height() const;
58+
%Docstring
59+
Returns height (altitude) of the symbol (in map units)
60+
%End
61+
void setHeight( float height );
62+
%Docstring
63+
Sets height (altitude) of the symbol (in map units)
64+
%End
65+
66+
float extrusionHeight() const;
67+
%Docstring
68+
Returns extrusion height (in map units)
69+
%End
70+
void setExtrusionHeight( float extrusionHeight );
71+
%Docstring
72+
Sets extrusion height (in map units)
73+
%End
74+
75+
QgsPhongMaterialSettings material() const;
76+
%Docstring
77+
Returns material used for shading of the symbol
78+
%End
79+
void setMaterial( const QgsPhongMaterialSettings &material );
80+
%Docstring
81+
Sets material used for shading of the symbol
82+
%End
83+
84+
85+
bool invertNormals() const;
86+
%Docstring
87+
Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)
88+
%End
89+
void setInvertNormals( bool invert );
90+
%Docstring
91+
Sets whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)
92+
%End
93+
94+
bool addBackFaces() const;
95+
%Docstring
96+
Returns whether also triangles facing the other side will be created. Useful if input data have inconsistent order of vertices
97+
98+
.. versionadded:: 3.2
99+
%End
100+
101+
void setAddBackFaces( bool add );
102+
%Docstring
103+
Sets whether also triangles facing the other side will be created. Useful if input data have inconsistent order of vertices
104+
105+
.. versionadded:: 3.2
106+
%End
107+
108+
};
109+
110+
111+
/************************************************************************
112+
* This file has been generated automatically from *
113+
* *
114+
* src/3d/symbols/qgspolygon3dsymbol.h *
115+
* *
116+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
117+
************************************************************************/

‎python/CMakeLists.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,17 @@ IF (WITH_GUI)
142142
)
143143
ENDIF ()
144144

145+
IF (WITH_3D)
146+
INCLUDE_DIRECTORIES(
147+
${CMAKE_SOURCE_DIR}/src/3d
148+
${CMAKE_SOURCE_DIR}/src/3d/chunks
149+
${CMAKE_SOURCE_DIR}/src/3d/symbols
150+
${CMAKE_SOURCE_DIR}/src/3d/terrain
151+
152+
${CMAKE_BINARY_DIR}/src/3d
153+
)
154+
ENDIF ()
155+
145156
IF(NOT ENABLE_TESTS)
146157
SET(SIP_DISABLE_FEATURES ${SIP_DISABLE_FEATURES} TESTS)
147158
ENDIF(NOT ENABLE_TESTS)
@@ -219,6 +230,24 @@ IF (WITH_GUI)
219230
BUILD_SIP_PYTHON_MODULE(qgis._gui gui/gui.sip ${cpp_files} "" qgis_core qgis_gui)
220231
ENDIF (WITH_GUI)
221232

233+
# 3D module
234+
IF (WITH_3D)
235+
SET(PY_MODULES ${PY_MODULES} 3d)
236+
237+
FILE(GLOB_RECURSE sip_files_3d 3d/*.sip 3d/*.sip.in)
238+
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_3d})
239+
SET(SIP_EXTRA_OPTIONS ${PYQT_SIP_FLAGS} -g -o -a ${CMAKE_BINARY_DIR}/python/qgis.qgis3d.api)
240+
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
241+
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -n sip)
242+
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.19.11) OR (${SIP_VERSION_STR} VERSION_GREATER 4.19.11))
243+
IF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
244+
SET(SIP_EXTRA_OPTIONS ${SIP_EXTRA_OPTIONS} -y ${QGIS_PYTHON_OUTPUT_DIRECTORY}/_qgis3d.pyi)
245+
ENDIF((${SIP_VERSION_STR} VERSION_EQUAL 4.18) OR (${SIP_VERSION_STR} VERSION_GREATER 4.18))
246+
247+
GENERATE_SIP_PYTHON_MODULE_CODE(qgis._3d 3d/3d.sip "${sip_files_3d}" cpp_files)
248+
BUILD_SIP_PYTHON_MODULE(qgis._3d 3d/3d.sip ${cpp_files} "" qgis_core qgis_3d)
249+
ENDIF (WITH_3D)
250+
222251
# server module
223252
IF (WITH_SERVER AND WITH_SERVER_PLUGINS)
224253
INCLUDE_DIRECTORIES(

‎python/core/auto_generated/3d/qgsabstract3drenderer.sip.in

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ Reads renderer's properties from given XML element
5252
%Docstring
5353
Resolves references to other objects - second phase of loading - after readXml()
5454
%End
55+
56+
protected:
57+
QgsAbstract3DRenderer();
58+
%Docstring
59+
Default constructor
60+
%End
61+
62+
private:
63+
QgsAbstract3DRenderer( const QgsAbstract3DRenderer & );
64+
QgsAbstract3DRenderer &operator=( const QgsAbstract3DRenderer & );
5565
};
5666

5767

‎scripts/sipify.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ sub detect_non_method_member{
754754

755755
# class declaration started
756756
# https://regex101.com/r/6FWntP/10
757-
if ( $LINE =~ m/^(\s*class)\s+([A-Z]+_EXPORT\s+)?(\w+)(\s*\:\s*(public|protected|private)\s+\w+(< *(\w|::)+ *>)?(::\w+(<\w+>)?)*(,\s*(public|protected|private)\s+\w+(< *(\w|::)+ *>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*\/?\/?\s*SIP_\w+)?\s*?(\/\/.*|(?!;))$/ ){
757+
if ( $LINE =~ m/^(\s*class)\s+([A-Z0-9_]+_EXPORT\s+)?(\w+)(\s*\:\s*(public|protected|private)\s+\w+(< *(\w|::)+ *>)?(::\w+(<\w+>)?)*(,\s*(public|protected|private)\s+\w+(< *(\w|::)+ *>)?(::\w+(<\w+>)?)*)*)?(?<annot>\s*\/?\/?\s*SIP_\w+)?\s*?(\/\/.*|(?!;))$/ ){
758758
dbg_info("class definition started");
759759
push @ACCESS, PUBLIC;
760760
push @EXPORTED, 0;
@@ -770,7 +770,7 @@ sub detect_non_method_member{
770770
push @DECLARED_CLASSES, $CLASSNAME[$#CLASSNAME];
771771
}
772772
dbg_info("class: ".$CLASSNAME[$#CLASSNAME]);
773-
if ($LINE =~ m/\b[A-Z]+_EXPORT\b/ || $#CLASSNAME != 0 || $INPUT_LINES[$LINE_IDX-2] =~ m/^\s*template</){
773+
if ($LINE =~ m/\b[A-Z0-9_]+_EXPORT\b/ || $#CLASSNAME != 0 || $INPUT_LINES[$LINE_IDX-2] =~ m/^\s*template</){
774774
# class should be exported except those not at top level or template classes
775775
# if class is not exported, then its methods should be (checked whenever leaving out the class)
776776
$EXPORTED[-1]++;

‎scripts/sipify_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pushd ${DIR} > /dev/null
3737

3838
count=0
3939

40-
modules=(core gui analysis server)
40+
modules=(3d core gui analysis server)
4141
for module in "${modules[@]}"; do
4242

4343
# clean auto_additions and auto_generated folders

‎src/3d/qgs3dutils.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef QGS3DUTILS_H
1717
#define QGS3DUTILS_H
1818

19+
#include "qgis_sip.h"
20+
1921
class QgsLineString;
2022
class QgsPolygon;
2123

@@ -44,6 +46,8 @@ enum AltitudeBinding
4446
};
4547

4648

49+
#ifndef SIP_RUN
50+
4751
/**
4852
* \ingroup 3d
4953
* Miscellaneous utility functions used from 3D code.
@@ -114,4 +118,6 @@ class _3D_EXPORT Qgs3DUtils
114118
const QgsCoordinateTransformContext &context );
115119
};
116120

121+
#endif
122+
117123
#endif // QGS3DUTILS_H

‎src/3d/qgsvectorlayer3drenderer.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define QGSVECTORLAYER3DRENDERER_H
1818

1919
#include "qgis_3d.h"
20+
#include "qgis_sip.h"
2021

2122
#include "qgs3drendererregistry.h"
2223
#include "qgsabstract3drenderer.h"
@@ -71,7 +72,7 @@ class _3D_EXPORT QgsVectorLayer3DRenderer : public QgsAbstract3DRenderer
7172

7273
QString type() const override { return "vector"; }
7374
QgsVectorLayer3DRenderer *clone() const override SIP_FACTORY;
74-
Qt3DCore::QEntity *createEntity( const Qgs3DMapSettings &map ) const override SIP_FACTORY;
75+
Qt3DCore::QEntity *createEntity( const Qgs3DMapSettings &map ) const override SIP_SKIP;
7576

7677
void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const override;
7778
void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) override;
@@ -80,6 +81,12 @@ class _3D_EXPORT QgsVectorLayer3DRenderer : public QgsAbstract3DRenderer
8081
private:
8182
QgsMapLayerRef mLayerRef; //!< Layer used to extract polygons from
8283
std::unique_ptr<QgsAbstract3DSymbol> mSymbol; //!< 3D symbol that defines appearance
84+
85+
private:
86+
#ifdef SIP_RUN
87+
QgsVectorLayer3DRenderer( const QgsVectorLayer3DRenderer & );
88+
QgsVectorLayer3DRenderer &operator=( const QgsVectorLayer3DRenderer & );
89+
#endif
8390
};
8491

8592

‎src/3d/symbols/qgspolygon3dsymbol.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class _3D_EXPORT QgsPolygon3DSymbol : public QgsAbstract3DSymbol
6767
void setMaterial( const QgsPhongMaterialSettings &material ) { mMaterial = material; }
6868

6969
//! Returns front/back culling mode
70-
Qt3DRender::QCullFace::CullingMode cullingMode() const { return mCullingMode; }
70+
Qt3DRender::QCullFace::CullingMode cullingMode() const { return mCullingMode; } SIP_SKIP
7171
//! Sets front/back culling mode
72-
void setCullingMode( Qt3DRender::QCullFace::CullingMode mode ) { mCullingMode = mode; }
72+
void setCullingMode( Qt3DRender::QCullFace::CullingMode mode ) { mCullingMode = mode; } SIP_SKIP
7373

7474
//! Returns whether the normals of triangles will be inverted (useful for fixing clockwise / counter-clockwise face vertex orders)
7575
bool invertNormals() const { return mInvertNormals; }

‎src/core/3d/qgsabstract3drenderer.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ class CORE_EXPORT QgsAbstract3DRenderer SIP_ABSTRACT
6363
virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context ) = 0;
6464
//! Resolves references to other objects - second phase of loading - after readXml()
6565
virtual void resolveReferences( const QgsProject &project );
66+
67+
protected:
68+
//! Default constructor
69+
QgsAbstract3DRenderer() = default;
70+
71+
private:
72+
#ifdef SIP_RUN
73+
QgsAbstract3DRenderer( const QgsAbstract3DRenderer & );
74+
QgsAbstract3DRenderer &operator=( const QgsAbstract3DRenderer & );
75+
#endif
76+
77+
Q_DISABLE_COPY( QgsAbstract3DRenderer )
6678
};
6779

6880

0 commit comments

Comments
 (0)
Please sign in to comment.