Skip to content

Commit

Permalink
Migrate InterestPointLine to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Aug 29, 2024
1 parent c97b2e3 commit 0e54e16
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'
import { v4 as uuidv4 } from 'uuid'

import { getInterestPointStyle, POIStyle } from './interestPoint.style'
import { InterestPointLine } from './interestPointLine'
import { InterestPointLine } from './InterestPointLine'
import { LayerProperties } from '../../../domain/entities/layers/constants'
import { MapBox, OPENLAYERS_PROJECTION } from '../../../domain/entities/map/constants'
import { setRightMapBoxOpened } from '../../../domain/shared_slices/Global'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@ import LineString from 'ol/geom/LineString'
export class InterestPointLine {
static typeProperty = 'type'
static isHiddenByZoomProperty = 'isHiddenByZoom'

/**
* InterestPointLine object for building OpenLayers interest point line to draggable overlay
* @param {string[]} fromCoordinates - The [longitude, latitude] of the start of the line (the interest point position)
* @param {string[]} toCoordinates - The [longitude, latitude] of the overlay position
* @param {string} featureId - The feature identifier
*
* @param fromCoordinates - The [longitude, latitude] of the start of the line (the interest point position)
* @param toCoordinates - The [longitude, latitude] of the overlay position
* @param featureId - The feature identifier
*/
static getFeature(fromCoordinates, toCoordinates, featureId) {
static getFeature(fromCoordinates: string[], toCoordinates: string[], featureId: string) {
const interestPointLineFeature = new Feature({
// TODO Fix that: `ype 'string[]' is not assignable to type 'number | Coordinate'.`. Legacy code.
// @ts-ignore
geometry: new LineString([fromCoordinates, toCoordinates])
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CircleStyle from 'ol/style/Circle'
import Fill from 'ol/style/Fill'
import Stroke from 'ol/style/Stroke'

import { InterestPointLine } from './interestPointLine'
import { InterestPointLine } from './InterestPointLine'
import { INTEREST_POINT_STYLE, InterestPointType } from '../utils'

const interestPointStylesCache = new Map()
Expand Down

0 comments on commit 0e54e16

Please sign in to comment.