datafilter can now be used with querystate
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good Details

AW-4620
Mark van der Wal 2022-10-24 13:23:33 +02:00
parent 41c7ab15f3
commit 2acf13cbac
2 changed files with 17 additions and 16 deletions

View File

@ -126,7 +126,7 @@ export class MapEffects {
var endDate = a.queryState.endDate; var endDate = a.queryState.endDate;
var newAction:Observable<Action>; var newAction:Observable<Action>;
if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) { if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) {
newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, null, a.queryState.level).pipe( newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, a.queryState.dataFilter, a.queryState.level).pipe(
switchMap((features: any) => { switchMap((features: any) => {
for (let f of features.features) { for (let f of features.features) {
if (f.properties && f.properties["code"]) { if (f.properties && f.properties["code"]) {
@ -157,7 +157,7 @@ export class MapEffects {
} }
if(action.features && action.features.length >0) { if(action.features && action.features.length >0) {
actions.push(new mapActions.SetExtent(extent)); actions.push(new mapActions.SetExtent(extent));
} }
} }
} }
return actions; return actions;
@ -172,7 +172,7 @@ export class MapEffects {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent()); extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
} }
if(action.features.length>0) return of(new mapActions.SetExtent(extent)); if(action.features.length>0) return of(new mapActions.SetExtent(extent));
} }
return EMPTY; return EMPTY;
}))); })));
@ -207,14 +207,14 @@ export class MapEffects {
selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe( selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS), ofType(mapActions.SELECTITEMSUCCESS),
map((action:mapActions.SelectItemSuccess) => map((action:mapActions.SelectItemSuccess) =>
new mapActions.SetSelectedItemLayer(action.item) new mapActions.SetSelectedItemLayer(action.item)
) )
)); ));
selectItemSuccess$ = createEffect(() => this.actions$.pipe( selectItemSuccess$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS), ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => { switchMap((action:mapActions.SelectItemSuccess) => {
if(!this.overrideSelectedItemLayer) { if(!this.overrideSelectedItemLayer) {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe( return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: any) => { map((feature: any) => {
@ -222,7 +222,7 @@ export class MapEffects {
f.setId(action.item.code); f.setId(action.item.code);
return new mapActions.AddFeatureSuccess(f ); return new mapActions.AddFeatureSuccess(f );
}), }),
catchError(error => of(new commonActions.Fail(error)))); catchError(error => of(new commonActions.Fail(error))));
} else { } else {
return EMPTY; return EMPTY;
} }
@ -299,7 +299,7 @@ export class MapEffects {
} else { } else {
newAction= new mapActions.StartSearch(queryState); newAction= new mapActions.StartSearch(queryState);
} }
} else { } else {
newAction = new mapActions.Clear(); newAction = new mapActions.Clear();
} }
@ -322,9 +322,9 @@ export class MapEffects {
return; return;
} }
}); });
a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v,layerName:l.name,quantity:"",unit:l.unit})); a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v,layerName:l.name,quantity:"",unit:l.unit}));
} else { } else {
a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v*scale,layerName:l.name,quantity:l.quantity,unit:l.unit})); a.push(new mapActions.GetLayerValueSuccess({date:action.itemLayer.item.dataDate,value:v*scale,layerName:l.name,quantity:l.quantity,unit:l.unit}));
} }
} }
return a; return a;
@ -346,7 +346,7 @@ export class MapEffects {
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)), withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
mergeMap(([[[action, selected], enabled],overlayLayers]) => { mergeMap(([[[action, selected], enabled],overlayLayers]) => {
let layers = []; let layers = [];
if(selected) { if(selected) {
if(selected && (selected as TemporalItemLayer).selectedItemLayer ) { if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
selected=(selected as TemporalItemLayer).selectedItemLayer; selected=(selected as TemporalItemLayer).selectedItemLayer;
@ -358,16 +358,16 @@ export class MapEffects {
}); });
let a = action as mapActions.SetLayerValuesLocation; let a = action as mapActions.SetLayerValuesLocation;
let actions = []; let actions = [];
if(enabled) { if(enabled) {
layers.forEach((ol) => { layers.forEach((ol) => {
if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) { if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) {
actions.push(new mapActions.GetLayerValue(ol,a.x,a.y)); actions.push(new mapActions.GetLayerValue(ol,a.x,a.y));
} }
}); });
} }
return actions; return actions;
}))); })));
setState$ = createEffect(() => this.actions$.pipe( setState$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETSTATE), ofType(mapActions.SETSTATE),
@ -385,7 +385,7 @@ export class MapEffects {
return of(new mapActions.Clear()); return of(new mapActions.Clear());
} else { } else {
return EMPTY; return EMPTY;
} }
}))); })));
setOverride$ = createEffect(() => this.actions$.pipe( setOverride$ = createEffect(() => this.actions$.pipe(
@ -404,6 +404,6 @@ export class MapEffects {
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) { constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService) {
this._geojsonFormat = new GeoJSON(); this._geojsonFormat = new GeoJSON();
this._wktFormat = new WKT(); this._wktFormat = new WKT();
} }
} }

View File

@ -1,6 +1,7 @@
export interface IQueryState { export interface IQueryState {
itemCode: string; itemCode: string;
parentCode: string; parentCode: string;
dataFilter?: string;
level: number; level: number;
itemType: string; itemType: string;
query: string; query: string;