g3w-admin-qplotly 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- g3w_admin_qplotly-0.0.1.dist-info/METADATA +52 -0
- g3w_admin_qplotly-0.0.1.dist-info/RECORD +139 -0
- g3w_admin_qplotly-0.0.1.dist-info/WHEEL +5 -0
- g3w_admin_qplotly-0.0.1.dist-info/licenses/LICENSE +373 -0
- g3w_admin_qplotly-0.0.1.dist-info/top_level.txt +1 -0
- qplotly/__init__.py +1 -0
- qplotly/admin.py +34 -0
- qplotly/api/__init__.py +0 -0
- qplotly/api/plots/__init__.py +0 -0
- qplotly/api/plots/views.py +211 -0
- qplotly/api/widgets/__init__.py +0 -0
- qplotly/api/widgets/permissions.py +79 -0
- qplotly/api/widgets/serializers.py +109 -0
- qplotly/api/widgets/views.py +287 -0
- qplotly/apiurls.py +132 -0
- qplotly/apps.py +11 -0
- qplotly/locale/bg/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/bg/LC_MESSAGES/django.po +162 -0
- qplotly/locale/de/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/de/LC_MESSAGES/django.po +126 -0
- qplotly/locale/de/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/de/LC_MESSAGES/djangojs.po +221 -0
- qplotly/locale/es/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/es/LC_MESSAGES/django.po +151 -0
- qplotly/locale/es/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/es/LC_MESSAGES/djangojs.po +232 -0
- qplotly/locale/fi/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/fi/LC_MESSAGES/django.po +126 -0
- qplotly/locale/fi/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/fi/LC_MESSAGES/djangojs.po +222 -0
- qplotly/locale/fr/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/fr/LC_MESSAGES/django.po +160 -0
- qplotly/locale/fr/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/fr/LC_MESSAGES/djangojs.po +222 -0
- qplotly/locale/it/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/it/LC_MESSAGES/django.po +163 -0
- qplotly/locale/it/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/it/LC_MESSAGES/djangojs.po +220 -0
- qplotly/locale/pl/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/pl/LC_MESSAGES/django.po +129 -0
- qplotly/locale/pl/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/pl/LC_MESSAGES/djangojs.po +217 -0
- qplotly/locale/pt/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/pt/LC_MESSAGES/django.po +160 -0
- qplotly/locale/ro/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/ro/LC_MESSAGES/django.po +128 -0
- qplotly/locale/ro/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/ro/LC_MESSAGES/djangojs.po +222 -0
- qplotly/locale/se/LC_MESSAGES/django.mo +0 -0
- qplotly/locale/se/LC_MESSAGES/django.po +126 -0
- qplotly/locale/se/LC_MESSAGES/djangojs.mo +0 -0
- qplotly/locale/se/LC_MESSAGES/djangojs.po +222 -0
- qplotly/migrations/0001_initial.py +26 -0
- qplotly/migrations/0002_qplotlywidget_type.py +18 -0
- qplotly/migrations/0003_auto_20200925_0838.py +18 -0
- qplotly/migrations/0004_auto_20200925_1535.py +25 -0
- qplotly/migrations/0005_qplotlywidget_show_on_start_client.py +18 -0
- qplotly/migrations/0006_alter_qplotlywidget_options_qplotlywidget_order.py +23 -0
- qplotly/migrations/0007_alter_qplotlywidget_options_and_more.py +22 -0
- qplotly/migrations/0008_alter_qplotlywidget_order.py +18 -0
- qplotly/migrations/0009_qplotlywidget_show_in_sidebar.py +18 -0
- qplotly/migrations/0010_remove_qplotlywidget_show_in_sidebar_and_more.py +22 -0
- qplotly/migrations/0011_rename_show_poistion_qplotlywidget_show_position.py +18 -0
- qplotly/migrations/0012_qplotlywidgetrelation_qplotlywidget_related_widgets.py +34 -0
- qplotly/migrations/0013_alter_qplotlywidgetrelation_source_and_more.py +24 -0
- qplotly/migrations/0014_alter_qplotlywidgetrelation_source_and_more.py +24 -0
- qplotly/migrations/0015_qplotlywidgetrelation_project.py +34 -0
- qplotly/migrations/0016_remove_qplotlywidget_project.py +17 -0
- qplotly/migrations/__init__.py +0 -0
- qplotly/models.py +142 -0
- qplotly/receivers.py +356 -0
- qplotly/requirements.txt +1 -0
- qplotly/server_filters/__init__.py +1 -0
- qplotly/server_filters/relations.py +32 -0
- qplotly/static/qplotly/icons/2dhistogram.svg +2048 -0
- qplotly/static/qplotly/icons/barplot.svg +2048 -0
- qplotly/static/qplotly/icons/boxplot.svg +2048 -0
- qplotly/static/qplotly/icons/contour.svg +2056 -0
- qplotly/static/qplotly/icons/histogram.svg +2048 -0
- qplotly/static/qplotly/icons/pie.svg +2048 -0
- qplotly/static/qplotly/icons/polar.svg +2055 -0
- qplotly/static/qplotly/icons/scatterplot.svg +2048 -0
- qplotly/static/qplotly/icons/scatterternary.svg +2055 -0
- qplotly/static/qplotly/icons/violin.svg +2878 -0
- qplotly/static/qplotly/js/data-widget-qplotlyWidgetList.js +373 -0
- qplotly/static/qplotly/js/i18n/bg.js +19 -0
- qplotly/static/qplotly/js/i18n/de.js +19 -0
- qplotly/static/qplotly/js/i18n/en.js +19 -0
- qplotly/static/qplotly/js/i18n/fi.js +19 -0
- qplotly/static/qplotly/js/i18n/fr.js +19 -0
- qplotly/static/qplotly/js/i18n/index.js +19 -0
- qplotly/static/qplotly/js/i18n/it.js +19 -0
- qplotly/static/qplotly/js/i18n/ro.js +19 -0
- qplotly/static/qplotly/js/i18n/se.js +19 -0
- qplotly/static/qplotly/js/i18n/uk.js +19 -0
- qplotly/static/qplotly/js/plugin.js +927 -0
- qplotly/static/qplotly/js/sidebar.js +373 -0
- qplotly/static/qplotly/js/widget.js +9 -0
- qplotly/static/qplotly/plotly-1.52.2.min.js +7 -0
- qplotly/static/qplotly/polyfill.min.js +3 -0
- qplotly/templates/qplotly/include/plot_type_icon.html +52 -0
- qplotly/templates/qplotly/layer_action.html +13 -0
- qplotly/templates/qplotly/plots_list_order.html +68 -0
- qplotly/templates/qplotly/plots_list_order_action.html +14 -0
- qplotly/templatetags/__init__.py +0 -0
- qplotly/templatetags/qplotly_tags.py +28 -0
- qplotly/urls.py +52 -0
- qplotly/utils/__init__.py +13 -0
- qplotly/utils/models.py +86 -0
- qplotly/utils/qplotly_factory.py +699 -0
- qplotly/utils/qplotly_settings.py +37 -0
- qplotly/vendor/DataPlotly/__init__.py +0 -0
- qplotly/vendor/DataPlotly/core/__init__.py +0 -0
- qplotly/vendor/DataPlotly/core/plot_factory.py +843 -0
- qplotly/vendor/DataPlotly/core/plot_settings.py +322 -0
- qplotly/vendor/DataPlotly/core/plot_types/__init__.py +20 -0
- qplotly/vendor/DataPlotly/core/plot_types/bar_plot.py +83 -0
- qplotly/vendor/DataPlotly/core/plot_types/box.py +56 -0
- qplotly/vendor/DataPlotly/core/plot_types/contour.py +43 -0
- qplotly/vendor/DataPlotly/core/plot_types/histogram.py +66 -0
- qplotly/vendor/DataPlotly/core/plot_types/histogram2d.py +39 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/2dhistogram.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/barplot.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/boxplot.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/contour.svg +2056 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/histogram.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/pie.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/polar.svg +2055 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/scatterplot.svg +2048 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/scatterternary.svg +2055 -0
- qplotly/vendor/DataPlotly/core/plot_types/icons/violin.svg +2878 -0
- qplotly/vendor/DataPlotly/core/plot_types/pie.py +60 -0
- qplotly/vendor/DataPlotly/core/plot_types/plot_type.py +170 -0
- qplotly/vendor/DataPlotly/core/plot_types/polar.py +63 -0
- qplotly/vendor/DataPlotly/core/plot_types/scatter.py +74 -0
- qplotly/vendor/DataPlotly/core/plot_types/ternary.py +129 -0
- qplotly/vendor/DataPlotly/core/plot_types/violin.py +62 -0
- qplotly/vendor/__init__.py +0 -0
- qplotly/views.py +148 -0
|
@@ -0,0 +1,699 @@
|
|
|
1
|
+
# coding=utf-8
|
|
2
|
+
""""Wrapper fo Data Plotly plot_factory module.
|
|
3
|
+
|
|
4
|
+
.. note:: This program is free software; you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the Mozilla Public License 2.0.
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__author__ = 'lorenzetti@gis3w.it'
|
|
10
|
+
__date__ = '2020-09-16'
|
|
11
|
+
__copyright__ = 'Copyright 2015 - 2020, Gis3w'
|
|
12
|
+
|
|
13
|
+
from qgis.PyQt.QtXml import QDomDocument
|
|
14
|
+
from qplotly.vendor.DataPlotly.core.plot_factory import (
|
|
15
|
+
PlotFactory,
|
|
16
|
+
QgsExpressionContext,
|
|
17
|
+
QgsExpressionContextUtils,
|
|
18
|
+
QgsExpression,
|
|
19
|
+
QgsFeatureRequest,
|
|
20
|
+
PlotSettings,
|
|
21
|
+
QgsCoordinateTransform,
|
|
22
|
+
QgsProject,
|
|
23
|
+
QgsCsException,
|
|
24
|
+
QgsGeometry,
|
|
25
|
+
NULL,
|
|
26
|
+
QColor,
|
|
27
|
+
QgsSymbolLayerUtils
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
from qgis.core import QgsVectorLayer, QgsWkbTypes
|
|
31
|
+
|
|
32
|
+
from qplotly.server_filters import ByFatherFeatursFilter
|
|
33
|
+
|
|
34
|
+
from core.api.filters import IntersectsBBoxFilter
|
|
35
|
+
from core.api.base.vector import MetadataVectorLayer
|
|
36
|
+
|
|
37
|
+
from qdjango.api.layers.filters import (
|
|
38
|
+
SingleLayerSessionTokenFilter,
|
|
39
|
+
RelationOneToManyFilter,
|
|
40
|
+
ColumnAclFilter,
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
from qdjango.api.constraints.filters import (
|
|
44
|
+
SingleLayerSubsetStringConstraintFilter,
|
|
45
|
+
SingleLayerExpressionConstraintFilter,
|
|
46
|
+
GeoConstraintsFilter,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
from qgis.PyQt.QtCore import (
|
|
50
|
+
QDate,
|
|
51
|
+
QDateTime,
|
|
52
|
+
QTime
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class QplotlyFactoring(PlotFactory):
|
|
57
|
+
|
|
58
|
+
filter_backends = (
|
|
59
|
+
IntersectsBBoxFilter,
|
|
60
|
+
SingleLayerSubsetStringConstraintFilter,
|
|
61
|
+
SingleLayerExpressionConstraintFilter,
|
|
62
|
+
SingleLayerSessionTokenFilter,
|
|
63
|
+
GeoConstraintsFilter,
|
|
64
|
+
RelationOneToManyFilter,
|
|
65
|
+
ColumnAclFilter,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
def __init__(self, *args, **kwargs):
|
|
69
|
+
|
|
70
|
+
self.djrequest = kwargs['request']
|
|
71
|
+
del(kwargs['request'])
|
|
72
|
+
|
|
73
|
+
self.layer = kwargs['layer']
|
|
74
|
+
|
|
75
|
+
del (kwargs['layer'])
|
|
76
|
+
|
|
77
|
+
# set data have to reproject
|
|
78
|
+
self.set_reprojecting_status()
|
|
79
|
+
|
|
80
|
+
super().__init__(*args, **kwargs)
|
|
81
|
+
|
|
82
|
+
def set_reprojecting_status(self):
|
|
83
|
+
"""
|
|
84
|
+
Check if data have to reproject
|
|
85
|
+
:return:
|
|
86
|
+
"""
|
|
87
|
+
# check if data to reproject
|
|
88
|
+
# FIXME: use QgsProject crs(), can be (in a try/except block):
|
|
89
|
+
# self.layer.project.qgis_project.crs() != self.layer.qgis_layer.crs()
|
|
90
|
+
if self.layer:
|
|
91
|
+
self.reproject = not self.layer.project.group.srid.auth_srid == self.layer.srid
|
|
92
|
+
|
|
93
|
+
def build_trace(self):
|
|
94
|
+
"""Build only trace"""
|
|
95
|
+
|
|
96
|
+
self.trace = self._build_trace()
|
|
97
|
+
|
|
98
|
+
def build_layout(self):
|
|
99
|
+
"""Build only trace"""
|
|
100
|
+
|
|
101
|
+
self.layout = self._build_layout()
|
|
102
|
+
|
|
103
|
+
def _pyqt2py(self, value):
|
|
104
|
+
"""
|
|
105
|
+
Check if the value is a PyQT object and translate it in native python object
|
|
106
|
+
"""
|
|
107
|
+
|
|
108
|
+
tp = type(value)
|
|
109
|
+
if tp in (QDate, QDateTime, QTime):
|
|
110
|
+
if tp == QDate:
|
|
111
|
+
value = value.toPyDate()
|
|
112
|
+
if tp == QDateTime:
|
|
113
|
+
value = value.toPyDateTime()
|
|
114
|
+
if tp == QTime:
|
|
115
|
+
value = value.toPyTime()
|
|
116
|
+
|
|
117
|
+
return value
|
|
118
|
+
|
|
119
|
+
def fetch_values_from_layer(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements
|
|
120
|
+
"""
|
|
121
|
+
(Re)fetches plot values from the source layer.
|
|
122
|
+
|
|
123
|
+
Modified by Walter lorenzetti for integration into G3W-SUITE
|
|
124
|
+
:param djrequest: Django HttpRequest instance.
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
# Note: we keep things nice and efficient and only iterate a single time over the layer!
|
|
128
|
+
|
|
129
|
+
if self.layer:
|
|
130
|
+
self.metadata_layer = MetadataVectorLayer(
|
|
131
|
+
self.source_layer,
|
|
132
|
+
self.layer.origname,
|
|
133
|
+
layer_id=self.layer.pk,
|
|
134
|
+
layer=self.layer
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
if not self.context_generator:
|
|
138
|
+
context = QgsExpressionContext()
|
|
139
|
+
context.appendScopes(
|
|
140
|
+
QgsExpressionContextUtils.globalProjectLayerScopes(self.source_layer))
|
|
141
|
+
else:
|
|
142
|
+
context = self.context_generator.createExpressionContext()
|
|
143
|
+
# add a new scope corresponding to the source layer -- this will potentially overwrite any other
|
|
144
|
+
# layer scopes which may be present in the context (e.g. from atlas layers), but we need to ensure
|
|
145
|
+
# that source layer fields and attributes are present in the context
|
|
146
|
+
context.appendScope(
|
|
147
|
+
self.source_layer.createExpressionContextScope())
|
|
148
|
+
|
|
149
|
+
self.settings.data_defined_properties.prepare(context)
|
|
150
|
+
|
|
151
|
+
self.fetch_layout_properties(context)
|
|
152
|
+
|
|
153
|
+
def add_source_field_or_expression(field_or_expression):
|
|
154
|
+
field_index = self.source_layer.fields().lookupField(field_or_expression)
|
|
155
|
+
if field_index == -1:
|
|
156
|
+
expression = QgsExpression(field_or_expression)
|
|
157
|
+
if not expression.hasParserError():
|
|
158
|
+
expression.prepare(context)
|
|
159
|
+
return expression, expression.needsGeometry(), expression.referencedColumns()
|
|
160
|
+
|
|
161
|
+
return None, False, {field_or_expression}
|
|
162
|
+
|
|
163
|
+
x_expression, x_needs_geom, x_attrs = add_source_field_or_expression(self.settings.properties['x_name']) if \
|
|
164
|
+
self.settings.properties[
|
|
165
|
+
'x_name'] else (None, False, set())
|
|
166
|
+
y_expression, y_needs_geom, y_attrs = add_source_field_or_expression(self.settings.properties['y_name']) if \
|
|
167
|
+
self.settings.properties[
|
|
168
|
+
'y_name'] else (None, False, set())
|
|
169
|
+
z_expression, z_needs_geom, z_attrs = add_source_field_or_expression(self.settings.properties['z_name']) if \
|
|
170
|
+
self.settings.properties[
|
|
171
|
+
'z_name'] else (None, False, set())
|
|
172
|
+
additional_info_expression, additional_needs_geom, additional_attrs = add_source_field_or_expression(
|
|
173
|
+
self.settings.layout['additional_info_expression']) if self.settings.layout[
|
|
174
|
+
'additional_info_expression'] else (None, False, set())
|
|
175
|
+
|
|
176
|
+
attrs = set().union(self.settings.data_defined_properties.referencedFields(),
|
|
177
|
+
x_attrs,
|
|
178
|
+
y_attrs,
|
|
179
|
+
z_attrs,
|
|
180
|
+
additional_attrs)
|
|
181
|
+
|
|
182
|
+
request = QgsFeatureRequest()
|
|
183
|
+
|
|
184
|
+
if self.settings.data_defined_properties.property(PlotSettings.PROPERTY_FILTER).isActive():
|
|
185
|
+
expression = self.settings.data_defined_properties.property(
|
|
186
|
+
PlotSettings.PROPERTY_FILTER).asExpression()
|
|
187
|
+
request.setFilterExpression(expression)
|
|
188
|
+
request.setExpressionContext(context)
|
|
189
|
+
|
|
190
|
+
original_subset_string = self.source_layer.subsetString()
|
|
191
|
+
|
|
192
|
+
if hasattr(self, 'filter_backends') \
|
|
193
|
+
and hasattr(self, 'djrequest') \
|
|
194
|
+
and hasattr(self, 'layer') \
|
|
195
|
+
and self.djrequest \
|
|
196
|
+
and self.layer:
|
|
197
|
+
for backend in self.filter_backends:
|
|
198
|
+
backend().apply_filter(self.djrequest, self.metadata_layer, request, self)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
request.setSubsetOfAttributes(attrs, self.source_layer.fields())
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
if not x_needs_geom and not y_needs_geom and not z_needs_geom and not additional_needs_geom and not self.settings.data_defined_properties.hasActiveProperties():
|
|
205
|
+
request.setFlags(QgsFeatureRequest.NoGeometry)
|
|
206
|
+
|
|
207
|
+
visible_geom_engine = None
|
|
208
|
+
if self.settings.properties.get('visible_features_only', False) and self.visible_region is not None:
|
|
209
|
+
ct = QgsCoordinateTransform(self.visible_region.crs(), self.source_layer.crs(),
|
|
210
|
+
QgsProject.instance().transformContext())
|
|
211
|
+
try:
|
|
212
|
+
rect = ct.transformBoundingBox(self.visible_region)
|
|
213
|
+
request.setFilterRect(rect)
|
|
214
|
+
except QgsCsException:
|
|
215
|
+
pass
|
|
216
|
+
elif self.settings.properties.get('visible_features_only', False) and self.polygon_filter is not None:
|
|
217
|
+
ct = QgsCoordinateTransform(self.polygon_filter.crs(), self.source_layer.crs(),
|
|
218
|
+
QgsProject.instance().transformContext())
|
|
219
|
+
try:
|
|
220
|
+
rect = ct.transformBoundingBox(
|
|
221
|
+
self.polygon_filter.geometry.boundingBox())
|
|
222
|
+
request.setFilterRect(rect)
|
|
223
|
+
g = self.polygon_filter.geometry
|
|
224
|
+
g.transform(ct)
|
|
225
|
+
|
|
226
|
+
visible_geom_engine = QgsGeometry.createGeometryEngine(
|
|
227
|
+
g.constGet())
|
|
228
|
+
visible_geom_engine.prepareGeometry()
|
|
229
|
+
except QgsCsException:
|
|
230
|
+
pass
|
|
231
|
+
|
|
232
|
+
# self.selected_features_only is not used into qplotly module !
|
|
233
|
+
# -------------------------------------------------------------
|
|
234
|
+
# if self.selected_features_only:
|
|
235
|
+
# it = self.source_layer.getSelectedFeatures(request)
|
|
236
|
+
# else:
|
|
237
|
+
# it = self.source_layer.getFeatures(request)
|
|
238
|
+
# Materialize features so we can both build a temporary memory layer
|
|
239
|
+
# (to expose the filtered features as an expression context scope)
|
|
240
|
+
# and iterate over them below.
|
|
241
|
+
features = list(self.source_layer.getFeatures(request))
|
|
242
|
+
|
|
243
|
+
# Build a temporary in-memory layer that mirrors the source layer
|
|
244
|
+
# schema/CRS and contains only the features matching the request.
|
|
245
|
+
geom_type = QgsWkbTypes.displayString(self.source_layer.wkbType())
|
|
246
|
+
crs_auth = self.source_layer.crs().authid() or ''
|
|
247
|
+
uri = '{geom}?crs={crs}'.format(geom=geom_type, crs=crs_auth)
|
|
248
|
+
temp_layer = QgsVectorLayer(uri, 'qplotly_filtered', 'memory')
|
|
249
|
+
if temp_layer.isValid():
|
|
250
|
+
temp_provider = temp_layer.dataProvider()
|
|
251
|
+
temp_provider.addAttributes(self.source_layer.fields().toList())
|
|
252
|
+
temp_layer.updateFields()
|
|
253
|
+
if features:
|
|
254
|
+
temp_provider.addFeatures(features)
|
|
255
|
+
temp_layer.updateExtents()
|
|
256
|
+
|
|
257
|
+
# Append the temporary layer scope to the expression context so
|
|
258
|
+
# downstream expressions can reference it (e.g. via @layer / fields).
|
|
259
|
+
context.appendScope(
|
|
260
|
+
QgsExpressionContextUtils.layerScope(temp_layer))
|
|
261
|
+
|
|
262
|
+
# Keep a reference on self in case callers need to access it.
|
|
263
|
+
self.temp_filtered_layer = temp_layer
|
|
264
|
+
|
|
265
|
+
it = iter(features)
|
|
266
|
+
|
|
267
|
+
self.qgsrequest = request
|
|
268
|
+
|
|
269
|
+
# Some plot types don't draw individual glyphs for each feature, but aggregate them instead.
|
|
270
|
+
# In that case it doesn't make sense to evaluate expressions for settings like marker size or color for each
|
|
271
|
+
# feature. Instead, the evaluation should be executed only once for these settings.
|
|
272
|
+
aggregating = self.settings.plot_type in ['box', 'histogram']
|
|
273
|
+
executed = False
|
|
274
|
+
|
|
275
|
+
xx = []
|
|
276
|
+
yy = []
|
|
277
|
+
zz = []
|
|
278
|
+
additional_hover_text = []
|
|
279
|
+
marker_sizes = []
|
|
280
|
+
colors = []
|
|
281
|
+
stroke_colors = []
|
|
282
|
+
stroke_widths = []
|
|
283
|
+
for f in it:
|
|
284
|
+
if visible_geom_engine and not visible_geom_engine.intersects(f.geometry().constGet()):
|
|
285
|
+
continue
|
|
286
|
+
|
|
287
|
+
self.settings.feature_ids.append(f.id())
|
|
288
|
+
context.setFeature(f)
|
|
289
|
+
|
|
290
|
+
x = None
|
|
291
|
+
if x_expression:
|
|
292
|
+
x = x_expression.evaluate(context)
|
|
293
|
+
if x == NULL or x is None:
|
|
294
|
+
continue
|
|
295
|
+
elif self.settings.properties['x_name']:
|
|
296
|
+
x = self._pyqt2py(f[self.settings.properties['x_name']])
|
|
297
|
+
if x == NULL or x is None:
|
|
298
|
+
continue
|
|
299
|
+
|
|
300
|
+
y = None
|
|
301
|
+
if y_expression:
|
|
302
|
+
y = y_expression.evaluate(context)
|
|
303
|
+
if y == NULL or y is None:
|
|
304
|
+
continue
|
|
305
|
+
elif self.settings.properties['y_name']:
|
|
306
|
+
y = self._pyqt2py(f[self.settings.properties['y_name']])
|
|
307
|
+
if y == NULL or y is None:
|
|
308
|
+
continue
|
|
309
|
+
|
|
310
|
+
z = None
|
|
311
|
+
if z_expression:
|
|
312
|
+
z = z_expression.evaluate(context)
|
|
313
|
+
if z == NULL or z is None:
|
|
314
|
+
continue
|
|
315
|
+
elif self.settings.properties['z_name']:
|
|
316
|
+
z = self._pyqt2py(f[self.settings.properties['z_name']])
|
|
317
|
+
if z == NULL or z is None:
|
|
318
|
+
continue
|
|
319
|
+
|
|
320
|
+
if additional_info_expression:
|
|
321
|
+
additional_hover_text.append(
|
|
322
|
+
additional_info_expression.evaluate(context))
|
|
323
|
+
elif self.settings.layout['additional_info_expression']:
|
|
324
|
+
additional_hover_text.append(
|
|
325
|
+
f[self.settings.layout['additional_info_expression']])
|
|
326
|
+
|
|
327
|
+
if x is not None:
|
|
328
|
+
xx.append(x)
|
|
329
|
+
if y is not None:
|
|
330
|
+
yy.append(y)
|
|
331
|
+
if z is not None:
|
|
332
|
+
zz.append(z)
|
|
333
|
+
|
|
334
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_MARKER_SIZE):
|
|
335
|
+
default_value = self.settings.properties['marker_size']
|
|
336
|
+
context.setOriginalValueVariable(default_value)
|
|
337
|
+
value, _ = self.settings.data_defined_properties.valueAsDouble(PlotSettings.PROPERTY_MARKER_SIZE,
|
|
338
|
+
context, default_value)
|
|
339
|
+
marker_sizes.append(value)
|
|
340
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_STROKE_WIDTH):
|
|
341
|
+
default_value = self.settings.properties['marker_width']
|
|
342
|
+
context.setOriginalValueVariable(default_value)
|
|
343
|
+
value, _ = self.settings.data_defined_properties.valueAsDouble(PlotSettings.PROPERTY_STROKE_WIDTH,
|
|
344
|
+
context, default_value)
|
|
345
|
+
stroke_widths.append(value)
|
|
346
|
+
|
|
347
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_COLOR) and (not aggregating or not executed):
|
|
348
|
+
default_value = QColor(self.settings.properties['in_color'])
|
|
349
|
+
value, conversion_success = self.settings.data_defined_properties.valueAsColor(PlotSettings.PROPERTY_COLOR, context,
|
|
350
|
+
default_value)
|
|
351
|
+
if conversion_success:
|
|
352
|
+
# We were given a valid color specification, use that color
|
|
353
|
+
colors.append(value.name())
|
|
354
|
+
else:
|
|
355
|
+
try:
|
|
356
|
+
# Attempt to interpret the value as a list of color specifications
|
|
357
|
+
value_list = self.settings.data_defined_properties.value(
|
|
358
|
+
PlotSettings.PROPERTY_COLOR, context)
|
|
359
|
+
color_list = [QgsSymbolLayerUtils.decodeColor(
|
|
360
|
+
item).name() for item in value_list]
|
|
361
|
+
colors.extend(color_list)
|
|
362
|
+
except TypeError:
|
|
363
|
+
# Not a list of color specifications, use the default color instead
|
|
364
|
+
colors.append(default_value.name())
|
|
365
|
+
|
|
366
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_STROKE_COLOR) and (not aggregating or not executed):
|
|
367
|
+
default_value = QColor(self.settings.properties['out_color'])
|
|
368
|
+
value, conversion_success = self.settings.data_defined_properties.valueAsColor(PlotSettings.PROPERTY_STROKE_COLOR, context,
|
|
369
|
+
default_value)
|
|
370
|
+
if conversion_success:
|
|
371
|
+
# We were given a valid color specification, use that color
|
|
372
|
+
stroke_colors.append(value.name())
|
|
373
|
+
else:
|
|
374
|
+
try:
|
|
375
|
+
# Attempt to interpret the value as a list of color specifications
|
|
376
|
+
value_list = self.settings.data_defined_properties.value(
|
|
377
|
+
PlotSettings.PROPERTY_STROKE_COLOR, context)
|
|
378
|
+
color_list = [QgsSymbolLayerUtils.decodeColor(
|
|
379
|
+
item).name() for item in value_list]
|
|
380
|
+
stroke_colors.extend(color_list)
|
|
381
|
+
except TypeError:
|
|
382
|
+
# Not a list of color specifications, use the default color instead
|
|
383
|
+
stroke_colors.append(default_value.name())
|
|
384
|
+
|
|
385
|
+
executed = True
|
|
386
|
+
|
|
387
|
+
self.settings.additional_hover_text = additional_hover_text
|
|
388
|
+
self.settings.x = xx
|
|
389
|
+
self.settings.y = yy
|
|
390
|
+
self.settings.z = zz
|
|
391
|
+
if marker_sizes:
|
|
392
|
+
self.settings.data_defined_marker_sizes = marker_sizes
|
|
393
|
+
if colors:
|
|
394
|
+
self.settings.data_defined_colors = colors
|
|
395
|
+
if stroke_colors:
|
|
396
|
+
self.settings.data_defined_stroke_colors = stroke_colors
|
|
397
|
+
if stroke_widths:
|
|
398
|
+
self.settings.data_defined_stroke_widths = stroke_widths
|
|
399
|
+
|
|
400
|
+
# Restore the original subset string
|
|
401
|
+
self.source_layer.setSubsetString(original_subset_string)
|
|
402
|
+
|
|
403
|
+
# Dispose of the temporary in-memory layer created for the
|
|
404
|
+
# expression context scope, to avoid keeping it alive longer than
|
|
405
|
+
# needed.
|
|
406
|
+
if getattr(self, 'temp_filtered_layer', None) is not None:
|
|
407
|
+
try:
|
|
408
|
+
self.temp_filtered_layer.deleteLater()
|
|
409
|
+
except Exception:
|
|
410
|
+
pass
|
|
411
|
+
self.temp_filtered_layer = None
|
|
412
|
+
|
|
413
|
+
def __fetch_values_from_layer(self):
|
|
414
|
+
"""
|
|
415
|
+
(Re)fetches plot values from the source layer.
|
|
416
|
+
|
|
417
|
+
Modified by Walter lorenzetti for integration into G3W-SUITE
|
|
418
|
+
:param djrequest: Django HttpRequest instance.
|
|
419
|
+
"""
|
|
420
|
+
|
|
421
|
+
# Note: we keep things nice and efficient and only iterate a single time over the layer!
|
|
422
|
+
|
|
423
|
+
if self.layer:
|
|
424
|
+
self.metadata_layer = MetadataVectorLayer(
|
|
425
|
+
self.source_layer,
|
|
426
|
+
self.layer.origname,
|
|
427
|
+
layer_id=self.layer.pk,
|
|
428
|
+
layer=self.layer
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
if not self.context_generator:
|
|
432
|
+
context = QgsExpressionContext()
|
|
433
|
+
context.appendScopes(
|
|
434
|
+
QgsExpressionContextUtils.globalProjectLayerScopes(self.source_layer))
|
|
435
|
+
else:
|
|
436
|
+
context = self.context_generator.createExpressionContext()
|
|
437
|
+
# add a new scope corresponding to the source layer -- this will potentially overwrite any other
|
|
438
|
+
# layer scopes which may be present in the context (e.g. from atlas layers), but we need to ensure
|
|
439
|
+
# that source layer fields and attributes are present in the context
|
|
440
|
+
context.appendScope(
|
|
441
|
+
self.source_layer.createExpressionContextScope())
|
|
442
|
+
|
|
443
|
+
self.settings.data_defined_properties.prepare(context)
|
|
444
|
+
|
|
445
|
+
self.fetch_layout_properties(context)
|
|
446
|
+
|
|
447
|
+
def add_source_field_or_expression(field_or_expression):
|
|
448
|
+
field_index = self.source_layer.fields().lookupField(field_or_expression)
|
|
449
|
+
if field_index == -1:
|
|
450
|
+
expression = QgsExpression(field_or_expression)
|
|
451
|
+
if not expression.hasParserError():
|
|
452
|
+
expression.prepare(context)
|
|
453
|
+
return expression, expression.needsGeometry(), expression.referencedColumns()
|
|
454
|
+
|
|
455
|
+
return None, False, {field_or_expression}
|
|
456
|
+
|
|
457
|
+
x_expression, x_needs_geom, x_attrs = add_source_field_or_expression(self.settings.properties['x_name']) if \
|
|
458
|
+
self.settings.properties[
|
|
459
|
+
'x_name'] else (None, False, set())
|
|
460
|
+
y_expression, y_needs_geom, y_attrs = add_source_field_or_expression(self.settings.properties['y_name']) if \
|
|
461
|
+
self.settings.properties[
|
|
462
|
+
'y_name'] else (None, False, set())
|
|
463
|
+
z_expression, z_needs_geom, z_attrs = add_source_field_or_expression(self.settings.properties['z_name']) if \
|
|
464
|
+
self.settings.properties[
|
|
465
|
+
'z_name'] else (None, False, set())
|
|
466
|
+
additional_info_expression, additional_needs_geom, additional_attrs = add_source_field_or_expression(
|
|
467
|
+
self.settings.layout['additional_info_expression']) if self.settings.layout[
|
|
468
|
+
'additional_info_expression'] else (None, False, set())
|
|
469
|
+
|
|
470
|
+
attrs = set().union(self.settings.data_defined_properties.referencedFields(),
|
|
471
|
+
x_attrs,
|
|
472
|
+
y_attrs,
|
|
473
|
+
z_attrs,
|
|
474
|
+
additional_attrs)
|
|
475
|
+
|
|
476
|
+
request = QgsFeatureRequest()
|
|
477
|
+
|
|
478
|
+
if self.settings.data_defined_properties.property(PlotSettings.PROPERTY_FILTER).isActive():
|
|
479
|
+
expression = self.settings.data_defined_properties.property(
|
|
480
|
+
PlotSettings.PROPERTY_FILTER).asExpression()
|
|
481
|
+
request.setFilterExpression(expression)
|
|
482
|
+
request.setExpressionContext(context)
|
|
483
|
+
|
|
484
|
+
original_subset_string = self.source_layer.subsetString()
|
|
485
|
+
|
|
486
|
+
if hasattr(self, 'filter_backends') \
|
|
487
|
+
and hasattr(self, 'djrequest') \
|
|
488
|
+
and hasattr(self, 'layer') \
|
|
489
|
+
and self.djrequest \
|
|
490
|
+
and self.layer:
|
|
491
|
+
for backend in self.filter_backends:
|
|
492
|
+
backend().apply_filter(self.djrequest, self.metadata_layer, request, self)
|
|
493
|
+
|
|
494
|
+
request.setSubsetOfAttributes(attrs, self.source_layer.fields())
|
|
495
|
+
|
|
496
|
+
if not x_needs_geom and not y_needs_geom and not z_needs_geom and not additional_needs_geom and not self.settings.data_defined_properties.hasActiveProperties():
|
|
497
|
+
request.setFlags(QgsFeatureRequest.NoGeometry)
|
|
498
|
+
|
|
499
|
+
visible_geom_engine = None
|
|
500
|
+
if self.visible_features_only and self.visible_region is not None:
|
|
501
|
+
ct = QgsCoordinateTransform(self.visible_region.crs(), self.source_layer.crs(),
|
|
502
|
+
QgsProject.instance().transformContext())
|
|
503
|
+
try:
|
|
504
|
+
rect = ct.transformBoundingBox(self.visible_region)
|
|
505
|
+
request.setFilterRect(rect)
|
|
506
|
+
except QgsCsException:
|
|
507
|
+
pass
|
|
508
|
+
elif self.visible_features_only and self.polygon_filter is not None:
|
|
509
|
+
ct = QgsCoordinateTransform(self.polygon_filter.crs(), self.source_layer.crs(),
|
|
510
|
+
QgsProject.instance().transformContext())
|
|
511
|
+
try:
|
|
512
|
+
rect = ct.transformBoundingBox(
|
|
513
|
+
self.polygon_filter.geometry.boundingBox())
|
|
514
|
+
request.setFilterRect(rect)
|
|
515
|
+
g = self.polygon_filter.geometry
|
|
516
|
+
g.transform(ct)
|
|
517
|
+
|
|
518
|
+
visible_geom_engine = QgsGeometry.createGeometryEngine(
|
|
519
|
+
g.constGet())
|
|
520
|
+
visible_geom_engine.prepareGeometry()
|
|
521
|
+
except QgsCsException:
|
|
522
|
+
pass
|
|
523
|
+
|
|
524
|
+
# self.selected_features_only is not used into qplotly module !
|
|
525
|
+
# -------------------------------------------------------------
|
|
526
|
+
# if self.selected_features_only:
|
|
527
|
+
# it = self.source_layer.getSelectedFeatures(request)
|
|
528
|
+
# else:
|
|
529
|
+
it = self.source_layer.getFeatures(request)
|
|
530
|
+
|
|
531
|
+
self.qgsrequest = request
|
|
532
|
+
|
|
533
|
+
# Some plot types don't draw individual glyphs for each feature, but aggregate them instead.
|
|
534
|
+
# In that case it doesn't make sense to evaluate expressions for settings like marker size or color for each
|
|
535
|
+
# feature. Instead, the evaluation should be executed only once for these settings.
|
|
536
|
+
aggregating = self.settings.plot_type in ['box', 'histogram']
|
|
537
|
+
executed = False
|
|
538
|
+
|
|
539
|
+
xx = []
|
|
540
|
+
yy = []
|
|
541
|
+
zz = []
|
|
542
|
+
additional_hover_text = []
|
|
543
|
+
marker_sizes = []
|
|
544
|
+
colors = []
|
|
545
|
+
stroke_colors = []
|
|
546
|
+
stroke_widths = []
|
|
547
|
+
for f in it:
|
|
548
|
+
if visible_geom_engine and not visible_geom_engine.intersects(f.geometry().constGet()):
|
|
549
|
+
continue
|
|
550
|
+
|
|
551
|
+
self.settings.feature_ids.append(f.id())
|
|
552
|
+
context.setFeature(f)
|
|
553
|
+
|
|
554
|
+
x = None
|
|
555
|
+
if x_expression:
|
|
556
|
+
x = x_expression.evaluate(context)
|
|
557
|
+
if x == NULL or x is None:
|
|
558
|
+
continue
|
|
559
|
+
elif self.settings.properties['x_name']:
|
|
560
|
+
x = self._pyqt2py(f[self.settings.properties['x_name']])
|
|
561
|
+
if x == NULL or x is None:
|
|
562
|
+
continue
|
|
563
|
+
|
|
564
|
+
y = None
|
|
565
|
+
if y_expression:
|
|
566
|
+
y = y_expression.evaluate(context)
|
|
567
|
+
if y == NULL or y is None:
|
|
568
|
+
continue
|
|
569
|
+
elif self.settings.properties['y_name']:
|
|
570
|
+
y = self._pyqt2py(f[self.settings.properties['y_name']])
|
|
571
|
+
if y == NULL or y is None:
|
|
572
|
+
continue
|
|
573
|
+
|
|
574
|
+
z = None
|
|
575
|
+
if z_expression:
|
|
576
|
+
z = z_expression.evaluate(context)
|
|
577
|
+
if z == NULL or z is None:
|
|
578
|
+
continue
|
|
579
|
+
elif self.settings.properties['z_name']:
|
|
580
|
+
z = self._pyqt2py(f[self.settings.properties['z_name']])
|
|
581
|
+
if z == NULL or z is None:
|
|
582
|
+
continue
|
|
583
|
+
|
|
584
|
+
if additional_info_expression:
|
|
585
|
+
additional_hover_text.append(
|
|
586
|
+
additional_info_expression.evaluate(context))
|
|
587
|
+
elif self.settings.layout['additional_info_expression']:
|
|
588
|
+
additional_hover_text.append(
|
|
589
|
+
f[self.settings.layout['additional_info_expression']])
|
|
590
|
+
|
|
591
|
+
if x is not None:
|
|
592
|
+
xx.append(x)
|
|
593
|
+
if y is not None:
|
|
594
|
+
yy.append(y)
|
|
595
|
+
if z is not None:
|
|
596
|
+
zz.append(z)
|
|
597
|
+
|
|
598
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_MARKER_SIZE):
|
|
599
|
+
default_value = self.settings.properties['marker_size']
|
|
600
|
+
context.setOriginalValueVariable(default_value)
|
|
601
|
+
value, _ = self.settings.data_defined_properties.valueAsDouble(PlotSettings.PROPERTY_MARKER_SIZE,
|
|
602
|
+
context, default_value)
|
|
603
|
+
marker_sizes.append(value)
|
|
604
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_STROKE_WIDTH):
|
|
605
|
+
default_value = self.settings.properties['marker_width']
|
|
606
|
+
context.setOriginalValueVariable(default_value)
|
|
607
|
+
value, _ = self.settings.data_defined_properties.valueAsDouble(PlotSettings.PROPERTY_STROKE_WIDTH,
|
|
608
|
+
context, default_value)
|
|
609
|
+
stroke_widths.append(value)
|
|
610
|
+
|
|
611
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_COLOR) and (not aggregating or not executed):
|
|
612
|
+
default_value = QColor(self.settings.properties['in_color'])
|
|
613
|
+
value, conversion_success = self.settings.data_defined_properties.valueAsColor(PlotSettings.PROPERTY_COLOR, context,
|
|
614
|
+
default_value)
|
|
615
|
+
if conversion_success:
|
|
616
|
+
# We were given a valid color specification, use that color
|
|
617
|
+
colors.append(value.name())
|
|
618
|
+
else:
|
|
619
|
+
try:
|
|
620
|
+
# Attempt to interpret the value as a list of color specifications
|
|
621
|
+
value_list = self.settings.data_defined_properties.value(
|
|
622
|
+
PlotSettings.PROPERTY_COLOR, context)
|
|
623
|
+
color_list = [QgsSymbolLayerUtils.decodeColor(
|
|
624
|
+
item).name() for item in value_list]
|
|
625
|
+
colors.extend(color_list)
|
|
626
|
+
except TypeError:
|
|
627
|
+
# Not a list of color specifications, use the default color instead
|
|
628
|
+
colors.append(default_value.name())
|
|
629
|
+
|
|
630
|
+
if self.settings.data_defined_properties.isActive(PlotSettings.PROPERTY_STROKE_COLOR) and (not aggregating or not executed):
|
|
631
|
+
default_value = QColor(self.settings.properties['out_color'])
|
|
632
|
+
value, conversion_success = self.settings.data_defined_properties.valueAsColor(PlotSettings.PROPERTY_STROKE_COLOR, context,
|
|
633
|
+
default_value)
|
|
634
|
+
if conversion_success:
|
|
635
|
+
# We were given a valid color specification, use that color
|
|
636
|
+
stroke_colors.append(value.name())
|
|
637
|
+
else:
|
|
638
|
+
try:
|
|
639
|
+
# Attempt to interpret the value as a list of color specifications
|
|
640
|
+
value_list = self.settings.data_defined_properties.value(
|
|
641
|
+
PlotSettings.PROPERTY_STROKE_COLOR, context)
|
|
642
|
+
color_list = [QgsSymbolLayerUtils.decodeColor(
|
|
643
|
+
item).name() for item in value_list]
|
|
644
|
+
stroke_colors.extend(color_list)
|
|
645
|
+
except TypeError:
|
|
646
|
+
# Not a list of color specifications, use the default color instead
|
|
647
|
+
stroke_colors.append(default_value.name())
|
|
648
|
+
|
|
649
|
+
executed = True
|
|
650
|
+
|
|
651
|
+
self.settings.additional_hover_text = additional_hover_text
|
|
652
|
+
self.settings.x = xx
|
|
653
|
+
self.settings.y = yy
|
|
654
|
+
self.settings.z = zz
|
|
655
|
+
if marker_sizes:
|
|
656
|
+
self.settings.data_defined_marker_sizes = marker_sizes
|
|
657
|
+
if colors:
|
|
658
|
+
self.settings.data_defined_colors = colors
|
|
659
|
+
if stroke_colors:
|
|
660
|
+
self.settings.data_defined_stroke_colors = stroke_colors
|
|
661
|
+
if stroke_widths:
|
|
662
|
+
self.settings.data_defined_stroke_widths = stroke_widths
|
|
663
|
+
|
|
664
|
+
# Restore the original subset string
|
|
665
|
+
self.source_layer.setSubsetString(original_subset_string)
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
class QplotlyFactoringRelation(QplotlyFactoring):
|
|
671
|
+
"""Inherit form QplotlyFactoring and is specific for relations"""
|
|
672
|
+
|
|
673
|
+
filter_backends = QplotlyFactoring.filter_backends + \
|
|
674
|
+
(ByFatherFeatursFilter, )
|
|
675
|
+
|
|
676
|
+
filter_backends = QplotlyFactoring.filter_backends + \
|
|
677
|
+
(ByFatherFeatursFilter, )
|
|
678
|
+
|
|
679
|
+
def set_father_features_expresion(self, qgs_relation=None, fsource_layer=None, ffiltered_features=None):
|
|
680
|
+
"""
|
|
681
|
+
Create expression and set into class
|
|
682
|
+
:param qgs_relation: QgsRelation instance
|
|
683
|
+
:param fsource_layer: QgsVectorLayer instance of father
|
|
684
|
+
:param ffiltered_features: QgsFeatureiterator of father
|
|
685
|
+
:return: Boolean
|
|
686
|
+
"""
|
|
687
|
+
|
|
688
|
+
# get features and
|
|
689
|
+
features = fsource_layer.getFeatures() if fsource_layer else ffiltered_features
|
|
690
|
+
|
|
691
|
+
expressions = []
|
|
692
|
+
for f in features:
|
|
693
|
+
expressions.append(qgs_relation.getRelatedFeaturesFilter(qgs_relation.referencedLayer().
|
|
694
|
+
getFeature(int(f.id()))))
|
|
695
|
+
|
|
696
|
+
if expressions:
|
|
697
|
+
self.father_features_expresion = ' OR '.join(expressions)
|
|
698
|
+
else:
|
|
699
|
+
self.father_features_expresion = 'false'
|