17845 Commits

Author SHA1 Message Date
Nyall Dawson
b9a147659f Fix sipifaction of enum class 2020-08-03 16:34:10 +10:00
Nyall Dawson
51cde6fbd2 [3d][FEATURE] Add CAD style ("Gooch") material for polygons/extruded lines
From the qt docs:

"The Gooch lighting model uses both color and brightness to help show the
curvature of 3D surfaces. This is often better than models such as Phong
that rely purely upon changes in brightness. In situations such as in CAD
and CAM applications where photorealism is not a goal, the Gooch shading
model in conjunction with some kind of silhouette edge inking is a popular
solution.

The Gooch lighting model is explained fully in the original Gooch paper.
The Gooch model mixes a diffuse object color with a user-provided cool
color and warm color to produce the end points of a color ramp that is
used to shade the object based upon the cosine of the angle between the
vector from the fragment to the light source and the fragment's normal
vector. Optionally, a specular highlight can be added on top. The
relative contributions to the cool and warm colors by the diffuse color
are controlled by the alpha and beta properties respecitvely."""

The TLDR: the shader works well for revealing 3d details of objects
which may otherwise be hidden due to the scene's lighting. Ultimately,
it's an easier material to work with as you don't need to worry
about setting up appropriate scene lighting in order to visualise features.
2020-08-03 16:34:10 +10:00
Nyall Dawson
daf38a9f23 Rework QgsAbstractMaterialSettings class to handle different rendering techniques
Restrict choice of material in widgets based on the symbol's required technique,
and hide material settings in phong widget which don't apply to certain
rendering techniques (e.g. hiding all but the ambient color for simple 3d line
symbols)
2020-08-03 16:34:10 +10:00
Nyall Dawson
d85228654b Add an icon in the 3d material combo box 2020-08-03 16:34:10 +10:00
Nyall Dawson
4f34b8a7f8 [3d][api] Split api from specifying 3d map layers to render from api
for specifying terrain layers to render

Previously the one method was used for both, which made it very
difficult to have a different set of layers used for terrain
generation vs 3d entity generation (you had to manually create a map
theme, which is very messy)
2020-08-03 13:13:11 +10:00
rldhont
f5b819fc4c [Tests] Check that GDAL Assign Projection updates QgsRasterLayer info 2020-07-31 14:32:48 +02:00
rldhont
6c44073ff0 [Processing] Fix GDAL Assign Projection: update QgsRasterLayer crs
Even if the projection is assign, the QgsRasterLayer and the QgsRasterDataProvider was not updated.

The fix reloads the QgsRasterDataProvider's data and updates the QgsRasterLayer's crs.

Fixed #37920
2020-07-31 14:32:48 +02:00
Nyall Dawson
e19f27d289 [processing] Fix hidden column names show in batch processing dialog,
throwing the table contents out of sync with the headers

Also make code a bit more robust

Fixes #38054
2020-07-31 16:03:28 +10:00
Nyall Dawson
b9f1f2ca32 [processing] Fix destination layer name ignored in Load Layer into Project
algorithm

Fixes #38046
2020-07-31 16:03:16 +10:00
Nyall Dawson
fd19167c0a [processing] Show some more warnings when spatial indexes are missing but desirable 2020-07-31 03:07:07 +10:00
Nyall Dawson
6d647aa678 Add method to filter QgsLayoutItemComboBox by item flags 2020-07-31 03:06:31 +10:00
Martin Dobias
836666e782
Merge pull request #37588 from NEDJIMAbelgacem/export-scene-feature
[Feature] Export 3D scene feature
2020-07-30 09:32:15 +02:00
Nyall Dawson
68c7cfb65f Use correct coordinate transform context in Raster Calculator algorithm 2020-07-30 08:26:40 +10:00
Nyall Dawson
0a556a8161 Gracefully handle no project available in context in algorithms
where a project is only required in some circumstances
2020-07-30 08:26:40 +10:00
Nyall Dawson
d57a638ec4 Add a processing algorithm flag to indicate that an algorithm requires
a valid project to be set in the context in order to execute

And flag a bunch of algorithms which require this
2020-07-30 08:26:40 +10:00
Nyall Dawson
687398415b [processing] Flag a bunch of algorithms to hide them from qgis_process 2020-07-30 08:26:40 +10:00
Nyall Dawson
937a41a656 [processing] Add a flag for algorithms to indicate that they should
not be available from the standalone qgis_process tool (e.g. "select by "
algorithms, which have no meaning outside of a GUI application)

These algorithms are hidden from the algorithm list for qgis_process
and cannot be run by the tool
2020-07-30 08:26:40 +10:00
Nyall Dawson
b40bfbbf4c Use direct getters for ellipsoid/units in processing algs
Refs #37988
2020-07-30 08:26:40 +10:00
Nyall Dawson
03854a41b0 Add explicit settings for ellipsoid, distance and area units to QgsProcessingContext
to avoid having to always retrieve these via the context's project (which may
not be available in some circumstances)

Refs #37988
2020-07-30 08:26:40 +10:00
Nyall Dawson
1484a30fef Add API to allow generation of icons for 3d symbols from app
(still not implement -- but a necessary prerequisite to proper icons)
2020-07-29 10:27:17 +10:00
Nyall Dawson
b1d02619f5 Use registry to create 3d symbol widgets, avoid hardcoded widgets 2020-07-29 10:27:17 +10:00
Nyall Dawson
a0e915fc50 Add support for filtering style model by 3d layer type 2020-07-29 10:27:17 +10:00
Nyall Dawson
d65b52db77 Add CompatibleGeometryTypesRole to style model 2020-07-29 10:27:17 +10:00
Nyall Dawson
6245b552a4 Add method to retrieve compatible layer types from 3d symbol in style library 2020-07-29 10:27:17 +10:00
Nyall Dawson
93022ea707 Add method to determine compatible vector layer types for a 3d symbol 2020-07-29 10:27:17 +10:00
Nyall Dawson
d8e44539f1 Allow adding/editing 3d symbols in style manager dialog 2020-07-29 10:27:17 +10:00
Nyall Dawson
6e40962510 Partial 3d symbol style manager work 2020-07-29 10:27:17 +10:00
Nyall Dawson
9e1cddaa8e Add render context flag to use when a map render job is part of a 3d map 2020-07-29 04:21:56 +10:00
NEDJIMAbelgacem
7c37c22ec1 Merge master and fix merge conflict 2020-07-28 18:00:20 +01:00
NEDJIMAbelgacem
750f21d467 Add SIP_SKIP to QgsPolygon3DSymbol::exportGeometries and its overloads 2020-07-28 17:07:23 +01:00
Nyall Dawson
beece1635d Start generalizing material widget handling 2020-07-28 20:45:50 +10:00
Nyall Dawson
e541fe68d7 Correctly restore materials using registry 2020-07-28 20:45:50 +10:00
Nyall Dawson
d579d67a4a [3d] Add a registry for 3d material settings 2020-07-28 20:45:50 +10:00
Nyall Dawson
a533268edf Ensure map frame and background also follow clip path 2020-07-28 15:12:04 +10:00
Nyall Dawson
c5b3443cb3 Don't draw items which are a clip source for a map 2020-07-28 15:12:04 +10:00
Nyall Dawson
264bd51594 [layouts] Add API to set item based clipping region on maps
Allows using shape or polygon layout items to set the overall shape
of a layout map item's contents
2020-07-28 15:12:04 +10:00
Nyall Dawson
915615aec4 [layouts][api] Add API to allow map items to be clipped (take their shape from)
other layout items which provide clipping paths

Opens the door for non-rectangular layout maps
2020-07-28 15:12:04 +10:00
Nyall Dawson
77badc0097 QgsLayoutItemShape can provide clip paths 2020-07-28 15:12:04 +10:00
Nyall Dawson
aa0b36b27d QgsLayoutItemPolygon can provide a clip path 2020-07-28 15:12:04 +10:00
Nyall Dawson
2b283951be Add api for layout items to create a clipping path 2020-07-28 15:12:04 +10:00
Nyall Dawson
19504adf55 Allow running "Add x/y fields" in place 2020-07-28 14:18:20 +10:00
Nyall Dawson
2104ae613a [processing] Add mechanism for algorithms to alter their core behavior
(e.g. parameters) when they are run in the "edit in-place" mode

This allows algorithms to dynamically adapt their behavior to make them compatible
with in-place mode. Previously, some useful algorithms could not be
run in-place because they alter a layer's structure (e.g. adding new
fields).

Now, these algorithms have a means to detect that they are being
run in-place and change their input parameters accordingly. E.g.
an algorithm which usually adds new fields to store calculated
values (such as "add xy fields to layer") could instead expose
field parameter choices to ask the user to pick from existing
fields in which to store the calculated values, thereby avoiding
the need to change the table structure and making them eligable
for running in-place mode.

Note that this needs to be handled algorithm-by-algorithm, it's
not automatic! It's just the raw api to allow this...
2020-07-28 14:18:20 +10:00
NEDJIMAbelgacem
a656da3b75 Moved finding geometries from parseVectorLayerEntity to each symbol class 2020-07-28 01:45:11 +01:00
Nyall Dawson
0bb9174c2a
Merge pull request #37973 from nyalldawson/table_editor_fixes
Misc layout table editor fixes and related text formatting widget fixes
2020-07-27 14:49:37 +10:00
Nyall Dawson
6e2d1023f2 [processing] Fix loading batch settings with date/time values
Fixes #37838
2020-07-27 14:19:49 +10:00
Nyall Dawson
466a01ca6d When setting a new text format for a QgsFontButton, automatically
update any open configuration panel to reflect the new format
(or dismiss it automatically if the new format is invalid)

Avoids UI going out of sync with text formats when a panel is already
open
2020-07-27 11:26:56 +10:00
Nyall Dawson
7cfa476a2d [layouts] Save table editor panel state to avoid having to constantly
resize formatting panel on reopen
2020-07-27 11:12:58 +10:00
Nyall Dawson
51d8ad75c5 Don't modify text format paint effects in place
Avoids race conditions when multiple threads are rendering the same
text format which contains paint effects

Fixes #37938
2020-07-27 07:36:50 +10:00
Nyall Dawson
95bd7b296b [feature][processing] New algorithm "Align points to features"
This algorithm calculates the rotation required to align point features
with their nearest feature from another reference layer. A new field is
added to the output layer which is filled with the angle (in degrees,
clockwise) to the nearest reference feature.

Optionally, the output layer's symbology can be set to automatically
use the calculated rotation field to rotate marker symbols.

If desired, a maximum distance to use when aligning points can be set,
to avoid aligning isolated points to distant features.

Designed for use cases like aligning building point symbols to follow
the nearest road direction!
2020-07-26 09:56:46 +10:00
Nyall Dawson
9b19e069b3 Allow symbol and color ramp visitors the ability to edit symbols/color ramps they visit 2020-07-26 09:56:46 +10:00