FarmMapsLib/projects/common-map/src/fm-map/actions/map.actions.ts

243 lines
6.2 KiB
TypeScript
Raw Normal View History

2020-01-07 21:27:46 +00:00
import { Action } from '@ngrx/store';
import { IMapState } from '../models/map.state';
import { IItemLayer } from '../models/item.layer';
import { IQueryState } from '../models/query.state';
import { IItem } from '@farmmaps/common';
2020-02-12 19:38:14 +00:00
import { Feature,Style } from 'ol';
2020-01-07 21:27:46 +00:00
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 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 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';
2020-02-12 19:38:14 +00:00
export const SETSTYLE = '[Map] SetStyle';
2020-01-07 21:27:46 +00:00
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) { }
}
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) { }
}
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 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 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) { }
}
2020-02-12 19:38:14 +00:00
export class SetStyle implements Action {
readonly type = SETSTYLE;
constructor(public itemType:string,public style: Style | (Feature)) { }
2020-02-12 19:38:14 +00:00
}
2020-01-07 21:27:46 +00:00
export type Actions = SetMapState
| Init
| SetParent
| StartSearch
| StartSearchSuccess
| SelectFeature
| SelectItem
| SelectItemSuccess
| AddFeatureSuccess
| UpdateFeatureSuccess
| ExpandSearch
| CollapseSearch
| SetExtent
| SetQueryState
| SetTimeSpan
| AddLayer
| RemoveLayer
| SetVisibility
| SetOpacity
| SetLayerIndex
| LoadBaseLayers
| LoadBaseLayersSuccess
| SelectBaseLayer
| SelectOverlayLayer
| ZoomToExtent
| SetState
| SetViewExtent
2020-02-12 19:38:14 +00:00
| DoQuery
| SetStyle;
2020-01-07 21:27:46 +00:00