diff --git a/packages/geo/src/lib/draw/draw/draw.component.ts b/packages/geo/src/lib/draw/draw/draw.component.ts index 13257d5b99..e77e778274 100644 --- a/packages/geo/src/lib/draw/draw/draw.component.ts +++ b/packages/geo/src/lib/draw/draw/draw.component.ts @@ -15,8 +15,7 @@ import { tryAddLoadingStrategy, tryAddSelectionStrategy, FeatureMotion, - FeatureStoreLoadingStrategy, - FeatureGeometry, + FeatureStoreLoadingStrategy } from '../../feature'; import { LanguageService } from '@igo2/core'; @@ -33,7 +32,6 @@ import { DrawControl } from '../../geometry/shared/controls/draw'; import { EntityRecord, EntityTableTemplate } from '@igo2/common'; import * as OlStyle from 'ol/style'; -import * as OlColor from 'ol/color'; import OlVectorSource from 'ol/source/Vector'; import OlCircle from 'ol/geom/Circle'; import OlPoint from 'ol/geom/Point'; @@ -82,8 +80,8 @@ export class DrawComponent implements OnInit, OnDestroy { public geometryType = GeometryType; // Reference to the GeometryType enum - @Output() fillColor: OlColor.Color; - @Output() strokeColor: OlColor.Color; + @Output() fillColor: string; + @Output() strokeColor: string; @Output() strokeWidth: number; @Input() map: IgoMap; // Map to draw on @@ -98,8 +96,8 @@ export class DrawComponent implements OnInit, OnDestroy { private drawSelect$$: Subscription; private olDrawingLayer: VectorLayer; public selectedFeatures$: BehaviorSubject = new BehaviorSubject([]); - public fillForm: OlColor.Color; - public strokeForm: OlColor.Color; + public fillForm: string; + public strokeForm: string; public drawControlIsDisabled: boolean = true; public drawControlIsActive: boolean = false; public labelsAreShown: boolean; @@ -148,7 +146,7 @@ export class DrawComponent implements OnInit, OnDestroy { * @param strokeWidth the stroke width * @returns a Draw Control */ - createDrawControl(fillColor?: OlColor.Color, strokeColor?: OlColor.Color, strokeWidth?: number) { + createDrawControl(fillColor?: string, strokeColor?: string, strokeWidth?: number) { const drawControl = new DrawControl({ geometryType: undefined, drawingLayerSource: this.olDrawingLayerSource, diff --git a/packages/geo/src/lib/draw/shared/draw-style.service.ts b/packages/geo/src/lib/draw/shared/draw-style.service.ts index d4ece8a1f5..e20b56195a 100644 --- a/packages/geo/src/lib/draw/shared/draw-style.service.ts +++ b/packages/geo/src/lib/draw/shared/draw-style.service.ts @@ -1,7 +1,6 @@ import { Injectable } from '@angular/core'; import * as OlStyle from 'ol/style'; -import * as OlColor from 'ol/color'; import OlPoint from 'ol/geom/Point'; import { transform } from 'ol/proj'; import { MapService } from '../../map/shared/map.service'; @@ -11,8 +10,8 @@ import { MapService } from '../../map/shared/map.service'; }) export class DrawStyleService { - private fillColor: OlColor = 'rgba(255,255,255,0.4)'; - private strokeColor: OlColor = 'rgba(143,7,7,1)'; + private fillColor = 'rgba(255,255,255,0.4)'; + private strokeColor = 'rgba(143,7,7,1)'; private strokeWidth: number = 1; private labelsAreShown = true; private icon: string; @@ -21,19 +20,19 @@ export class DrawStyleService { private mapService: MapService ) {} - getFillColor(): OlColor { + getFillColor(): string { return this.fillColor; } - setFillColor(fillColor: OlColor) { + setFillColor(fillColor: string) { this.fillColor = fillColor; } - getStrokeColor(): OlColor { + getStrokeColor(): string { return this.strokeColor; } - setStrokeColor(strokeColor: OlColor) { + setStrokeColor(strokeColor: string) { this.strokeColor = strokeColor; } diff --git a/packages/geo/src/lib/draw/shared/draw.utils.ts b/packages/geo/src/lib/draw/shared/draw.utils.ts index 3d1ac00483..707e0c1ab4 100644 --- a/packages/geo/src/lib/draw/shared/draw.utils.ts +++ b/packages/geo/src/lib/draw/shared/draw.utils.ts @@ -19,7 +19,7 @@ import { * @param label a label * @returns OL style */ -export function createInteractionStyle(fillColor?: OlColor, strokeColor?: OlColor, strokeWidth?: number, label?: string): Olstyle.Style { +export function createInteractionStyle(fillColor?: string, strokeColor?: string, strokeWidth?: number, label?: string): Olstyle.Style { return new Olstyle.Style({ stroke: new Olstyle.Stroke({ color: strokeColor ? strokeColor : 'rgba(143,7,7,1)', diff --git a/packages/geo/src/lib/measure/measurer/measurer.component.ts b/packages/geo/src/lib/measure/measurer/measurer.component.ts index fe7ad12cb2..93b7201c7c 100644 --- a/packages/geo/src/lib/measure/measurer/measurer.component.ts +++ b/packages/geo/src/lib/measure/measurer/measurer.component.ts @@ -513,7 +513,8 @@ export class MeasurerComponent implements OnInit, OnDestroy { this.store.deleteMany(this.selectedFeatures$.value); this.selectedFeatures$.value.forEach(selectedFeature => { this.olDrawSource.getFeatures().forEach(drawingLayerFeature => { - if (selectedFeature.properties.id === drawingLayerFeature.getGeometry().ol_uid) { + const geometry = drawingLayerFeature.getGeometry() as any; + if (selectedFeature.properties.id === geometry.ol_uid) { this.olDrawSource.removeFeature(drawingLayerFeature); } }); @@ -857,7 +858,7 @@ export class MeasurerComponent implements OnInit, OnDestroy { * will trigger and add the feature to the map. * @internal */ - private addFeatureToStore(olGeometry: OlLineString | OlPolygon, localFeature?: FeatureWithMeasure) { + private addFeatureToStore(olGeometry, localFeature?: FeatureWithMeasure) { const featureId = localFeature ? localFeature.properties.id : olGeometry.ol_uid; const projection = this.map.ol.getView().getProjection(); const geometry = new OlGeoJSON().writeGeometryObject(olGeometry, {