-
Notifications
You must be signed in to change notification settings - Fork 15
BGDIINF_SB-2958 : add cesium component #415
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
Conversation
@pakb, what is the failing "AWS CodeBuild eu-central-1 (web-mapviewer)" check? |
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.
See my comments, otherwise looks like a good start to me.
I let @pakb handle the full review.
That's our CI hosted on Amazon, I'll check if we can give you read access to it. Here's the error it gave for this PR :
You might want to add the |
e2cb4a7
to
f2d54e1
Compare
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.
As you've clearly detected 3 steps in your work, would it be possible to have this 3 steps represented as commits?
That would make it much easier to review this PR, as it's already quite big
f2d54e1
to
c306c47
Compare
I fixed the import and CI passed locally |
I split it into 3 commits, I will try to do smaller PRs in future |
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 a lot!
I would like to change a bit your approach to map component switching as I find your solution a bit too obfuscated.
src/modules/map/MapModule.vue
Outdated
<KeepAlive> | ||
<component :is="selectedMap"> | ||
<!-- So that external modules can have access to the map instance through the provided 'getMap' --> | ||
<template #openlayers> | ||
<slot name="openlayers" /> | ||
</template> | ||
<template #cesium> | ||
<slot name="cesium" /> | ||
</template> | ||
<slot /> | ||
<LocationPopup v-if="!is3DActive" /> | ||
</component> | ||
</KeepAlive> |
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.
would it not be possible to have something like
<CesiumMap v-if="is3DActive" />
<OpenLayersMap v-else>
// ...
</OpenLayersMap>
I find your approach way too hard to understand and the implication it has (some slot down the lines are implicitly called this way, like the DrawingModule and Footer, but that is not clear here that this will be the case)
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 was my first solution but it is not really good in the case of performance when switching OL/cesium. With my solution with templates and keepAlive, OL/cesium component, map, and everything related creates and loads only one time when you switch it on the first time. With an if/else solution everything creates and loads each time when you switch between 2d/3d so it takes more time on the second switch and the same data loads again
Anyway, I reworked my solution with if/else so you can test and then we can keep it or back to a templates solution
@@ -357,17 +362,16 @@ export default { | |||
this.map.on('pointerdown', this.onMapPointerDown) | |||
// TODO: trigger a click after pointer is down at (roughly) the same spot | |||
// for longer than 1sec (no need to wait for the user to stop the click) | |||
this.map.on('pointerup', this.onMapPointerUp) | |||
// this.map.on('pointerup', this.onMapPointerUp) todo onMapPointerUp undefined |
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.
good catch, but I would prefer we stick to the task at hand.
I'll create a ticket on our side to deal with this
@vladyslav-tk, I propose we rely on https://www.npmjs.com/package/@cesium/engine |
engine doesn't contain a viewer so we can't use the engine only |
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.
That's much easier to understand what's going on with the component hierarchy this way, thanks!
The trade off is that it's a bit less efficient if you switch back and forth between 3D and 2D, but that's not something users should be doing too often.
Now a last little thing to add : some Cypress test that check that an intercepted (mockup) 3D tile is loaded after we've clicked on the 3D button (checking that Cesium was configured and loaded correctly)
cy.get('#cesium canvas').should('be.visible') | ||
cy.get('#ol-map canvas').should('not.exist') |
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.
if possible, it would be better to use custom data-cy="..."
CSS selector (Cypress best practices), at least to grab the OL and Cesium map element (grabbing the canvas cannot be done any other way)
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.
updated
expect(cameraPosition.longitude).to.eq(0.13147292983909972) | ||
expect(cameraPosition.latitude).to.eq(0.819968266410843) |
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.
is that expressed in radians?
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.
yes, when using camera.positionCartographic
, camera.position
will be in Cartesian3
7cc71b0
to
195349b
Compare
195349b
to
4dfb76b
Compare
Test link