-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CADENZA-38130 Feat: adding additionalLayers param to showMap API #69
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -474,9 +474,60 @@ | |
<label for="embeddingTargetId">Embedding target ID of the map view *</label> | ||
<input name="embeddingTargetId" id="embeddingTargetId" required> | ||
</div> | ||
<div> | ||
<label for="geometry">Additional layers (GeoJSON)</label> | ||
<textarea name="additionalLayers" id="additionalLayers" rows="10"></textarea> | ||
<small> | ||
<strong>Example:</strong> | ||
<pre> | ||
[ | ||
{ | ||
"type":"geojson", | ||
"name":"freiburg", | ||
"content":{ | ||
"type":"FeatureCollection", | ||
"features":[ | ||
{ | ||
"type":"Feature", | ||
"properties":{}, | ||
"geometry":{ | ||
"coordinates":[ | ||
[ | ||
[7.965977481550681,47.93787211649922], | ||
[7.903787681150362,47.64741821336713], | ||
[8.310793134690243,47.70344757260733], | ||
[7.965977481550681,47.93787211649922] | ||
] | ||
], | ||
"type":"Polygon" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
</pre> | ||
</small> | ||
</div> | ||
<div> | ||
<label for="geometry">Geometry (GeoJSON)</label> | ||
<textarea name="geometry" id="geometry" rows="5" placeholder="{"coordinates":[[[9.598504509838506,52.70992820638244],[8.899110702389294,51.72257425885121],[10.906499617840836,51.725944168909365],[9.598504509838506,52.70992820638244]]],"type":"Polygon"}"></textarea> | ||
<textarea name="geometry" id="geometry" rows="5"></textarea> | ||
<small> | ||
<strong>Example:</strong> | ||
<pre> | ||
{ | ||
"coordinates":[ | ||
[ | ||
[9.598504509838506,52.70992820638244], | ||
[8.899110702389294,51.72257425885121], | ||
[10.906499617840836,51.725944168909365], | ||
[9.598504509838506,52.70992820638244] | ||
] | ||
], | ||
"type":"Polygon" | ||
} | ||
</pre> | ||
</small> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. <small>
<strong>Example:</strong>
<pre>
{
"type":"Polygon",
"coordinates": [ [ 9.599, 52.71 ], ... ]
}</pre>
</small> |
||
</div> | ||
</template> | ||
|
||
|
@@ -503,7 +554,38 @@ | |
</div> | ||
<div> | ||
<label for="geometry">Additional layers (GeoJSON)</label> | ||
<textarea name="additionalLayers" id="additionalLayers" rows="10" placeholder="[ { type: "geojson", name: "Stuttgart", content: { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "coordinates": [ [ [ 9.019743777219759, 48.939075160317145 ], [ 9.060437807540097, 48.70393235548886 ], [ 9.734017619469824, 48.7841975772329 ], [ 9.019743777219759, 48.939075160317145 ] ] ], "type": "Polygon" } } ] } } ]"></textarea> | ||
<textarea name="additionalLayers" id="additionalLayers" rows="10"></textarea> | ||
<small> | ||
<strong>Example:</strong> | ||
<pre> | ||
[ | ||
{ | ||
"type":"geojson", | ||
"name":"freiburg", | ||
"content":{ | ||
"type":"FeatureCollection", | ||
"features":[ | ||
{ | ||
"type":"Feature", | ||
"properties":{}, | ||
"geometry":{ | ||
"coordinates":[ | ||
[ | ||
[7.965977481550681,47.93787211649922], | ||
[7.903787681150362,47.64741821336713], | ||
[8.310793134690243,47.70344757260733], | ||
[7.965977481550681,47.93787211649922] | ||
] | ||
], | ||
"type":"Polygon" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
</pre> | ||
</small> | ||
</div> | ||
<div> | ||
<label for="geometryType">Geometry type</label> | ||
|
@@ -535,13 +617,58 @@ | |
</div> | ||
<div> | ||
<label for="geometry">Additional layers (GeoJSON)</label> | ||
<button>Add example</button> | ||
<textarea name="additionalLayers" id="additionalLayers" rows="10" placeholder="[ { type: "geojson", name: "Stuttgart", content: { "type": "FeatureCollection", "features": [ { "type": "Feature", "properties": {}, "geometry": { "coordinates": [ [ [ 9.019743777219759, 48.939075160317145 ], [ 9.060437807540097, 48.70393235548886 ], [ 9.734017619469824, 48.7841975772329 ], [ 9.019743777219759, 48.939075160317145 ] ] ], "type": "Polygon" } } ] } } ]"></textarea> | ||
<textarea name="additionalLayers" id="additionalLayers" rows="10"></textarea> | ||
<small> | ||
<strong>Example:</strong> | ||
<pre> | ||
[ | ||
{ | ||
"type":"geojson", | ||
"name":"freiburg", | ||
"content":{ | ||
"type":"FeatureCollection", | ||
"features":[ | ||
{ | ||
"type":"Feature", | ||
"properties":{}, | ||
"geometry":{ | ||
"coordinates":[ | ||
[ | ||
[7.965977481550681,47.93787211649922], | ||
[7.903787681150362,47.64741821336713], | ||
[8.310793134690243,47.70344757260733], | ||
[7.965977481550681,47.93787211649922] | ||
] | ||
], | ||
"type":"Polygon" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
</pre> | ||
</small> | ||
</div> | ||
<div> | ||
<label for="geometry">Geometry (GeoJSON) *</label> | ||
<textarea name="geometry" id="geometry" rows="5" required placeholder="{"coordinates":[[[9.598504509838506,52.70992820638244],[8.899110702389294,51.72257425885121],[10.906499617840836,51.725944168909365],[9.598504509838506,52.70992820638244]]],"type":"Polygon"}"></textarea> | ||
<small></small> | ||
<textarea name="geometry" id="geometry" rows="5" required></textarea> | ||
<small> | ||
<strong>Example:</strong> | ||
<pre> | ||
{ | ||
"coordinates":[ | ||
[ | ||
[9.598504509838506,52.70992820638244], | ||
[8.899110702389294,51.72257425885121], | ||
[10.906499617840836,51.725944168909365], | ||
[9.598504509838506,52.70992820638244] | ||
] | ||
], | ||
"type":"Polygon" | ||
} | ||
</pre> | ||
</small> | ||
</div> | ||
<div> | ||
<label> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,6 +385,7 @@ export class CadenzaClient { | |
* @param {boolean} [options.useMapSrs] - Whether the geometry and the extent are in the map's SRS (otherwise EPSG:4326 is assumed) | ||
* @param {ZoomTarget} [options.zoomTarget] - A target Cadenza should zoom to | ||
* @param {AbortSignal} [options.signal] - A signal to abort the iframe loading | ||
* @param {LayerDefinition[]} [options.additionalLayers] - Layer definitions to be imported and shown in the background, as a basis for the drawing. | ||
* @return {Promise<void>} A `Promise` for when the iframe is loaded | ||
* @throws For invalid arguments | ||
* @fires | ||
|
@@ -408,6 +409,7 @@ export class CadenzaClient { | |
useMapSrs, | ||
zoomTarget, | ||
signal, | ||
additionalLayers, | ||
} = {}, | ||
) { | ||
this.#log('CadenzaClient#showMap', ...arguments); | ||
|
@@ -437,6 +439,11 @@ export class CadenzaClient { | |
zoomToGeometry, | ||
}); | ||
} | ||
if (additionalLayers) { | ||
additionalLayers.forEach((layer) => | ||
this.#postEvent('importLayer', layer), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Klaus changes this to a request, please coordinate this change with him. |
||
); | ||
} | ||
} | ||
|
||
/** | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These examples are hard to read in the sandbox, because there are no line breaks and indentation. Proposal:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the examples are really lengthy? Do we really need all the info, which makes the sidebar rather long? After all it's only an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Klaus wanted to have the possibility for people to easily copy paste and use it in the input, so for that we need everything, yes. Is this a problem? it's only a few pixels more.