FarmMapsLib/projects/common-map/src/fm-map/actions/map.actions.ts
Willem Dantuma 9d5cd0fa88
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
Add layer values
2021-03-05 17:19:30 +01:00

353 lines
9.3 KiB
TypeScript

import { Action } from '@ngrx/store';
import { IMapState } from '../models/map.state';
import { IItemLayer } from '../models/item.layer';
import { ILayervalue } from '../models/layer.value';
import { IQueryState } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { Feature,Style } from 'ol';
export const SETSTATE = '[Map] SetState';
export const SETMAPSTATE = '[Map] MapState';
export const SETVIEWEXTENT = '[Map] SetViewExtent';
export const INIT = '[Map] Init';
export const SETPARENT = '[Map] SetParent';
export const STARTSEARCH = '[Map] StartSearch';
export const STARTSEARCHSUCCESS = '[Map] StartSearchSuccess';
export const SELECTFEATURE = '[Map] SelectFeature';
export const SELECTITEM = '[Map] SelectItem';
export const SELECTITEMSUCCESS = '[Map] SelectItemSuccess';
export const SETSELECTEDITEMLAYER = '[Map] SetSelectedItemLayer';
export const SELECTTEMPORALITEMSSUCCESS = '[Map] SelectTemporalItemsSuccess';
export const NEXTTEMPORAL = '[Map] NextTemporal';
export const PREVIOUSTEMPORAL = '[Map] PreviousTemporal';
export const SELECTTEMPORAL = '[Map] SelectTemporal';
export const ADDFEATURESUCCESS = '[Map] AddFeatureSuccess';
export const UPDATEFEATURESUCCESS = '[Map] UpdateFeatureSuccess';
export const EXPANDSEARCH = '[Map] ExpandSearch';
export const COLLAPSESEARCH = '[Map] CollapseSearch';
export const SETEXTENT = '[Map] SetExtent';
export const SETQUERYSTATE = '[Map] SetQueryState';
export const SETTIMESPAN = '[Map] SetTimeSpan';
export const ADDLAYER = '[Map] AddLayer';
export const SETVISIBILITY = '[Map] SetVisibility';
export const SETOPACITY = '[Map] SetOpacity';
export const SETLAYERINDEX = '[Map] SetLayerIndex';
export const REMOVELAYER = '[Map] RemoveLayer';
export const CLEARLAYERS = '[Map] ClearLayers';
export const LOADBASELAYERS = '[Map] LoadLayers';
export const LOADBASELAYERSSUCCESS = '[Map] LoadLayersSuccess';
export const SELECTBASELAYER = '[Map] SelectBaseLayers';
export const SELECTOVERLAYLAYER = '[Map] SelectOverlayLayers';
export const ZOOMTOEXTENT = '[Map] ZoomToExtent';
export const DOQUERY = '[Map] DoQuery';
export const SETSTYLE = '[Map] SetStyle';
export const SHOWLAYERSWITCHER = '[Map] ShowLayerSwitcher';
export const CLEAR = '[Map] Clear';
export const SETREPLACEURL = '[Map] SetReplaceUrl';
export const SETFEATURES = '[Map] SetFeatures'
export const SETLAYERVALUESLOCATION = '[Map] SetLayerValuesLocation'
export const TOGGLELAYERVALUESENABLED = '[Map] ToggleLayerValuesEnabled'
export const GETLAYERVALUE = '[Map] GetLayerValue'
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
export class Clear implements Action {
readonly type = CLEAR;
constructor() {}
}
export class SetState implements Action {
readonly type = SETSTATE;
constructor(public mapState: IMapState,public queryState:IQueryState) { }
}
export class SetMapState implements Action {
readonly type = SETMAPSTATE;
constructor(public mapState: IMapState) { }
}
export class SetViewExtent implements Action {
readonly type = SETVIEWEXTENT;
constructor(public extent:number[]) { }
}
export class Init implements Action {
readonly type = INIT;
constructor() { }
}
export class SetParent implements Action {
readonly type = SETPARENT;
constructor(public parentCode:string) { }
}
export class StartSearch implements Action {
readonly type = STARTSEARCH;
constructor(public queryState: IQueryState) { }
}
export class StartSearchSuccess implements Action {
readonly type = STARTSEARCHSUCCESS;
constructor(public features: Array<Feature>, public query:IQueryState) { }
}
export class SelectFeature implements Action {
readonly type = SELECTFEATURE;
constructor(public feature:Feature) { }
}
export class SelectItem implements Action {
readonly type = SELECTITEM;
constructor(public itemCode:string) { }
}
export class SelectItemSuccess implements Action {
readonly type = SELECTITEMSUCCESS;
constructor(public item: IItem, public parentItem: IItem) { }
}
export class SelectTemporalItemsSuccess implements Action {
readonly type = SELECTTEMPORALITEMSSUCCESS;
constructor(public temporalItems: IItem[]) { }
}
export class NextTemporal implements Action {
readonly type = NEXTTEMPORAL;
constructor() { }
}
export class PreviousTemporal implements Action {
readonly type = PREVIOUSTEMPORAL;
constructor() { }
}
export class SelectTemporal implements Action {
readonly type = SELECTTEMPORAL;
constructor(item:IItem) { }
}
export class AddFeatureSuccess implements Action {
readonly type = ADDFEATURESUCCESS;
constructor(public feature: Feature) { }
}
export class UpdateFeatureSuccess implements Action {
readonly type = UPDATEFEATURESUCCESS;
constructor(public feature: Feature) { }
}
export class ExpandSearch implements Action {
readonly type = EXPANDSEARCH;
constructor() { }
}
export class CollapseSearch implements Action {
readonly type = COLLAPSESEARCH;
constructor() { }
}
export class SetExtent implements Action {
readonly type = SETEXTENT;
constructor(public extent:number[]) { }
}
export class SetQueryState implements Action {
readonly type = SETQUERYSTATE;
constructor(public queryState: IQueryState,public replaceUrl:boolean = true) { }
}
export class SetTimeSpan implements Action {
readonly type = SETTIMESPAN;
constructor(public startDate: Date, public endDate: Date) { }
}
export class AddLayer implements Action {
readonly type = ADDLAYER;
constructor(public item:IItem,public layerIndex=-1) { }
}
export class SetSelectedItemLayer implements Action {
readonly type = SETSELECTEDITEMLAYER;
constructor(public item:IItem,public layerIndex=-1) { }
}
export class SetVisibility implements Action {
readonly type = SETVISIBILITY;
constructor(public itemLayer:IItemLayer,public visibility:boolean) { }
}
export class SetOpacity implements Action {
readonly type = SETOPACITY;
constructor(public itemLayer: IItemLayer, public opacity: number) { }
}
export class SetLayerIndex implements Action {
readonly type = SETLAYERINDEX;
constructor(public layerIndex: number, public itemLayer: IItemLayer = null) { }
}
export class RemoveLayer implements Action {
readonly type = REMOVELAYER;
constructor(public itemLayer: IItemLayer) { }
}
export class ClearLayers implements Action {
readonly type = CLEARLAYERS;
constructor() { }
}
export class LoadBaseLayers implements Action {
readonly type = LOADBASELAYERS;
constructor(public projection: string) { }
}
export class LoadBaseLayersSuccess implements Action {
readonly type = LOADBASELAYERSSUCCESS;
constructor(public items: IItem[] ) { }
}
export class SelectBaseLayer implements Action {
readonly type = SELECTBASELAYER;
constructor(public itemLayer: IItemLayer) { }
}
export class SelectOverlayLayer implements Action {
readonly type = SELECTOVERLAYLAYER;
constructor(public itemLayer: IItemLayer) { }
}
export class ZoomToExtent implements Action {
readonly type = ZOOMTOEXTENT;
constructor(public itemLayer: IItemLayer) { }
}
export class DoQuery implements Action {
readonly type = DOQUERY;
constructor(public query:IQueryState) { }
}
export class SetStyle implements Action {
readonly type = SETSTYLE;
constructor(public itemType:string,public style: Style | (Feature)) { }
}
export class ShowLayerSwitcher implements Action {
readonly type = SHOWLAYERSWITCHER;
constructor(public show:boolean) {}
}
export class SetReplaceUrl implements Action {
readonly type = SETREPLACEURL;
constructor(public replaceUrl:boolean) {}
}
export class SetFeatures implements Action {
readonly type = SETFEATURES;
constructor(public features: Array<Feature>) { }
}
export class SetLayerValuesLocation implements Action {
readonly type = SETLAYERVALUESLOCATION;
constructor(public x:number, public y:number) { }
}
export class ToggleLayerValuesEnabled implements Action {
readonly type = TOGGLELAYERVALUESENABLED;
constructor() { }
}
export class GetLayerValue implements Action {
readonly type = GETLAYERVALUE;
constructor(public itemLayer:IItemLayer,public x:number,public y:number) { }
}
export class GetLayerValueSuccess implements Action {
readonly type = GETLAYERVALUESUCCESS;
constructor(public layervalue:ILayervalue) { }
}
export type Actions = SetMapState
| Init
| Clear
| SetParent
| StartSearch
| StartSearchSuccess
| SelectFeature
| SelectItem
| SelectItemSuccess
| SelectTemporalItemsSuccess
| NextTemporal
| PreviousTemporal
| SelectTemporal
| AddFeatureSuccess
| UpdateFeatureSuccess
| ExpandSearch
| CollapseSearch
| SetExtent
| SetQueryState
| SetTimeSpan
| AddLayer
| RemoveLayer
| ClearLayers
| SetVisibility
| SetOpacity
| SetLayerIndex
| LoadBaseLayers
| LoadBaseLayersSuccess
| SelectBaseLayer
| SelectOverlayLayer
| ZoomToExtent
| SetState
| SetViewExtent
| DoQuery
| SetStyle
| ShowLayerSwitcher
| SetReplaceUrl
| SetFeatures
| SetSelectedItemLayer
| SetLayerValuesLocation
| ToggleLayerValuesEnabled
| GetLayerValueSuccess
| GetLayerValue;