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

Add a d3 quadFeature #581

Merged
merged 11 commits into from
Jun 6, 2016
Merged

Add a d3 quadFeature #581

merged 11 commits into from
Jun 6, 2016

Conversation

manthey
Copy link
Contributor

@manthey manthey commented Jun 1, 2016

This will render similar to the gl quadFeature, with the exception that when an image quad is not a parallelogram, the image is still drawn as one. The gl renderer skews an image using two different transforms making the quad contain the full image, but with a transform discontinuity along one of the diagonals when the quad is not a parallelogram. The d3 render will skew the image with a single transform, and non-parallelograms will be render somewhat incorrectly.

Initially, this was implemented with polygons for both color quads and image quads, but polygons using images have to use defs to define an svg pattern, and were substantially slower than using images (one virtue of using polygons is that non-parallelogram quads were rendered with the correct area, though the image was still incorrectly transformed).

The d3 tile layer has been switched to use the quad feature. This is slightly faster than using the plane feature (perhaps a 10% speed up), but still much slower than canvas or gl.

The quad tests were dropped when the webpack refactor was done. They have been added back in.

This will render nearly identically to the gl quadFeature, with the exception that when an image quad is not a parallelogram.

When the quad is not a parallelogram, the gl renderer will skew the image using two different transforms making the quad contain the full image, but with a transform discontinuity along one of the diagonals.  The d3 render will skew the image with a single transform, and part of the image will not be visible.  For not convex quads, the d3 renderer could display part of the image multiple times.
Switch to using svg image elements.  These are always parallelograms, so quads that are convex may not have their full areas covered, and quads that are not parallelograms will have extra areas rendered.
Percolate a reference for each tile to the canvas element to make it easier to debug and test.

Use floats for the null renderer so that its tiles will be located at close to the same position as svg tiles.

Reenable the one disabled test for null renderer tiles.
Remove some code that is no longer used.
@manthey
Copy link
Contributor Author

manthey commented Jun 1, 2016

This resolves issue #540 and is needed by issues #541 and #548.

@codecov-io
Copy link

codecov-io commented Jun 1, 2016

Current coverage is 74.00%

Merging #581 into master will increase coverage by 0.88%

@@             master       #581   diff @@
==========================================
  Files            82         83     +1   
  Lines          7216       7300    +84   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           5276       5402   +126   
+ Misses         1940       1898    -42   
  Partials          0          0          

Powered by Codecov. Last updated by 85af24d...1c233f4

I've added a config file for jsdoc so that the class names show the long name.  This makes it so instead of seeing four quadFeature in the table of contents, you now see geo.quadFeature, geo.gl.quadFeature, geo.canvas.quadFeature, and geo.d3.quadFeature.

I fixed a few other minor jsdoc issues.

I also added a build-examples script to package.json.
I had one of the tests fail twice on my system and this fixes it.
@@ -70,6 +70,7 @@
},
"scripts": {
"build": "webpack --config webpack.config.js && webpack --config external.config.js",
"build-examples": "webpack --config webpack-examples.config.js",
Copy link
Member

Choose a reason for hiding this comment

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

+1

@aashish24
Copy link
Member

Not directly related to this branch: I am having issues with data:

[ 63%] Downloading grid.jpg
-- Data is here: https://data.kitware.com/api/v1/file/560a89518d777f7bfaadd3dd/download
CMake Error at Girder_FetchScripts/fetch_26e86857de2e8c4c4fc808dfd6b12e95_grid.jpg.cmake:7 (message):
  Error downloading grid.jpg: "Unsupported protocol"

@jbeezley
Copy link
Contributor

jbeezley commented Jun 3, 2016

You probably need to compile cmake with SSL support.

@aashish24
Copy link
Member

thanks @jbeezley didn't have this issue before. Is it because we switched to https on data recently?

@aashish24
Copy link
Member

that was indeed the problem, my cmake was built without openssl.

Also, use integer transforms for the svg tile layer where appropriate.  Only compare the positions of the top-most level, as lower levels are increasingly offset.
parseInt casts to a string and then converts to an integer (at least in Chrome), so values like 8e-14 convert to 8, not 0.
Drawing features was moved inside a requestAnimationFrame.  Removing features also needs to be there or the dynamicData example doesn't work.
@aashish24
Copy link
Member

@manthey LGTM 👍 @jbeezley do you bless this change too?

@jbeezley
Copy link
Contributor

jbeezley commented Jun 6, 2016

Yup, LGTM.

@manthey manthey merged commit 878ecc7 into master Jun 6, 2016
@manthey manthey deleted the d3-quad-feature branch June 6, 2016 13:47
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