Skip to content

PB-95: Add zoom to KML extent in import file #608

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

Merged
merged 3 commits into from
Jan 22, 2024

Conversation

ltshb
Copy link
Contributor

@ltshb ltshb commented Jan 18, 2024

Now when importing a KML file we automatically zoom to its extent

Test link

Copy link

cypress bot commented Jan 18, 2024

Passing run #337 ↗︎

0 165 19 0 Flakiness 0

Details:

PB-95: Added unit tests
Project: web-mapviewer Commit: 1428a01662
Status: Passed Duration: 03:55 💡
Started: Jan 22, 2024 2:30 PM Ended: Jan 22, 2024 2:34 PM

Review all test suite changes for PR #608 ↗︎

@ltshb ltshb force-pushed the feat-PB-95-kml-zoom-to-extent branch 2 times, most recently from 584a43e to dea5181 Compare January 18, 2024 16:12
@ltshb ltshb requested a review from pakb January 18, 2024 16:13
@ltshb ltshb force-pushed the feat-PB-95-kml-zoom-to-extent branch 5 times, most recently from e2fc458 to 5da960c Compare January 18, 2024 20:47
@ltshb
Copy link
Contributor Author

ltshb commented Jan 18, 2024

@pakb I don't understand why the cesium test is now failing ? The comment about empty collection seems also a bit strange

// should be 3 (line, icon, text) but ol-cesium creates additional empty collection
expect(layerCollection.length).to.eq(4)

Do you know if the test is really correct ?

@ltkum
Copy link
Contributor

ltkum commented Jan 19, 2024

Hey, @ltshb
I tried to test the failing test personally on your branch (basically : drawing a few lines, a marker, a text), and as soon as I get out of the drawing mode, everything except the line gets deleted. As soon as I get back into the drawing mode, they reappear. I think there is something that changed in the way we store the kmls that makes them not load in "normal mode" and still let them appear in drawing mode.

Since the failing test checks the drawings displayed once in 3d mode, my guess is it doesn't see the layers that haven't been loaded correctly.

@ltshb ltshb force-pushed the feat-PB-95-kml-zoom-to-extent branch from 5da960c to 576f945 Compare January 19, 2024 15:29
@ltshb
Copy link
Contributor Author

ltshb commented Jan 19, 2024

@ltkum thanks for the hint I found the bug.

@ltshb ltshb force-pushed the feat-PB-95-kml-zoom-to-extent branch 2 times, most recently from 750b58a to 4050cfd Compare January 19, 2024 19:27
@ltshb ltshb force-pushed the feat-PB-95-kml-zoom-to-extent branch from 4050cfd to c2b056c Compare January 22, 2024 11:46
Comment on lines +433 to +445
setLayerErrorKey({ commit, getters }, payload) {
const { layerId, errorKey } = payload
const currentLayer = getters.getActiveLayerById(layerId)
if (!currentLayer) {
throw new Error(
`Failed to update layer error key "${layerId}", layer not found in active layers`
)
}
const updatedLayer = currentLayer.clone()
updatedLayer.errorKey = errorKey
updatedLayer.hasError = !!errorKey
commit('updateLayer', updatedLayer)
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't that only be applied to KML layers?
If that's not what is intended, I would move the declaration of errorKey and hasError into AbstractLayer.class.js instead of KMLLayer.class.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

errorKey and hasError were meant for ExternalLayer but because for KML we have only one class for internal and external I had to put the flag again in this class. But this is a good idea to move them into the abstract layer even if for the moment they are only used for external layer (internal layer should never have an error ;-) ).

Copy link
Contributor

Choose a reason for hiding this comment

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

a couple unit tests to cover these two new utils wouldn't hurt (if their usage isn't limited to KML utils only)
As they stand now, they can be used elsewhere, so I would cover them with unit test (the basic, input checking and such cases)

Those flage are only intended for external layer but because not all
external layer extends ExternalLayer (e.g. KML) I moved those flag into the
abstract class.
@ltshb ltshb requested a review from pakb January 22, 2024 14:08
@ltshb ltshb force-pushed the feat-PB-95-kml-zoom-to-extent branch from 8351f02 to 1428a01 Compare January 22, 2024 14:25
@ltshb ltshb merged commit 23903e3 into develop Jan 22, 2024
@ltshb ltshb deleted the feat-PB-95-kml-zoom-to-extent branch January 22, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants