Skip to content

Commit

Permalink
feat(DH): Typefix for ol update
Browse files Browse the repository at this point in the history
  • Loading branch information
Angi-Kinas committed Dec 5, 2023
1 parent 9ce41a9 commit fd410ad
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import {
ViewChild,
} from '@angular/core'
import { ThemeService } from '@geonetwork-ui/util/shared'
import type { Feature } from 'geojson'
import type { Feature as FeatureType } from 'geojson'
import { asArray, asString } from 'ol/color'
import { isEmpty } from 'ol/extent'
import GeoJSON from 'ol/format/GeoJSON'
import { Geometry } from 'ol/geom'
import TileLayer from 'ol/layer/Tile'
import VectorLayer from 'ol/layer/Vector'
import Map from 'ol/Map'
import { Map, Feature } from 'ol'
import OSM from 'ol/source/OSM'
import VectorSource from 'ol/source/Vector'
import { Fill, RegularShape, Stroke, Style } from 'ol/style'
import { StyleLike } from 'ol/style/Style'
import View from 'ol/View'
import { FeatureLike } from 'ol/Feature'

const DEFAULT_PRIMARY_COLOR = '#9a9a9a'
const PADDING = 50
Expand All @@ -41,7 +42,7 @@ export class DataImportValidationMapPanelComponent
@Input() headerLabel = ''
@Input() footerLabel = ''
@Input() footerList = []
@Input() geoJson?: Feature
@Input() geoJson?: FeatureType
@Input() footerValue = ''
@Input() padding = []

Expand All @@ -50,8 +51,8 @@ export class DataImportValidationMapPanelComponent
selectedValue: any

private map: Map
private source: VectorSource<Geometry>
private vectorLayer: VectorLayer<VectorSource<Geometry>>
private source: VectorSource<FeatureLike>
private vectorLayer: VectorLayer<VectorSource<Feature<Geometry>>>
private format: any = new GeoJSON({})

ngOnInit(): void {
Expand Down Expand Up @@ -158,8 +159,8 @@ export class DataImportValidationMapPanelComponent
]
}

private buildVectorLayer(): VectorLayer<VectorSource<Geometry>> {
this.source = new VectorSource({})
private buildVectorLayer(): VectorLayer<VectorSource<Feature<Geometry>>> {
this.source = new VectorSource<Feature<Geometry>>({})
if (this.geoJson) {
this.source.addFeatures(
this.format.readFeatures(this.geoJson, {
Expand All @@ -168,7 +169,7 @@ export class DataImportValidationMapPanelComponent
)
}
return new VectorLayer({
source: this.source,
source: this.source as VectorSource<Feature<Geometry>>,
style: this.getDefaultStyle(),
})
}
Expand Down

0 comments on commit fd410ad

Please sign in to comment.