Add layer values
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -5,6 +5,7 @@ import { IMapState} from '../models/map.state';
|
||||
import { IQueryState} from '@farmmaps/common';
|
||||
import { IPeriodState} from '../models/period.state';
|
||||
import { IStyles} from '../models/style.cache';
|
||||
import { ILayervalue } from '../models/layer.value';
|
||||
import * as mapActions from '../actions/map.actions';
|
||||
import {commonActions} from '@farmmaps/common';
|
||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||
@@ -59,7 +60,11 @@ export interface State {
|
||||
showLayerSwitcher:boolean,
|
||||
inSearch:boolean,
|
||||
inZoom:boolean,
|
||||
replaceUrl:boolean
|
||||
replaceUrl:boolean,
|
||||
layerValuesX:number,
|
||||
layerValuesY:number,
|
||||
layerValuesEnabled:boolean;
|
||||
layerValues: Array<ILayervalue>;
|
||||
}
|
||||
|
||||
export const initialState: State = {
|
||||
@@ -98,7 +103,11 @@ export const initialState: State = {
|
||||
showLayerSwitcher: false,
|
||||
inSearch:false,
|
||||
inZoom:false,
|
||||
replaceUrl:true
|
||||
replaceUrl:true,
|
||||
layerValuesX:0,
|
||||
layerValuesY:0,
|
||||
layerValuesEnabled:false,
|
||||
layerValues:[]
|
||||
}
|
||||
|
||||
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
|
||||
@@ -322,7 +331,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
||||
case mapActions.COLLAPSESEARCH: {
|
||||
return tassign(state, { searchCollapsed: state.panelVisible ? false: true});
|
||||
}
|
||||
case commonActions.CLOSEALL: {
|
||||
case commonActions.CLOSEALL: {
|
||||
return tassign(state, { searchCollapsed: state.panelVisible ? false: true,showLayerSwitcher:false});
|
||||
}
|
||||
case mapActions.SETEXTENT: {
|
||||
@@ -462,6 +471,7 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
||||
selectedFeature: null,
|
||||
queryState: newQueryState,
|
||||
clearEnabled: false,
|
||||
layerValuesEnabled: false,
|
||||
searchCollapsed: true,
|
||||
searchMinified: false,
|
||||
features: [],
|
||||
@@ -484,6 +494,19 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
||||
let a= action as mapActions.SetReplaceUrl;
|
||||
return tassign(state,{replaceUrl:a.replaceUrl});
|
||||
}
|
||||
case mapActions.TOGGLELAYERVALUESENABLED: {
|
||||
return tassign(state,{layerValuesEnabled:!state.layerValuesEnabled});
|
||||
}
|
||||
case mapActions.SETLAYERVALUESLOCATION: {
|
||||
let a= action as mapActions.SetLayerValuesLocation;
|
||||
return tassign(state,{layerValuesX: a.x, layerValuesY:a.y,layerValues:[]});
|
||||
}
|
||||
case mapActions.GETLAYERVALUESUCCESS:{
|
||||
let a= action as mapActions.GetLayerValueSuccess;
|
||||
let v = state.layerValues.slice(0);
|
||||
v.push(a.layervalue);
|
||||
return tassign(state,{layerValues:v});
|
||||
}
|
||||
default: {
|
||||
return state;
|
||||
}
|
||||
@@ -515,6 +538,11 @@ export const getStyles = (state:State) => state.styles;
|
||||
export const getShowLayerSwitcher = (state:State) => state.showLayerSwitcher;
|
||||
export const getInSearch = (state:State) => state.inSearch;
|
||||
export const getState = (state:State) => {return {mapState:state.mapState,queryState:state.queryState,replaceUrl:state.replaceUrl};}
|
||||
export const getLayerValuesEnabled = (state:State) => state.layerValuesEnabled;
|
||||
export const getLayerValues = (state:State) => state.layerValues;
|
||||
export const getLayerValuesX = (state:State) => state.layerValuesX;
|
||||
export const getLayerValuesY = (state:State) => state.layerValuesY;
|
||||
|
||||
|
||||
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
|
||||
export const selectGetMapState= createSelector(selectMapState, getMapState);
|
||||
@@ -542,5 +570,9 @@ export const selectGetStyles = createSelector(selectMapState, getStyles);
|
||||
export const selectGetShowLayerSwitcher = createSelector(selectMapState,getShowLayerSwitcher);
|
||||
export const selectGetInSearch = createSelector(selectMapState,getInSearch);
|
||||
export const selectGetState = createSelector(selectMapState,getState);
|
||||
export const selectGetLayerValuesEnabled = createSelector(selectMapState,getLayerValuesEnabled);
|
||||
export const selectGetLayerValues = createSelector(selectMapState,getLayerValues);
|
||||
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
|
||||
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user