@disy/cadenza.js 2.11.0 → 2.13.0
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/CHANGELOG.md +8 -0
- package/README.md +1 -0
- package/apidoc/assets/navigation.js +1 -1
- package/apidoc/assets/search.js +1 -1
- package/apidoc/classes/AbortError.html +3 -3
- package/apidoc/classes/CadenzaClient.html +47 -25
- package/apidoc/classes/CadenzaError.html +5 -5
- package/apidoc/functions/cadenza.html +3 -3
- package/apidoc/index.html +10 -2
- package/apidoc/interfaces/CadenzaClientOptions.html +5 -5
- package/apidoc/interfaces/CadenzaEvent.html +4 -4
- package/apidoc/interfaces/Distance.html +3 -0
- package/apidoc/interfaces/ExternalLinkKey.html +4 -4
- package/apidoc/interfaces/Feature.html +12 -0
- package/apidoc/interfaces/FeatureCollection.html +4 -0
- package/apidoc/interfaces/Geometry.html +3 -3
- package/apidoc/interfaces/GeometryZoomTarget.html +4 -0
- package/apidoc/interfaces/PageSource.html +3 -3
- package/apidoc/modules.html +10 -3
- package/apidoc/types/CadenzaActionEvent.html +2 -0
- package/apidoc/types/CadenzaChangeSelectionEvent.html +2 -2
- package/apidoc/types/CadenzaDrillThroughEvent.html +2 -2
- package/apidoc/types/CadenzaEditGeometryCancelEvent.html +2 -2
- package/apidoc/types/CadenzaEditGeometryOkEvent.html +2 -2
- package/apidoc/types/CadenzaEditGeometryUpdateEvent.html +2 -2
- package/apidoc/types/CadenzaErrorEvent.html +2 -2
- package/apidoc/types/CadenzaEventByType.html +1 -1
- package/apidoc/types/CadenzaEventType.html +2 -2
- package/apidoc/types/CadenzaObjectInfoEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
- package/apidoc/types/DataType.html +2 -2
- package/apidoc/types/EmbeddingTargetId.html +2 -2
- package/apidoc/types/Extent.html +2 -2
- package/apidoc/types/FilterVariables.html +2 -2
- package/apidoc/types/GeometryType.html +2 -2
- package/apidoc/types/GlobalId.html +2 -2
- package/apidoc/types/LengthUnit.html +1 -0
- package/apidoc/types/OpaqueString.html +2 -2
- package/apidoc/types/OperationMode.html +2 -2
- package/apidoc/types/TablePart.html +2 -2
- package/apidoc/types/UiFeature.html +2 -2
- package/apidoc/types/WorkbookLayerPath.html +2 -2
- package/apidoc/types/ZoomTarget.html +2 -0
- package/cadenza.d.ts +125 -14
- package/cadenza.js +125 -18
- package/package.json +1 -1
- package/sandbox.cjs +2 -2
- package/sandbox.html +97 -14
package/cadenza.js
CHANGED
|
@@ -96,6 +96,14 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
96
96
|
* * `"workbook-design"` - The workbook designer
|
|
97
97
|
* * `"workbook-view-management"` - Add/Edit/Remove workbook views (Is included in 'workbook-design'.)
|
|
98
98
|
* */
|
|
99
|
+
/**
|
|
100
|
+
* @typedef Distance
|
|
101
|
+
* @property {number} value
|
|
102
|
+
* @property {LengthUnit} lengthUnit
|
|
103
|
+
*/
|
|
104
|
+
/**
|
|
105
|
+
* @typedef {'m'|'km'} LengthUnit
|
|
106
|
+
*/
|
|
99
107
|
/**
|
|
100
108
|
* @typedef Geometry - A [GeoJSON](https://geojson.org/) geometry object
|
|
101
109
|
* @property {GeometryType} type - The type of the geometry
|
|
@@ -106,6 +114,13 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
106
114
|
* _Note:_ The GeoJSON geometry type "GeometryCollection" is currently not supported.
|
|
107
115
|
*/
|
|
108
116
|
/** @typedef {[number,number,number,number]} Extent - An array of numbers representing an extent: [minx, miny, maxx, maxy] */
|
|
117
|
+
/**
|
|
118
|
+
* @typedef {GeometryZoomTarget} ZoomTarget - An object describing a target to zoom to
|
|
119
|
+
*/
|
|
120
|
+
/**
|
|
121
|
+
* @typedef GeometryZoomTarget - Instructs Cadenza to zoom to a provided {@Link Geometry}
|
|
122
|
+
* @property {'geometry'} type The type of the zoom target
|
|
123
|
+
*/
|
|
109
124
|
/**
|
|
110
125
|
* @typedef {'csv' | 'excel' | 'json' | 'pdf' | 'png'} DataType - A data type
|
|
111
126
|
*
|
|
@@ -120,6 +135,18 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
120
135
|
* _Note:_ Since numbers in JavaScript are Double values ([more info on MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number#number_encoding)),
|
|
121
136
|
* for Long variables, the API is currently limited to the Double value range.
|
|
122
137
|
*/
|
|
138
|
+
/**
|
|
139
|
+
* @typedef Feature - A adapted [GeoJSON](https://geojson.org/) feature object.
|
|
140
|
+
* @property {any[]} objectId - The id of the feature
|
|
141
|
+
* @property {Geometry} geometry - The geometry
|
|
142
|
+
* @property {Record<string, string>} properties - The formated properties
|
|
143
|
+
* @property {number} [area] - The area of a `Polygon` feature
|
|
144
|
+
* @property {number} [length] - The area of a `LineString` feature
|
|
145
|
+
*/
|
|
146
|
+
/**
|
|
147
|
+
* @typedef FeatureCollection - A adapted [GeoJSON](https://geojson.org/) feature collection object
|
|
148
|
+
* @property {Feature[]} features - The features within this collection
|
|
149
|
+
*/
|
|
123
150
|
let hasCadenzaSession = false;
|
|
124
151
|
/** @type {Promise<void> | undefined} */
|
|
125
152
|
let firstEmbeddingTargetShown;
|
|
@@ -226,7 +253,9 @@ export class CadenzaClient {
|
|
|
226
253
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
227
254
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
228
255
|
* @throws For invalid arguments
|
|
229
|
-
* @fires
|
|
256
|
+
* @fires
|
|
257
|
+
* - {@link CadenzaDrillThroughEvent}
|
|
258
|
+
* - {@link CadenzaActionEvent}
|
|
230
259
|
* @embed
|
|
231
260
|
*/
|
|
232
261
|
show(source, { dataType, disabledUiFeatures, expandNavigator, filter, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, operationMode, signal, } = {}) {
|
|
@@ -288,17 +317,21 @@ export class CadenzaClient {
|
|
|
288
317
|
* @param {Extent} [options.mapExtent] - A map extent to set
|
|
289
318
|
* @param {OperationMode} [options.operationMode] - The mode in which a workbook should be operated
|
|
290
319
|
* @param {boolean} [options.useMapSrs] - Whether the geometry and the extent are in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
320
|
+
* @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
|
|
291
321
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
292
322
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
293
323
|
* @throws For invalid arguments
|
|
294
|
-
* @fires
|
|
324
|
+
* @fires
|
|
325
|
+
* - {@link CadenzaDrillThroughEvent}
|
|
326
|
+
* - {@link CadenzaActionEvent}
|
|
295
327
|
* @embed
|
|
296
328
|
*/
|
|
297
|
-
async showMap(mapView, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, } = {}) {
|
|
329
|
+
async showMap(mapView, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, zoomTarget, signal, } = {}) {
|
|
298
330
|
this.#log('CadenzaClient#showMap', ...arguments);
|
|
299
331
|
if (geometry) {
|
|
300
332
|
assertValidGeometryType(geometry.type);
|
|
301
333
|
}
|
|
334
|
+
const zoomToGeometry = geometry && zoomTarget?.type === 'geometry';
|
|
302
335
|
const params = createParams({
|
|
303
336
|
disabledUiFeatures,
|
|
304
337
|
expandNavigator,
|
|
@@ -306,7 +339,9 @@ export class CadenzaClient {
|
|
|
306
339
|
hideMainHeaderAndFooter,
|
|
307
340
|
hideWorkbookToolBar,
|
|
308
341
|
highlightGlobalId,
|
|
309
|
-
locationFinder,
|
|
342
|
+
// only use locationFinder if zoom to geometry is not set, to avoid
|
|
343
|
+
// zooming race condition for Cadenza versions below 10.1
|
|
344
|
+
locationFinder: zoomToGeometry ? undefined : locationFinder,
|
|
310
345
|
mapExtent,
|
|
311
346
|
operationMode,
|
|
312
347
|
targetType: 'MAP',
|
|
@@ -314,7 +349,10 @@ export class CadenzaClient {
|
|
|
314
349
|
});
|
|
315
350
|
await this.#show(resolvePath(mapView), params, signal);
|
|
316
351
|
if (geometry) {
|
|
317
|
-
this.#postEvent('setGeometry', {
|
|
352
|
+
this.#postEvent('setGeometry', {
|
|
353
|
+
geometry,
|
|
354
|
+
zoomToGeometry,
|
|
355
|
+
});
|
|
318
356
|
}
|
|
319
357
|
}
|
|
320
358
|
/**
|
|
@@ -380,7 +418,7 @@ export class CadenzaClient {
|
|
|
380
418
|
*
|
|
381
419
|
* @hidden
|
|
382
420
|
* @param {WorkbookLayerPath | string} layer - The data view layer to set the selection in
|
|
383
|
-
* @param {unknown[]} values - The IDs of the objects to select
|
|
421
|
+
* @param {unknown[][]} values - The IDs of the objects to select
|
|
384
422
|
* @return {Promise<void>} A `Promise` for when the selection was set.
|
|
385
423
|
* @postMessage
|
|
386
424
|
*/
|
|
@@ -393,7 +431,7 @@ export class CadenzaClient {
|
|
|
393
431
|
*
|
|
394
432
|
* @hidden
|
|
395
433
|
* @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
|
|
396
|
-
* @param {unknown[]} values - The IDs of the objects to select
|
|
434
|
+
* @param {unknown[][]} values - The IDs of the objects to select
|
|
397
435
|
* @return {Promise<void>} A `Promise` for when the selection was changed.
|
|
398
436
|
* @postMessage
|
|
399
437
|
*/
|
|
@@ -406,7 +444,7 @@ export class CadenzaClient {
|
|
|
406
444
|
*
|
|
407
445
|
* @hidden
|
|
408
446
|
* @param {WorkbookLayerPath | string} layer - The data view layer to change the selection in
|
|
409
|
-
* @param {unknown[]} values - The IDs of the objects to unselect
|
|
447
|
+
* @param {unknown[][]} values - The IDs of the objects to unselect
|
|
410
448
|
* @return {Promise<void>} A `Promise` for when the selection was changed.
|
|
411
449
|
* @postMessage
|
|
412
450
|
*/
|
|
@@ -464,6 +502,7 @@ export class CadenzaClient {
|
|
|
464
502
|
* @param {Extent} [options.mapExtent] - A map extent to set
|
|
465
503
|
* @param {number} [options.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
|
|
466
504
|
* @param {boolean} [options.useMapSrs] - Whether the geometry is in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
505
|
+
* @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to
|
|
467
506
|
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading
|
|
468
507
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
469
508
|
* @throws For invalid arguments
|
|
@@ -473,20 +512,26 @@ export class CadenzaClient {
|
|
|
473
512
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
474
513
|
* @embed
|
|
475
514
|
*/
|
|
476
|
-
async editGeometry(backgroundMapView, geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, signal } = {}) {
|
|
515
|
+
async editGeometry(backgroundMapView, geometry, { filter, locationFinder, mapExtent, minScale, useMapSrs, zoomTarget, signal, } = {}) {
|
|
477
516
|
this.#log('CadenzaClient#editGeometry', ...arguments);
|
|
478
517
|
assertValidGeometryType(geometry.type);
|
|
518
|
+
const zoomToGeometry = geometry && zoomTarget?.type === 'geometry';
|
|
479
519
|
const params = createParams({
|
|
480
520
|
action: 'editGeometry',
|
|
481
521
|
filter,
|
|
482
|
-
locationFinder,
|
|
522
|
+
// only use locationFinder if zoom to geometry is not set, to avoid
|
|
523
|
+
// zooming race condition for Cadenza versions below 10.1
|
|
524
|
+
locationFinder: zoomToGeometry ? undefined : locationFinder,
|
|
483
525
|
mapExtent,
|
|
484
526
|
minScale,
|
|
485
527
|
useMapSrs,
|
|
486
528
|
});
|
|
487
529
|
await this.#show(resolvePath(backgroundMapView), params, signal);
|
|
488
530
|
if (geometry) {
|
|
489
|
-
this.#postEvent('setGeometry', {
|
|
531
|
+
this.#postEvent('setGeometry', {
|
|
532
|
+
geometry,
|
|
533
|
+
zoomToGeometry,
|
|
534
|
+
});
|
|
490
535
|
}
|
|
491
536
|
}
|
|
492
537
|
/**
|
|
@@ -719,18 +764,75 @@ export class CadenzaClient {
|
|
|
719
764
|
const params = createParams({ dataType, filter, parts });
|
|
720
765
|
return this.#fetch(resolvePath(source), params, signal);
|
|
721
766
|
}
|
|
767
|
+
/**
|
|
768
|
+
* Fetch object info from a workbook map view.
|
|
769
|
+
*
|
|
770
|
+
* @param {EmbeddingTargetId} source - The workbook view to fetch object info from.
|
|
771
|
+
* @param {(WorkbookLayerPath | string)[]} layerPath - Layer path to identify the layer
|
|
772
|
+
* (identified using layer paths or print names)
|
|
773
|
+
* @param {unknown[][]} objectIds - The IDs of the objects to select
|
|
774
|
+
* @param {object} [options] - Options
|
|
775
|
+
* @param {FilterVariables} [options.filter] - Filter variables
|
|
776
|
+
* @param {AbortSignal} [options.signal] - A signal to abort the data fetching
|
|
777
|
+
* @param {Boolean} [options.useMapSrs] - Use the map SRS instead of WGS84
|
|
778
|
+
* @param {Boolean} [options.fullGeometries] - Return non-simplified geometries
|
|
779
|
+
* @return {Promise<FeatureCollection>} A `Promise` for the fetch response
|
|
780
|
+
* @throws For invalid arguments
|
|
781
|
+
*/
|
|
782
|
+
fetchObjectInfo(source, layerPath, objectIds, { filter, signal, useMapSrs, fullGeometries } = {}) {
|
|
783
|
+
this.#log('CadenzaClient#fetchObjectInfo', ...arguments);
|
|
784
|
+
const params = createParams({
|
|
785
|
+
filter,
|
|
786
|
+
});
|
|
787
|
+
return this.#fetch(resolvePath(source) + '/objectinfo', params, signal, JSON.stringify({
|
|
788
|
+
objectIds,
|
|
789
|
+
layerPath: array(layerPath),
|
|
790
|
+
useMapSrs,
|
|
791
|
+
fullGeometries,
|
|
792
|
+
})).then((response) => response.json());
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Fetch the intersection areas from a workbook map view layer in JSON format for a given area.
|
|
796
|
+
*
|
|
797
|
+
* @param {EmbeddingTargetId} source - The workbook view to fetch object info from.
|
|
798
|
+
* @param {(WorkbookLayerPath | string)[]} layerPath - Layer path to identify the layer
|
|
799
|
+
* (identified using layer paths or print names)
|
|
800
|
+
* @param {Geometry} geometry - The intersection geometry
|
|
801
|
+
* @param {object} [options] - Options
|
|
802
|
+
* @param {boolean} [options.useMapSrs] - The intersection geometry and the result geometries are in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
803
|
+
* @param {Distance} [options.buffer] - Buffer size for geometry of the transition
|
|
804
|
+
* @param {AbortSignal} [options.signal] - A signal to abort the data fetching
|
|
805
|
+
* @return {Promise<FeatureCollection>} A `Promise` for the fetch response
|
|
806
|
+
* @server
|
|
807
|
+
*/
|
|
808
|
+
fetchAreaIntersections(source, layerPath, geometry, { useMapSrs, buffer, signal } = {}) {
|
|
809
|
+
this.#log('CadenzaClient#areaIntersections', ...arguments);
|
|
810
|
+
const params = createParams({});
|
|
811
|
+
return this.#fetch(resolvePath(source) + '/area-intersections', params, signal, JSON.stringify({
|
|
812
|
+
layerPath: array(layerPath),
|
|
813
|
+
geometry: geometry,
|
|
814
|
+
useMapSrs: useMapSrs,
|
|
815
|
+
buffer: buffer,
|
|
816
|
+
})).then((response) => response.json());
|
|
817
|
+
}
|
|
722
818
|
async #fetch(
|
|
723
819
|
/** @type string */ path,
|
|
724
820
|
/** @type URLSearchParams */ params,
|
|
725
|
-
/** @type AbortSignal | undefined */ signal
|
|
821
|
+
/** @type AbortSignal | undefined */ signal,
|
|
822
|
+
/** @type String | undefined If body is set, the fetch will be a post.*/ body) {
|
|
726
823
|
const url = this.#createUrl(path, params);
|
|
727
824
|
this.#log('Fetch', url.toString());
|
|
825
|
+
const method = body ? 'POST' : undefined;
|
|
826
|
+
const headers = new Headers();
|
|
827
|
+
headers.set('X-Requested-With', 'XMLHttpRequest');
|
|
828
|
+
if (body) {
|
|
829
|
+
headers.set('Content-Type', 'application/json');
|
|
830
|
+
}
|
|
728
831
|
const res = await fetch(url, {
|
|
729
832
|
signal,
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
},
|
|
833
|
+
method,
|
|
834
|
+
headers,
|
|
835
|
+
body,
|
|
734
836
|
});
|
|
735
837
|
if (!res.ok) {
|
|
736
838
|
const errorType = {
|
|
@@ -955,7 +1057,8 @@ function array(/** @type unknown */ value) {
|
|
|
955
1057
|
}
|
|
956
1058
|
// Please do not add internal event types like 'ready' here.
|
|
957
1059
|
/**
|
|
958
|
-
* @typedef {'
|
|
1060
|
+
* @typedef {'action'
|
|
1061
|
+
* | 'change:selection'
|
|
959
1062
|
* | 'drillThrough'
|
|
960
1063
|
* | 'editGeometry:ok'
|
|
961
1064
|
* | 'editGeometry:update'
|
|
@@ -967,7 +1070,8 @@ function array(/** @type unknown */ value) {
|
|
|
967
1070
|
*/
|
|
968
1071
|
/**
|
|
969
1072
|
* @template {CadenzaEventType} T
|
|
970
|
-
* @typedef {T extends '
|
|
1073
|
+
* @typedef {T extends 'action' ? CadenzaActionEvent
|
|
1074
|
+
* : T extends 'change:selection' ? CadenzaChangeSelectionEvent
|
|
971
1075
|
* : T extends 'drillThrough' ? CadenzaDrillThroughEvent
|
|
972
1076
|
* : T extends 'editGeometry:update' ? CadenzaEditGeometryUpdateEvent
|
|
973
1077
|
* : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent
|
|
@@ -985,6 +1089,9 @@ function array(/** @type unknown */ value) {
|
|
|
985
1089
|
* @property {TYPE} type - The event type
|
|
986
1090
|
* @property {DETAIL} detail - Optional event details (depending on the event type)
|
|
987
1091
|
*/
|
|
1092
|
+
/**
|
|
1093
|
+
* @typedef {CadenzaEvent<'action', {context: string}>} CadenzaActionEvent - When the user executed a POST message action, which is defined on an external link in the Cadenza management center.
|
|
1094
|
+
*/
|
|
988
1095
|
/*
|
|
989
1096
|
* @hidden
|
|
990
1097
|
* @typedef {CadenzaEvent<'change:extent', {extent: Extent}>} CadenzaChangeExtentEvent - When the user moved the map.
|
package/package.json
CHANGED
package/sandbox.cjs
CHANGED
|
@@ -6,8 +6,8 @@ const DEFAULT_CADENZA_URL = 'http://localhost:8080/cadenza';
|
|
|
6
6
|
|
|
7
7
|
const index = process.argv.indexOf(CADENZA_URL_PARAM);
|
|
8
8
|
const cadenzaUrlFromArgs = index !== -1
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
? process.argv[index + 1]
|
|
10
|
+
: process.argv.find(arg => arg.startsWith(CADENZA_URL_PARAM + '='))?.slice(CADENZA_URL_PARAM.length + 1);
|
|
11
11
|
const cadenzaUrl = new URL(cadenzaUrlFromArgs || process.env.CADENZA_URL || DEFAULT_CADENZA_URL);
|
|
12
12
|
|
|
13
13
|
execSync(`npx --yes http-server -a localhost -c-1 -d false --proxy ${cadenzaUrl.origin} --proxy-options.headers.Origin ${cadenzaUrl.origin} -o /sandbox.html${cadenzaUrl.pathname !== '/' ? `?contextPath=${cadenzaUrl.pathname}` : ''}`, { stdio: 'inherit' });
|
package/sandbox.html
CHANGED
|
@@ -161,9 +161,9 @@
|
|
|
161
161
|
},
|
|
162
162
|
setFilter: data => cadenzaClient.setFilter(parseFilterVariables(data.filter)),
|
|
163
163
|
setLayerVisibility: data => cadenzaClient.setLayerVisibility(JSON.parse(data.layer), data.visibility === 'on'),
|
|
164
|
-
setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.
|
|
165
|
-
addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.
|
|
166
|
-
removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.
|
|
164
|
+
setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
|
|
165
|
+
addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
|
|
166
|
+
removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds)),
|
|
167
167
|
createGeometry: data => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data)),
|
|
168
168
|
editGeometry: ({ geometry, ...data }) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(geometry), getOptions(data)),
|
|
169
169
|
selectObjects: data => cadenzaClient.selectObjects(data.embeddingTargetId, getOptions(data)),
|
|
@@ -171,6 +171,16 @@
|
|
|
171
171
|
console.log('Inspect the fetchData() request in the devtools.');
|
|
172
172
|
cadenzaClient.fetchData(data.embeddingTargetId, data.dataType, getOptions(data));
|
|
173
173
|
},
|
|
174
|
+
fetchObjectInfo: data => {
|
|
175
|
+
console.log('Inspect the fetchObjectInfo() request in the devtools.');
|
|
176
|
+
cadenzaClient.fetchObjectInfo(data.embeddingTargetId, JSON.parse(data.layer), JSON.parse(data.objectIds), getOptions(data))
|
|
177
|
+
.then(console.log);
|
|
178
|
+
},
|
|
179
|
+
fetchAreaIntersections: data => {
|
|
180
|
+
console.log('Inspect the fetchAreaIntersections() request in the devtools.');
|
|
181
|
+
cadenzaClient.fetchAreaIntersections(data.embeddingTargetId, JSON.parse(data.layer), JSON.parse(data.geometry), getOptions(data))
|
|
182
|
+
.then(console.log);
|
|
183
|
+
},
|
|
174
184
|
downloadData: data => cadenzaClient.downloadData(data.embeddingTargetId, data.dataType, getOptions(data))
|
|
175
185
|
};
|
|
176
186
|
|
|
@@ -216,7 +226,11 @@
|
|
|
216
226
|
parts,
|
|
217
227
|
layers,
|
|
218
228
|
simplifiedOperationMode,
|
|
219
|
-
useMapSrs
|
|
229
|
+
useMapSrs,
|
|
230
|
+
fullGeometries,
|
|
231
|
+
zoomToGeometry,
|
|
232
|
+
distance,
|
|
233
|
+
lengthUnit
|
|
220
234
|
}) {
|
|
221
235
|
return {
|
|
222
236
|
disabledUiFeatures: disabledUiFeatures && disabledUiFeatures.split(','),
|
|
@@ -235,7 +249,10 @@
|
|
|
235
249
|
parts: parts && parts.split(','),
|
|
236
250
|
...(simplifiedOperationMode === 'on' && { operationMode: 'simplified' }),
|
|
237
251
|
layers: layers ? JSON.parse(layers) : undefined,
|
|
238
|
-
useMapSrs: useMapSrs === 'on'
|
|
252
|
+
useMapSrs: useMapSrs === 'on',
|
|
253
|
+
fullGeometries: fullGeometries === 'on',
|
|
254
|
+
zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined,
|
|
255
|
+
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined
|
|
239
256
|
};
|
|
240
257
|
}
|
|
241
258
|
|
|
@@ -284,6 +301,8 @@
|
|
|
284
301
|
<optgroup label="Without Iframe">
|
|
285
302
|
<option value="downloadData">Download data</option>
|
|
286
303
|
<option value="fetchData">Fetch data</option>
|
|
304
|
+
<option value="fetchObjectInfo">Fetch Object Info</option>
|
|
305
|
+
<option value="fetchAreaIntersections">Fetch Area Intersections</option>
|
|
287
306
|
</optgroup>
|
|
288
307
|
</select>
|
|
289
308
|
</div>
|
|
@@ -442,7 +461,7 @@
|
|
|
442
461
|
</div>
|
|
443
462
|
</template>
|
|
444
463
|
|
|
445
|
-
<template data-action="showMap" data-common="map,showWorkbook,filter,show">
|
|
464
|
+
<template data-action="showMap" data-common="zoomTo,map,showWorkbook,filter,show">
|
|
446
465
|
<div>
|
|
447
466
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
448
467
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
@@ -477,7 +496,7 @@
|
|
|
477
496
|
</div>
|
|
478
497
|
</template>
|
|
479
498
|
|
|
480
|
-
<template data-action="editGeometry" data-common="map,filter">
|
|
499
|
+
<template data-action="editGeometry" data-common="zoomTo,map,filter">
|
|
481
500
|
<div>
|
|
482
501
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
483
502
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
@@ -518,9 +537,9 @@
|
|
|
518
537
|
</div>
|
|
519
538
|
</template>
|
|
520
539
|
|
|
521
|
-
<template data-action="setSelection" data-common="layer,
|
|
522
|
-
<template data-action="addSelection" data-common="layer,
|
|
523
|
-
<template data-action="removeSelection" data-common="layer,
|
|
540
|
+
<template data-action="setSelection" data-common="layer,object-ids"></template>
|
|
541
|
+
<template data-action="addSelection" data-common="layer,object-ids"></template>
|
|
542
|
+
<template data-action="removeSelection" data-common="layer,object-ids"></template>
|
|
524
543
|
|
|
525
544
|
<template data-action="reload">
|
|
526
545
|
<div>
|
|
@@ -532,12 +551,12 @@
|
|
|
532
551
|
</template>
|
|
533
552
|
<template data-action="closeMe">No Parameters needed.</template>
|
|
534
553
|
|
|
535
|
-
<template id="common-
|
|
554
|
+
<template id="common-object-ids">
|
|
536
555
|
<div>
|
|
537
|
-
<label for="
|
|
538
|
-
<textarea name="
|
|
556
|
+
<label for="objectids">List of object ID value lists *</label>
|
|
557
|
+
<textarea name="objectIds" id="objectids" rows="5" required></textarea>
|
|
539
558
|
<small>
|
|
540
|
-
<p>A JSON value like <code>["object1","object2"]</code></p>
|
|
559
|
+
<p>A JSON value like <code>[["<object1-id>"],["<object2-id>"]]</code></p>
|
|
541
560
|
</small>
|
|
542
561
|
</div>
|
|
543
562
|
</template>
|
|
@@ -555,6 +574,15 @@
|
|
|
555
574
|
</div>
|
|
556
575
|
</template>
|
|
557
576
|
|
|
577
|
+
<template id="common-zoomTo">
|
|
578
|
+
<div>
|
|
579
|
+
<label>
|
|
580
|
+
<input type="checkbox" name="zoomToGeometry">
|
|
581
|
+
Zoom to geometry
|
|
582
|
+
</label>
|
|
583
|
+
</div>
|
|
584
|
+
</template>
|
|
585
|
+
|
|
558
586
|
<template data-action="downloadData" data-common="data,filter">
|
|
559
587
|
<div>
|
|
560
588
|
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
@@ -573,6 +601,61 @@
|
|
|
573
601
|
</div>
|
|
574
602
|
</template>
|
|
575
603
|
|
|
604
|
+
<template data-action="fetchObjectInfo" data-common="layer,object-ids,filter">
|
|
605
|
+
<div>
|
|
606
|
+
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
607
|
+
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
608
|
+
</div>
|
|
609
|
+
<div>
|
|
610
|
+
<label>
|
|
611
|
+
<input type="checkbox" name="useMapSrs">
|
|
612
|
+
Use map SRS
|
|
613
|
+
</label>
|
|
614
|
+
</div>
|
|
615
|
+
<div>
|
|
616
|
+
<label>
|
|
617
|
+
<input type="checkbox" name="fullGeometries">
|
|
618
|
+
Return the non-simplified geometries
|
|
619
|
+
</label>
|
|
620
|
+
</div>
|
|
621
|
+
</template>
|
|
622
|
+
|
|
623
|
+
<template data-action="fetchAreaIntersections" data-common="layer">
|
|
624
|
+
<div>
|
|
625
|
+
<label for="embeddingTargetId">Embedding target ID *</label>
|
|
626
|
+
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
627
|
+
</div>
|
|
628
|
+
<div>
|
|
629
|
+
<label for="geometry">Intersection Geometry (GeoJSON) *</label>
|
|
630
|
+
<textarea name="geometry" id="geometry" rows="5" required></textarea>
|
|
631
|
+
<small>
|
|
632
|
+
<p>
|
|
633
|
+
The geometry must result in an area in combination with the buffer specification.
|
|
634
|
+
</p>
|
|
635
|
+
</small>
|
|
636
|
+
</div>
|
|
637
|
+
<div>
|
|
638
|
+
<label>
|
|
639
|
+
<input type="checkbox" name="useMapSrs">
|
|
640
|
+
Use map SRS
|
|
641
|
+
</label>
|
|
642
|
+
</div>
|
|
643
|
+
<div>
|
|
644
|
+
<label for="distance">Buffer size</label>
|
|
645
|
+
<input name="distance" id="distance" type="number" min="0">
|
|
646
|
+
<label for="lengthUnit">Length unit</label>
|
|
647
|
+
<select name="lengthUnit" id="lengthUnit">
|
|
648
|
+
<option>m</option>
|
|
649
|
+
<option>km</option>
|
|
650
|
+
</select>
|
|
651
|
+
<small>
|
|
652
|
+
<p>
|
|
653
|
+
A positive buffer size is needed for point or line intersection geometries.
|
|
654
|
+
</p>
|
|
655
|
+
</small>
|
|
656
|
+
</div>
|
|
657
|
+
</template>
|
|
658
|
+
|
|
576
659
|
<template data-action="getData">
|
|
577
660
|
<div>
|
|
578
661
|
<label for="dataType">Data type</label>
|