# All files / components/geo/processing GeoTable.ts

28.57% Statements 4/14
25% Branches 2/8
50% Functions 1/2
30.76% Lines 4/13

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51

    3x
    3x
    3x

    3x

     export interface Coordinates {
      lon: number
      lat: number
    }

    export enum CoordinateEncoding {
      GEO_HASH,
      FIELDS,
    }

    export interface Track extends Array<number[]> {}

    export interface GeoTable {
      getValue(index: number, field: string): number

      getRowCount(): number

      getLatLon(index: number): Coordinates

      getTimeString(index: number): string

      isTruncated(): boolean

      mapTracks<T, U>(
        mapper: (track: Track, options: U, index: number) => T,
        options: U
      ): T[]
    }

    export interface MinAndMax {
      min?: number
      max?: number
    }

    export const getMinAndMax = (table: GeoTable, field: string): MinAndMax => {
      const rowCount = table.getRowCount()
      const range: MinAndMax = {}
      for (let i = 0; i < rowCount; i++) {
        const value = table.getValue(i, field)

        Iif (range.min === undefined || value < range.min) {
          range.min = value
        }

        Iif (range.max === undefined || value > range.max) {
          range.max = value
        }
      }
      return range
    }