More type fixes

This commit is contained in:
Willem Dantuma 2021-10-05 16:13:25 +02:00
parent 5d21d66589
commit 1c1315a580
4 changed files with 10 additions and 7 deletions

View File

@ -273,7 +273,7 @@ export class DoQuery implements Action {
export class SetStyle implements Action { export class SetStyle implements Action {
readonly type = SETSTYLE; readonly type = SETSTYLE;
constructor(public itemType:string,public style: Style | (Feature<Geometry>)) { } constructor(public itemType:string,public style: Style | ((feature:Feature<Geometry>) => Style )) { }
} }
export class ShowLayerSwitcher implements Action { export class ShowLayerSwitcher implements Action {

View File

@ -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 { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common'; import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
import { Feature } from 'ol'; import { Feature } from 'ol';
import { Point,Geometry } from 'ol/geom'; import { Point,Geometry } from 'ol/geom';
import { MapBrowserEvent } from 'ol'; import { MapBrowserEvent } from 'ol';
import { Types } from 'ol/MapBrowserEventType';
import * as style from 'ol/style'; import * as style from 'ol/style';
import * as color from 'ol/color'; import * as color from 'ol/color';
import * as loadingstrategy from 'ol/loadingstrategy'; import * as loadingstrategy from 'ol/loadingstrategy';
@ -87,7 +88,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
return this.getSelectedStyle(feature); return this.getSelectedStyle(feature);
}, },
hitTolerance: 10, hitTolerance: 10,
condition: (e: MapBrowserEvent) => { condition: (e: MapBrowserEvent<UIEvent>) => {
return e.type == 'pointermove'; return e.type == 'pointermove';
}, },
layers: [this.layer.instance as Layer<Source>] layers: [this.layer.instance as Layer<Source>]

View File

@ -1,6 +1,8 @@
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core'; import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
import { LayerVectorComponent, MapComponent } from 'ngx-openlayers'; 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({ @Component({
selector: 'fm-map-aol-layer-vector-image', selector: 'fm-map-aol-layer-vector-image',
@ -12,7 +14,7 @@ export class LayerVectorImageComponent extends LayerVectorComponent implements O
//public source: Vector; //public source: Vector;
@Input() @Input()
renderMode: RenderType | string = "image"; renderMode: RenderType<VectorSource<Geometry>> | string = "image";
constructor(map: MapComponent) { constructor(map: MapComponent) {
super(map); super(map);

View File

@ -1,6 +1,6 @@
import { Component, Input, OnInit,ViewChild } from '@angular/core'; import { Component, Input, OnInit,ViewChild } from '@angular/core';
import { Feature} from 'ol'; import { Feature} from 'ol';
import { Geometry } from 'ol/geom'; import { Geometry,Polygon,MultiPolygon } from 'ol/geom';
import * as extent from 'ol/extent'; import * as extent from 'ol/extent';
import * as render from 'ol/render'; import * as render from 'ol/render';
import * as style from 'ol/style'; import * as style from 'ol/style';
@ -28,7 +28,7 @@ export class GeometryThumbnailComponent implements OnInit {
stroke: new style.Stroke({ color: 'black',width:1.5 }) stroke: new style.Stroke({ color: 'black',width:1.5 })
}); });
let geom = geometry.clone(), let geom = geometry.clone() as Polygon,
line = geom.getCoordinates()[0], line = geom.getCoordinates()[0],
e = extent.boundingExtent( line ); e = extent.boundingExtent( line );