Fix device geometry update
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
eb1157d608
commit
6ff3c0ec96
@ -50,15 +50,16 @@ export class MapEffects {
|
|||||||
private _wktFormat: WKT;
|
private _wktFormat: WKT;
|
||||||
private overrideSelectedItemLayer: boolean = false;
|
private overrideSelectedItemLayer: boolean = false;
|
||||||
|
|
||||||
private toPointFeature(updateEvent:commonActions.DeviceUpdateEvent): Feature {
|
private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
|
||||||
|
let newFeature = feature.clone();
|
||||||
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||||
dataProjection: 'EPSG:4326',
|
dataProjection: 'EPSG:4326',
|
||||||
featureProjection: 'EPSG:3857'
|
featureProjection: 'EPSG:3857'
|
||||||
});
|
});
|
||||||
f.setId(updateEvent.itemCode);
|
|
||||||
var centroid = getCenter(f.getGeometry().getExtent());
|
var centroid = getCenter(f.getGeometry().getExtent());
|
||||||
f.setGeometry(new Point(centroid));
|
newFeature.setId(feature.getId());
|
||||||
return f;
|
newFeature.setGeometry(new Point(centroid));
|
||||||
|
return newFeature;
|
||||||
}
|
}
|
||||||
|
|
||||||
init$ = createEffect(() => this.actions$.pipe(
|
init$ = createEffect(() => this.actions$.pipe(
|
||||||
@ -263,7 +264,7 @@ export class MapEffects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (feature) {
|
if (feature) {
|
||||||
return of(new mapActions.UpdateFeatureSuccess(this.toPointFeature(deviceUpdateEventAction)));
|
return of(new mapActions.UpdateFeatureSuccess(this.updateFeatureGeometry(feature,deviceUpdateEventAction)));
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user