Fix request canceling
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:
parent
9d5cd0fa88
commit
aa308abbb0
@ -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>{{layerValue.quantity}}</span> <span>{{layerValue.value}}</span><span>{{layerValue.unit}}</span></div>
|
||||
<div><span class="mr-1">{{layerValue.quantity}}</span> <span class="mr-1 font-weight-bold">{{layerValue.value}}</span><span>{{layerValue.unit}}</span></div>
|
||||
</li>
|
||||
</ul>
|
||||
<ng-template #no_data>
|
||||
|
@ -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<any>();
|
||||
|
||||
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() {
|
||||
|
@ -300,13 +300,25 @@ export class MapEffects {
|
||||
@Effect()
|
||||
getLayerValue$: Observable<Action> = 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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user