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

Emit event for overlay annotations #787

Merged
merged 2 commits into from
Feb 23, 2022
Merged

Emit event for overlay annotations #787

merged 2 commits into from
Feb 23, 2022

Conversation

naglepuff
Copy link
Collaborator

This PR makes the following changes:

  1. Emit an event of type g:drawOverlayAnnotation when a GeoJS layer is created for an image overlay. This is useful for code that uses large_image, such as HistomicsUI, since creating these layers happens asynchronously.
  2. Fix a bug where the URL for annotations of type pixelmap would be malformed if it had a different number of zoom levels compared to the base image layer.

Also fix URL generation for tiled pixelmaps.
@naglepuff naglepuff requested a review from manthey February 22, 2022 21:53
@naglepuff naglepuff marked this pull request as ready for review February 22, 2022 21:53
// For pixelmap overlays, there are additional parameters to set
layerParams.keepLower = false;
layerParams.url = layerParams.url + `?encoding=PNG`;
if (levelDifference > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this necessary since if this is non-zero the url would have already been 'api/v1/item/' + overlayImageId + /tiles/zxy/${z - levelDifference}/${x}/${y} based on the code in _generateOverlayLayerParam? The only difference I see is a / before the ?encoding=PNG

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In the case that levelDifference is non-zero, layerParams.url is a function, so concatenating the ?encoding=PNG wasn't working in that case.

Is there a better way to do change the function?

I've recently pushed 14d38de to make sure the levelDifference check passes if it is non-zero, not just positive, and removed those extra / characters from the url.

Copy link
Member

Choose a reason for hiding this comment

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

Probably we should eventually abstract this to have the GeoJS utility functions generate appropriate urls directly based on the level difference. For now, this is fine.

Previously it only checked for greater than zero, but levelDifference
could be negative. Also remove extra / from layer URL.
@naglepuff naglepuff merged commit 311bd05 into master Feb 23, 2022
@naglepuff naglepuff deleted the overlay-layer-event branch February 23, 2022 17:38
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.

2 participants