Skip to content

Allow Multiple extents #632

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

Merged
merged 24 commits into from
Jan 12, 2022
Merged

Conversation

Anshpreet8
Copy link
Contributor

@Anshpreet8 Anshpreet8 commented Dec 13, 2021

Each Extent added is presented in the layer control, under the corresponding layer. If the label attribute is missing from the extent, it's inherited from the layer (for now).

Note, there are some issues with opacity and query links when unchecking then checking an extent that I'm currently working on.

Other things I have not yet considered or taken a look at the behaviour of are:

There might be other things or issues, feel free to list them.

Closes #439

@Anshpreet8 Anshpreet8 marked this pull request as draft December 13, 2021 14:09
Copy link
Member

@Malvoz Malvoz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally each mapml-layer-extent would be exposed the same to ATs as the layers are, i.e.:

  1. Change div to fieldset
  2. Have the fieldset labelled (aria-labelledby) by the corresponding mapml-layer-item-name

Also, I think it'd be desired to have all mapml-layer-extent elements themselves be children of a group (<fieldset>) which is labelled (using <legend> or aria-label, probably the latter to keep it consistent) "Sublayers" (or "Extents"?).

@Anshpreet8
Copy link
Contributor Author

Anshpreet8 commented Dec 13, 2021

  1. Change div to fieldset
    Would it be okay to have nested fieldsets? I saw here that nesting fieldsets was not recommended

@Malvoz
Copy link
Member

Malvoz commented Dec 13, 2021

@Anshpreet8 they state:

Screen readers do not automatically indicate the end of the <fieldset> element

I don't know if that's the expectation, but even if that's true I don't see how that's a problem.

so it is impossible for screen reader users to confidently know which fields belong within which fieldset.

That's an incorrect statement, if a fieldset is labelled - as suggested - the user will know which inputs belong to that fieldset.

I say go ahead 👍🏼

Edit: not to mention that the HTML spec has an example of nested fieldsets: https://html.spec.whatwg.org/multipage/form-elements.html#:~:text=You%20can%20also%20nest%20fieldset%20elements

@ahmadayubi
Copy link
Member

ahmadayubi commented Dec 23, 2021

The issue with zoom to layer is that the <layer-> custom element's zoomTo function (the focus()) doesn't have an idea of multiple extents currently. It is a method of the <layer-> custom element so it's simply using the <layer-> context.

The copy extent menu item also uses the parent <layer->'s context, not the various extent's context.

The <layer-> API functions (focus) would need updating to consider the various extents seperately, or the functionality can be moved out of the <layer-> API and become a event handler within mapml.js

The functions referenced are:

https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/816f7c19372bae1da571f74656b38a555d08bbab/src/layer.js#L317

https://github.com/Maps4HTML/Web-Map-Custom-Element/blob/816f7c19372bae1da571f74656b38a555d08bbab/src/mapml/handlers/ContextMenu.js#L182

The contextmenu event is also per layer item, so anything inside the layer item is for the layer (the menu you see is for the associated layer item not the extent), you'd have to attach new event handlers for the multiple extents

@prushforth
Copy link
Member

The issue with Zoom to layer was, as @Anshpreet8 suggested, an issue with extractInputBounds on the main branch, which has been fixed and merged into this branch.

Remove TemplatedTileLayer.addTo function (redundant).
Remove getCombinedExtentsLayerBounds, make calls for this behaviour
go through _setLayerElExtent only.
map-meta name=extent, used as the extent in case there are no map-extent
elements with their inputs specifying native bounds for content.
load slowly and which fire the `extentload` event are handled properly,
which is more common with `<layer- src="...">` layers, and which are
created (typically though not exclusively) through drag and drop.
@prushforth
Copy link
Member

Hi @Anshpreet8

This PR is very solid work, thank you! Sorry to have taken so long to properly review, most changes are minor and to help the reader (me) understand the intent.

Other things I have not yet considered or taken a look at the behaviour of are:

[ ] Zoom Bounds
[x] Right Clicking on the extent in layer control results in an error
[x] Reordering extents
[ ] The behaviour when there is a feature query link and another query link (https://cwfis.cfs.nrcan.gc.ca/geoserver/public/wms?i={i}&j={j}&service=WMS&version=1.3.0&request=GetFeatureInfo&layers=public:fdr_current&QUERY_LAYERS=current:fdr_current&styles=&bbox={xmin},{ymin},{xmax},{ymax}&width={w}&height={h}&srs=EPSG:3978&INFO_FORMAT=text/html&m4h=t) within the same bounds

Can you clarify for me what's left to do for the unchecked items above? I will try to address them if they still need attention.

The only thing that stands out to me was the need to cycle the debug mode off / on to reflect extent removal/addition. I will take a look to see if that can be easily fixed. I may just merge this PR and log an issue for later so that we can move on to other work.

@prushforth prushforth marked this pull request as ready for review January 12, 2022 15:48
@prushforth prushforth added this to the Fall term 2021 milestone Jan 12, 2022
@Anshpreet8
Copy link
Contributor Author

Can you clarify for me what's left to do for the unchecked items above? I will try to address them if they still need attention.

Hi @prushforth , when there were was a feature query extent and a non-feature query extent, the behaviour was kind of odd, the non-feature link only pops up once and when I tried going forward and back to the previous queries, it was no longer there.

@prushforth
Copy link
Member

List of things to do related to multiple extents (feel free to add/suggest, remove items):

  • prevent absent extent label attribute from making previous sibling extent elements hidden to the user
  • enable checked attribute on extent so that extents can be author configured, slightly
  • allow author to set extent opacity
  • enable extent display/undisplay in debug mode when checked/unchecked
  • label extents according to their label value in debug mode
  • create / enable "Zoom To..." in layer control (extent) context menu
  • create / enable "Copy Extent As..." in layer control (extent) context menu
  • Enable mixed HTML/MapML query responses to be navigated via popup
  • ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Would it be useful to allow and enable more than one <extent units="..."> per layer
4 participants