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

#9585: fix zoom to 3d layer to the correct extent in csw catalog #9610

Merged
merged 5 commits into from
Oct 23, 2023

Conversation

mahmoudadel54
Copy link
Contributor

@mahmoudadel54 mahmoudadel54 commented Oct 17, 2023

Description

Fix zoom to any 3D layer in CSW Catalog to the correct extent.
I tried to handle bbox in metadata and parse the extent to the correct one but there is a missing point - I think it's related to axis order with different CSW versions and it needs a lot of conditions in code- so I go with the 2nd option fixing by getting layer extent from tileset json.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

Issue

#9585

What is the current behavior?
#9585
What is the new behavior?

  • when user adds a 3D layer from CSW catalog, it gets the extent of 3D layer from the tileset json then it zooms to the correct extent of the layer.

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

- fixing by getting layer extent from tileset json
@mahmoudadel54 mahmoudadel54 added bug BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch C027-COMUNE_FI-2023-SUPPORT labels Oct 17, 2023
@mahmoudadel54 mahmoudadel54 added this to the 2023.02.01 milestone Oct 17, 2023
@mahmoudadel54 mahmoudadel54 requested a review from MV88 October 17, 2023 09:48
@mahmoudadel54 mahmoudadel54 self-assigned this Oct 17, 2023
@mahmoudadel54 mahmoudadel54 linked an issue Oct 17, 2023 that may be closed by this pull request
1 task
description: fix test case in CSW-test
web/client/api/CSW.js Outdated Show resolved Hide resolved
@mahmoudadel54 mahmoudadel54 requested a review from MV88 October 19, 2023 09:05
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

  • please isolate the behaviour you have edited by removing async await
    you can chaining it with a function similar to addCapabilitiesToRecords

  • possibly I would like to have a dedicated test for 3dtiles use case

description: write unit test for add recordsfor 3d tile layers
@mahmoudadel54 mahmoudadel54 requested a review from MV88 October 23, 2023 07:14
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

please checkout inline comments,

if (!result) return result;
let { records } = result;
if (records?.length) {
let records3D = records.filter(rec=>rec?.dc?.format === THREE_D_TILES);
Copy link
Contributor

Choose a reason for hiding this comment

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

hi, there is a mistake here that could have been fetched from adding proper unit testing


you cannot filter records here and then update them layer on because you can end updating the wrong one:

examples that you must have covered during tests

  • you have 4 records, the first one is a THREE_D_TILES
  • you have 4 records, the last one is a THREE_D_TILES
  • you have 3 records, the middle one is a THREE_D_TILES

in second and third scenario you are going to update the extent to the wrong layer

avoid filtering and return the getCapabilities only if you match the config otherwise you can return a a promise that resolves the original record for those that are not THREE_D_TILES

}));
}
return null;
}).then(results=>getBboxFor3DLayersToRecords(results))); // handle getting bbox from capabilities in case of 3D tile layer
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
}).then(results=>getBboxFor3DLayersToRecords(results))); // handle getting bbox from capabilities in case of 3D tile layer
}).then(results => getBboxFor3DLayersToRecords(results))); // handle getting bbox from capabilities in case of 3D tile layer

@@ -433,7 +461,7 @@ const Api = {
workspaceSearch: function(url, startPosition, maxRecords, text, workspace) {
return new Promise((resolve) => {
require.ensure(['../utils/ogc/CSW', '../utils/ogc/Filter'], () => {
const {Filter} = require('../utils/ogc/Filter');
const { Filter } = require('../utils/ogc/Filter');
Copy link
Contributor

Choose a reason for hiding this comment

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

why have you started to add all of this formatting?
is there a tool you are using or what?

let's avoid introducing custom syntax formation different from what setup with vscode or the eslint rules of this project, so please let me know if you can disable this


});

describe("getLayerReferenceFromDc", () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

wrong title?

mockAxios.restore();
setTimeout(done);
});
it('test getBboxFor3DLayersToRecords function that handles getting bbox for 3D tile layers from ', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

improve this title, it's too generic, which case are you testing exactly?
4 records the first is 3d_tile or what else?

Comment on lines 342 to 347
mockAxios.onGet().reply(()=>{
return [200, tileSetResponse];
});
mockAxios.onGet().reply(()=>{
return [200, tileSetResponse];
});
Copy link
Contributor

Choose a reason for hiding this comment

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

duplication

description: add unit tests for csw that handle 3d tile layers
Copy link
Contributor

@MV88 MV88 left a comment

Choose a reason for hiding this comment

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

I approve, but make sure to not send other format syntax change in the future

@MV88 MV88 merged commit eef0cee into geosolutions-it:master Oct 23, 2023
4 checks passed
@MV88
Copy link
Contributor

MV88 commented Oct 23, 2023

@ElenaGallo please test it in DEV

@ElenaGallo
Copy link
Contributor

ElenaGallo commented Oct 24, 2023

Test passed, @mahmoudadel54 please backport to 2023.02.xx. Thanks

@mahmoudadel54
Copy link
Contributor Author

Test passed, @mahmoudadel54 please backport to 2023.02.xx. Thanks

Backport is done ---> #9649

MV88 pushed a commit that referenced this pull request Oct 24, 2023
@ElenaGallo ElenaGallo removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zoom to layer is not correct for the 3D tiles resources in CSW
3 participants