QGIS/python/3d/__init__.py.in
Nyall Dawson da317dd8de
Fix PyQGIS 3D module patching
The module patching for _3d was not working at all, because
the same logic which works for other modules with a private _module
copy clashed with the approach of exposing the public 3d module
as qgis._3d

Work around this by renaming the private internal module as _3d_p,
so that the monkey patching logic from sip is correctly run
when the module is loaded.

Fixes broken API in 3d module for renamed enums, and fixes the
broken PyQGIS doc for the 3d module
2024-08-30 11:57:42 +10:00

65 lines
2.7 KiB
Python

# -*- 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'
from qgis.PyQt import QtCore
from qgis._3d_p import *
@MONKEYPATCH_INJECTIONS@
from qgis.core import Qgis as _Qgis
# manual monkey patching for old enum values
Qgs3DTypes.AltitudeClamping = _Qgis.AltitudeClamping
Qgs3DTypes.AltClampAbsolute = _Qgis.AltitudeClamping.Absolute
Qgs3DTypes.AltClampAbsolute.is_monkey_patched = True
Qgs3DTypes.AltClampRelative = _Qgis.AltitudeClamping.Relative
Qgs3DTypes.AltClampRelative.is_monkey_patched = True
Qgs3DTypes.AltClampTerrain = _Qgis.AltitudeClamping.Terrain
Qgs3DTypes.AltClampTerrain.is_monkey_patched = True
Qgs3DTypes.AltitudeBinding = _Qgis.AltitudeBinding
Qgs3DTypes.AltBindVertex = _Qgis.AltitudeBinding.Vertex
Qgs3DTypes.AltBindVertex.is_monkey_patched = True
Qgs3DTypes.AltBindCentroid = _Qgis.AltitudeBinding.Centroid
Qgs3DTypes.AltBindCentroid.is_monkey_patched = True
QgsPoint3DSymbol.Shape = _Qgis.Point3DShape
QgsPoint3DSymbol.Cylinder = _Qgis.Point3DShape.Cylinder
QgsPoint3DSymbol.Cylinder.is_monkey_patched = True
QgsPoint3DSymbol.Sphere = _Qgis.Point3DShape.Sphere
QgsPoint3DSymbol.Sphere.is_monkey_patched = True
QgsPoint3DSymbol.Cone = _Qgis.Point3DShape.Cone
QgsPoint3DSymbol.Cone.is_monkey_patched = True
QgsPoint3DSymbol.Cube = _Qgis.Point3DShape.Cube
QgsPoint3DSymbol.Cube.is_monkey_patched = True
QgsPoint3DSymbol.Torus = _Qgis.Point3DShape.Torus
QgsPoint3DSymbol.Torus.is_monkey_patched = True
QgsPoint3DSymbol.Plane = _Qgis.Point3DShape.Plane
QgsPoint3DSymbol.Plane.is_monkey_patched = True
QgsPoint3DSymbol.ExtrudedText = _Qgis.Point3DShape.ExtrudedText
QgsPoint3DSymbol.ExtrudedText.is_monkey_patched = True
QgsPoint3DSymbol.Model = _Qgis.Point3DShape.Model
QgsPoint3DSymbol.Model.is_monkey_patched = True
QgsPoint3DSymbol.Billboard = _Qgis.Point3DShape.Billboard
QgsPoint3DSymbol.Billboard.is_monkey_patched = True