-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(map): rework map state & map-related features
- Loading branch information
Showing
33 changed files
with
420 additions
and
1,199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,13 @@ | ||
export * from './lib/+state/map.facade' | ||
export * from './lib/+state/map.models' | ||
export * from './lib/+state/map.selectors' | ||
export * from './lib/+state/map.reducer' | ||
export * from './lib/+state/map.actions' | ||
export * from './lib/feature-map.module' | ||
export * from './lib/manager/map-manager.service' | ||
export * from './lib/manager/map-instance.directive' | ||
export * from './lib/feature-info/feature-info.service' | ||
export * from './lib/map-context/map-context.model' | ||
export * from './lib/map-context/map-context.service' | ||
export * from './lib/map-context/component/map-context.component' | ||
export * from './lib/map-state-container/map-state-container.component' | ||
export * from './lib/constant' | ||
export * from './lib/utils' | ||
export * from './lib/style' | ||
export * from './lib/layers-panel/layers-panel.component' | ||
export * from './lib/add-layer-from-catalog/add-layer-from-catalog.component' | ||
export * from './lib/add-layer-from-catalog/add-layer-record-preview/add-layer-record-preview.component' | ||
export * from './lib/map-container/map-container.component' | ||
export * from './lib/geocoding/geocoding.component' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,17 @@ | ||
import { createAction, props } from '@ngrx/store' | ||
import { MapLayer } from './map.models' | ||
import { MapContext } from '@geospatial-sdk/core' | ||
import type { Feature } from 'geojson' | ||
|
||
export const addLayer = createAction( | ||
'[Map] Add Layer', | ||
props<{ layer: MapLayer; atIndex?: number }>() | ||
export const setContext = createAction( | ||
'[Map] Set Context', | ||
props<{ context: MapContext }>() | ||
) | ||
|
||
export const removeLayer = createAction( | ||
'[Map] Remove Layer', | ||
props<{ index: number }>() | ||
export const setSelectedFeatures = createAction( | ||
'[Map] Set Selected Features', | ||
props<{ selectedFeatures: Feature[] }>() | ||
) | ||
|
||
export const updateLayer = createAction( | ||
'[Map] Update Layer', | ||
props<{ updatedLayer: MapLayer; index: number }>() | ||
) | ||
|
||
export const changeLayerOrder = createAction( | ||
'[Map] Change Layer Order', | ||
props<{ currentIndex: number; newIndex: number }>() | ||
) | ||
|
||
export const setLayerError = createAction( | ||
'[Map] Set Layer Error', | ||
props<{ index: number; error: string }>() | ||
) | ||
|
||
export const clearLayerError = createAction( | ||
'[Map] Clear Layer Error', | ||
props<{ index: number }>() | ||
export const clearSelectedFeatures = createAction( | ||
'[Map] Clear Selected Features' | ||
) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
import { Injectable } from '@angular/core' | ||
import { select, Store } from '@ngrx/store' | ||
import * as MapSelectors from './map.selectors' | ||
import { MapLayer } from './map.models' | ||
import * as MapActions from './map.actions' | ||
import { MapContext } from '@geospatial-sdk/core' | ||
import { Feature } from 'geojson' | ||
|
||
@Injectable() | ||
export class MapFacade { | ||
layers$ = this.store.pipe(select(MapSelectors.getMapLayers)) | ||
context$ = this.store.pipe(select(MapSelectors.getMapContext)) | ||
selectedFeatures$ = this.store.pipe(select(MapSelectors.getSelectedFeatures)) | ||
|
||
constructor(private readonly store: Store) {} | ||
|
||
/** | ||
* Use the initialization action to perform one | ||
* or more tasks in your Effects. | ||
*/ | ||
init() { | ||
// placeholder | ||
applyContext(context: MapContext) { | ||
this.store.dispatch(MapActions.setContext({ context })) | ||
} | ||
|
||
addLayer(layer: MapLayer) { | ||
this.store.dispatch(MapActions.addLayer({ layer })) | ||
selectFeatures(selectedFeatures: Feature[]) { | ||
this.store.dispatch(MapActions.setSelectedFeatures({ selectedFeatures })) | ||
} | ||
addLayerAtIndex(layer: MapLayer, index: number) { | ||
this.store.dispatch(MapActions.addLayer({ layer, atIndex: index })) | ||
} | ||
removeLayer(index: number) { | ||
this.store.dispatch(MapActions.removeLayer({ index })) | ||
|
||
clearFeatureSelection() { | ||
this.store.dispatch(MapActions.clearSelectedFeatures()) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.