Skip to content

Commit

Permalink
CADENZA-37531 and CADENZA-38242: (#67)
Browse files Browse the repository at this point in the history
* CADENZA-37531 and CADENZA-38242:
- Cleanup of type definition 'LayerDefinition'
- Fix displaying of parameter descriptions in case of an options object being destructured immediately (in this case the parameter descriptions weren't visible in the documentation)
- Order the parameters in alphabetical order
- Add the Cadenza JS part for zooming extensions

* CADENZA-37531 and CADENZA-38242:
- Fix CadenzaClientOptions to use options again instead of __namedParameter

* CADENZA-37531 and CADENZA-38242:
- Ran prettier now
- Added Changelog entries

* CADENZA-37531 and CADENZA-38242:
- Remove duplicated Changelog entry

* CADENZA-37531 and CADENZA-38242:
- Add overriding of locationFinder by mapExtent also explicitely in the code like it was before the story CADENZA-37531

* CADENZA-37531 and CADENZA-38242:
- Fix handling useMapSrs parameter for creating a valid GeometryZoomTarget

* CADENZA-37531 and CADENZA-38242:
- Change Sandbox to be usable with all supported ZoomTargets

* CADENZA-37531 and CADENZA-38242:
- Add the zoomTarget also to the "createGeometry" action

* CADENZA-37531 and CADENZA-38242: Changes after first code review:
- Remove the DefaultZoomTarget and the DataExtentZoomTarget
- Add the description of the DefaultZoomTarget to the ZoomTarget type
- Add the functionality of DataExtentZoomTarget to the LayerDataExtentZoomTarget in case of having no "layers" specified
- Rename the MapExtentZoomTarget to StaticZoomTarget
- Add the deprecation hint also to the description of the CadenzaClient
- Don't let it be possible to have a different "useMapSrs" parameter in the GeometryZoomTarget
- Rewrite the description of the "useMapSrs" parameter to make it clear it applies to all given coordinates
- Rename the function "createValidZoomTarget" to "sanitizeZoomTarget" and make it much simpler
- Remove 'locationFinder' and 'mapExtent' parameters from the 'createParams' method, because they were already considered correctly in the "sanitizeZoomTarget" method
- Simplify the method when to send the 'setZoomTarget' postMessage and when to not do it
- Add the "zoomTarget" parameter also to the "selectObjects" method to apply the extent and locationFinder parameters also correctly there
- Adapt the Sandbox to the reduced types of ZoomTargets and add the parameter also to the selectObjects command

* CADENZA-37531 and CADENZA-38242: Remove unneeded namespace
  • Loading branch information
klschm authored Nov 25, 2024
1 parent 6a2f5d9 commit 9a50d1c
Show file tree
Hide file tree
Showing 3 changed files with 273 additions and 151 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ This project uses a version scheme based on the Cadenza main version in the form
## Unreleased
### Added
- `additionalLayers` option for `CadenzaClient#showMap`
- Improved sandbox additionalLayers and geometry coordinates examples
- `LayerDataExtentZoomTarget`, `LocationFinderZoomTarget` and `StaticZoomTarget` added
- Added the 'ZoomTarget' also to the sandbox
- Improved sandbox 'additionalLayers' and 'geometry' examples

### Deprecated
- The optional zooming parameters `locationFinder` and `mapExtent` in `CadenzaClient#showMap`, `CadenzaClient#createGeometry` and `CadenzaClient#editGeometry`

## 10.2.3 - 2024-11-08
### Added
Expand Down
57 changes: 32 additions & 25 deletions sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
display: flex;
flex-direction: column;
gap: var(--gap);
overflow: scroll;
}
fieldset > div {
display: flex;
Expand Down Expand Up @@ -121,7 +122,7 @@
settingsContainer.append(
document.createElement('hr'),
commonSettingsTemplate.content.cloneNode(true));
})
});
}

const data = localStorage.getItem(`cadenzajs-sandbox-${action}`);
Expand Down Expand Up @@ -193,7 +194,7 @@
localStorage.setItem(`cadenzajs-sandbox-${action}`, JSON.stringify(data));
};

actionSelect.classList.toggle('show-unpublished', urlParams.has('showUnpublished'))
actionSelect.classList.toggle('show-unpublished', urlParams.has('showUnpublished'));
actionSelect.value = urlParams.get('action') || 'show';
actionSelect.onchange();

Expand Down Expand Up @@ -221,15 +222,13 @@
highlightGlobalId,
requestAsPdf,
labelSet,
locationFinder,
mapExtent,
minScale,
parts,
layers,
simplifiedOperationMode,
useMapSrs,
fullGeometries,
zoomToGeometry,
zoomTarget,
distance,
lengthUnit,
additionalLayers
Expand All @@ -245,15 +244,13 @@
highlightGlobalId,
...(requestAsPdf === 'on' && { dataType: 'pdf' }),
labelSet,
locationFinder,
mapExtent: mapExtent && mapExtent.split(',').map(Number),
minScale: minScale && Number(minScale),
parts: parts && parts.split(','),
operationMode: (simplifiedOperationMode === 'on' ? 'simplified' : 'normal' ),
layers: layers ? JSON.parse(layers) : undefined,
useMapSrs: useMapSrs === 'on',
fullGeometries: fullGeometries === 'on',
zoomTarget: zoomToGeometry === 'on' ? { type: 'geometry' } : undefined,
zoomTarget: zoomTarget && JSON.parse(zoomTarget),
buffer: distance ? { value: Number(distance), lengthUnit: lengthUnit ? lengthUnit : 'm' } : undefined,
additionalLayers: additionalLayers && JSON.parse(additionalLayers)
};
Expand Down Expand Up @@ -399,14 +396,6 @@
Use map SRS
</label>
</div>
<div>
<label for="mapExtent">Map extent coordinates</label>
<input name="mapExtent" id="mapExtent" placeholder="minX,minY,maxX,maxY">
</div>
<div>
<label for="locationFinder">Location finder search query</label>
<input name="locationFinder" id="locationFinder">
</div>
</template>

<template id="common-data">
Expand Down Expand Up @@ -469,7 +458,7 @@
</div>
</template>

<template data-action="showMap" data-common="zoomTo,map,showWorkbook,disabledUiFeatures,filter,show">
<template data-action="showMap" data-common="zoomTarget,map,showWorkbook,disabledUiFeatures,filter,show">
<div>
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
<input name="embeddingTargetId" id="embeddingTargetId" required>
Expand Down Expand Up @@ -547,7 +536,7 @@

<template data-action="setFilter" data-common="filter"></template>

<template data-action="createGeometry" data-common="map,disabledUiFeatures,filter">
<template data-action="createGeometry" data-common="zoomTarget,map,disabledUiFeatures,filter">
<div>
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
<input name="embeddingTargetId" id="embeddingTargetId" required>
Expand Down Expand Up @@ -610,7 +599,7 @@
</div>
</template>

<template data-action="editGeometry" data-common="zoomTo,map,disabledUiFeatures,filter">
<template data-action="editGeometry" data-common="zoomTarget,map,disabledUiFeatures,filter">
<div>
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
<input name="embeddingTargetId" id="embeddingTargetId" required>
Expand Down Expand Up @@ -682,7 +671,7 @@
</div>
</template>

<template data-action="selectObjects" data-common="map,filter">
<template data-action="selectObjects" data-common="zoomTarget,map,filter">
<div>
<label for="embeddingTargetId">Embedding target ID of the map view *</label>
<input name="embeddingTargetId" id="embeddingTargetId" required>
Expand Down Expand Up @@ -751,12 +740,30 @@
</div>
</template>

<template id="common-zoomTo">
<template id="common-zoomTarget">
<div>
<label>
<input type="checkbox" name="zoomToGeometry">
Zoom to geometry
</label>
<label for="zoomTarget">Zoom Target</label>
<textarea name="zoomTarget" id="zoomTarget" rows="5"></textarea>
<small>
<p>Optional JSON Object</p>
<p>
Hints for some types:
<ul>
<li>'geometry' of 'geometry': GeoJSON geometry</li>
<li>'extent' of 'static': [minX,minY,maxX,maxY]</li>
</ul>
</p>
<p>
Supported zoomTargets as examples to use:
<ul>
<li>{"type": "geometry", "geometry": {"coordinates":[[[9.598504509838506,52.70992820638244],[8.899110702389294,51.72257425885121],[10.906499617840836,51.725944168909365],[9.598504509838506,52.70992820638244]]],"type":"Polygon"}}</li>
<li>{"type": "locationFinder", "query": "Hamburg"}</li>
<li>{"type": "static", "extent": [9.585571,53.38169,10.483704,53.859007]}</li>
<li>{"type": "layerDataExtent"}</li>
<li>{"type": "layerDataExtent", "layers": ["Messstellen", "Gewässer"]}</li>
</ul>
</p>
</small>
</div>
</template>

Expand Down
Loading

0 comments on commit 9a50d1c

Please sign in to comment.