Kitware / minerva

Minerva: client/server/services for analysis and visualization
Apache License 2.0
36 stars 14 forks source link

Map screenshot and map scale widget #493

Closed matthewma7 closed 6 years ago

matthewma7 commented 6 years ago

Implement taking map screenshot feature with a map ui layer widget

2018-03-05_17-54-24

aashish24 commented 6 years ago

@matthewma7 is this ready for review? Looks like travis is failing.

matthewma7 commented 6 years ago

@aashish24 David and I looked into why it's failing. David is fixing the issue in Girder and GeoJS. I'll change this to [WIP]

manthey commented 6 years ago

Fundamentally, there is a webkit bug (also see here and here) that prevents webkit-based browsers from using the canvas to take a screenshot of HTML components. This applies to PhantomJS (which we use for testing), iOS, and probably Safari.

There is a minor issue in the GeoJS screenshot code in that if a css file is missing, the screenshot fails. I'll have a PR for that soon. But this doesn't fix the underlying webit issue. For webkit browsers, the best we can do with a screenshot is get the canvas elements (webGL and 2d canvas layers), and skip the html and svg layers (though some svg would be possible with a bunch of work).

I think the best thing to do would be the first time a screenshot is attempted that wants an HTML layer, we test if such a thing is supported. If not, we emit a console warning and then skip rendering such layers. This has the virtue that webkit browsers would still get screenshots of base maps and many features (and, thus, not be completely broken). The Minerva screenshot test would succeed (though would not contain the scale in the PhantomJS test). Unless there is some reason not to, I'll make another GeoJS PR to this effect.

matthewma7 commented 6 years ago

Updated to latest GeoJS and fixed the build error. Thanks @manthey

Also, added scale widget to the map. image

manthey commented 6 years ago

@matthewma7 This is failing due to pip 10.0's release. I'll make a PR to address that soon.