diff --git a/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.html b/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.html index feeeba4..58cdfca 100644 --- a/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.html +++ b/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.html @@ -7,7 +7,7 @@
  • {{layerValue.layerName}}
    {{layerValue.date|date}}
    -
    {{layerValue.quantity}} {{layerValue.value}}{{layerValue.unit}}
    +
    {{layerValue.quantity}} {{layerValue.value}}{{layerValue.unit}}
  • diff --git a/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts b/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts index 2fb9380..81c0406 100644 --- a/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts +++ b/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts @@ -5,8 +5,8 @@ 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 } from 'rxjs'; -import { debounce } from 'rxjs/operators'; +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' @@ -37,12 +37,15 @@ export class LayerValuesComponent implements OnInit,AfterViewInit { } + moveEndSubject = new Subject(); + ngAfterViewInit():void { this.offsetY$ = this.containerRef.nativeElement.offsetTop; this.offsetX$ = this.containerRef.nativeElement.offsetLeft; this.map.instance.on('moveend', () => { - this.updateValuesLocation(); + this.moveEndSubject.next({}); }); + this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() => this.updateValuesLocation()); } updateValuesLocation() { diff --git a/projects/common-map/src/fm-map/effects/map.effects.ts b/projects/common-map/src/fm-map/effects/map.effects.ts index 08d44c2..d812b01 100644 --- a/projects/common-map/src/fm-map/effects/map.effects.ts +++ b/projects/common-map/src/fm-map/effects/map.effects.ts @@ -300,13 +300,25 @@ export class MapEffects { @Effect() getLayerValue$: Observable = this.actions$.pipe( ofType(mapActions.GETLAYERVALUE), - switchMap((action:mapActions.GetLayerValue) => { + mergeMap((action:mapActions.GetLayerValue) => { var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex]; var scale = l.scale?l.scale:1; return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe( - switchMap((v: number) => { + mergeMap((v: number) => { let a=[]; - if(v) a.push(new mapActions.GetLayerValueSuccess({date:"",value:v*scale,layerName:l.name,quantity:l.quantity,unit:l.unit})); + if(v) { + if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") { + l.renderer.colorMap.entries.forEach((e) => { + if(e.value == v) { + v=e.label; + return; + } + }); + 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})); + } + } return a; })) } @@ -327,7 +339,7 @@ export class MapEffects { withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItemLayer)), withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)), withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)), - switchMap(([[[action, selected], enabled],overlayLayers]) => { + mergeMap(([[[action, selected], enabled],overlayLayers]) => { let layers = []; if(selected) layers.push(selected); overlayLayers.forEach((ol) => {