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 newAction:Observable<Action>;
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) => {
for (let f of features.features) {
if (f.properties && f.properties["code"]) {
@ -157,7 +157,7 @@ export class MapEffects {
}
if(action.features && action.features.length >0) {
actions.push(new mapActions.SetExtent(extent));
}
}
}
}
return actions;
@ -172,7 +172,7 @@ export class MapEffects {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
}
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
}
}
return EMPTY;
})));
@ -207,14 +207,14 @@ export class MapEffects {
selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
map((action:mapActions.SelectItemSuccess) =>
map((action:mapActions.SelectItemSuccess) =>
new mapActions.SetSelectedItemLayer(action.item)
)
));
selectItemSuccess$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => {
switchMap((action:mapActions.SelectItemSuccess) => {
if(!this.overrideSelectedItemLayer) {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: any) => {
@ -222,7 +222,7 @@ export class MapEffects {
f.setId(action.item.code);
return new mapActions.AddFeatureSuccess(f );
}),
catchError(error => of(new commonActions.Fail(error))));
catchError(error => of(new commonActions.Fail(error))));
} else {
return EMPTY;
}
@ -299,7 +299,7 @@ export class MapEffects {
} else {
newAction= new mapActions.StartSearch(queryState);
}
} else {
newAction = new mapActions.Clear();
}
@ -322,9 +322,9 @@ export class MapEffects {
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 {
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;
@ -346,7 +346,7 @@ export class MapEffects {
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
mergeMap(([[[action, selected], enabled],overlayLayers]) => {
let layers = [];
let layers = [];
if(selected) {
if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
selected=(selected as TemporalItemLayer).selectedItemLayer;
@ -358,16 +358,16 @@ export class MapEffects {
});
let a = action as mapActions.SetLayerValuesLocation;
let actions = [];
if(enabled) {
if(enabled) {
layers.forEach((ol) => {
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));
}
});
}
}
return actions;
})));
setState$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETSTATE),
@ -385,7 +385,7 @@ export class MapEffects {
return of(new mapActions.Clear());
} else {
return EMPTY;
}
}
})));
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) {
this._geojsonFormat = new GeoJSON();
this._wktFormat = new WKT();
}
this._wktFormat = new WKT();
}
}

View File

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