@disy/cadenza.js 10.3.0 → 10.3.2
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/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 +23 -21
- package/apidoc/classes/CadenzaError.html +5 -5
- package/apidoc/functions/cadenza.html +4 -4
- package/apidoc/index.html +2 -2
- package/apidoc/interfaces/CadenzaClientOptions.html +5 -5
- package/apidoc/interfaces/CadenzaEvent.html +4 -4
- package/apidoc/interfaces/Distance.html +2 -2
- package/apidoc/interfaces/ExternalLinkKey.html +4 -4
- package/apidoc/interfaces/Feature.html +9 -9
- package/apidoc/interfaces/FeatureCollection.html +4 -4
- package/apidoc/interfaces/Geometry.html +4 -4
- package/apidoc/interfaces/GeometryExtentStrategy.html +4 -4
- package/apidoc/interfaces/LayerDataExtentStrategy.html +4 -4
- package/apidoc/interfaces/LayerDefinition.html +4 -4
- package/apidoc/interfaces/LocationFinderExtentStrategy.html +4 -4
- package/apidoc/interfaces/PageSource.html +3 -3
- package/apidoc/interfaces/SnappingOptions.html +5 -0
- package/apidoc/interfaces/StaticExtentStrategy.html +4 -4
- package/apidoc/modules.html +1 -1
- package/apidoc/types/CadenzaActionEvent.html +2 -2
- 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/CadenzaReloadEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsCancelEvent.html +2 -2
- package/apidoc/types/CadenzaSelectObjectsOkEvent.html +2 -2
- package/apidoc/types/Coordinate.html +2 -2
- package/apidoc/types/CustomValidityType.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/ExtentStrategy.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 -1
- 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 +3 -2
- package/apidoc/types/WorkbookLayerPath.html +2 -2
- package/cadenza.d.ts +38 -23
- package/cadenza.js +40 -29
- package/package.json +1 -1
- package/sandbox.html +64 -21
package/cadenza.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
// This placeholder is replaced when Cadenza JS is released,
|
|
14
14
|
// i.e. during development, the version is not available.
|
|
15
|
-
const CADENZAJS_VERSION = '10.3.
|
|
15
|
+
const CADENZAJS_VERSION = '10.3.2';
|
|
16
16
|
/**
|
|
17
17
|
* Creates an instance of the Cadenza JS client.
|
|
18
18
|
*
|
|
@@ -95,9 +95,10 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
95
95
|
*/
|
|
96
96
|
/** @typedef {'normal'|'simplified'} OperationMode - The mode in which a workbook should be operated */
|
|
97
97
|
/**
|
|
98
|
-
* @typedef {'workbook-design'|'workbook-map-add-layer'|'workbook-view-management'} UiFeature - The name of a Cadenza UI feature
|
|
98
|
+
* @typedef {'geometry-edit-translate'|'workbook-design'|'workbook-map-add-layer'|'workbook-view-management'} UiFeature - The name of a Cadenza UI feature
|
|
99
99
|
*
|
|
100
100
|
* _Note:_ Supported features are:
|
|
101
|
+
* * `"geometry-edit-translate"` - Enables translation interactions when editing geometries
|
|
101
102
|
* * `"workbook-design"` - The workbook designer
|
|
102
103
|
* * `"workbook-map-add-layer"`- Add layers to the map
|
|
103
104
|
* * `"workbook-view-management"` - Add/Edit/Remove workbook views (Is included in 'workbook-design'.)
|
|
@@ -188,6 +189,11 @@ globalThis.cadenza = Object.assign((/** @type Parameters<cadenza> */ ...args) =>
|
|
|
188
189
|
* @property {Feature[]} features - The features within this collection
|
|
189
190
|
*/
|
|
190
191
|
/** @typedef {'error'|'warning'|'info'|'success'} CustomValidityType - The type of custom validity used for disclose on visual presentation and form submission behavior */
|
|
192
|
+
/**
|
|
193
|
+
* @typedef SnappingOptions
|
|
194
|
+
* @property {WorkbookLayerPath | string} layer - The layer to snap to
|
|
195
|
+
* @property {('toVertices' | 'toEdges' | 'lineTracing')[]} [types] - Snapping types; Without this option, the Cadenza default snapping types are used.
|
|
196
|
+
*/
|
|
191
197
|
let hasCadenzaSession = false;
|
|
192
198
|
/** @type {Promise<void> | undefined} */
|
|
193
199
|
let firstEmbeddingTargetShown;
|
|
@@ -312,6 +318,7 @@ export class CadenzaClient {
|
|
|
312
318
|
source.page === 'welcome', 'labelSet is only supported on the welcome page');
|
|
313
319
|
}
|
|
314
320
|
const params = createParams({
|
|
321
|
+
dataType,
|
|
315
322
|
disabledUiFeatures,
|
|
316
323
|
expandNavigator,
|
|
317
324
|
filter,
|
|
@@ -319,7 +326,6 @@ export class CadenzaClient {
|
|
|
319
326
|
hideWorkbookToolBar,
|
|
320
327
|
highlightGlobalId,
|
|
321
328
|
labelSet,
|
|
322
|
-
dataType,
|
|
323
329
|
operationMode,
|
|
324
330
|
});
|
|
325
331
|
return this.#show(resolvePath(source), params, signal);
|
|
@@ -353,6 +359,7 @@ export class CadenzaClient {
|
|
|
353
359
|
* @param {LayerDefinition[]} [__namedParameters.additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing.
|
|
354
360
|
* @param {UiFeature[]} [__namedParameters.disabledUiFeatures] - Cadenza UI features to disable
|
|
355
361
|
* @param {boolean} [__namedParameters.expandNavigator] - Indicates if the navigator should be expanded.
|
|
362
|
+
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
356
363
|
* @param {FilterVariables} [__namedParameters.filter] - Filter variables
|
|
357
364
|
* @param {Geometry} [__namedParameters.geometry] - A geometry to show on the map
|
|
358
365
|
* @param {boolean} [__namedParameters.hideMainHeaderAndFooter] - Whether to hide the main Cadenza header and footer
|
|
@@ -363,7 +370,6 @@ export class CadenzaClient {
|
|
|
363
370
|
* @param {OperationMode} [__namedParameters.operationMode] - The mode in which a workbook should be operated
|
|
364
371
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the iframe loading
|
|
365
372
|
* @param {boolean} [__namedParameters.useMapSrs] - Whether the coordinates specified in other parameters are specified in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
366
|
-
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
367
373
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
368
374
|
* @throws For invalid arguments
|
|
369
375
|
* @fires
|
|
@@ -371,16 +377,16 @@ export class CadenzaClient {
|
|
|
371
377
|
* - {@link CadenzaActionEvent}
|
|
372
378
|
* @embed
|
|
373
379
|
*/
|
|
374
|
-
async showMap(mapView, { disabledUiFeatures, expandNavigator, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs,
|
|
380
|
+
async showMap(mapView, { additionalLayers, disabledUiFeatures, expandNavigator, extentStrategy, filter, geometry, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, locationFinder, mapExtent, operationMode, useMapSrs, signal, } = {}) {
|
|
375
381
|
this.#log('CadenzaClient#showMap', ...arguments);
|
|
376
382
|
if (geometry) {
|
|
377
383
|
assertValidGeometryType(geometry.type);
|
|
378
384
|
}
|
|
379
385
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
386
|
+
extentStrategy,
|
|
380
387
|
geometry,
|
|
381
388
|
locationFinder,
|
|
382
389
|
mapExtent,
|
|
383
|
-
extentStrategy,
|
|
384
390
|
});
|
|
385
391
|
const params = createParams({
|
|
386
392
|
disabledUiFeatures,
|
|
@@ -536,14 +542,15 @@ export class CadenzaClient {
|
|
|
536
542
|
* @param {object} [__namedParameters] - Options
|
|
537
543
|
* @param {LayerDefinition[]} [__namedParameters.additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing.
|
|
538
544
|
* @param {UiFeature[]} [__namedParameters.disabledUiFeatures] - Cadenza UI features to disable
|
|
545
|
+
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
539
546
|
* @param {FilterVariables} [__namedParameters.filter] - Filter variables
|
|
540
547
|
* @param {string} [__namedParameters.locationFinder] - A search query for the location finder - _Deprecated_: Use {@link LocationFinderExtentStrategy} instead.
|
|
541
548
|
* @param {Extent} [__namedParameters.mapExtent] - A map extent to set - _Deprecated_: Use {@link StaticExtentStrategy} instead.
|
|
542
549
|
* @param {number} [__namedParameters.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
|
|
543
550
|
* @param {OperationMode} [__namedParameters.operationMode] - The mode in which a workbook should be operated
|
|
544
551
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the iframe loading
|
|
552
|
+
* @param {SnappingOptions} [__namedParameters.snapping] - Passing these options enables snapping
|
|
545
553
|
* @param {boolean} [__namedParameters.useMapSrs] - Whether the coordinates specified in other parameters are specified in the map's SRS and the created geometry should use the map's SRS (otherwise EPSG:4326 is assumed)
|
|
546
|
-
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
547
554
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
548
555
|
* @throws For invalid arguments
|
|
549
556
|
* @fires
|
|
@@ -552,12 +559,12 @@ export class CadenzaClient {
|
|
|
552
559
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
553
560
|
* @embed
|
|
554
561
|
*/
|
|
555
|
-
async createGeometry(backgroundMapView, geometryType, { additionalLayers, disabledUiFeatures, filter, locationFinder, mapExtent, minScale, useMapSrs, operationMode, signal,
|
|
562
|
+
async createGeometry(backgroundMapView, geometryType, { additionalLayers, disabledUiFeatures, extentStrategy, filter, locationFinder, mapExtent, minScale, useMapSrs, operationMode, signal, snapping, } = {}) {
|
|
556
563
|
this.#log('CadenzaClient#createGeometry', ...arguments);
|
|
557
564
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
565
|
+
extentStrategy,
|
|
558
566
|
locationFinder,
|
|
559
567
|
mapExtent,
|
|
560
|
-
extentStrategy,
|
|
561
568
|
});
|
|
562
569
|
const params = createParams({
|
|
563
570
|
action: 'editGeometry',
|
|
@@ -566,6 +573,7 @@ export class CadenzaClient {
|
|
|
566
573
|
geometryType,
|
|
567
574
|
minScale,
|
|
568
575
|
operationMode,
|
|
576
|
+
snapping,
|
|
569
577
|
useMapSrs,
|
|
570
578
|
validExtentStrategy,
|
|
571
579
|
});
|
|
@@ -585,14 +593,15 @@ export class CadenzaClient {
|
|
|
585
593
|
* @param {object} [__namedParameters] - Options
|
|
586
594
|
* @param {LayerDefinition[]} [__namedParameters.additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing. Each is a layer definition, with name, type and content (a Geojson featureCollection).
|
|
587
595
|
* @param {UiFeature[]} [__namedParameters.disabledUiFeatures] - Cadenza UI features to disable
|
|
596
|
+
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
588
597
|
* @param {FilterVariables} [__namedParameters.filter] - Filter variables
|
|
589
598
|
* @param {string} [__namedParameters.locationFinder] - A search query for the location finder - _Deprecated_: Use {@link LocationFinderExtentStrategy} instead.
|
|
590
599
|
* @param {Extent} [__namedParameters.mapExtent] - A map extent to set - _Deprecated_: Use {@link StaticExtentStrategy} instead.
|
|
591
600
|
* @param {number} [__namedParameters.minScale] - The minimum scale where the user should work on. A warning is shown when the map is zoomed out above the threshold.
|
|
592
601
|
* @param {OperationMode} [__namedParameters.operationMode] - The mode in which a workbook should be operated
|
|
593
602
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the iframe loading
|
|
603
|
+
* @param {SnappingOptions} [__namedParameters.snapping] - Passing these options enables snapping
|
|
594
604
|
* @param {boolean} [__namedParameters.useMapSrs] - Whether the coordinates specified in other parameters are specified in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
595
|
-
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
596
605
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
597
606
|
* @throws For invalid arguments
|
|
598
607
|
* @fires
|
|
@@ -601,14 +610,14 @@ export class CadenzaClient {
|
|
|
601
610
|
* - {@link CadenzaEditGeometryCancelEvent}
|
|
602
611
|
* @embed
|
|
603
612
|
*/
|
|
604
|
-
async editGeometry(backgroundMapView, geometry, { additionalLayers, disabledUiFeatures, filter, locationFinder, mapExtent, minScale, operationMode, signal,
|
|
613
|
+
async editGeometry(backgroundMapView, geometry, { additionalLayers, disabledUiFeatures, extentStrategy, filter, locationFinder, mapExtent, minScale, operationMode, signal, snapping, useMapSrs, } = {}) {
|
|
605
614
|
this.#log('CadenzaClient#editGeometry', ...arguments);
|
|
606
615
|
assertValidGeometryType(geometry.type);
|
|
607
616
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
617
|
+
extentStrategy,
|
|
608
618
|
geometry,
|
|
609
619
|
locationFinder,
|
|
610
620
|
mapExtent,
|
|
611
|
-
extentStrategy,
|
|
612
621
|
});
|
|
613
622
|
const params = createParams({
|
|
614
623
|
action: 'editGeometry',
|
|
@@ -616,6 +625,7 @@ export class CadenzaClient {
|
|
|
616
625
|
filter,
|
|
617
626
|
minScale,
|
|
618
627
|
operationMode,
|
|
628
|
+
snapping,
|
|
619
629
|
useMapSrs,
|
|
620
630
|
validExtentStrategy,
|
|
621
631
|
});
|
|
@@ -650,6 +660,7 @@ export class CadenzaClient {
|
|
|
650
660
|
*
|
|
651
661
|
* @param {EmbeddingTargetId} backgroundMapView - The workbook map view
|
|
652
662
|
* @param {object} [__namedParameters] - Options
|
|
663
|
+
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
653
664
|
* @param {FilterVariables} [__namedParameters.filter] - Filter variables
|
|
654
665
|
* @param {(WorkbookLayerPath | string)[]} [__namedParameters.layers] - Layers to restrict the selection to
|
|
655
666
|
* (identified using layer paths or print names)
|
|
@@ -658,7 +669,6 @@ export class CadenzaClient {
|
|
|
658
669
|
* @param {boolean} [__namedParameters.useMapSrs] - Whether the coordinates specified in other parameters are specified in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
659
670
|
* @param {OperationMode} [__namedParameters.operationMode] - The mode in which a workbook should be operated
|
|
660
671
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the iframe loading
|
|
661
|
-
* @param {ExtentStrategy} [__namedParameters.extentStrategy] - Defines the initial map extent; If not given, Cadenza's default logic is used.
|
|
662
672
|
* @return {Promise<void>} A `Promise` for when the iframe is loaded
|
|
663
673
|
* @throws For invalid arguments
|
|
664
674
|
* @fires
|
|
@@ -668,7 +678,7 @@ export class CadenzaClient {
|
|
|
668
678
|
* - {@link CadenzaSelectObjectsCancelEvent}
|
|
669
679
|
* @embed
|
|
670
680
|
*/
|
|
671
|
-
async selectObjects(backgroundMapView, { filter, layers, locationFinder, mapExtent, useMapSrs, operationMode, signal,
|
|
681
|
+
async selectObjects(backgroundMapView, { extentStrategy, filter, layers, locationFinder, mapExtent, useMapSrs, operationMode, signal, } = {}) {
|
|
672
682
|
this.#log('CadenzaClient#selectObjects', ...arguments);
|
|
673
683
|
const validExtentStrategy = sanitizeExtentStrategy({
|
|
674
684
|
geometry: undefined,
|
|
@@ -901,22 +911,22 @@ export class CadenzaClient {
|
|
|
901
911
|
* @param {unknown[][]} objectIds - The IDs of the objects to select
|
|
902
912
|
* @param {object} [__namedParameters] - Options
|
|
903
913
|
* @param {FilterVariables} [__namedParameters.filter] - Filter variables
|
|
914
|
+
* @param {Boolean} [__namedParameters.fullGeometries] - Return non-simplified geometries
|
|
904
915
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the data fetching
|
|
905
916
|
* @param {Boolean} [__namedParameters.useMapSrs] - Use the map SRS instead of WGS84
|
|
906
|
-
* @param {Boolean} [__namedParameters.fullGeometries] - Return non-simplified geometries
|
|
907
917
|
* @return {Promise<FeatureCollection>} A `Promise` for the fetch response
|
|
908
918
|
* @throws For invalid arguments
|
|
909
919
|
*/
|
|
910
|
-
fetchObjectInfo(source, layerPath, objectIds, { filter, signal,
|
|
920
|
+
fetchObjectInfo(source, layerPath, objectIds, { filter, signal, fullGeometries, useMapSrs } = {}) {
|
|
911
921
|
this.#log('CadenzaClient#fetchObjectInfo', ...arguments);
|
|
912
922
|
const params = createParams({
|
|
913
923
|
filter,
|
|
914
924
|
});
|
|
915
925
|
return this.#fetch(resolvePath(source) + '/objectinfo', params, signal, JSON.stringify({
|
|
926
|
+
fullGeometries,
|
|
916
927
|
objectIds,
|
|
917
928
|
layerPath: array(layerPath),
|
|
918
929
|
useMapSrs,
|
|
919
|
-
fullGeometries,
|
|
920
930
|
})).then((response) => response.json());
|
|
921
931
|
}
|
|
922
932
|
/**
|
|
@@ -927,20 +937,20 @@ export class CadenzaClient {
|
|
|
927
937
|
* (identified using layer paths or print names)
|
|
928
938
|
* @param {Geometry} geometry - The intersection geometry
|
|
929
939
|
* @param {object} [__namedParameters] - Options
|
|
930
|
-
* @param {boolean} [__namedParameters.useMapSrs] - The intersection geometry and the result geometries are in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
931
940
|
* @param {Distance} [__namedParameters.buffer] - Buffer size for geometry of the transition
|
|
932
941
|
* @param {AbortSignal} [__namedParameters.signal] - A signal to abort the data fetching
|
|
942
|
+
* @param {boolean} [__namedParameters.useMapSrs] - The intersection geometry and the result geometries are in the map's SRS (otherwise EPSG:4326 is assumed)
|
|
933
943
|
* @return {Promise<FeatureCollection>} A `Promise` for the fetch response
|
|
934
944
|
* @server
|
|
935
945
|
*/
|
|
936
|
-
fetchAreaIntersections(source, layerPath, geometry, {
|
|
946
|
+
fetchAreaIntersections(source, layerPath, geometry, { buffer, signal, useMapSrs } = {}) {
|
|
937
947
|
this.#log('CadenzaClient#areaIntersections', ...arguments);
|
|
938
948
|
const params = createParams({});
|
|
939
949
|
return this.#fetch(resolvePath(source) + '/area-intersections', params, signal, JSON.stringify({
|
|
950
|
+
buffer,
|
|
940
951
|
layerPath: array(layerPath),
|
|
941
|
-
geometry
|
|
942
|
-
useMapSrs
|
|
943
|
-
buffer: buffer,
|
|
952
|
+
geometry,
|
|
953
|
+
useMapSrs,
|
|
944
954
|
})).then((response) => response.json());
|
|
945
955
|
}
|
|
946
956
|
async #fetch(
|
|
@@ -1105,6 +1115,7 @@ function validOperationMode(/** @type string */ value) {
|
|
|
1105
1115
|
}
|
|
1106
1116
|
function validUiFeature(/** @type string */ value) {
|
|
1107
1117
|
return [
|
|
1118
|
+
'geometry-edit-translate',
|
|
1108
1119
|
'workbook-design',
|
|
1109
1120
|
'workbook-map-add-layer',
|
|
1110
1121
|
'workbook-view-management',
|
|
@@ -1133,11 +1144,12 @@ function assertSupportedDataType(
|
|
|
1133
1144
|
* @param {OperationMode} [params.operationMode]
|
|
1134
1145
|
* @param {TablePart[]} [params.parts]
|
|
1135
1146
|
* @param {'MAP'} [params.targetType]
|
|
1147
|
+
* @param {SnappingOptions} [params.snapping]
|
|
1136
1148
|
* @param {boolean} [params.useMapSrs]
|
|
1137
1149
|
* @param {ExtentStrategy | undefined} [params.validExtentStrategy]
|
|
1138
1150
|
* @return {URLSearchParams}
|
|
1139
1151
|
*/
|
|
1140
|
-
function createParams({ action, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, useMapSrs, validExtentStrategy, }) {
|
|
1152
|
+
function createParams({ action, dataType, disabledUiFeatures, expandNavigator, fileName, filter, geometryType, hideMainHeaderAndFooter, hideWorkbookToolBar, highlightGlobalId, labelSet, layers, minScale, operationMode, parts, targetType, snapping, useMapSrs, validExtentStrategy, }) {
|
|
1141
1153
|
if (disabledUiFeatures) {
|
|
1142
1154
|
disabledUiFeatures.forEach((feature) => assert(validUiFeature(feature), `Invalid UI feature: ${feature}`));
|
|
1143
1155
|
}
|
|
@@ -1181,15 +1193,14 @@ function createParams({ action, dataType, disabledUiFeatures, expandNavigator, f
|
|
|
1181
1193
|
...(hideWorkbookToolBar && { hideWorkbookToolBar: 'true' }),
|
|
1182
1194
|
...(highlightGlobalId && { highlightGlobalId }),
|
|
1183
1195
|
...(labelSet && { labelSet }),
|
|
1184
|
-
...(layers &&
|
|
1185
|
-
layers.length && {
|
|
1186
|
-
layers: JSON.stringify(layers),
|
|
1187
|
-
}),
|
|
1196
|
+
...(layers?.length && { layers: JSON.stringify(layers) }),
|
|
1188
1197
|
...(locationFinder && { locationFinder }),
|
|
1189
1198
|
...(mapExtent && { mapExtent: mapExtent.join() }),
|
|
1190
1199
|
...(minScale && { minScale: String(minScale) }),
|
|
1191
1200
|
...(operationMode && { operationMode }),
|
|
1192
1201
|
...(parts && { parts: parts.join() }),
|
|
1202
|
+
...(snapping && { snappingLayer: JSON.stringify(array(snapping.layer)) }),
|
|
1203
|
+
...(snapping?.types?.length && { snappingTypes: snapping.types.join() }),
|
|
1193
1204
|
...(targetType && { targetType }),
|
|
1194
1205
|
...(useMapSrs && { useMapSrs: 'true' }),
|
|
1195
1206
|
});
|
|
@@ -1257,9 +1268,9 @@ function sanitizeExtentStrategy({ extentStrategy, mapExtent, locationFinder, geo
|
|
|
1257
1268
|
* | 'editGeometry:update'
|
|
1258
1269
|
* | 'editGeometry:cancel'
|
|
1259
1270
|
* | 'objectInfo'
|
|
1271
|
+
* | 'reload'
|
|
1260
1272
|
* | 'selectObjects:ok'
|
|
1261
1273
|
* | 'selectObjects:cancel'
|
|
1262
|
-
* | 'reload'
|
|
1263
1274
|
* } CadenzaEventType - An event type to subscribe to using {@link CadenzaClient#on}
|
|
1264
1275
|
*/
|
|
1265
1276
|
/**
|
|
@@ -1271,9 +1282,9 @@ function sanitizeExtentStrategy({ extentStrategy, mapExtent, locationFinder, geo
|
|
|
1271
1282
|
* : T extends 'editGeometry:ok' ? CadenzaEditGeometryOkEvent
|
|
1272
1283
|
* : T extends 'editGeometry:cancel' ? CadenzaEditGeometryCancelEvent
|
|
1273
1284
|
* : T extends 'objectInfo' ? CadenzaObjectInfoEvent
|
|
1285
|
+
* : T extends 'reload' ? CadenzaReloadEvent
|
|
1274
1286
|
* : T extends 'selectObjects:ok' ? CadenzaSelectObjectsOkEvent
|
|
1275
1287
|
* : T extends 'selectObjects:cancel' ? CadenzaSelectObjectsCancelEvent
|
|
1276
|
-
* : T extends 'reload' ? CadenzaReloadEvent
|
|
1277
1288
|
* : never
|
|
1278
1289
|
* } CadenzaEventByType
|
|
1279
1290
|
*/
|
package/package.json
CHANGED
package/sandbox.html
CHANGED
|
@@ -165,8 +165,8 @@
|
|
|
165
165
|
setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), {extentStrategy: JSON.parse(data.extentStrategy)}),
|
|
166
166
|
addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), { extentStrategy: JSON.parse(data.extentStrategy) }),
|
|
167
167
|
removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layer), JSON.parse(data.objectIds), { extentStrategy: JSON.parse(data.extentStrategy) }),
|
|
168
|
-
createGeometry: data => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data)),
|
|
169
|
-
editGeometry: ({ geometry, ...data }) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(geometry), getOptions(data)),
|
|
168
|
+
createGeometry: (data, formData) => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data, formData)),
|
|
169
|
+
editGeometry: ({ geometry, ...data }, formData) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(geometry), getOptions(data, formData)),
|
|
170
170
|
selectObjects: data => cadenzaClient.selectObjects(data.embeddingTargetId, getOptions(data)),
|
|
171
171
|
fetchData: data => {
|
|
172
172
|
console.log('Inspect the fetchData() request in the devtools.');
|
|
@@ -189,8 +189,9 @@
|
|
|
189
189
|
const form = document.getElementById('form');
|
|
190
190
|
form.onsubmit = (event) => {
|
|
191
191
|
event.preventDefault();
|
|
192
|
-
const
|
|
193
|
-
|
|
192
|
+
const formData = new FormData(form);
|
|
193
|
+
const { action, ...data } = Object.fromEntries(formData);
|
|
194
|
+
actionHandlers[action](data, formData);
|
|
194
195
|
localStorage.setItem(`cadenzajs-sandbox-${action}`, JSON.stringify(data));
|
|
195
196
|
};
|
|
196
197
|
|
|
@@ -212,47 +213,52 @@
|
|
|
212
213
|
}
|
|
213
214
|
|
|
214
215
|
function getOptions ({
|
|
216
|
+
additionalLayers,
|
|
215
217
|
disabledUiFeatures,
|
|
218
|
+
distance,
|
|
216
219
|
expandNavigator,
|
|
220
|
+
extentStrategy,
|
|
221
|
+
fullGeometries,
|
|
217
222
|
fileName,
|
|
218
223
|
filter,
|
|
219
224
|
geometry,
|
|
220
225
|
hideMainHeaderAndFooter,
|
|
221
226
|
hideWorkbookToolBar,
|
|
222
227
|
highlightGlobalId,
|
|
223
|
-
requestAsPdf,
|
|
224
228
|
labelSet,
|
|
229
|
+
layers,
|
|
230
|
+
lengthUnit,
|
|
225
231
|
minScale,
|
|
226
232
|
parts,
|
|
227
|
-
|
|
233
|
+
requestAsPdf,
|
|
228
234
|
simplifiedOperationMode,
|
|
235
|
+
snappingLayer,
|
|
229
236
|
useMapSrs,
|
|
230
|
-
|
|
231
|
-
extentStrategy,
|
|
232
|
-
distance,
|
|
233
|
-
lengthUnit,
|
|
234
|
-
additionalLayers
|
|
235
|
-
}) {
|
|
237
|
+
}, formData) {
|
|
236
238
|
return {
|
|
239
|
+
additionalLayers: additionalLayers && JSON.parse(additionalLayers),
|
|
240
|
+
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined,
|
|
241
|
+
...(requestAsPdf === 'on' && { dataType: 'pdf' }),
|
|
237
242
|
disabledUiFeatures: disabledUiFeatures && disabledUiFeatures.split(','),
|
|
238
243
|
expandNavigator: (expandNavigator === 'on'),
|
|
244
|
+
extentStrategy: extentStrategy && JSON.parse(extentStrategy),
|
|
239
245
|
fileName,
|
|
240
246
|
filter: filter && parseFilterVariables(filter),
|
|
247
|
+
fullGeometries: fullGeometries === 'on',
|
|
241
248
|
geometry: geometry && JSON.parse(geometry),
|
|
242
249
|
hideMainHeaderAndFooter: (hideMainHeaderAndFooter === 'on'),
|
|
243
250
|
hideWorkbookToolBar: (hideWorkbookToolBar === 'on'),
|
|
244
251
|
highlightGlobalId,
|
|
245
|
-
...(requestAsPdf === 'on' && { dataType: 'pdf' }),
|
|
246
252
|
labelSet,
|
|
253
|
+
layers: layers ? JSON.parse(layers) : undefined,
|
|
247
254
|
minScale: minScale && Number(minScale),
|
|
248
|
-
parts: parts && parts.split(','),
|
|
249
255
|
operationMode: (simplifiedOperationMode === 'on' ? 'simplified' : 'normal' ),
|
|
250
|
-
|
|
256
|
+
parts: parts && parts.split(','),
|
|
257
|
+
snapping: snappingLayer ? {
|
|
258
|
+
layer: JSON.parse(snappingLayer),
|
|
259
|
+
types: formData?.getAll('snappingTypes')
|
|
260
|
+
}: undefined,
|
|
251
261
|
useMapSrs: useMapSrs === 'on',
|
|
252
|
-
fullGeometries: fullGeometries === 'on',
|
|
253
|
-
extentStrategy: extentStrategy && JSON.parse(extentStrategy),
|
|
254
|
-
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined,
|
|
255
|
-
additionalLayers: additionalLayers && JSON.parse(additionalLayers)
|
|
256
262
|
};
|
|
257
263
|
}
|
|
258
264
|
|
|
@@ -368,6 +374,7 @@
|
|
|
368
374
|
|
|
369
375
|
Supported features:
|
|
370
376
|
<ul>
|
|
377
|
+
<li>geometry-edit-translate</li>
|
|
371
378
|
<li>workbook-design</li>
|
|
372
379
|
<li>workbook-map-add-layer</li>
|
|
373
380
|
<li>workbook-view-management</li>
|
|
@@ -481,7 +488,7 @@
|
|
|
481
488
|
|
|
482
489
|
<template data-action="setFilter" data-common="filter"></template>
|
|
483
490
|
|
|
484
|
-
<template data-action="createGeometry" data-common="additionalLayers,extentStrategy,map,disabledUiFeatures,filter">
|
|
491
|
+
<template data-action="createGeometry" data-common="additionalLayers,extentStrategy,map,snapping,disabledUiFeatures,filter">
|
|
485
492
|
<div>
|
|
486
493
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
487
494
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
@@ -509,7 +516,7 @@
|
|
|
509
516
|
</div>
|
|
510
517
|
</template>
|
|
511
518
|
|
|
512
|
-
<template data-action="editGeometry" data-common="additionalLayers,extentStrategy,map,disabledUiFeatures,filter">
|
|
519
|
+
<template data-action="editGeometry" data-common="additionalLayers,extentStrategy,map,snapping,disabledUiFeatures,filter">
|
|
513
520
|
<div>
|
|
514
521
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|
|
515
522
|
<input name="embeddingTargetId" id="embeddingTargetId" required>
|
|
@@ -546,6 +553,42 @@
|
|
|
546
553
|
</div>
|
|
547
554
|
</template>
|
|
548
555
|
|
|
556
|
+
<template id="common-snapping">
|
|
557
|
+
<div>
|
|
558
|
+
<label for="snappingLayer">Snapping Layer</label>
|
|
559
|
+
<input name="snappingLayer" id="snappingLayer">
|
|
560
|
+
<small>
|
|
561
|
+
<p>
|
|
562
|
+
A JSON value like <code>"<layerPrintName>"</code> or
|
|
563
|
+
<code>["<layerGroupPrintName>","<layerPrintName>"]</code>
|
|
564
|
+
</p>
|
|
565
|
+
</small>
|
|
566
|
+
</div>
|
|
567
|
+
<div>
|
|
568
|
+
<label for="snappingTypes">Snapping Types</label>
|
|
569
|
+
<div role="group" id="snappingTypes">
|
|
570
|
+
<div>
|
|
571
|
+
<label>
|
|
572
|
+
<input type="checkbox" name="snappingTypes" value="toVertices">
|
|
573
|
+
To Vertices
|
|
574
|
+
</label>
|
|
575
|
+
</div>
|
|
576
|
+
<div>
|
|
577
|
+
<label>
|
|
578
|
+
<input type="checkbox" name="snappingTypes" value="toEdges">
|
|
579
|
+
To Edges
|
|
580
|
+
</label>
|
|
581
|
+
</div>
|
|
582
|
+
<div>
|
|
583
|
+
<label>
|
|
584
|
+
<input type="checkbox" name="snappingTypes" value="lineTracing">
|
|
585
|
+
Line Tracing
|
|
586
|
+
</label>
|
|
587
|
+
</div>
|
|
588
|
+
</div>
|
|
589
|
+
</div>
|
|
590
|
+
</template>
|
|
591
|
+
|
|
549
592
|
<template data-action="selectObjects" data-common="extentStrategy,map,filter">
|
|
550
593
|
<div>
|
|
551
594
|
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
|