Refactoring types

This commit is contained in:
Willem Dantuma
2021-10-05 13:46:10 +02:00
parent 4ef077f8d7
commit 160eb10aba
31 changed files with 118 additions and 102 deletions

View File

@@ -11,7 +11,7 @@ import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/opera
import {GeoJSON,WKT} from 'ol/format';
import {Feature} from 'ol';
import { getCenter,createEmpty,extend } from 'ol/extent';
import {Point} from 'ol/geom'
import {Point,Geometry} from 'ol/geom'
import * as mapActions from '../actions/map.actions';
@@ -50,7 +50,7 @@ export class MapEffects {
private _wktFormat: WKT;
private overrideSelectedItemLayer: boolean = false;
private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
let newFeature = feature.clone();
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
dataProjection: 'EPSG:4326',
@@ -153,7 +153,7 @@ export class MapEffects {
if (!action.query.bboxFilter) {
if (extent) {
for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent());
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
}
if(action.features && action.features.length >0) {
actions.push(new mapActions.SetExtent(extent));
@@ -169,7 +169,7 @@ export class MapEffects {
let extent = createEmpty();
if (extent) {
for (let f of action.features) {
extend(extent, (f as Feature).getGeometry().getExtent());
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
}
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
}
@@ -256,7 +256,7 @@ export class MapEffects {
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
mergeMap(([action, features]) => {
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
var feature: Feature = null;
var feature: Feature<Geometry> = null;
for (let f of features) {
if (f.getId() == deviceUpdateEventAction.itemCode) {
feature = f;