From 1c1315a580b6467a414fd6584635654572563e46 Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Tue, 5 Oct 2021 16:13:25 +0200 Subject: [PATCH] More type fixes --- projects/common-map/src/fm-map/actions/map.actions.ts | 2 +- .../aol/item-vector-source/item-vector-source.component.ts | 5 +++-- .../aol/layer-vector-image/layer-vector-image.component.ts | 6 ++++-- .../feature-thumbnail/feature-thumbnail.component.ts | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/projects/common-map/src/fm-map/actions/map.actions.ts b/projects/common-map/src/fm-map/actions/map.actions.ts index 888fe54..69547c1 100644 --- a/projects/common-map/src/fm-map/actions/map.actions.ts +++ b/projects/common-map/src/fm-map/actions/map.actions.ts @@ -273,7 +273,7 @@ export class DoQuery implements Action { export class SetStyle implements Action { readonly type = SETSTYLE; - constructor(public itemType:string,public style: Style | (Feature)) { } + constructor(public itemType:string,public style: Style | ((feature:Feature) => Style )) { } } export class ShowLayerSwitcher implements Action { diff --git a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts index 696e32f..2d805e8 100644 --- a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts @@ -1,10 +1,11 @@ -import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core'; +import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core'; import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers'; import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common'; import { Feature } from 'ol'; import { Point,Geometry } from 'ol/geom'; import { MapBrowserEvent } from 'ol'; +import { Types } from 'ol/MapBrowserEventType'; import * as style from 'ol/style'; import * as color from 'ol/color'; import * as loadingstrategy from 'ol/loadingstrategy'; @@ -87,7 +88,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements return this.getSelectedStyle(feature); }, hitTolerance: 10, - condition: (e: MapBrowserEvent) => { + condition: (e: MapBrowserEvent) => { return e.type == 'pointermove'; }, layers: [this.layer.instance as Layer] diff --git a/projects/common-map/src/fm-map/components/aol/layer-vector-image/layer-vector-image.component.ts b/projects/common-map/src/fm-map/components/aol/layer-vector-image/layer-vector-image.component.ts index 05293d7..649e30b 100644 --- a/projects/common-map/src/fm-map/components/aol/layer-vector-image/layer-vector-image.component.ts +++ b/projects/common-map/src/fm-map/components/aol/layer-vector-image/layer-vector-image.component.ts @@ -1,6 +1,8 @@ import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; import { LayerVectorComponent, MapComponent } from 'ngx-openlayers'; -import { RenderType } from 'ol/layer/Vector'; +import RenderType from 'ol/layer/Vector'; +import { Vector as VectorSource } from 'ol/source'; +import { Geometry } from 'ol/geom'; @Component({ selector: 'fm-map-aol-layer-vector-image', @@ -12,7 +14,7 @@ export class LayerVectorImageComponent extends LayerVectorComponent implements O //public source: Vector; @Input() - renderMode: RenderType | string = "image"; + renderMode: RenderType> | string = "image"; constructor(map: MapComponent) { super(map); diff --git a/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts b/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts index d5e61a5..3e5679f 100644 --- a/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts +++ b/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts @@ -1,6 +1,6 @@ import { Component, Input, OnInit,ViewChild } from '@angular/core'; import { Feature} from 'ol'; -import { Geometry } from 'ol/geom'; +import { Geometry,Polygon,MultiPolygon } from 'ol/geom'; import * as extent from 'ol/extent'; import * as render from 'ol/render'; import * as style from 'ol/style'; @@ -28,7 +28,7 @@ export class GeometryThumbnailComponent implements OnInit { stroke: new style.Stroke({ color: 'black',width:1.5 }) }); - let geom = geometry.clone(), + let geom = geometry.clone() as Polygon, line = geom.getCoordinates()[0], e = extent.boundingExtent( line );