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

BaseLayerPicker improvement & Timeline.prototype.destroy() #798

Closed
wants to merge 4 commits into from

Conversation

akosmaroy
Copy link
Contributor

please consider these changes, which I originally posted from the batching branch, also see #789 and #790

@pjcozzi
Copy link
Contributor

pjcozzi commented May 27, 2013

Thanks for separating out this pull request @akosmaroy. I'm the wrong person to review this, but I'm sure @mramato will be happy to.

@mramato
Copy link
Contributor

mramato commented May 28, 2013

Sorry I never replied to the original thread about this, I've been unable to work on Cesium for the past few days. Now that I'm back, I'm reviewing this change now.

document.addEventListener('touchend', function(e) {
widget._handleTouchEnd(e);
}, false);
this.onmousedown = function(e) { widget._handleMouseDown(e); };
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please make these new functions start with underscore and match our capitalization rules? Instead of this.onmousedown, use this._onMouseDown. We use underscore as a convention for pseudo-private variables.

@mramato
Copy link
Contributor

mramato commented May 28, 2013

Other than my two minor comments, the Timeline changes look good. The Timeline itself certainly needs an overhaul, but I appreciate the cleanup you've done in the meantime.

@akosmaroy
Copy link
Contributor Author

thanks for the feedback, see the above commit that hopefully contains the suggested changes

@@ -90,12 +94,21 @@ define(['../../Core/DeveloperError',
return selectedViewModel();
},
write : function(value) {
if (imageryLayers.getLength() > 0) {
while (imageryLayers.getLength() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You changed the code to simply remove all layers when a layer is switched. This is definitely not what we want. Someone may use the widget to allow base layer swapping, but want to manage additional layers on top of that themselves. With this change, that's no longer possible. The work-around would be to have each viewModel always return the same set of imagery providers, this way on remove, we only remove the ones that we originally added. Since we'll use instance comparison, this should work even if the added provider was manually moved around by the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fair enough. what I wanted to achieve is to be able to pass multiple layers - what would be your suggestion to be able to achieve this?
the use case is that if someone wants to add a 'set of layers' which overlap each other in semi-transparent ways, he should be able to do that.

@mramato
Copy link
Contributor

mramato commented May 28, 2013

For the BaseLayerPicker changes, I'll ask @emackey, @shunter, and @kring to also chime in with their thoughts. This widget was originally designed to only operate on the base layer and as an interim step to "real" layer management in our soon-to-be-developed Table of Contents widget. I was originally hesitant with this change, but after thinking about it some more I think we can make it work without any issues and it might be useful if there's a common use case for having "imagery sets" get added instead of just the one provider.

We also need to make sure any documentation is updated to reflect the new behavior, primarily the creationCommand in ImageryProviderViewModel.js and additional unit tests would have to be created for BaseLayerPicker to ensure that everything works as expected.

What do you guys think?

@shunter
Copy link
Contributor

shunter commented May 31, 2013

I think extending a "base layer" to allow multiple makes sense, since as you point out the BaseLayerViewModel can keep track of the layer(s) that it added in order to remove just those independently of any other layers added programmatically.



Conflicts:
	Source/Widgets/BaseLayerPicker/BaseLayerPickerViewModel.js
	Source/Widgets/Timeline/Timeline.js
@akosmaroy
Copy link
Contributor Author

@shunter I tried to implement such an approach, but the issue with this is that the picker replaces the base layer which is added when creating the viewer (i.e. a default base layer) - in effect a base layer that is not added by the picker. as this layer is not added by the picker, it doesn't know that it has to remove it first.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 13, 2013

What's the plan with this pull request? We have this change in the batching branch and don't want to bring it in early.

@mramato
Copy link
Contributor

mramato commented Jun 18, 2013

There's been tons of changes in the widget code recently, so this branch needs to merge in master and fix the definite conflicts that have arisen. For the question @akosmaroy, I would have the BaseLayerPicker not remove any providers except the ones it created. We could then change the Viewer widget code to make sure that it removes all layers before it creates the BaseLayerPicker.

@akosmaroy if you don't have time to work on this, I'd be happy to merge this code into my own branch and finish it up so that it can come into master ahead of the batching branch. It's up to you.

@akosmaroy
Copy link
Contributor Author

@mramato thank you, I won't have time to work on this in the next two weeks. I'm sorry about that

@mramato
Copy link
Contributor

mramato commented Jun 18, 2013

Timeline cleanup is done in #874. Working on BaseLayerPicker changes now.

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.

4 participants