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

Optional vtkjs #893

Merged
merged 47 commits into from
Nov 2, 2018
Merged

Optional vtkjs #893

merged 47 commits into from
Nov 2, 2018

Conversation

zachmullen
Copy link
Contributor

This merges latest master with the changes on @sankhesh 's vtk branch, as well merging the dual-builds branch.

@sankhesh @manthey during the merge there was one conflict I wasn't sure about -- are the changes in src/camera.js to the far and near camera bounds still necessary?

aashish24 and others added 24 commits January 24, 2018 16:12
The problem is that we will have to transform every vtkPoints
to destination gcs (like geotransform in vtk) and then we can have
reasonable near and far and also proper radius
The changes include:

- Create an alias `vtk` to the compiled `vtk.js` in the `vtk.js/dist`
director.
- Comment out passing the whole code-base through Uglify.js.
Comment out passing through UglifyJs
The caveat is that geojs needs to call resetCamera and setClippingRange
on vtk-js camera.
This was erroneously removed during conflict resolution
@manthey
Copy link
Contributor

manthey commented Aug 10, 2018

@zachmullen I'm reworking how the camera class allows setting the clip bounds (including near and far). I hope to have a PR for that soon. This PR ultimately won't change camera.js but will have the renderer do something like this.map().camera().clipbounds = {near: <x>, far: <y>} (but I'm not certain of that interface yet).

The latest (v7) did not import properly.
@zachmullen
Copy link
Contributor Author

I've updated to the the earliest version of vtk.js that this works with, but the rendering is not working:

screen shot 2018-10-23 at 2 46 31 pm

It just shows the background of the vtk render window. Panning the map causes that to disappear and be replaced with the normal map tiles, but no points appear in either case. Any thoughts?

@manthey
Copy link
Contributor

manthey commented Oct 23, 2018

To fix the pan issue, I'm guessing that the geoOn(geo_event.pan, ... function should call m_this._render. I'll have to look further than that.

@zachmullen
Copy link
Contributor Author

@aashish24 @sankhesh @manthey I've pushed changes that now make the vtk.js example that @sankhesh wrote load into the list and have access to the data, but as I mentioned before, the vtkjs renderer is only showing the background, no map or points.

Is this expected? Did this ever work, or was it just not completed? Something is clearly wrong in the renderer implementation itself.

@sankhesh
Copy link
Contributor

@zachmullen It did work at one point. However, I must admit that it was all hacked together back then. My understanding was that between the changes to vtk-js and this branch, it should all work. I can take a look if you like.

zachmullen and others added 2 commits October 24, 2018 12:00
@manthey
Copy link
Contributor

manthey commented Oct 29, 2018

@zachmullen I just pushed some changes that make it so that when I use the simple_point tutorial I see points in the appropriate spots. You can zoom and pan via the console: tutorial.map.zoom(5), tutorial.map.center({x: -90, y: 30}). The mouse interactor seems to be disabled because the vtkjs window is on top of the geojs div.

There are a bunch of points in the code I've marked as TODO. At the very least, we need to use the non-fullscreen vtk.js renderer so we don't break interaction. I don't know why vtk.js renders a background color once but then not again -- we'd rather it never do so.

@manthey
Copy link
Contributor

manthey commented Oct 29, 2018

@aashish24 I think, at the very least, we have to resolve the initial color overlay and the mouse interaction issue before we could merge this. There are many other smaller issues which we could defer or wait until they are resolved before merging. I'd also like to see us using the latest vtk.js version (the latest version doesn't import the same way, so we have to figure that out).

@aashish24
Copy link
Member

There are a bunch of points in the code I've marked as TODO. At the very least, we need to use the non-fullscreen vtk.js renderer so we don't break interaction

+1, yes that is the right thing to do.

t the very least, we have to resolve the initial color overlay

What is the initial color overlay issue is? just wanted to make sure I understand.

mouse interaction issue

Are we still having some interaction issues? I believe @sankhesh fixed some but wondering if there are more.

@manthey
Copy link
Contributor

manthey commented Oct 29, 2018

What is the initial color overlay issue is? just wanted to make sure I understand.

For whatever reason, the vtkjs renderer fills its background with a color. As @zachmullen just commented, we can ask for transparent to avoid this.

Are we still having some interaction issues? I believe @sankhesh fixed some but wondering if there are more.

Yes -- the vtkjs render window is the full screen renderer, which makes a div on top of everything. This is wrong for two reasons: (1) the map may not be the full windows, and (2) the div eats the mouse events. I crudely switched to the vtkGenericRenderWindow, and set its container to the layer div. This fixed the interaction issue, but the vtk renderer had the wrong resolution (and may have had other issues), so I assume we just need to not use the full screen renderer and configure a partial screen renderer properly.

However, if I manually pan, zoom, etc., the drawn points are all in the correct spots.

@sankhesh
Copy link
Contributor

Perhaps, we could use the vtkGenericRenderWindow and set the size on it each frame. That should fix the issue of wrong viewport size.

@aashish24
Copy link
Member

Perhaps, we could use the vtkGenericRenderWindow and set the size on it each frame. That should fix the issue of wrong viewport size.

I believe that is what David did. David, with these two fixes, do you still think we need to address these issues in depth before we approve this PR? Perhaps, we can list all of these issues and check if they can be addressed in another PR?

This removes the duplicate capitals.json and just references the file
from the reprojection example.

This adds a very basic test for the vtkjs point feature.  It really only
tests that the canvas is created.
Ideally this would be an option that multiple renderers could honor.
This required a lighting change to the actor.
@manthey
Copy link
Contributor

manthey commented Oct 30, 2018

@zachmullen, @aashish24 There are still a pile of "TODO" issues, but this is superficially working. It even has coverage of much of the new code. I recommend that we merge this and fix issues in future PRs.

The biggest defect, in my opinion, is that it uses a single value for radius, color, and opacity for all points (and doesn't distinguish between fill and stroke values at all). I don't (yet) know enough about vtkjs to know how to color and size each point distinctly in an efficient manner.

@aashish24
Copy link
Member

@zachmullen, @aashish24 There are still a pile of "TODO" issues, but this is superficially working. It even has coverage of much of the new code. I recommend that we merge this and fix issues in future PRs.

The biggest defect, in my opinion, is that it uses a single value for radius, color, and opacity for all points (and doesn't distinguish between fill and stroke values at all). I don't (yet) know enough about vtkjs to know how to color and size each point distinctly in an efficient manner.

I agree, lets merge this if it is okay with @zachmullen and @sankhesh as well.

@manthey manthey merged commit 0ba82ff into master Nov 2, 2018
@zachmullen zachmullen deleted the optional-vtkjs branch November 2, 2018 18:11
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