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

OverviewMap control #2769

Merged
merged 3 commits into from
Oct 9, 2014
Merged

OverviewMap control #2769

merged 3 commits into from
Oct 9, 2014

Conversation

adube
Copy link
Contributor

@adube adube commented Sep 29, 2014

This replaces both the old #822 and #2444.

The following fixes were made so far:

  • (enhancement - fixed) use map postrender instead of view resolution, center and rotation property changes, as suggested by @tonio. The small box doesn't follow the animation of the map (i.e. while doing a pan/zoom), because the extent of the main map is always the same while animating, i.e. is equal to the end result. More about this.
  • (bug - fixed) listen to the map view change and act accordingly, as suggested by @elemoine and @tschaub .
  • (bug - fixed) defining the control with maximized: false no longer works
  • (task - fixed) follow the new button structure
  • (task - fixed) add a 'collapsible' option, as the attributions control, to allow the control to be drawn without a button

What's remaining to do, which includes all comments from #822 and #2444, in my personal order of priority :

  • (enhancement, requires One map per view #2735) use map corners instead of the extent as a way to get draw the box to allow it to animate smoothly while the map is animating.
  • (task) add tests
  • (task) support dragging the box to change the main map view (it would be really nice to have this)
  • (enhancement) support rotating the box instead of overview map (this could be left undone for now)

@adube adube mentioned this pull request Sep 29, 2014
@adube
Copy link
Contributor Author

adube commented Sep 30, 2014

The button structure of ol3 is now used for the overviewmap control. I "borrow" lots of css from the attribution control (i.e.: copy).

@adube
Copy link
Contributor Author

adube commented Sep 30, 2014

ol3 currently does not have a method to get the map 4 corners, which is different from a view extent (if I understood correctly). This seem to be one of the topic of #2735. I'll wait for #2735 to be completed.

BTW, the overview map no longer assumes the map has a view. It doesn't do anything if it doesn't have one. Please, correct me if I'm wrong.

@elemoine
Copy link
Member

Yep, having a getViewportCorners method would be useful. With #2735 it's not clear to me if that method should be on the map or on the view. This is one of the reasons I'm still not comfortable with #2735 – it blurs the boundary between the map and the view.

@adube
Copy link
Contributor Author

adube commented Sep 30, 2014

I think the overviewmap control would be ready 'as-is'. What's remaining to do could be marked in separate issues. The control could use some tests, but I'd like to have it reviewed first. The tests could also be done after.

Thanks

}
.ol-overviewmap-box {
border: 2px dotted rgba(0,60,136,0.7);
}
Copy link
Member

Choose a reason for hiding this comment

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

"No new line at end of file"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@elemoine
Copy link
Member

Thanks @adube. I'm done reviewing for today. I'd like to look more closely at how the map and the overview map are synchronized and when the rendering of the overview map occurs.

@adube
Copy link
Contributor Author

adube commented Sep 30, 2014

@elemoine thank you ! I should be able to complete all fixes you mentioned by tomorrow.

@tschaub
Copy link
Member

tschaub commented Oct 1, 2014

Leaving #2735 out of this, let's discuss how the overview map should show the main map extent with rotation (and potentially with tilt).

Making it so the overview map is fully synchronized with the main map would be facilitated by animating the view (see https://github.com/tschaub/ol3/tree/animated-view).

@tschaub
Copy link
Member

tschaub commented Oct 1, 2014

If you want to demonstrate two different uses of an overview map, I'd suggest two different examples. One that uses the defaults and one that uses custom options.

@elemoine
Copy link
Member

elemoine commented Oct 1, 2014

The overview map could "just" draw a quadrilateral representing the main map viewport. Until we support tilt that quadrilateral will always be a rectangle. And also, I think I'd focus on the case where the overview map does not rotate with the main map. So the overview map would show a rotated rectangle when the main map is rotated. Is that making any sense?

* rotateBox: (boolean|undefined),
* target: (Element|undefined),
* tipLabel: (string|undefined)}}
* @api stable
Copy link
Member

Choose a reason for hiding this comment

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

You can remove stable here (but leave @api). It is useless and we don't have it for the other @typedefs. Stability is marked on individual properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@adube
Copy link
Contributor Author

adube commented Oct 1, 2014

Following and agreeing with @tschaub suggestion, we now have two examples:

  • one with the default behaviour and style of the overviewmap control
  • the other featuring advanced customization using options and CSS

@adube
Copy link
Contributor Author

adube commented Oct 1, 2014

I'm done with fixing everything from @elemoine review. Only two points remain undone, but those are trivial IMHO.

I'd be in favor of merging this pull request "as-is" (with any additional trivial fixes if required). Discussions / new features such as showing a rotated rectangle when the main map is rotated could come in an other pull request, in an other separated discussion.

After 1 and a half year of waiting, I'm eager to see this merged 😄

Thank you very much for your help

* @type {number}
* @private
*/
this.minRatio_ = ol.OVERVIEWMAP_MIN_RATIO;
Copy link
Member

Choose a reason for hiding this comment

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

Why storing the value min and max ratio values in the instance? Why not use the constants in the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Now using constants directly.

@elemoine
Copy link
Member

elemoine commented Oct 7, 2014

I'd be in favor of merging this. It seems to me that the overview map control still needs some work, but I'd secure this work by merging it into master, and improve on it with new PRs.

And before merging I'd change all the @api stable annotations to @api (experimental), to give us the capacity to change the API while working on improvements in the future. I'd also squash the commits into, say, 3 commits: one for the control itself, and one for each example.

What do others think?

@pagameba
Copy link
Member

pagameba commented Oct 7, 2014

I agree with the rationale for merging (I have not reviewed but have been following the thread).

@ahocevar
Copy link
Member

ahocevar commented Oct 8, 2014

+1 on merging without any @api stable annotations. @adube, can you please change them to just @api? Thanks.

@adube
Copy link
Contributor Author

adube commented Oct 9, 2014

@ahocevar sure, I'm on it.

@adube adube force-pushed the overviewmap branch 3 times, most recently from 0cd615f to 1e7fbcf Compare October 9, 2014 13:21
@adube
Copy link
Contributor Author

adube commented Oct 9, 2014

There you go. Travis build fails, but I don't think it's caused by the content of this PR.

Thanks to all of you who helped me working on this control.

@elemoine
Copy link
Member

elemoine commented Oct 9, 2014

@fredj any idea on the Travis build failure?

@fredj
Copy link
Member

fredj commented Oct 9, 2014

The examples must include jquery with:

<script src="../resources/jquery.min.js" type="text/javascript"></script>

instead of:

<script src="jquery.min.js" type="text/javascript"></script>

@elemoine
Copy link
Member

elemoine commented Oct 9, 2014

Yep, I knew this was related to jquery moved to the resources dir :-) Thanks @fredj. @adube can you please fix your examples? Thanks.

@adube
Copy link
Contributor Author

adube commented Oct 9, 2014

Done

@elemoine
Copy link
Member

elemoine commented Oct 9, 2014

Thanks.

elemoine pushed a commit that referenced this pull request Oct 9, 2014
@elemoine elemoine merged commit 4c63609 into openlayers:master Oct 9, 2014
@adube adube deleted the overviewmap branch October 9, 2014 18:25
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.

None yet

6 participants