Skip to content
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

Overview map #266

Merged
merged 25 commits into from
Jan 18, 2022
Merged

Overview map #266

merged 25 commits into from
Jan 18, 2022

Conversation

fschmenger
Copy link
Collaborator

This branch adds OpenLayers overview maps as a configurable component (closes #204).
wegue_overview_map

The control will be added to the map, when a top level overviewMap configuration option is declared.
I added an example to various app templates, e.g.

 "overviewMap" : {
    "collapsible": true,
    "collapsed": false
  }

@fschmenger
Copy link
Collaborator Author

I provide this as a preview for investigation. Maybe you should wait with merging until #262 is included in the main branch, so I can adjust the colorization part. Also I will add some basic unit tests and documentation upon finalization.

Some topics to discuss:

  • I'm not really happy with default placement of the control, but all corners of the UI are already occupied. Any ideas on layout welcome.
  • Codewise I decided to separate the control from the other OL control initializations in ol\Map.vue. I think on the long run the components should use a self-contained configuration object and this gives us the option to use a custom control (e.g. a vuetify sheet with GeoExt like control later on). Let me know if you think otherwise.
  • Currently I'm displaying the active background layer, if a TileLayer, otherwise a fallback to OSM maps is implemented. This is since OL6 requires us to clone a layer if we want to reuse it for overview maps.
  • Localization is currently not implemented (same for zoom buttons).
  • For a first shot I used the OL names for configuration options. overviewMap uses collapsed while e.g. for sidebar it's visible. I should change it one or the other way round, probably collapsed is the more intuitive name?!

@chrismayer
Copy link
Collaborator

Thanks for kickstarting this @fschmenger. Regarding layout: I do not like having it with an "OL button". Since it is a comparable tool to the BaselayerSwitcher it should be the same look and feel, IMHO. Some ideas just shooting from the hips:

Maybe we place different buttons in the upper-left corer of the map, which is surely limited if more components would come into play and not sure how to arrange the open components, e.g. having BaselayerSwitcher and OverviewMap open at same time?

image

Anotehr option would be to introduce a circular menu, shwoing the underlying map-related tools on clicking the main button.

image

But the problem remains, how to place the concrete windows / components? Any ideas?

Third option would be to place it in the lower-right corner of the map as you did, but with a vuetify button. This would mean that we have to find another default spot for the floating measure window. Which is surely no problem (hopefully 😉 🤞 )

image

Thinking about this it might make sense to rework the zoom buttons as vuetify buttons as well? We had that in other projects with other frameworks, to have a common look and feel:

image

Please ignore the "wrong" icons (did not have any proper in my sketching tool)

@fschmenger
Copy link
Collaborator Author

@chrismayer Thanks for the review and the provided feedback. I will work towards a vuetify based button and a v-sheet then - probably something along the lines of you first sketch and then we can refine it later.

One problem that I see is, that in contrast to the BgLayerSwitcher (which will close on map click) the OverviewMap is of more permanent nature and requires some toggle semantics for its button. I ran a brief test on this: If I place the sheet to the right of a corresponding button, this will consume too much screen space for small devices and the overview map is located very much in the interior of the map control. Maybe I can try and place the sheet under the button in an overlapping fashion (like it is the case now), but then the vuetify button is probably too large and hides large parts of the overview map.

Anyway I can start reworking this when time, and we can discuss the placement issues in the process.

@fschmenger
Copy link
Collaborator Author

Here's a proof of concept implementation with vuetify based UI elements. There are still known bugs

  • initialization order renders the extent box in the overview map invisible, until it gets the first map scroll event.
  • z-order currently paints this control over the sidebar.

Anyway it should be sufficient for further investigation, so we can discuss placement stuff and you can fiddle around with it easily. For a first shot I decided to align it at 50% screen height to get it out of the way of the BgLayerSwitcher panel.
wegue_overview_map2

As mentioned above it doesn't look too impressive on a small screen device:
wegue_overview_map2_mobile

Copy link
Collaborator

@JakobMiksch JakobMiksch left a comment

Choose a reason for hiding this comment

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

I tried it and it works well so far.
One case I observed:
when there are no baselayers activated the overviewMap stays empty. See screenshot below.
Maybe we could handle it similarly to the BaseLayer switcher which does not appear when there are no baselayers.

image

@fschmenger
Copy link
Collaborator Author

Hi Jakob, thanks for the review.

So far I wasn't aware, that a map configuration without at least 1 declared base layer is valid.
Currently, if no base layers, Wegue will just display arbitrary visible layers with the one on top as prioritized by order of declaration. You end up without a background map when toggling it/them off in the LayerList.
Is this even a desired behavior? IMHO it shouldn't be and we probably should prompt a configuration warning.

Anyway I see no need to disable the overview map in this case, as this feature does not depend on base layers directly.
I probably will just use the OSM layer as default then (currently implemented as a fallback , if the selected background layer is not a TileLayer)

If you have any ideas on improving the layout and positioning, let me know.

@JakobMiksch
Copy link
Collaborator

Hi @fschmenger . I was not aware that it is compulsory to have at least one baselayer. I could image applications without baselayers. But I admit, that these are rather exceptions. Using the OSM layer as default is fine for me.

@fschmenger
Copy link
Collaborator Author

Ok, z-index and OSM fallback are in there.
Still looking at the asnychronous initialization problem regarding the extent selection box, which looks like a harder nut to crack.

@fschmenger
Copy link
Collaborator Author

I found a fix for the selection box issue. So apart from documentation, unit tests and the upcoming colorization part that should be all the basics.
We should probably add a configurable size for the control, rather than doing it via css?!

Copy link
Collaborator

@JakobMiksch JakobMiksch left a comment

Choose a reason for hiding this comment

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

I tried it again and it seems to be fine to merge.

@fschmenger
Copy link
Collaborator Author

@JakobMiksch Thanks for testing and approving this!

I will merge / rebase with the newly integrated theming PR and make some minor adjustments for the overview map to be theming consistent. Also I will provide unit tests and some basic documentation. This probably will be after the christmas break.

…ithout any colorization of customization options.
…oes not perform any vue component rendering.
…lor. Use a vuetify card like design for the control.
…ich is displayed when no baseLayers are configured.
…overview maps to be initially collapsed. Remove no longer supported 'collapsible' attribute.
@fschmenger
Copy link
Collaborator Author

I rebased this PR on the current master branch and adjusted it to be theme compliant. Unit tests and documentation have been provided.
Note that 1f86331 and 2435c9d are not strictly related to overview maps, but affected the unit tests and therefore had to be fixed.

As a far as I am concerned this should be ready to merge now.

Co-authored-by: Jakob Miksch <info@jakobmiksch.eu>
@fschmenger
Copy link
Collaborator Author

@JakobMiksch Thanks a lot for reviewing this, Jakob!

@chrismayer
Copy link
Collaborator

Thanks for this @fschmenger.

@chrismayer chrismayer merged commit f1bfafb into wegue-oss:master Jan 18, 2022
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.

Add overview map component
3 participants