Skip to content

Commit

Permalink
fix(draw-measurer): fix ol typo
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeLafreniere18 committed Sep 16, 2021
1 parent 4c6aa2f commit cbfc116
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
14 changes: 6 additions & 8 deletions packages/geo/src/lib/draw/draw/draw.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import {
tryAddLoadingStrategy,
tryAddSelectionStrategy,
FeatureMotion,
FeatureStoreLoadingStrategy,
FeatureGeometry,
FeatureStoreLoadingStrategy
} from '../../feature';

import { LanguageService } from '@igo2/core';
Expand All @@ -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';
Expand Down Expand Up @@ -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
Expand All @@ -98,8 +96,8 @@ export class DrawComponent implements OnInit, OnDestroy {
private drawSelect$$: Subscription;
private olDrawingLayer: VectorLayer;
public selectedFeatures$: BehaviorSubject<FeatureWithDraw[]> = 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;
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 6 additions & 7 deletions packages/geo/src/lib/draw/shared/draw-style.service.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand All @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/geo/src/lib/draw/shared/draw.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)',
Expand Down
5 changes: 3 additions & 2 deletions packages/geo/src/lib/measure/measurer/measurer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
Expand Down Expand Up @@ -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, {
Expand Down

0 comments on commit cbfc116

Please sign in to comment.