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

fix(layers): fixes geocore layers not appearing in service order #2685

Conversation

DamonU2
Copy link
Member

@DamonU2 DamonU2 commented Jan 13, 2025

Closes #2644

Description

Sorts geocore child layers properly, in ordered layer info and legend layers.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

https://damonu2.github.io/geoview/add-layers.html
Layer: 4bece602-04cf-4520-a512-9f4d8720b683

Checklist:

  • I have build (rush build) and deploy (rush host) my PR
  • I have connected the issues(s) to this PR
  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have created new issue(s) related to the outcome of this PR is needed
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This change is Reviewable

@DamonU2 DamonU2 requested a review from jolevesq January 13, 2025 19:26
@DamonU2 DamonU2 self-assigned this Jan 13, 2025
@jolevesq jolevesq requested a review from Alex-NRCan January 13, 2025 20:13
Copy link
Member

@Alex-NRCan Alex-NRCan left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 6 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @jolevesq)


packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts line 357 at r1 (raw file):

    // Reorder the array so legend tab is in synch
    const sortedLayers = layers.sort((a, b) =>
      MapEventProcessor.getMapIndexFromOrderedLayerInfo(mapId, a.layerPath) >

Same as other comment here


packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts line 756 at r1 (raw file):

      if (legendLayer.children.length)
        legendLayer.children.sort((a, b) =>
          MapEventProcessor.getMapIndexFromOrderedLayerInfo(mapId, a.layerPath) >

Idea, an alternative and popular way of writing a sort callback would be something like:
.sort((a, b) =>
return MapEventProcessor.getMapIndexFromOrderedLayerInfo(mapId, a.layerPath) - MapEventProcessor.getMapIndexFromOrderedLayerInfo(mapId, b.layerPath);

@DamonU2 DamonU2 force-pushed the 2644-geocore-layer-order branch from a6b6a29 to 9d4c073 Compare January 14, 2025 15:22
Copy link
Member Author

@DamonU2 DamonU2 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 5 of 6 files reviewed, all discussions resolved (waiting on @Alex-NRCan and @jolevesq)


packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts line 357 at r1 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Same as other comment here

Thanks! Changed


packages/geoview-core/src/api/event-processors/event-processor-children/legend-event-processor.ts line 756 at r1 (raw file):

Previously, Alex-NRCan (Alex) wrote…

Idea, an alternative and popular way of writing a sort callback would be something like:
.sort((a, b) =>
return MapEventProcessor.getMapIndexFromOrderedLayerInfo(mapId, a.layerPath) - MapEventProcessor.getMapIndexFromOrderedLayerInfo(mapId, b.layerPath);

Changed!

Copy link
Member

@jolevesq jolevesq left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 6 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @DamonU2)

@DamonU2 DamonU2 force-pushed the 2644-geocore-layer-order branch from 9d4c073 to e25ec7d Compare January 14, 2025 18:53
@jolevesq jolevesq merged commit 0030f48 into Canadian-Geospatial-Platform:develop Jan 14, 2025
6 checks passed
@DamonU2 DamonU2 deleted the 2644-geocore-layer-order branch January 15, 2025 20:56
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.

[BUG] 1 - Viewer reorganizes the layer hierarchy causing display and query issues [OSDP-1801] (1 layer)
3 participants