Projekt

Obecné

Profil

« Předchozí | Další » 

Revize c0b66eaf

Přidáno uživatelem Václav Honzík před asi 2 roky(ů)

map icon colors start

re #9741

Zobrazit rozdíly:

frontend/src/features/TrackingTool/Map/pathUtils.ts
1
// Business logic for tracking tool
2

  
3 1
import { CatalogItemDto, PathDto } from '../../../swagger/data-contracts'
4 2
import generateUuid from '../../../utils/id/uuidGenerator'
3
import { MapPoint, MapPointType, PathVariant } from '../trackingToolUtils'
5 4

  
6
// For more comprehensive code alias CatalogItemDto[] as path variant
7
export type PathVariant = MapPoint[]
8

  
9
export enum MapPointType {
10
    LocalCatalog, // Fetched from local catalog
11
    ExternalCatalog, // Fetched from external catalog
12
    GeoJson, // From GeoJSON file
13
    FromCoordinates, // From coordinates
14
}
15

  
16
// Represents a point on the map - wrapper for CatalogItemDto to make it easier to work with
17
export interface MapPoint {
18
    id: string // unique id for react
19
    idx: number,
20
    addToPath: boolean, // whether to add the point to the path
21
    catalogItem: CatalogItemDto,
22
    type: MapPointType
23
    hidden?: boolean // if true the point will not be displayed on the map
24
}
25

  
26
export const isMapPointDisplayable = (mapPoint: MapPoint): boolean =>
27
    !!mapPoint.catalogItem.latitude && !!mapPoint.catalogItem.longitude && !mapPoint.hidden
28 5

  
29 6
/**
30 7
 * Cartesian product of two arrays

Také k dispozici: Unified diff