248 Commits

Author SHA1 Message Date
Julien Cabieces
94863b435e
Merge pull request #58534 from nyalldawson/fix_3d_import
Fix PyQGIS 3D module patching
2024-09-02 11:21:11 +02:00
Nyall Dawson
ef0289f3ec Fix formatting of Python ..deprecated annotations in docstrings
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/174
2024-09-02 11:42:12 +10:00
Nyall Dawson
765cbb32db Standardise some deprecated annotations 2024-09-02 11:42:12 +10:00
Nyall Dawson
2af54ad057 Fix malformed python docstrings when enum value has \since annotation 2024-09-01 02:29:17 +10:00
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
qgis-bot
9a3809de82 auto sipify 🍺 2024-08-28 02:41:19 +00:00
Nyall Dawson
e161d0bd60 Enforce thread safety for Qgs3DMapSettings 2024-08-28 12:38:16 +10:00
Nyall Dawson
9391a62664 Refactor so Qgs3DMapSettings is a member of Qgs3DSceneEntity 2024-08-28 12:38:16 +10:00
Nyall Dawson
1f94f9bc4e Rework to use Qgs3DRenderContext instead 2024-08-28 12:38:16 +10:00
Nyall Dawson
5e33ee4a57 Add some thread safety to Qgs3DMapSettings usage
Create a small, cheap to copy (non-qobject) class
Qgs3DMapSettingsSnapshot which is designed to store
just cheap properties of Qgs3DMapSettings. Then use this
object wherever possible to avoid accessing the (non-thread
safe) Qgs3DMapSettings object for retrieval of simple
map properties (eg crs, extent, ...)

Refs https://github.com/qgis/QGIS-Enhancement-Proposals/issues/301
2024-08-28 12:38:16 +10:00
qgis-bot
a37fec4fc9 auto sipify 🍺 2024-08-28 02:01:25 +00:00
Nyall Dawson
bc52832b47 Lazily hack around markdown title underline not being long enough
Causes a bunch of warnings when building the PyQGIS docs
2024-08-28 11:58:21 +10:00
Nyall Dawson
6a936472d4 Remove incorrect 'not available in python' note 2024-08-28 11:58:21 +10:00
Jean Felder
8dab246707
[3D] Use QGIS material for the terrain (#58134)
* terrain: Use PhongMaterialSettings material for the non texture case

There is no functional change. With this change, the terrain uses a
material defined by QGIS instead of a default Qt3D. This will make it
easier to customize the shader in the future.

* qgsphongmaterialsettings: Fix setShininess signature

`mShininess` is a double.

* qgsphongtexturedmaterialsettings: Use a double to store shininess

This is already waht QgsPhongTexturedMaterialSettings does. The reason
for this change is to avoid the user-set values changing for them when
saving/restoring projects.

* qgsphongtexturedmaterialsettings: Use a double to store opacity

This is already waht QgsPhongTexturedMaterialSettings does. The reason
for this change is to avoid the user-set values changing for them when
saving/restoring projects.

* qgsphongtexturedmaterialsettings: Do proper opacity cast in toMaterial

* qgsphongtexturedmaterialsettings: Factor out material creation

This introduces a new class `QgsPhongTexturedMaterial` which is
similar to Qt3D `QDiffuseSpecularMaterial`.
`QgsPhongTexturedMaterial::toMaterial()` now calls
`QgsPhongTexturedMaterial` to create the material. This has no
functional change.

This will make it possible to directly use `QgsPhongTexturedMaterial`
for the terrain in the next commit. Indeed, the texture case needs to
use a `QTexture2D` which cannot be stored in a settings class. This
issue is avoided by directly creating the material instead of using
`QgsPhongTexturedMaterial::toMaterial()`.

* qgsterraintileloader: Fix typo

* terrain: Use QgsPhongTexturedMaterial for shading texture

There is no functional change. With this change, the terrain uses a
material defined by QGIS instead of a default Qt3D. This will make it
easier to customize the shader in the future.

* 3d/material: Introduce QgsTextureMaterial

This is the same material as the qt3d one:
`Qt3DExtras::QTextureMaterial`. It will also be used in the following
commit by the terrain.

* terrain: Use QgsTextureMaterial for non shading texture

There is no functional change. With this change, the terrain uses a
material defined by QGIS instead of a default Qt3D. This will make it
easier to customize the shader in the future.
2024-08-19 23:01:06 +02:00
qgis-bot
6222445858 auto sipify 🍺 2024-08-19 09:19:05 +00:00
Nyall Dawson
bc331f6a98 Add documentation for QgsPoint3DSymbol properties
Fixes https://github.com/qgis/pyqgis-api-docs-builder/issues/140
2024-08-19 11:16:01 +02:00
Nyall Dawson
3f481b568e Record header subfolders as __group__ attribute in PyQGIS classes
This will allow us to logically create subgroups for PyQGIS modules
in the API reference guide
2024-08-17 20:13:12 +10:00
Nyall Dawson
1f27fc627a [pyqgis] Wrap unambiguously static methods in staticmethod
sip doesn't use the standard Python staticmethod type for defining
static methods, which means that standard means of testing
for a static method (like `isinstance(..., staticmethod)`) fail
with any PyQGIS static methods.

This causes issues with lint tools, which incorrectly flag
calls to QGIS static methods as missing self arguments. It also
breaks detection of static methods in the sphinx PyQGIS docs,
so all static methods are shown as non-static.

Work around this in sipify, by wrapping unambiguously static
methods in staticmethod wrappers.
2024-08-14 22:08:41 +10:00
Nyall Dawson
dc68f03f88 Be tolerant against optional sip modules 2024-08-14 13:05:46 +10:00
Nyall Dawson
ed19d996b2 Collect attribute docstrings for PyQGIS documentation 2024-08-14 13:05:46 +10:00
Nyall Dawson
774ad87251 Remove orphaned sip files
These headers are marked SIP_NO_FILE, these files are not
referenced anywhere
2024-08-13 20:28:55 +10:00
Nyall Dawson
3a578d6712 Header update 2024-08-13 20:28:55 +10:00
Nyall Dawson
e7b26478e2 Valid fixes 2024-08-13 20:28:55 +10:00
qgis-bot
3aed037ce2 auto sipify 🍺 2024-07-25 08:00:08 +00:00
Nyall Dawson
c2c75f3b19
More no-value dox removal 2024-07-25 09:04:22 +10:00
qgis-bot
15fe04a289 auto sipify 🍺 2024-07-24 18:05:14 +00:00
Nyall Dawson
6f652d251b Drop no-value copy constructor dox 2024-07-25 04:02:55 +10:00
qgis-bot
612afa779a auto sipify 🍺 2024-07-22 16:10:48 +00:00
Nyall Dawson
28943f9c1b Remove a bunch of useless default constructor doxygen 2024-07-23 02:08:28 +10:00
Denis Rouzaud
6e9933145a
Adds a file to hold a map from class/method to headerfile (#58054)
* create map file for class / header files for PyQGIS API docs

* create map files

* install file

* add line numbers

* also add methods

* wait to sort

* more methods

* fix CMakeLists install

* fix sorting

* fix spell check

* remove map files for Qt6

* Revert "remove map files for Qt6"

This reverts commit 972f483410f556d1735a2070943b8ad9e2522c5e.

* do not test class_map files + auto sipify_all on branches

* fix warning
2024-07-16 11:40:25 +02:00
Jean Felder
2682a2ee2d qgs3dmapsettings: Fix extent methods documention
The 3D scene's CRS is not necessarily the same as the project's
CRS. For example, it can be "EPSG:3857" if the project's CRS is
geographic.

The stored extent in the settings is always the 3D scene's extent.

See:
b0d1a4f8b1
2024-05-30 05:28:33 +10:00
Jean Felder
13109d7577 qgs3dmapscene: Fix python bindings availability note
Qgs3DMapScene is now available in Python bindings.

See: 176807bc35
2024-05-04 06:31:11 +10:00
Even Rouault
15ea5c46bc
Header files: remove all mentions of '\since QGIS 3.0' 2024-02-18 20:57:23 +01:00
Nyall Dawson
87f117f47b [sipify] Avoid leading and trailing newlines in enum value docstrings 2024-02-11 13:37:29 +10:00
uclaros
38db09fa39 deprecate Qgs3DMapScene::openScenes() hack
fix docstrings
2024-01-19 06:51:53 -08:00
uclaros
652b6a630d limit what's exposed to python 2024-01-19 06:51:53 -08:00
uclaros
d8996ae33b Add 3D map canvas handling methods to QgisInterface 2024-01-19 06:51:53 -08:00
uclaros
2f98809d2c cleanup 2024-01-19 06:51:53 -08:00
uclaros
75607c05f8 Qgs3DMapCanvas + Qgs3DWindow = <3 2024-01-19 06:51:53 -08:00
Nyall Dawson
da06bde051 Use double instead of float in high level class to avoid
user set values changing when saving/restoring material settings

Convert to float when creating low level, performance critical
objects only.
2024-01-16 13:20:47 +10:00
Nyall Dawson
0215bf01a3 Add API to control coefficients (strength) of ambient/diffuse/specular
contributions to phong shader
2024-01-16 13:20:47 +10:00
Julien Cabieces
3e27ac5985 [PyQt6] Build PyQt6 2024-01-16 12:18:11 +10:00
Nyall Dawson
9099fa4f3e Add a physically based metal rough material
Adds a new material choice for a physically based metal/roughness
material. Options are available for setting the material base color,
metalness and roughness.

Internally this uses a clone of Qt's QMetalRoughMaterial class. We
use a copy of the Qt class instead of relying on Qt's implementation
as longer-term improvements (such as data defined base color) will
require a re-implementation anyway. By using our own material we
will avoid having two different code paths for the data-defined/
non-data defined scenarios.
2024-01-11 11:43:01 +10:00
Nyall Dawson
f6addcd0ca Promote 3d point symbol shape to enum class 2023-12-25 17:54:44 +10:00
Nyall Dawson
7b41268c99 Ensure that default shape properties for 3d symbols are only
stored in a single place, and that we always use the default
value when its not overwise set

This has two benefits:
1. The user doesn't see confusing "0" values for radius/length etc,
which are silently treated as some other fixed value when rendering
2. The default values are correctly accounted for when calculating
the layer's AABB, otherwise we end up with a flat AABB by
default
2023-12-23 06:38:43 +10:00
Martin Dobias
fa49d149fe sip fixes 2023-12-18 12:07:17 +01:00
Julien Cabieces
e57a13639e fix useless new line 2023-12-13 05:36:44 +10:00
bdm-oslandia
3707510ede fix(Qgs3DMapScene): add const to const member functions 2023-12-12 07:38:31 +10:00
Jean Felder
1200cbbe58 qgspolygon3dsymbol: Rename height property to offset
This is similar to the changes already applied to QgsLine3DSymbol.

height() are setHeight() are kept for API compatibility reasons.
2023-11-09 05:22:05 +10:00
Jean Felder
630fec5cc8 qgsline3dsymbol: Rename height property to offset
The `height` property is in fact a vertical offset applied to the
line. Also, the `offset` phrase is already used by the terrain for
similar purposes.

height() are setHeight() are kept for API compatibility reasons.
2023-11-09 05:22:05 +10:00