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

feat-fix(layers-event): Add getGeoJSON for vector layer, patch timing… #2382

Merged

Conversation

jolevesq
Copy link
Member

@jolevesq jolevesq commented Jul 17, 2024

… issue with geoCoreLayer, add layerError event, add global layerVisibility event

Closes #2338, #2376

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

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?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

Hosted July 17th, 2h30:

https://canadian-geospatial-platform.github.io/geoview/public/esri-feature.html
In the console type and see the result
cgpv.api.maps['LYR1'].layer.getGeoviewLayers()[0].getFeaturesAsGeoJSON('uniqueValueId/1')

https://jolevesq.github.io/geoview/demo-function-event.html
in the notifiaction, new event for layerError and one for visibility (use the GeoJSON layer)

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

@jolevesq jolevesq requested review from DamonU2 and Alex-NRCan July 17, 2024 18:21
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 10 of 10 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @DamonU2)


packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts line 518 at r1 (raw file):

  getFeaturesAsGeoJSON(layerPath: string): JSON {
    // Get map projection
    const mapProjection: ProjectionLike = MapEventProcessor.getMapViewer(this.mapId).getProjection().getCode();

FYI
Alternatively can call this.getMapViewer() as well if preferred.


packages/geoview-core/src/geo/layer/gv-layers/abstract-gv-layer.ts line 594 at r1 (raw file):

    const curVisible = this.getVisible();
    this.getOLLayer().setVisible(layerVisibility);
    if (layerVisibility !== curVisible) this.#emitVisibleChanged({ layerPath: this.getLayerPath(), visible: layerVisibility });

FYI
Here, the sender parameter, when handling the event in the handler method, would be able to do something like sender.getLayerPath() if we want to know which layer has raised the visible changed.
There's no harm in providing it, explicitly, via the event as well if we feel it's necessary. It's just growing the event payload.


packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts line 298 at r1 (raw file):

  getFeaturesAsGeoJSON(): JSON {
    // Get map projection
    const mapProjection: ProjectionLike = MapEventProcessor.getMapViewer(this.getMapId()).getProjection().getCode();

FYI
Same comment as before

Copy link
Member

@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.

Reviewed 10 of 10 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @jolevesq)


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

  }

  static setOrToggleMapLayerVisibilityState(mapId: string, curOrderedLayerInfo: TypeOrderedLayerInfo[]): void {

Should this be something more generic like setOrderedLayerInfoWithNoOrderChange? It will probably be used for other purposes going forward.


packages/geoview-core/src/geo/layer/layer.ts line 1747 at r1 (raw file):

 */
export type LayerRemovedEvent = {
  // The added layer

I think I did this, but added should be removed in this comment

Copy link
Member

@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.

Reviewed 6 of 6 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @jolevesq)

Copy link
Member Author

@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 8 of 10 files at r1, 2 of 6 files at r2, 1 of 2 files at r3, all commit messages.
Reviewable status: 9 of 10 files reviewed, 2 unresolved discussions (waiting on @Alex-NRCan and @DamonU2)


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

Previously, DamonU2 (Damon Ulmi) wrote…

Should this be something more generic like setOrderedLayerInfoWithNoOrderChange? It will probably be used for other purposes going forward.

Done.


packages/geoview-core/src/geo/layer/layer.ts line 1747 at r1 (raw file):

Previously, DamonU2 (Damon Ulmi) wrote…

I think I did this, but added should be removed in this comment

Done.


packages/geoview-core/src/geo/layer/geoview-layers/vector/abstract-geoview-vector.ts line 518 at r1 (raw file):

Previously, Alex-NRCan (Alex) wrote…

FYI
Alternatively can call this.getMapViewer() as well if preferred.

Done


packages/geoview-core/src/geo/layer/gv-layers/vector/abstract-gv-vector.ts line 298 at r1 (raw file):

Previously, Alex-NRCan (Alex) wrote…

FYI
Same comment as before

Done

Copy link
Member Author

@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 1 of 10 files at r1, 3 of 6 files at r2, 1 of 2 files at r3.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @DamonU2)

@jolevesq jolevesq force-pushed the 2338-ol-geojson-v2 branch from ddd20bc to 0fe720d Compare July 18, 2024 13:11
@jolevesq jolevesq merged commit 0408913 into Canadian-Geospatial-Platform:develop Jul 18, 2024
5 of 6 checks passed
@jolevesq jolevesq deleted the 2338-ol-geojson-v2 branch September 12, 2024 17:20
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.

[FEATURE] Utility Conversion Function ol-geoJSON
3 participants