qwc2 2025.10.16 → 2025.10.24
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.
- package/actions/locate.js +3 -2
- package/components/AttributeTableWidget.js +24 -15
- package/components/FeatureAttributesWindow.js +177 -0
- package/components/IdentifyViewer.js +80 -39
- package/components/LocationRecorder.js +138 -0
- package/components/PickFeature.js +87 -26
- package/components/PluginsContainer.js +16 -3
- package/components/map/OlLayer.js +2 -1
- package/components/map3d/HeightProfile3D.js +2 -0
- package/components/style/App.css +14 -0
- package/components/style/AttributeTableWidget.css +1 -1
- package/components/style/FeatureAttributesWindow.css +16 -0
- package/components/style/IdentifyViewer.css +5 -0
- package/components/style/LocationRecorder.css +10 -0
- package/components/style/NumericInputWindow.css +7 -0
- package/components/style/PluginsContainer.css +16 -0
- package/components/widgets/LayerCatalogWidget.js +40 -16
- package/components/widgets/NavBar.js +10 -3
- package/icons/circle_full.svg +75 -0
- package/package.json +1 -1
- package/plugins/AttributeTable.js +4 -0
- package/plugins/GeometryDigitizer.js +3 -0
- package/plugins/HeightProfile.js +2 -0
- package/plugins/Identify.js +7 -3
- package/plugins/ObjectList.js +116 -0
- package/plugins/Redlining.js +14 -55
- package/plugins/map/EditingSupport.js +22 -1
- package/plugins/map/LocateSupport.js +8 -1
- package/plugins/map/RedliningSupport.js +108 -18
- package/plugins/map/SnappingSupport.js +11 -6
- package/plugins/map/style/SnappingSupport.css +2 -13
- package/reducers/locate.js +4 -2
- package/reducers/redlining.js +2 -1
- package/static/translations/bg-BG.json +13 -0
- package/static/translations/ca-ES.json +13 -0
- package/static/translations/cs-CZ.json +13 -0
- package/static/translations/de-CH.json +13 -0
- package/static/translations/de-DE.json +14 -1
- package/static/translations/en-US.json +13 -0
- package/static/translations/es-ES.json +13 -0
- package/static/translations/fi-FI.json +13 -0
- package/static/translations/fr-FR.json +13 -0
- package/static/translations/hu-HU.json +13 -0
- package/static/translations/it-IT.json +13 -0
- package/static/translations/ja-JP.json +13 -0
- package/static/translations/nl-NL.json +13 -0
- package/static/translations/no-NO.json +13 -0
- package/static/translations/pl-PL.json +13 -0
- package/static/translations/pt-BR.json +13 -0
- package/static/translations/pt-PT.json +13 -0
- package/static/translations/ro-RO.json +13 -0
- package/static/translations/ru-RU.json +13 -0
- package/static/translations/sv-SE.json +13 -0
- package/static/translations/tr-TR.json +13 -0
- package/static/translations/tsconfig.json +10 -0
- package/static/translations/uk-UA.json +13 -0
- package/utils/EditingInterface.js +4 -1
- package/utils/EditingUtils.js +3 -1
- package/utils/MiscUtils.js +65 -0
- package/utils/expr_grammar/grammar.js +104 -22
- package/utils/expr_grammar/grammar.ne +2 -0
- package/utils/expr_grammar/test.js +21 -4
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"MapExport3D": "",
|
|
25
25
|
"MapFilter": "Harita Filtresi",
|
|
26
26
|
"MapLight3D": "Tarih Zaman",
|
|
27
|
+
"ObjectList": "",
|
|
27
28
|
"Print": "Yazdır",
|
|
28
29
|
"Reports": "Raporlar",
|
|
29
30
|
"Settings": "Ayarlar",
|
|
@@ -192,6 +193,12 @@
|
|
|
192
193
|
"takepicture": "Fotoğraf çek",
|
|
193
194
|
"unsavedchanged": "Kaydedilmemiş değişiklikler mevcut. Yine de sayfadan ayrılmak istiyor musunuz?"
|
|
194
195
|
},
|
|
196
|
+
"featureattributes": {
|
|
197
|
+
"name": "",
|
|
198
|
+
"nofeature": "",
|
|
199
|
+
"value": "",
|
|
200
|
+
"windowtitle": ""
|
|
201
|
+
},
|
|
195
202
|
"featureform": {
|
|
196
203
|
"feature": "Obje",
|
|
197
204
|
"noresults": "Sonuç yok",
|
|
@@ -244,6 +251,7 @@
|
|
|
244
251
|
"identify": {
|
|
245
252
|
"aggregatedreport": "Toplu rapor",
|
|
246
253
|
"clipboard": "Panoya kopyala",
|
|
254
|
+
"compare": "",
|
|
247
255
|
"comparing": "",
|
|
248
256
|
"download": "İndir",
|
|
249
257
|
"export": "Dışarıya aktar",
|
|
@@ -345,6 +353,10 @@
|
|
|
345
353
|
"PERMISSION_DENIED": "Konum: izin verilmedi"
|
|
346
354
|
}
|
|
347
355
|
},
|
|
356
|
+
"locationrecorder": {
|
|
357
|
+
"record": "",
|
|
358
|
+
"stop": ""
|
|
359
|
+
},
|
|
348
360
|
"map": {
|
|
349
361
|
"loading": "Yükleniyor...",
|
|
350
362
|
"resetrotation": "Dönüklüğü sıfırla"
|
|
@@ -481,6 +493,7 @@
|
|
|
481
493
|
"loading": "Form yükleniyor..."
|
|
482
494
|
},
|
|
483
495
|
"redlining": {
|
|
496
|
+
"attributes": "",
|
|
484
497
|
"buffer": "Tampon",
|
|
485
498
|
"buffercompute": "Hesapla",
|
|
486
499
|
"bufferdistance": "Mesafe",
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"appmenu.items.MeasureLineString",
|
|
46
46
|
"appmenu.items.MeasurePolygon",
|
|
47
47
|
"appmenu.items.NewsPopup",
|
|
48
|
+
"appmenu.items.ObjectList",
|
|
48
49
|
"appmenu.items.Panoramax",
|
|
49
50
|
"appmenu.items.Portal",
|
|
50
51
|
"appmenu.items.PrintScreen3D",
|
|
@@ -79,6 +80,7 @@
|
|
|
79
80
|
"appmenu.items.MapExport3D",
|
|
80
81
|
"appmenu.items.MapFilter",
|
|
81
82
|
"appmenu.items.MapLight3D",
|
|
83
|
+
"appmenu.items.ObjectList",
|
|
82
84
|
"appmenu.items.Print",
|
|
83
85
|
"appmenu.items.Reports",
|
|
84
86
|
"appmenu.items.Settings",
|
|
@@ -195,6 +197,10 @@
|
|
|
195
197
|
"editing.select",
|
|
196
198
|
"editing.takepicture",
|
|
197
199
|
"editing.unsavedchanged",
|
|
200
|
+
"featureattributes.name",
|
|
201
|
+
"featureattributes.nofeature",
|
|
202
|
+
"featureattributes.value",
|
|
203
|
+
"featureattributes.windowtitle",
|
|
198
204
|
"featureform.feature",
|
|
199
205
|
"featureform.noresults",
|
|
200
206
|
"featureform.querying",
|
|
@@ -234,6 +240,7 @@
|
|
|
234
240
|
"hideobjects3d.restoreall",
|
|
235
241
|
"identify.aggregatedreport",
|
|
236
242
|
"identify.clipboard",
|
|
243
|
+
"identify.compare",
|
|
237
244
|
"identify.comparing",
|
|
238
245
|
"identify.download",
|
|
239
246
|
"identify.export",
|
|
@@ -312,6 +319,8 @@
|
|
|
312
319
|
"locate.statustooltip.FOLLOWING",
|
|
313
320
|
"locate.statustooltip.LOCATING",
|
|
314
321
|
"locate.statustooltip.PERMISSION_DENIED",
|
|
322
|
+
"locationrecorder.record",
|
|
323
|
+
"locationrecorder.stop",
|
|
315
324
|
"map.loading",
|
|
316
325
|
"map.resetrotation",
|
|
317
326
|
"map3d.lockview",
|
|
@@ -413,6 +422,7 @@
|
|
|
413
422
|
"print.submit",
|
|
414
423
|
"print.wait",
|
|
415
424
|
"qtdesignerform.loading",
|
|
425
|
+
"redlining.attributes",
|
|
416
426
|
"redlining.buffer",
|
|
417
427
|
"redlining.buffercompute",
|
|
418
428
|
"redlining.bufferdistance",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"MapExport3D": "",
|
|
25
25
|
"MapFilter": "",
|
|
26
26
|
"MapLight3D": "",
|
|
27
|
+
"ObjectList": "",
|
|
27
28
|
"Print": "Друк",
|
|
28
29
|
"Reports": "",
|
|
29
30
|
"Settings": "",
|
|
@@ -192,6 +193,12 @@
|
|
|
192
193
|
"takepicture": "",
|
|
193
194
|
"unsavedchanged": ""
|
|
194
195
|
},
|
|
196
|
+
"featureattributes": {
|
|
197
|
+
"name": "",
|
|
198
|
+
"nofeature": "",
|
|
199
|
+
"value": "",
|
|
200
|
+
"windowtitle": ""
|
|
201
|
+
},
|
|
195
202
|
"featureform": {
|
|
196
203
|
"feature": "",
|
|
197
204
|
"noresults": "",
|
|
@@ -244,6 +251,7 @@
|
|
|
244
251
|
"identify": {
|
|
245
252
|
"aggregatedreport": "",
|
|
246
253
|
"clipboard": "",
|
|
254
|
+
"compare": "",
|
|
247
255
|
"comparing": "",
|
|
248
256
|
"download": "",
|
|
249
257
|
"export": "Експорт",
|
|
@@ -345,6 +353,10 @@
|
|
|
345
353
|
"PERMISSION_DENIED": "Геолокація: доступ заборонено"
|
|
346
354
|
}
|
|
347
355
|
},
|
|
356
|
+
"locationrecorder": {
|
|
357
|
+
"record": "",
|
|
358
|
+
"stop": ""
|
|
359
|
+
},
|
|
348
360
|
"map": {
|
|
349
361
|
"loading": "Завантаження...",
|
|
350
362
|
"resetrotation": ""
|
|
@@ -481,6 +493,7 @@
|
|
|
481
493
|
"loading": ""
|
|
482
494
|
},
|
|
483
495
|
"redlining": {
|
|
496
|
+
"attributes": "",
|
|
484
497
|
"buffer": "",
|
|
485
498
|
"buffercompute": "",
|
|
486
499
|
"bufferdistance": "",
|
|
@@ -159,11 +159,13 @@ var EditingInterface = {
|
|
|
159
159
|
* @param callback Callback invoked with the picked features, taking `{features: [...]}` on success and `null` on failure
|
|
160
160
|
* @param filter An optional feature attribute filter expression
|
|
161
161
|
* @param filterGeom An optional filter geometry
|
|
162
|
+
* @param fields An optional list of fields to query, if unspecified all fields are queried
|
|
162
163
|
*/
|
|
163
164
|
getFeatures: function getFeatures(editConfig, mapCrs, callback) {
|
|
164
165
|
var bbox = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
165
166
|
var filter = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
166
167
|
var filterGeom = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
168
|
+
var fields = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
167
169
|
var editServiceUrl = ConfigUtils.getConfigProp("editServiceUrl").replace(/\/$/, '');
|
|
168
170
|
var requestUrl = editServiceUrl + '/' + editConfig.editDataset + '/';
|
|
169
171
|
var params = {
|
|
@@ -177,7 +179,8 @@ var EditingInterface = {
|
|
|
177
179
|
name: mapCrs
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
|
-
})) : undefined
|
|
182
|
+
})) : undefined,
|
|
183
|
+
fields: fields ? fields.join(",") : undefined
|
|
181
184
|
};
|
|
182
185
|
var headers = {
|
|
183
186
|
"Accept-Language": LocaleUtils.lang()
|
package/utils/EditingUtils.js
CHANGED
|
@@ -32,6 +32,7 @@ import { v5 as uuidv5 } from 'uuid';
|
|
|
32
32
|
import StandardApp from '../components/StandardApp';
|
|
33
33
|
import ConfigUtils from './ConfigUtils';
|
|
34
34
|
import LocaleUtils from './LocaleUtils';
|
|
35
|
+
import MiscUtils from './MiscUtils';
|
|
35
36
|
import grammar from './expr_grammar/grammar';
|
|
36
37
|
var UUID_NS = '5ae5531d-8e21-4456-b45d-77e9840a5bb7';
|
|
37
38
|
export var FeatureCache = /*#__PURE__*/_createClass(function FeatureCache() {
|
|
@@ -176,6 +177,7 @@ export function parseExpression(expr, feature, editConfig, editIface, mapPrefix,
|
|
|
176
177
|
representValue: function representValue(attr) {
|
|
177
178
|
return _representValue(attr, editConfig, editIface, promises);
|
|
178
179
|
},
|
|
180
|
+
formatDate: MiscUtils.formatDate,
|
|
179
181
|
asFilter: asFilter,
|
|
180
182
|
username: ConfigUtils.getConfigProp("username"),
|
|
181
183
|
layer: editConfig.layerName,
|
|
@@ -267,7 +269,7 @@ export function getFeatureTemplate(editConfig, feature, editIface, mapPrefix, ma
|
|
|
267
269
|
}
|
|
268
270
|
// Apply default values
|
|
269
271
|
var defaultFieldExpressions = editConfig.fields.reduce(function (res, field) {
|
|
270
|
-
if (field.defaultValue) {
|
|
272
|
+
if (field.defaultValue && !(field.id in feature.properties)) {
|
|
271
273
|
return [].concat(_toConsumableArray(res), [{
|
|
272
274
|
field: field.id,
|
|
273
275
|
expression: field.defaultValue.replace(/^expr:/, '')
|
package/utils/MiscUtils.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; }
|
|
3
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
4
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
2
5
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
6
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
7
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
@@ -9,6 +12,10 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
|
|
|
9
12
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
10
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
11
14
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
16
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
18
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
12
19
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
13
20
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
14
21
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -200,6 +207,60 @@ var MiscUtils = {
|
|
|
200
207
|
},
|
|
201
208
|
resolveAssetsPath: function resolveAssetsPath(path) {
|
|
202
209
|
return path && path.startsWith(":/") ? ConfigUtils.getAssetsPath() + path.substr(1) : path;
|
|
210
|
+
},
|
|
211
|
+
formatDate: function formatDate(input, pattern) {
|
|
212
|
+
var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
213
|
+
// Try to parse the input as a full date-time or as time-only
|
|
214
|
+
var date;
|
|
215
|
+
if (/^\d{2}:\d{2}(:\d{2})?$/.test(input)) {
|
|
216
|
+
var now = new Date();
|
|
217
|
+
var _input$split$map = input.split(':').map(Number),
|
|
218
|
+
_input$split$map2 = _slicedToArray(_input$split$map, 3),
|
|
219
|
+
h = _input$split$map2[0],
|
|
220
|
+
m = _input$split$map2[1],
|
|
221
|
+
s = _input$split$map2[2];
|
|
222
|
+
date = new Date(now.getFullYear(), now.getMonth(), now.getDate(), h, m, s || 0);
|
|
223
|
+
} else {
|
|
224
|
+
date = new Date(input);
|
|
225
|
+
}
|
|
226
|
+
if (isNaN(date)) throw new Error("Invalid date");
|
|
227
|
+
var pad = function pad(n) {
|
|
228
|
+
var len = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
229
|
+
return String(n).padStart(len, "0");
|
|
230
|
+
};
|
|
231
|
+
var tokens = {
|
|
232
|
+
yyyy: date.getFullYear(),
|
|
233
|
+
yy: String(date.getFullYear()).slice(-2),
|
|
234
|
+
MMMM: date.toLocaleString(locale, {
|
|
235
|
+
month: "long"
|
|
236
|
+
}),
|
|
237
|
+
MMM: date.toLocaleString(locale, {
|
|
238
|
+
month: "short"
|
|
239
|
+
}),
|
|
240
|
+
MM: pad(date.getMonth() + 1),
|
|
241
|
+
M: date.getMonth() + 1,
|
|
242
|
+
dd: pad(date.getDate()),
|
|
243
|
+
d: date.getDate(),
|
|
244
|
+
dddd: date.toLocaleString(locale, {
|
|
245
|
+
weekday: "long"
|
|
246
|
+
}),
|
|
247
|
+
ddd: date.toLocaleString(locale, {
|
|
248
|
+
weekday: "short"
|
|
249
|
+
}),
|
|
250
|
+
hh: pad((date.getHours() + 11) % 12 + 1),
|
|
251
|
+
h: (date.getHours() + 11) % 12 + 1,
|
|
252
|
+
HH: pad(date.getHours()),
|
|
253
|
+
H: date.getHours(),
|
|
254
|
+
mm: pad(date.getMinutes()),
|
|
255
|
+
m: date.getMinutes(),
|
|
256
|
+
ss: pad(date.getSeconds()),
|
|
257
|
+
s: date.getSeconds(),
|
|
258
|
+
AP: date.getHours() < 12 ? "AM" : "PM",
|
|
259
|
+
ap: date.getHours() < 12 ? "am" : "pm"
|
|
260
|
+
};
|
|
261
|
+
return pattern.replace(/(yyyy|yy|MMMM|MMM|MM|M|dddd|ddd|dd|d|hh|h|HH|H|mm|m|ss|s|AP|ap)/g, function (match) {
|
|
262
|
+
return tokens[match];
|
|
263
|
+
});
|
|
203
264
|
}
|
|
204
265
|
};
|
|
205
266
|
export var ToggleSet = /*#__PURE__*/_createClass(function ToggleSet() {
|
|
@@ -227,6 +288,10 @@ export var ToggleSet = /*#__PURE__*/_createClass(function ToggleSet() {
|
|
|
227
288
|
return _this;
|
|
228
289
|
}
|
|
229
290
|
});
|
|
291
|
+
_defineProperty(this, "filtered", function (test) {
|
|
292
|
+
var newset = _construct(Set, _toConsumableArray(_toConsumableArray(_this._set).filter(test)));
|
|
293
|
+
return new ToggleSet(newset);
|
|
294
|
+
});
|
|
230
295
|
_defineProperty(this, "add", function (key) {
|
|
231
296
|
if (!_this._set.has(key)) {
|
|
232
297
|
var newset = new Set(_this._set);
|
|
@@ -1652,6 +1652,88 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1652
1652
|
"postprocess": function postprocess(d) {
|
|
1653
1653
|
return window.qwc2ExpressionParserContext.representValue(d[4]);
|
|
1654
1654
|
}
|
|
1655
|
+
}, {
|
|
1656
|
+
"name": "N$string$44",
|
|
1657
|
+
"symbols": [{
|
|
1658
|
+
"literal": "f"
|
|
1659
|
+
}, {
|
|
1660
|
+
"literal": "o"
|
|
1661
|
+
}, {
|
|
1662
|
+
"literal": "r"
|
|
1663
|
+
}, {
|
|
1664
|
+
"literal": "m"
|
|
1665
|
+
}, {
|
|
1666
|
+
"literal": "a"
|
|
1667
|
+
}, {
|
|
1668
|
+
"literal": "t"
|
|
1669
|
+
}, {
|
|
1670
|
+
"literal": "_"
|
|
1671
|
+
}, {
|
|
1672
|
+
"literal": "d"
|
|
1673
|
+
}, {
|
|
1674
|
+
"literal": "a"
|
|
1675
|
+
}, {
|
|
1676
|
+
"literal": "t"
|
|
1677
|
+
}, {
|
|
1678
|
+
"literal": "e"
|
|
1679
|
+
}],
|
|
1680
|
+
"postprocess": function joiner(d) {
|
|
1681
|
+
return d.join('');
|
|
1682
|
+
}
|
|
1683
|
+
}, {
|
|
1684
|
+
"name": "N",
|
|
1685
|
+
"symbols": ["N$string$44", "_", {
|
|
1686
|
+
"literal": "("
|
|
1687
|
+
}, "_", "sqstring", "_", {
|
|
1688
|
+
"literal": ","
|
|
1689
|
+
}, "_", "sqstring", "_", {
|
|
1690
|
+
"literal": ")"
|
|
1691
|
+
}],
|
|
1692
|
+
"postprocess": function postprocess(d) {
|
|
1693
|
+
return window.qwc2ExpressionParserContext.formatDate(d[4], d[8]);
|
|
1694
|
+
}
|
|
1695
|
+
}, {
|
|
1696
|
+
"name": "N$string$45",
|
|
1697
|
+
"symbols": [{
|
|
1698
|
+
"literal": "f"
|
|
1699
|
+
}, {
|
|
1700
|
+
"literal": "o"
|
|
1701
|
+
}, {
|
|
1702
|
+
"literal": "r"
|
|
1703
|
+
}, {
|
|
1704
|
+
"literal": "m"
|
|
1705
|
+
}, {
|
|
1706
|
+
"literal": "a"
|
|
1707
|
+
}, {
|
|
1708
|
+
"literal": "t"
|
|
1709
|
+
}, {
|
|
1710
|
+
"literal": "_"
|
|
1711
|
+
}, {
|
|
1712
|
+
"literal": "d"
|
|
1713
|
+
}, {
|
|
1714
|
+
"literal": "a"
|
|
1715
|
+
}, {
|
|
1716
|
+
"literal": "t"
|
|
1717
|
+
}, {
|
|
1718
|
+
"literal": "e"
|
|
1719
|
+
}],
|
|
1720
|
+
"postprocess": function joiner(d) {
|
|
1721
|
+
return d.join('');
|
|
1722
|
+
}
|
|
1723
|
+
}, {
|
|
1724
|
+
"name": "N",
|
|
1725
|
+
"symbols": ["N$string$45", "_", {
|
|
1726
|
+
"literal": "("
|
|
1727
|
+
}, "_", "sqstring", "_", {
|
|
1728
|
+
"literal": ","
|
|
1729
|
+
}, "_", "sqstring", "_", {
|
|
1730
|
+
"literal": ","
|
|
1731
|
+
}, "_", "sqstring", "_", {
|
|
1732
|
+
"literal": ")"
|
|
1733
|
+
}],
|
|
1734
|
+
"postprocess": function postprocess(d) {
|
|
1735
|
+
return window.qwc2ExpressionParserContext.formatDate(d[4], d[8], d[12]);
|
|
1736
|
+
}
|
|
1655
1737
|
}, {
|
|
1656
1738
|
"name": "N$subexpression$1",
|
|
1657
1739
|
"symbols": [/[pP]/, /[iI]/],
|
|
@@ -1713,7 +1795,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1713
1795
|
return true;
|
|
1714
1796
|
}
|
|
1715
1797
|
}, {
|
|
1716
|
-
"name": "N$string$
|
|
1798
|
+
"name": "N$string$46",
|
|
1717
1799
|
"symbols": [{
|
|
1718
1800
|
"literal": "@"
|
|
1719
1801
|
}, {
|
|
@@ -1736,12 +1818,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1736
1818
|
}
|
|
1737
1819
|
}, {
|
|
1738
1820
|
"name": "N",
|
|
1739
|
-
"symbols": ["N$string$
|
|
1821
|
+
"symbols": ["N$string$46"],
|
|
1740
1822
|
"postprocess": function postprocess(d) {
|
|
1741
1823
|
return window.qwc2ExpressionParserContext.feature;
|
|
1742
1824
|
}
|
|
1743
1825
|
}, {
|
|
1744
|
-
"name": "N$string$
|
|
1826
|
+
"name": "N$string$47",
|
|
1745
1827
|
"symbols": [{
|
|
1746
1828
|
"literal": "@"
|
|
1747
1829
|
}, {
|
|
@@ -1766,13 +1848,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1766
1848
|
}
|
|
1767
1849
|
}, {
|
|
1768
1850
|
"name": "N",
|
|
1769
|
-
"symbols": ["N$string$
|
|
1851
|
+
"symbols": ["N$string$47"],
|
|
1770
1852
|
"postprocess": function postprocess(d) {
|
|
1771
1853
|
var _window$qwc2Expressio7;
|
|
1772
1854
|
return (_window$qwc2Expressio7 = window.qwc2ExpressionParserContext.feature) === null || _window$qwc2Expressio7 === void 0 ? void 0 : _window$qwc2Expressio7.geometry;
|
|
1773
1855
|
}
|
|
1774
1856
|
}, {
|
|
1775
|
-
"name": "N$string$
|
|
1857
|
+
"name": "N$string$48",
|
|
1776
1858
|
"symbols": [{
|
|
1777
1859
|
"literal": "@"
|
|
1778
1860
|
}, {
|
|
@@ -1785,13 +1867,13 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1785
1867
|
}
|
|
1786
1868
|
}, {
|
|
1787
1869
|
"name": "N",
|
|
1788
|
-
"symbols": ["N$string$
|
|
1870
|
+
"symbols": ["N$string$48"],
|
|
1789
1871
|
"postprocess": function postprocess(d) {
|
|
1790
1872
|
var _window$qwc2Expressio8;
|
|
1791
1873
|
return (_window$qwc2Expressio8 = window.qwc2ExpressionParserContext.feature) === null || _window$qwc2Expressio8 === void 0 ? void 0 : _window$qwc2Expressio8.id;
|
|
1792
1874
|
}
|
|
1793
1875
|
}, {
|
|
1794
|
-
"name": "N$string$
|
|
1876
|
+
"name": "N$string$49",
|
|
1795
1877
|
"symbols": [{
|
|
1796
1878
|
"literal": "@"
|
|
1797
1879
|
}, {
|
|
@@ -1810,12 +1892,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1810
1892
|
}
|
|
1811
1893
|
}, {
|
|
1812
1894
|
"name": "N",
|
|
1813
|
-
"symbols": ["N$string$
|
|
1895
|
+
"symbols": ["N$string$49"],
|
|
1814
1896
|
"postprocess": function postprocess(d) {
|
|
1815
1897
|
return window.qwc2ExpressionParserContext.layer;
|
|
1816
1898
|
}
|
|
1817
1899
|
}, {
|
|
1818
|
-
"name": "N$string$
|
|
1900
|
+
"name": "N$string$50",
|
|
1819
1901
|
"symbols": [{
|
|
1820
1902
|
"literal": "@"
|
|
1821
1903
|
}, {
|
|
@@ -1844,12 +1926,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1844
1926
|
}
|
|
1845
1927
|
}, {
|
|
1846
1928
|
"name": "N",
|
|
1847
|
-
"symbols": ["N$string$
|
|
1929
|
+
"symbols": ["N$string$50"],
|
|
1848
1930
|
"postprocess": function postprocess(d) {
|
|
1849
1931
|
return window.qwc2ExpressionParserContext.layer;
|
|
1850
1932
|
}
|
|
1851
1933
|
}, {
|
|
1852
|
-
"name": "N$string$
|
|
1934
|
+
"name": "N$string$51",
|
|
1853
1935
|
"symbols": [{
|
|
1854
1936
|
"literal": "@"
|
|
1855
1937
|
}, {
|
|
@@ -1876,12 +1958,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1876
1958
|
}
|
|
1877
1959
|
}, {
|
|
1878
1960
|
"name": "N",
|
|
1879
|
-
"symbols": ["N$string$
|
|
1961
|
+
"symbols": ["N$string$51"],
|
|
1880
1962
|
"postprocess": function postprocess(d) {
|
|
1881
1963
|
return window.qwc2ExpressionParserContext.projection;
|
|
1882
1964
|
}
|
|
1883
1965
|
}, {
|
|
1884
|
-
"name": "N$string$
|
|
1966
|
+
"name": "N$string$52",
|
|
1885
1967
|
"symbols": [{
|
|
1886
1968
|
"literal": "@"
|
|
1887
1969
|
}, {
|
|
@@ -1922,12 +2004,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1922
2004
|
}
|
|
1923
2005
|
}, {
|
|
1924
2006
|
"name": "N",
|
|
1925
|
-
"symbols": ["N$string$
|
|
2007
|
+
"symbols": ["N$string$52"],
|
|
1926
2008
|
"postprocess": function postprocess(d) {
|
|
1927
2009
|
return window.qwc2ExpressionParserContext.mapPrefix;
|
|
1928
2010
|
}
|
|
1929
2011
|
}, {
|
|
1930
|
-
"name": "N$string$
|
|
2012
|
+
"name": "N$string$53",
|
|
1931
2013
|
"symbols": [{
|
|
1932
2014
|
"literal": "@"
|
|
1933
2015
|
}, {
|
|
@@ -1958,12 +2040,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1958
2040
|
}
|
|
1959
2041
|
}, {
|
|
1960
2042
|
"name": "N",
|
|
1961
|
-
"symbols": ["N$string$
|
|
2043
|
+
"symbols": ["N$string$53"],
|
|
1962
2044
|
"postprocess": function postprocess(d) {
|
|
1963
2045
|
return window.qwc2ExpressionParserContext.projection;
|
|
1964
2046
|
}
|
|
1965
2047
|
}, {
|
|
1966
|
-
"name": "N$string$
|
|
2048
|
+
"name": "N$string$54",
|
|
1967
2049
|
"symbols": [{
|
|
1968
2050
|
"literal": "@"
|
|
1969
2051
|
}, {
|
|
@@ -1994,12 +2076,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1994
2076
|
}
|
|
1995
2077
|
}, {
|
|
1996
2078
|
"name": "N",
|
|
1997
|
-
"symbols": ["N$string$
|
|
2079
|
+
"symbols": ["N$string$54"],
|
|
1998
2080
|
"postprocess": function postprocess(d) {
|
|
1999
2081
|
return window.qwc2ExpressionParserContext.lang;
|
|
2000
2082
|
}
|
|
2001
2083
|
}, {
|
|
2002
|
-
"name": "N$string$
|
|
2084
|
+
"name": "N$string$55",
|
|
2003
2085
|
"symbols": [{
|
|
2004
2086
|
"literal": "@"
|
|
2005
2087
|
}, {
|
|
@@ -2042,12 +2124,12 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2042
2124
|
}
|
|
2043
2125
|
}, {
|
|
2044
2126
|
"name": "N",
|
|
2045
|
-
"symbols": ["N$string$
|
|
2127
|
+
"symbols": ["N$string$55"],
|
|
2046
2128
|
"postprocess": function postprocess(d) {
|
|
2047
2129
|
return window.qwc2ExpressionParserContext.username;
|
|
2048
2130
|
}
|
|
2049
2131
|
}, {
|
|
2050
|
-
"name": "N$string$
|
|
2132
|
+
"name": "N$string$56",
|
|
2051
2133
|
"symbols": [{
|
|
2052
2134
|
"literal": "@"
|
|
2053
2135
|
}, {
|
|
@@ -2084,7 +2166,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
2084
2166
|
}
|
|
2085
2167
|
}, {
|
|
2086
2168
|
"name": "N",
|
|
2087
|
-
"symbols": ["N$string$
|
|
2169
|
+
"symbols": ["N$string$56"],
|
|
2088
2170
|
"postprocess": function postprocess(d) {
|
|
2089
2171
|
return window.qwc2ExpressionParserContext.username;
|
|
2090
2172
|
}
|
|
@@ -121,6 +121,8 @@ N -> float {% id %}
|
|
|
121
121
|
| "get_feature" _ "(" _ P0 _ "," _ P0 _ "," _ P0 _ ")" {% function(d) { return window.qwc2ExpressionParserContext.getFeature(d[4], d[8], d[12]); } %}
|
|
122
122
|
| "get_feature_by_id" _ "(" _ P0 _ "," _ P0 _ ")" {% function(d) { return window.qwc2ExpressionParserContext.getFeature(d[4], "id", d[8]); } %}
|
|
123
123
|
| "represent_value" _ "(" _ dqstring _ ")" {% function(d) { return window.qwc2ExpressionParserContext.representValue(d[4]); } %}
|
|
124
|
+
| "format_date" _ "(" _ sqstring _ "," _ sqstring _ ")" {% function(d) { return window.qwc2ExpressionParserContext.formatDate(d[4], d[8]); } %}
|
|
125
|
+
| "format_date" _ "(" _ sqstring _ "," _ sqstring _ "," _ sqstring _ ")" {% function(d) { return window.qwc2ExpressionParserContext.formatDate(d[4], d[8], d[12]); } %}
|
|
124
126
|
| "PI"i {% function(d) { return Math.PI; } %}
|
|
125
127
|
| "E"i {% function(d) { return Math.E; } %}
|
|
126
128
|
| "NULL"i {% function(d) { return null; } %}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
/* This is just a scratch file for testing the expression grammar */
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import nearley from "nearley";
|
|
4
|
+
import grammar from "./grammar.js";
|
|
5
|
+
import MiscUtils from '../MiscUtils.js';
|
|
5
6
|
global.qwc2ExpressionParserContext = {
|
|
6
7
|
feature: {
|
|
7
8
|
"type": "Feature",
|
|
8
9
|
"properties": {
|
|
9
10
|
"listnr": 1,
|
|
10
11
|
"grpcode": 2,
|
|
11
|
-
"numcode": 3
|
|
12
|
+
"numcode": 3,
|
|
13
|
+
"label": "My fancy feature",
|
|
14
|
+
"BerechneteGruenflaeche": 10,
|
|
15
|
+
"EffektiveGruenflaeche": 8,
|
|
16
|
+
// "BerechneteBebauungsflaeche" - "EffektiveBebauungsflaeche" - "Abtretung" + "Zuteilung"
|
|
17
|
+
"BerechneteBebauungsflaeche": 10,
|
|
18
|
+
"EffektiveBebauungsflaeche": 9,
|
|
19
|
+
"Abtretung": 8.1,
|
|
20
|
+
"Zuteilung": 7.3
|
|
21
|
+
// 10 - 9 - 8 + 7 = 0
|
|
12
22
|
}
|
|
13
23
|
},
|
|
14
24
|
getFeature: function getFeature(layerName, attr, value) {
|
|
@@ -52,6 +62,7 @@ global.qwc2ExpressionParserContext = {
|
|
|
52
62
|
4: 'Four'
|
|
53
63
|
}[value]) !== null && _$2$3$4$value !== void 0 ? _$2$3$4$value : value;
|
|
54
64
|
},
|
|
65
|
+
formatDate: MiscUtils.formatDate,
|
|
55
66
|
asFilter: false,
|
|
56
67
|
username: "testuser",
|
|
57
68
|
layer: "layername"
|
|
@@ -74,5 +85,11 @@ var parser = new nearley.Parser(nearley.Grammar.fromCompiled(grammar));
|
|
|
74
85
|
// parser.feed("nullif('a', 'b')")
|
|
75
86
|
// parser.feed("@user_account_name")
|
|
76
87
|
// parser.feed("'Hello' || ' ' || 'World'");
|
|
77
|
-
parser.feed('represent_value("numcode")');
|
|
88
|
+
// parser.feed('represent_value("numcode")');
|
|
89
|
+
// parser.feed('"BerechneteGruenflaeche" - "EffektiveGruenflaeche"');
|
|
90
|
+
// parser.feed('"BerechneteBebauungsflaeche" - "EffektiveBebauungsflaeche" - "Abtretung" + "Zuteilung"');
|
|
91
|
+
// parser.feed('randf(0.5,0.6)');
|
|
92
|
+
// parser.feed('round(\r "Abtretung" \r+ "Zuteilung")')
|
|
93
|
+
// parser.feed("format_date('2012-05-15','d MMMM yyyy','fr')")
|
|
94
|
+
|
|
78
95
|
console.log(JSON.stringify(parser.results));
|