138 Commits

Author SHA1 Message Date
Nyall Dawson
06f36ddbe6 Cleanup duplicate code and add tests for graduated range resolving 2019-11-11 17:51:49 +10:00
Hugo Mercier
845894b313
[FEATURE] Selective masking (#30747)
* [FEATURE] Selective masking

Advanced rendering feature that allows the definition of 'masks' areas around labels or with a new typ of symbol layer. These masks will "un-draw" symbol layers of other layers underneath.
It modifies the rendering process by adding an optional second pass.
2019-11-07 08:17:25 +01:00
Matthias Kuhn
1f3b039fe2
Merge pull request #32552 from m-kuhn/q_global_static
non POD static
2019-11-03 23:11:51 +01:00
Matthias Kuhn
5c439ab693 More efficient loops 2019-11-02 16:05:28 +01:00
Matthias Kuhn
179fcf3347 Use Q_GLOBAL_STATIC 2019-11-02 15:01:59 +01:00
nirvn
b2e7121493 [FEATURE][symbology] Add density-based point count for the random marker fill 2019-10-30 12:04:13 +07:00
Nyall Dawson
9bc9808e4e Dox++ 2019-10-28 14:34:30 +10:00
Nyall Dawson
a58012545d Bump default point count to 10 2019-10-28 14:34:30 +10:00
Nyall Dawson
d64666559a Spelling 2019-10-28 14:34:30 +10:00
Nyall Dawson
57d977cf8a Add sip cast for random marker fill 2019-10-28 14:34:30 +10:00
Nyall Dawson
351970e1c2 Dox, spelling 2019-10-28 14:34:30 +10:00
Nyall Dawson
491a4a794d Provide hooks for symbol layers to notify them before and after
rendering operations on a specific feature are performed

This allows symbol layer subclasses to know when a set of rendering
operations all relate to a single feature, e.g. when a number
of polygons are rendered which all belong to the same multi-polygon
geometry attached to a single feature.

Without these hooks, symbol layer subclasses have no stable method
of knowing that these parts all relate to a single feature, or
have no means of knowing when the final part of that feature has
been rendered.
2019-10-28 14:34:30 +10:00
Nyall Dawson
b5e92d41f5 [FEATURE] Random marker fill symbol layer type
This commit adds a new fill symbol layer type "Random marker fill". It
allows polygon features to be rendered using a marker symbol placed
at random locations within the polygon boundary.

Options include:
- number of marker symbols to render for the polygon
- whether markers rendered near the edges of polygons should be clipped
to the polygon boundary or not
- an optional random number seed, to give consistent placement
of markers whenever maps are refreshed (also allows random placement
to play nice with QGIS server and tile-based rendering)

Sponsored by the SLYR project
2019-10-28 14:34:30 +10:00
Denis Rouzaud
758d7cff4a run sipify to update deprecation annotations 2019-10-15 13:17:38 +02:00
rldhont
6625c7ba62 [Bugfix] Get remote SVG synchronously - in the server context 2019-10-11 14:08:17 +10:00
nirvn
531e1b0715 [categorized][graduated] Handle categorized<->graduated renderer conversion
(fixes #31633)
2019-09-24 20:08:47 +07:00
Nyall Dawson
abc9f47ca4 [legends] Fix missing symbols for inverted polygon layers when using
filter by map content

Fixes #22718
2019-09-21 06:03:47 +10:00
Nyall Dawson
2212617f0c Reuse a single expression context when building icons in QgsStyleModel
Whilst usually this is bad practice (reusing an existing expression context),
and instead you should make a new context for every batch of expression evaluations,
we can't do this in the style model and we end up potentially creating
thousands of new contexts. So instead, we use a single one, which is
safe because the actual expression context used here is a very
basic one...
2019-09-07 15:56:40 +10:00
Nyall Dawson
6b1e96c180 Make a shared instance of QgsStyleModel for the default application style
This allows shared caching of symbol icons, greatly speeding up display
of views which use style models
2019-09-07 15:56:40 +10:00
Nyall Dawson
1aeb4d5d79 Try to fix dox warning 2019-09-03 10:35:21 +10:00
Nyall Dawson
4d67f803b4 Fix leak 2019-09-03 10:35:21 +10:00
Nyall Dawson
6de34d472e Add missing SIP_DEPRECATED 2019-09-03 10:35:21 +10:00
Nyall Dawson
bf61a94b4a Don't pass doubles by reference, pass lists by reference 2019-09-03 10:35:21 +10:00
Denis Rouzaud
9a089132a3 remove Q_DECL_DEPRECATED as Doxygen throws a warning 2019-09-02 12:59:58 +02:00
Denis Rouzaud
68a9ea5d70 move src/core/symbology/classification to src/core/classification 2019-09-02 09:46:40 +02:00
Denis Rouzaud
d58be2814d missing SIP_FACTORY, addMethod returns bool, and minor fixes 2019-09-02 09:40:34 +02:00
Denis Rouzaud
c20e3a1475 make variables private, correclty initalize label format 2019-08-31 10:53:03 +02:00
Denis Rouzaud
d10f8ce2a0 a bit more API doc 2019-08-31 10:31:50 +02:00
Denis Rouzaud
ac1ce4f4ed better naming of methods and API documentation 2019-08-30 15:35:53 +02:00
Denis Rouzaud
b580242aef fix deprecated methods and remove leftovers 2019-08-30 13:12:43 +02:00
Denis Rouzaud
41495058d1 run sipify 2019-08-30 12:45:37 +02:00
Nyall Dawson
0e3a4478d9 Add missing transfer annotation (#31482) 2019-08-29 20:12:23 +02:00
Denis Rouzaud
2a9f215f98
fix missing SIP_OUT (#31470) 2019-08-29 10:38:03 +02:00
Nyall Dawson
ddbb1b175f [FEATURE] Allow array values as a valid result for data defined offset
or size properties

Previously only string values of the format 'x,y' would be permitted. But
I've seen MANY bug reports and questions about this, so also allow
arrays of doubles as a valid result. E.g. "array(3,5)". In any case, it's
just nicer.

Fixes #31444
2019-08-29 13:18:58 +10:00
Denis Rouzaud
44acec6b8a
move QgsRenderRange and QgsRendererRangeLabelFormat to their own file (#31464) 2019-08-28 14:22:07 +02:00
Ismail Sunni
b9978d53d1 [FEATURE][3D] Billboard Rendering for Points (#31308)
* Add button to change billboard symbol.

* Add shaders for billboards.

* Add billboard material class.

* Add sample billboard image.

* Add dummy handler for billboard.

* Add billboard geometry class.

* First working version of 3D point as billboard.

* Make selected feature bigger.

* Use default symbol preview as billboard.

* Update billboard when changes the viewport size.

* Use QgsTerrainTextureImage for adding image to texture.

* Show better quality of billboard default symbol.

* Promote QgsSymbolButton not working.

* Add QgsSymbolButton properly.

* Add seTexture2DFromSymbol.

* Use default symbol

* [On Progress] Get symbol from the QgsSymbolButton.

* [On progress] failed to change the symbol

* Fix billboard fragment shader for macOS

* Better transparency handling.

* Use size from the symbol.

* Add set layer for 3d billboard symbol.

* Set billboard size from the symbol pixel size * 20

* Use size from the image.

* [Debug] set white symbol to success kid, it work when previous billboard is success kid.

* Use store and restore symbol from Nyall.

* Remove unrelated code.

* Apply random extent to fix the bug, from Martin.

* Remove add mesh entities for billboard.

* Hide material and transformation widget for billboard.

* Remove add scene entities for billboard.

* Add selected as parameter in drawPreviewIcon.

* Add QgsMarkerSymbol to store the symbol in billboard

* Put billboard symbol in point3dsymbol serialization.

* Add billboard height in the UI.

* Set height for billboard.

* Store billboard height separately. Perhaps better to use existing transform.

* Set height of billboard to TY.

* Flipped image for billboard symbol.

* Add helper function to set billboard function.

* Generate billboard transform from general transform.

* Use static dpi for context size.

* Remove debug message.

* Use Qgs3DRenderContext for selection color and dpi from QgsApplication.

* Remove unnecessary file and code.

* Remove commented iut code.

* Add documentation of new classes.

* Fix banned keywords.

* Add missing parameter's documentation.

* Address PR review.

* Use context from readXML.

* Remove one line function.

* Fix billboard size.

* Make some functions private, remove unused function.

* Use unique_ptr for the ownership.

* Use unique_ptr for default symbol to avoid memory leak.

* Add parent to texture2D.

* Fix documentation.

* Add copy constructor.

* Fix documentation.

* Remove documentation warning.

* Fix sip error.

* Add unit test for billboard rendering.

* Set ambient to not transparent for measurement line.

* Add dpi in the Qgs3DMapSetting

* Update billboard rendering unit test.

* Remove layer from 3d point widget since it's not supported yet.

* Addressing PR review from Martin.

* Attach dom directly for the billboard symbol.

* Remove unused constructor for point3dsymbol.

* Use stroke width ratio for solving big stroke width.

* Update unit test for rendering with some stroke color.

* Fix typo.
2019-08-27 10:04:56 +02:00
Nyall Dawson
2ca302999d [FEATURE] "Center of segment" placement mode for marker and hash line symbol layers
Adds a new placement option to place markers/hash lines at the center
point of individual line segments

Refs #29785
2019-08-21 19:41:58 +10:00
Nyall Dawson
c965f5fb75 Fix misleading dox, memory leaks in renderer widgets 2019-08-12 11:59:12 +10:00
Nyall Dawson
47f83b582f [FEATURE] Add "copy symbol" and "paste symbol" actions to layer right click, style menu
Allows for individual symbols to be copied and pasted between layers or rule/categorized/graduated
nodes
2019-07-31 20:49:43 +10:00
Nyall Dawson
fee239dbcc Avoid storing and cloning paint effects for layers if they are just
the default stack unchanged

Speeds up cloning of symbol layers
2019-07-25 07:00:37 +10:00
Nyall Dawson
45b23fd5b2 [callouts] Allow callout types to have icons, and use them in the type combobox
...and pick ugly icons to prompt @nirvn into action ;)
2019-07-23 12:12:18 +10:00
Nyall Dawson
ac0326a351 [API] Add useful PyQGIS additions to QgsSymbol
Adds:
- __len__ : returns number of symbol layers in symbol
- [ ] getter: returns a specific symbol layer, also allows negative indices to retrieve from end of symbol
- del [ ]: removes a specific symbol layer, also allows negative indices
- raise IndexError when an invalid symbol layer is requested
- allow iteration over symbol layers using
  for layer in symbol:
     print(layer.color())
2019-07-08 08:41:59 +10:00
Nyall Dawson
f3dcd8211e Dox, comments 2019-07-06 12:36:54 +10:00
Nyall Dawson
4f5f6b5607 Add a generic method for adding style entities to a QgsStyle 2019-07-06 12:36:54 +10:00
Nyall Dawson
590d1aae9d [FEATURE][API] Visitor API for style entities
Adds a new visitor pattern API for creation of visitors which visit
all the style entities (symbols, color ramps, text formats, and
label styles) associated with different objects. Can be used on a
renderer, map layer, or project wide level.

E.g. on a project wide level, allows collection of ALL the style
symbols/color ramps/text settings inside a project, including those
in layouts or annotations!
2019-07-06 12:36:54 +10:00
nirvn
0e4f0c8555 [symbology] Fix broken centroid fill's force point inside polygon 2019-06-26 12:05:07 +07:00
Nyall Dawson
850ea71c4d More wip 2019-06-21 15:52:56 +10:00
Nyall Dawson
d4d77808f9 Style model work 2019-06-21 15:52:56 +10:00
Nyall Dawson
0fd4984b3b [FEATURE] Allow storage of label settings in style manager
Just like the earlier change which allows for text formats to
be managed in style manager, this change allows for layer-wide
label settings to be stored and managed in styles.

So while a text format includes just the font settings and other
appearance related settings, Label Settings also includes layer-type
specific settings such as label placement, priority, rendering
settings.
2019-06-21 15:52:56 +10:00
Nyall Dawson
6f172da7e0 Fix dox 2019-06-21 15:52:56 +10:00