-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Pick/Drillpick Imagery Layer #9651
Conversation
Thanks for the pull request @srothst1!
Reviewers, don't forget to make sure that:
|
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.
Not too many comments on the code itself which looks pretty good. The major limitation of this approach is that it isn't pixel perfect. Still I think it's would be valuable until someone implements the pixel perfect approach. I wrote some starter notes on that here: #8692 (comment).
Probably not worth tackling now unless you are up for it.
@lilleyse Thank you for the feedback. I am happy to hear that the code looked mostly good. I implemented some of your suggestions:
Before I consider implementing a pixel-perfect version of A few questions:
|
|
The new approach is better but there's still a lot of code duplication. One idea is to pass a callback function to the helper so that once overlapping imagery is found it can let the callback do the rest of the work. This lets It was a bit hard to annotate the idea on github so I mocked something up: callback.txt. I haven't actually tested it so double check that there aren't any mistakes. What do you think? |
I submitted an issue for this #9672 |
Co-authored-by: Sean Lilley <[email protected]>
…back function to pickImageryHelper
@lilleyse Thanks for the feedback! I added a series of commits. Here is a quick summary:
|
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.
Thanks @srothst1 - the main code looks good - I have some comments on the tests. Make sure to run code coverage (see #9651 (comment)) - there are some code paths that would be frequently hit that could be better tested. I marked some of those in red.
@lilleyse a few updates:
Should specs covering these paths go in a separate
|
The specs can be put in the group they're most relevant to. If there's overlap I think
|
… location to improve coverage
… to improve coverage
@lilleyse I apologize for the delay - I just added three specs that should address the cases outlined above.
"continues if imagery rectangle does not contain picked location" covers the following code in
However, coverage is not shown when running Any ideas of why we are seeing this behavior? |
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.
"pickImageryHelper returns if undefined tile picked"
"continues if imagery rectangle does not contain picked location"
These descriptions could be improved. They should be describing the behavior, not how the code is written. Maybe instead:
- pickImageryLayers returns undefined if no tiles are picked
- pickImageryLayers skips imagery layers that don't overlap the picked location
"pickImageryHelper continues if provider.pickFeatures is undefined"
This ought to already be covered by returns undefined when ImageryProvider does not implement pickFeatures
...
"continues if imagery rectangle does not contain picked location" covers the following code in
ImageryLayerCollection.js
when run individually (checked using DevTools)
...
However, coverage is not shown when runningnpm run coverage
.
This is most likely related to #9651 (comment). You'll need to get to the bottom of why. This could also explain why other tests aren't hitting the right code.
var customScene; | ||
var customGlobe; | ||
var customCamera; | ||
|
||
beforeAll(function () { | ||
scene = createScene(); | ||
globe = scene.globe = new Globe(); | ||
camera = scene.camera; | ||
|
||
scene.frameState.passes.render = true; | ||
//NEW: | ||
customScene = createScene(); | ||
customGlobe = customScene.globe = new Globe(); | ||
customCamera = customScene.camera; | ||
|
||
customScene.frameState.passes.render = true; |
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.
What are these custom
variables used for? Feels like a strange workaround.
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.
I originally added the set of custom variables because the spec "pickImageryLayers returns undefined if no tiles are picked"
modifies globe._surface._tilesToRender
and I do not want this change to impact the other specs.
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.
@srothst1 just one comment and then this PR can be merged.
* Asynchronously determines the imagery layer features that are intersected by a pick ray. The intersected imagery | ||
* layer features are found by invoking {@link ImageryProvider#pickFeatures} for each imagery layer tile intersected | ||
* by the pick ray. To compute a pick ray from a location on the screen, use {@link Camera.getPickRay}. | ||
* Helper function for `pickImageryLayers` and `pickImageryLayerFeatures`. |
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.
It's fine to remove the documentation above pickImageryHelper
since it's a local function.
Also some of the doc is misformatted (I think in @return
) which is causing CI to fail, but no need to worry about since the doc will be removed.
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.
@lilleyse I just removed the documentation above pickImageryHelper
. CI now passes.
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.
Thanks!
@srothst1 Sorry one last thing - could you add an entry to |
@lilleyse done! |
Fixes #8692
Based on the discussion from this post, there is clearly demand for functionality allowing users to select an imagery layer (or imagery layers) from our viewer. Currently, in demos like this one, if a user selects an imagery layer and not a feature they are presented with the message "No features found." The final goal of this pull request is to give users easy access to imagery layer data.
I have spent the last few days looking through
ImageryLayer.js
,ImageryLayerCollection.js
andViewer.js
. I believe that this functionality should be added to a new methodpickImageryLayer
inImageryLayerCollection.js
and eventually integrated into eitherviewer.pickEntity
orviewer.pickImageryLayerFeature
.Here is a sandcastle demo that showcases how this functionality currently works. When selecting a position on the globe, we see that
pickImageryLayers
returns anImageryLayer
andpickImageryLayerFeatures
returns nothing since there are no features. I think this is a step in the right direction.While I am looking for overall feedback and clarification, I do have some more specific questions:
ImageryLayerCollection.prototype.pickImageryLayers
return aImageryLayerCollection
or a promise toImageryLayerFeatureInfo
?ImageryLayerCollection.prototype.pickImageryLayers
be integrated intoImageryLayer.js
andScene.js
?When I get a better understanding of what needs to be done, I will update
ImageryLayerCollectionSpec.js
andCHANGES.md
. I do not expect this to be part of Thursday's release.@lilleyse
@ebogo1