AW-4860
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good Details
FarmMaps/FarmMapsLib/pipeline/head This commit looks good Details

master 2023.03
Willem Dantuma 2023-03-15 12:18:23 +01:00
parent 3c7adf012f
commit f2e265391c
5 changed files with 196 additions and 187 deletions

View File

@ -1,6 +1,6 @@
{
"name": "farmmaps-lib-app",
"version": "3.0.1",
"version": "3.0.2",
"scripts": {
"ng": "ng",
"start": "ng serve",

View File

@ -7,7 +7,7 @@
<li class="border-top pt-1 pb-1 value" *ngFor="let layerValue of layers">
<div>{{layerValue.layerName}}</div>
<div>{{layerValue.date|date}}</div>
<div><span *ngIf="layerValue.quantity"><span class="me-1">{{layerValue.quantity}}</span> </span><span class="me-1 font-weight-bold">{{layerValue.value}}</span><span>{{layerValue.unit}}</span></div>
<div><span *ngIf="layerValue.quantity"><span class="me-1">{{layerValue.quantity}}</span> </span><span class="me-1 font-weight-bold">{{getScaledValue(layerValue)}}</span><span>{{layerValue.unit}}</span></div>
</li>
</ul>
<ng-template #no_data>
@ -15,4 +15,4 @@
</ng-template>
</div>
</div>
</div>>
</div>

View File

@ -1,16 +1,16 @@
import { Component, OnInit,Input,ViewChild,ElementRef,AfterViewInit } from '@angular/core';
import {IItemLayer} from '../../../models/item.layer';
import { Component, OnInit, Input, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
import { IItemLayer } from '../../../models/item.layer';
import { Store } from '@ngrx/store';
import * as mapReducers from '../../../reducers/map.reducer';
import * as mapActions from '../../../actions/map.actions';
import { MapComponent } from 'ngx-openlayers';
import { ILayervalue } from '../../../models/layer.value';
import { Observable,interval,Subject } from 'rxjs';
import { Observable, interval, Subject } from 'rxjs';
import { debounce, throttle } from 'rxjs/operators';
import { toLonLat } from 'ol/proj';
import { toStringHDMS } from 'ol/coordinate';
import { ClipboardService } from 'ngx-clipboard'
import {GeoJSON,WKT} from 'ol/format';
import { GeoJSON, WKT } from 'ol/format';
import { Point } from 'ol/geom';
@Component({
@ -18,45 +18,53 @@ import { Point } from 'ol/geom';
templateUrl: './layer-values.component.html',
styleUrls: ['./layer-values.component.scss']
})
export class LayerValuesComponent implements OnInit,AfterViewInit {
export class LayerValuesComponent implements OnInit, AfterViewInit {
@ViewChild('layerValues') containerRef:ElementRef;
offsetX$ =0;
offsetY$ =0;
lonlat$="";
wkt$= "";
layerValues$:Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues);
enabled$:Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled);
wktFormat$:WKT;
@ViewChild('layerValues') containerRef: ElementRef;
offsetX$ = 0;
offsetY$ = 0;
lonlat$ = "";
wkt$ = "";
layerValues$: Observable<Array<ILayervalue>> = this.store.select(mapReducers.selectGetLayerValues);
enabled$: Observable<boolean> = this.store.select(mapReducers.selectGetLayerValuesEnabled);
wktFormat$: WKT;
constructor( private store: Store<mapReducers.State>,private map: MapComponent,private clipboardService$:ClipboardService) {
this.wktFormat$=new WKT();
constructor(private store: Store<mapReducers.State>, private map: MapComponent, private clipboardService$: ClipboardService) {
this.wktFormat$ = new WKT();
}
ngOnInit(): void {
}
moveEndSubject = new Subject<any>();
ngAfterViewInit():void {
ngAfterViewInit(): void {
this.offsetY$ = this.containerRef.nativeElement.offsetTop;
this.offsetX$ = this.containerRef.nativeElement.offsetLeft;
this.map.instance.on('moveend', () => {
this.moveEndSubject.next({});
this.moveEndSubject.next({});
});
this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() => this.updateValuesLocation());
this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() => this.updateValuesLocation());
}
updateValuesLocation() {
const xy = this.map.instance.getCoordinateFromPixel([this.offsetX$,this.offsetY$])
const xy = this.map.instance.getCoordinateFromPixel([this.offsetX$, this.offsetY$])
const lonlat = toLonLat(xy);
this.wkt$ = this.wktFormat$.writeGeometry(new Point(lonlat))
this.lonlat$ = toStringHDMS(lonlat);
this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0],xy[1]));
}
this.store.dispatch(new mapActions.SetLayerValuesLocation(xy[0], xy[1]));
}
copyToClipboard() {
this.clipboardService$.copy(this.wkt$);
}
public getScaledValue(layerValue: ILayervalue): number {
let v = layerValue.value;
if (layerValue.scale && layerValue.scale != 0) {
v = layerValue.scale * layerValue.value;
}
return v;
}
}

View File

@ -1,34 +1,34 @@
import { Injectable } from '@angular/core';
import { Store, Action,createFeatureSelector } from '@ngrx/store';
import { Store, Action, createFeatureSelector } from '@ngrx/store';
import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store';
import * as fromRouter from '@ngrx/router-store';
import { createEffect, Actions,ofType } from '@ngrx/effects';
import { createEffect, Actions, ofType } from '@ngrx/effects';
import { EMPTY, Observable , of} from 'rxjs';
import { EMPTY, Observable, of } from 'rxjs';
import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
import {GeoJSON,WKT} from 'ol/format';
import {Feature} from 'ol';
import { getCenter,createEmpty,extend } from 'ol/extent';
import {Point,Geometry} from 'ol/geom'
import { GeoJSON, WKT } from 'ol/format';
import { Feature } from 'ol';
import { getCenter, createEmpty, extend } from 'ol/extent';
import { Point, Geometry } from 'ol/geom'
import * as mapActions from '../actions/map.actions';
import * as mapReducers from '../reducers/map.reducer';
import {commonReducers} from '@farmmaps/common';
import { commonReducers } from '@farmmaps/common';
import {commonActions} from '@farmmaps/common';
import { commonActions } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { FolderService, ItemService } from '@farmmaps/common';
import { tassign } from 'tassign';
import {FeatureIconService} from '../services/feature-icon.service';
import { FeatureIconService } from '../services/feature-icon.service';
import * as style from 'ol/style';
import { ItemTypeService,IQueryState } from '@farmmaps/common';
import { ItemTypeService, IQueryState } from '@farmmaps/common';
import { TemporalItemLayer } from '../models/item.layer'
export const getRouterState = createFeatureSelector<RouterReducerState>('router');
@ -50,9 +50,9 @@ export class MapEffects {
private _wktFormat: WKT;
private overrideSelectedItemLayer = false;
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
private updateFeatureGeometry(feature: Feature<Geometry>, updateEvent: commonActions.DeviceUpdateEvent): Feature<Geometry> {
const newFeature = feature.clone();
const f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
const f = this._wktFormat.readFeature(updateEvent.attributes["geometry"], {
dataProjection: 'EPSG:4326',
featureProjection: 'EPSG:3857'
});
@ -62,19 +62,19 @@ export class MapEffects {
return newFeature;
}
init$ = createEffect(() => this.actions$.pipe(
init$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.INIT),
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
switchMap(([action, rootItems]) => {
const actions=[];
const actions = [];
for (const rootItem of rootItems) {
if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code));
}
// initialize default feature styles
actions.push(new mapActions.SetStyle('file',new style.Style({
actions.push(new mapActions.SetStyle('file', new style.Style({
image: new style.Icon({
anchor: [0.5, 1],
scale: 0.05,
anchor: [0.5, 1],
scale: 0.05,
src: this.featureIconService$.getIconImageDataUrl("fal fa-file")
}),
stroke: new style.Stroke({
@ -85,7 +85,7 @@ export class MapEffects {
color: 'rgba(0, 0, 0,0)'
})
})));
actions.push(new mapActions.SetStyle('selected',new style.Style({
actions.push(new mapActions.SetStyle('selected', new style.Style({
image: new style.Icon({
anchor: [0.5, 1],
scale: 0.08,
@ -104,13 +104,13 @@ export class MapEffects {
}
)));
initBaseLayers$ = createEffect(() => this.actions$.pipe(
initBaseLayers$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.INIT),
withLatestFrom(this.store$.select(mapReducers.selectGetProjection)),
map(([action, projection]) => new mapActions.LoadBaseLayers(projection)))
);
loadBaseLayers$ = createEffect(() => this.actions$.pipe(
loadBaseLayers$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.LOADBASELAYERS),
switchMap((action: mapActions.LoadBaseLayers) => {
return this.itemService$.getItemList("vnd.farmmaps.itemtype.layer", { "isBaseLayer": true }).pipe(
@ -118,15 +118,15 @@ export class MapEffects {
catchError(error => of(new commonActions.Fail(error))));
})));
startSearch$ = createEffect(() => this.actions$.pipe(
startSearch$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCH),
switchMap((action) => {
const a = action as mapActions.StartSearch;
const startDate = a.queryState.startDate;
const endDate = a.queryState.endDate;
let newAction:Observable<Action>;
let 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, a.queryState.dataFilter, 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 (const f of features.features) {
if (f.properties && f.properties["code"]) {
@ -144,18 +144,18 @@ export class MapEffects {
})));
zoomToExtent$ = createEffect(() => this.actions$.pipe(
zoomToExtent$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => {
const actions =[];
const actions = [];
actions.push(new commonActions.SetMenuVisible(false));
const extent = createEmpty();
if (!action.query.bboxFilter) {
if (extent) {
if (extent) {
for (const f of action.features) {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
}
if(action.features && action.features.length >0) {
if (action.features && action.features.length > 0) {
actions.push(new mapActions.SetExtent(extent));
}
}
@ -163,64 +163,64 @@ export class MapEffects {
return actions;
})));
zoomToExtent2$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETFEATURES),
switchMap((action: mapActions.SetFeatures) => {
const extent = createEmpty();
if (extent) {
for (const f of action.features) {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
}
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
zoomToExtent2$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETFEATURES),
switchMap((action: mapActions.SetFeatures) => {
const extent = createEmpty();
if (extent) {
for (const f of action.features) {
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
}
return EMPTY;
})));
if (action.features.length > 0) return of(new mapActions.SetExtent(extent));
}
return EMPTY;
})));
hideMenu$ = createEffect(() => this.actions$.pipe(
hideMenu$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.STARTSEARCHSUCCESS),
mergeMap((action: mapActions.StartSearchSuccess) => {
return of(new commonActions.SetMenuVisible(false));
})));
selectItem$ = createEffect(() => this.actions$.pipe(
selectItem$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEM),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
switchMap(([action, selectedItem]) => {
const a = action as mapActions.SelectItem;
const itemCode = selectedItem ? selectedItem.code : "";
if (a.itemCode != itemCode) {
return this.itemService$.getItem(a.itemCode).pipe(
switchMap(child => {
return this.itemService$.getItem(child.parentCode)
.pipe(map(parent => {
return {child, parent};
}),catchError(() => { const parent:IItem = null;return of({child,parent})})
);
}),
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
catchError(error => of(new commonActions.Fail(error))))
} else {
return [];
}
switchMap(([action, selectedItem]) => {
const a = action as mapActions.SelectItem;
const itemCode = selectedItem ? selectedItem.code : "";
if (a.itemCode != itemCode) {
return this.itemService$.getItem(a.itemCode).pipe(
switchMap(child => {
return this.itemService$.getItem(child.parentCode)
.pipe(map(parent => {
return { child, parent };
}), catchError(() => { const parent: IItem = null; return of({ child, parent }) })
);
}),
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
catchError(error => of(new commonActions.Fail(error))))
} else {
return [];
}
}
)));
selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
map((action:mapActions.SelectItemSuccess) =>
new mapActions.SetSelectedItemLayer(action.item)
)
));
selectItemSuccess$ = createEffect(() => this.actions$.pipe(
selectItemSuccessSetLayer$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => {
if(!this.overrideSelectedItemLayer) {
map((action: mapActions.SelectItemSuccess) =>
new mapActions.SetSelectedItemLayer(action.item)
)
));
selectItemSuccess$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action: mapActions.SelectItemSuccess) => {
if (!this.overrideSelectedItemLayer) {
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
map((feature: any) => {
const f = this._geojsonFormat.readFeature(feature);
f.setId(action.item.code);
return new mapActions.AddFeatureSuccess(f );
return new mapActions.AddFeatureSuccess(f);
}),
catchError(error => of(new commonActions.Fail(error))));
} else {
@ -229,29 +229,29 @@ export class MapEffects {
}
)));
selectItemSuccessTemporal$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action:mapActions.SelectItemSuccess) => {
if(action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
return this.itemService$.getChildItemList(action.item.code,null).pipe(
map(items => new mapActions.SelectTemporalItemsSuccess(
items.sort((a, b) =>
-(Date.parse(b.dataDate) - Date.parse(a.dataDate))
)
)),
catchError(error => of(new commonActions.Fail(error))));
} else {
return [];
}
selectItemSuccessTemporal$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SELECTITEMSUCCESS),
switchMap((action: mapActions.SelectItemSuccess) => {
if (action.item.itemType == "vnd.farmmaps.itemtype.temporal") {
return this.itemService$.getChildItemList(action.item.code, null).pipe(
map(items => new mapActions.SelectTemporalItemsSuccess(
items.sort((a, b) =>
-(Date.parse(b.dataDate) - Date.parse(a.dataDate))
)
)),
catchError(error => of(new commonActions.Fail(error))));
} else {
return [];
}
)));
uploadedItemClick$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.UPLOADEDFILECLICK),
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query.querystate, {itemCode:action.itemCode})))
}
)));
featureUpdate$ = createEffect(() => this.actions$.pipe(
uploadedItemClick$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.UPLOADEDFILECLICK),
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query.querystate, { itemCode: action.itemCode })))
)));
featureUpdate$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.DEVICEUPDATEEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => {
@ -264,13 +264,13 @@ export class MapEffects {
}
}
if (feature) {
return of(new mapActions.UpdateFeatureSuccess(this.updateFeatureGeometry(feature,deviceUpdateEventAction)));
return of(new mapActions.UpdateFeatureSuccess(this.updateFeatureGeometry(feature, deviceUpdateEventAction)));
} else {
return [];
}
})));
itemUpdate$ = createEffect(() => this.actions$.pipe(
itemUpdate$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.ITEMCHANGEDEVENT),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
mergeMap(([action, selectedItem]) => {
@ -280,8 +280,8 @@ export class MapEffects {
switchMap(child => {
return this.itemService$.getItem(child.parentCode)
.pipe(map(parent => {
return {child, parent};
})
return { child, parent };
})
);
}),
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
@ -291,13 +291,13 @@ export class MapEffects {
}
})));
getActionFromQueryState(queryState:IQueryState, inSearch:boolean):Observable<Action>|[] {
if(!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) {
var newAction:Action;
getActionFromQueryState(queryState: IQueryState, inSearch: boolean): Observable<Action> | [] {
if (!inSearch && (queryState.itemType || queryState.parentCode || queryState.itemCode || queryState.query || queryState.tags)) {
var newAction: Action;
if (queryState.itemCode && queryState.itemCode != "") {
newAction= new mapActions.SelectItem(queryState.itemCode);
newAction = new mapActions.SelectItem(queryState.itemCode);
} else {
newAction= new mapActions.StartSearch(queryState);
newAction = new mapActions.StartSearch(queryState);
}
} else {
@ -306,104 +306,104 @@ export class MapEffects {
return of(newAction);
}
getLayerValue$ = createEffect(() => this.actions$.pipe(
getLayerValue$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.GETLAYERVALUE),
mergeMap((action:mapActions.GetLayerValue) => {
mergeMap((action: mapActions.GetLayerValue) => {
const l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex];
const scale = l.scale?l.scale:1;
return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe(
const scale = l.scale ? l.scale : 1;
return this.itemService$.getLayerValue(action.itemLayer.item.code, action.itemLayer.layerIndex, action.x, action.y).pipe(
mergeMap((v: number) => {
const a=[];
if(v !== null) {
if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") {
const a = [];
if (v !== null) {
if (l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") {
l.renderer.colorMap.entries.forEach((e) => {
if(e.value == v && e.label) {
v=e.label;
return;
}
if (e.value == v && e.label) {
v = e.label;
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, scale: l.scale }));
} 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, scale: l.scale }));
}
}
return a;
}))
}
)));
}
)));
updateLayerValuesOnLayerAddedOrRemoved$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.ADDLAYER,mapActions.REMOVELAYER,mapActions.SELECTITEMSUCCESS,mapActions.SELECTTEMPORALITEMSSUCCESS, mapActions.NEXTTEMPORAL,mapActions.PREVIOUSTEMPORAL,mapActions.TOGGLELAYERVALUESENABLED,mapActions.SETLAYERINDEX,mapActions.SETSELECTEDITEMLAYER),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)),
map(([[action,x],y]) => new mapActions.SetLayerValuesLocation(x,y))
updateLayerValuesOnLayerAddedOrRemoved$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.ADDLAYER, mapActions.REMOVELAYER, mapActions.SELECTITEMSUCCESS, mapActions.SELECTTEMPORALITEMSSUCCESS, mapActions.NEXTTEMPORAL, mapActions.PREVIOUSTEMPORAL, mapActions.TOGGLELAYERVALUESENABLED, mapActions.SETLAYERINDEX, mapActions.SETSELECTEDITEMLAYER),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesX)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesY)),
map(([[action, x], y]) => new mapActions.SetLayerValuesLocation(x, y))
));
getLayerValues$ = createEffect(() => this.actions$.pipe(
getLayerValues$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETLAYERVALUESLOCATION),
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItemLayer)),
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
mergeMap(([[[action, selected], enabled],overlayLayers]) => {
mergeMap(([[[action, selected], enabled], overlayLayers]) => {
const layers = [];
if(selected) {
if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
selected=(selected as TemporalItemLayer).selectedItemLayer;
if (selected) {
if (selected && (selected as TemporalItemLayer).selectedItemLayer) {
selected = (selected as TemporalItemLayer).selectedItemLayer;
}
layers.push(selected);
}
overlayLayers.forEach((ol) => {
if(ol!=selected) layers.push(ol);
if (ol != selected) layers.push(ol);
});
const a = action as mapActions.SetLayerValuesLocation;
const 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));
}
});
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(
setState$ = createEffect(() => this.actions$.pipe(
ofType(mapActions.SETSTATE),
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
switchMap(([action,inSearch]) => {
switchMap(([action, inSearch]) => {
const a = action as mapActions.SetState;
return this.getActionFromQueryState(a.queryState,inSearch);
return this.getActionFromQueryState(a.queryState, inSearch);
})));
escape$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.ESCAPE),
switchMap((action) => {
const a = action as commonActions.Escape;
if(a.escapeKey) {
return of(new mapActions.Clear());
} else {
return EMPTY;
}
})));
escape$ = createEffect(() => this.actions$.pipe(
ofType(commonActions.ESCAPE),
switchMap((action) => {
const a = action as commonActions.Escape;
if (a.escapeKey) {
return of(new mapActions.Clear());
} else {
return EMPTY;
}
})));
setOverride$ = createEffect(() => this.actions$.pipe(
ofType(ROUTER_NAVIGATED),
switchMap(() => this.store$.select(selectRouteData as any)),
switchMap((data: any) => {
if(data && data["fm-map-map"]) {
const params = data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
} else {
this.overrideSelectedItemLayer = false;
}
return [];
})
));
setOverride$ = createEffect(() => this.actions$.pipe(
ofType(ROUTER_NAVIGATED),
switchMap(() => this.store$.select(selectRouteData as any)),
switchMap((data: any) => {
if (data && data["fm-map-map"]) {
const params = data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
} else {
this.overrideSelectedItemLayer = false;
}
return [];
})
));
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._wktFormat = new WKT();
}
}
}

View File

@ -1,7 +1,8 @@
export interface ILayervalue {
date:string;
layerName:string;
unit:string;
quantity:string;
value:number;
date: string;
layerName: string;
unit: string;
quantity: string;
value: number;
scale: number;
}