@@ -3,13 +3,13 @@ import moment from 'moment';
3
3
import WKT from 'terraformer-wkt-parser' ;
4
4
import { RequestConfiguration } from '../utils/cancelRequests' ;
5
5
import { CRS_EPSG4326 , CRS_WGS84 , findCrsFromUrn } from '../crs' ;
6
- import { AbstractLayer } from '../layer/AbstractLayer' ;
7
- import { AbstractSentinelHubV1OrV2Layer } from '../layer/AbstractSentinelHubV1OrV2Layer' ;
8
- import { AbstractSentinelHubV3Layer } from '../layer/AbstractSentinelHubV3Layer' ;
6
+ import type { AbstractLayer } from '../layer/AbstractLayer' ;
7
+ import type { AbstractSentinelHubV1OrV2Layer } from '../layer/AbstractSentinelHubV1OrV2Layer' ;
8
+ import type { AbstractSentinelHubV3Layer } from '../layer/AbstractSentinelHubV3Layer' ;
9
9
import { FisPayload , FisResponse , GetStatsParams , HistogramType } from '../layer/const' ;
10
10
import { CACHE_CONFIG_NOCACHE } from '../utils/cacheHandlers' ;
11
11
import { getAxiosReqParams } from '../utils/cancelRequests' ;
12
- import { StatisticsProvider } from './StatisticsProvider' ;
12
+ import type { StatisticsProvider } from './StatisticsProvider' ;
13
13
import { StatisticalApiResponse } from './const' ;
14
14
15
15
export class Fis implements StatisticsProvider {
@@ -63,8 +63,8 @@ export class Fis implements StatisticsProvider {
63
63
} else {
64
64
payload . evalscript = Buffer . from ( layer . getEvalscript ( ) , 'utf8' ) . toString ( 'base64' ) ;
65
65
}
66
- if ( layer instanceof AbstractSentinelHubV1OrV2Layer ) {
67
- payload . evalsource = layer . getEvalsource ( ) ;
66
+ if ( layer . type === ' AbstractSentinelHubV1OrV2Layer' ) {
67
+ payload . evalsource = ( layer as AbstractSentinelHubV1OrV2Layer ) . getEvalsource ( ) ;
68
68
}
69
69
}
70
70
return payload ;
@@ -86,10 +86,10 @@ export class Fis implements StatisticsProvider {
86
86
params : GetStatsParams ,
87
87
reqConfig ?: RequestConfiguration ,
88
88
) : Promise < FisResponse > {
89
- if ( layer instanceof AbstractSentinelHubV3Layer ) {
90
- return this . handleV3 ( layer , params , reqConfig ) ;
91
- } else if ( layer instanceof AbstractSentinelHubV1OrV2Layer ) {
92
- return this . handleV1orV2 ( layer , params , reqConfig ) ;
89
+ if ( layer . type === ' AbstractSentinelHubV3Layer' ) {
90
+ return this . handleV3 ( layer as AbstractSentinelHubV3Layer , params , reqConfig ) ;
91
+ } else if ( layer . type === ' AbstractSentinelHubV1OrV2Layer' ) {
92
+ return this . handleV1orV2 ( layer as AbstractSentinelHubV1OrV2Layer , params , reqConfig ) ;
93
93
} else {
94
94
throw new Error ( 'Not supported' ) ;
95
95
}
0 commit comments