1
- import { SurfaceAnalystService } from '../../../src/common/iServer/SurfaceAnalystService' ;
2
- import { DatasetSurfaceAnalystParameters } from '../../../src/common/iServer/DatasetSurfaceAnalystParameters' ;
3
- import { GeometrySurfaceAnalystParameters } from '../../../src/common/iServer/GeometrySurfaceAnalystParameters' ;
4
- import { SurfaceAnalystParametersSetting } from '../../../src/common/iServer/SurfaceAnalystParametersSetting' ;
5
- import { DataReturnOption } from '../../../src/common/iServer/DataReturnOption' ;
6
- import { Util } from '../../../src/common/commontypes/Util' ;
7
- import { Point } from '../../../src/common/commontypes/geometry/Point' ;
8
- import { SmoothMethod } from '../../../src/common/REST' ;
9
- import { SurfaceAnalystMethod } from '../../../src/common/REST' ;
10
- import { FetchRequest } from '../../../src/common/util/FetchRequest' ;
1
+ import {
2
+ SurfaceAnalystService
3
+ } from '../../../src/common/iServer/SurfaceAnalystService' ;
4
+ import {
5
+ DatasetSurfaceAnalystParameters
6
+ } from '../../../src/common/iServer/DatasetSurfaceAnalystParameters' ;
7
+ import {
8
+ GeometrySurfaceAnalystParameters
9
+ } from '../../../src/common/iServer/GeometrySurfaceAnalystParameters' ;
10
+ import {
11
+ SurfaceAnalystParametersSetting
12
+ } from '../../../src/common/iServer/SurfaceAnalystParametersSetting' ;
13
+ import {
14
+ DataReturnOption
15
+ } from '../../../src/common/iServer/DataReturnOption' ;
16
+ import {
17
+ Util
18
+ } from '../../../src/common/commontypes/Util' ;
19
+ import {
20
+ Point
21
+ } from '../../../src/common/commontypes/geometry/Point' ;
22
+ import {
23
+ SmoothMethod
24
+ } from '../../../src/common/REST' ;
25
+ import {
26
+ SurfaceAnalystMethod
27
+ } from '../../../src/common/REST' ;
28
+ import {
29
+ FetchRequest
30
+ } from '../../../src/common/util/FetchRequest' ;
11
31
12
32
var spatialAnalystURL = "http://supermap:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst" ;
13
- var surfaceAnalystEventArgsSystem = null , serviceFailedEventArgsSystem = null ;
33
+ var surfaceAnalystEventArgsSystem = null ,
34
+ serviceFailedEventArgsSystem = null ;
14
35
var surfaceAnalystCompleted = ( surfaceAnalystEventArgs ) => {
15
36
surfaceAnalystEventArgsSystem = surfaceAnalystEventArgs ;
16
37
} ;
@@ -55,16 +76,18 @@ describe('SurfaceAnalystService', () => {
55
76
resolution : 3000 ,
56
77
zValueFieldName : "AVG_TMP" ,
57
78
surfaceAnalystMethod : SurfaceAnalystMethod . ISOLINE ,
58
- resultSetting : new DataReturnOption ( { expectCount : 1 } )
79
+ resultSetting : new DataReturnOption ( {
80
+ expectCount : 1
81
+ } )
59
82
} ) ;
60
83
var surfaceAnalystService = initSurfaceService ( ) ;
61
84
expect ( surfaceAnalystService ) . not . toBeNull ( ) ;
62
85
expect ( surfaceAnalystService . url ) . toEqual ( spatialAnalystURL ) ;
63
86
spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
64
87
expect ( method ) . toBe ( 'POST' ) ;
65
88
expect ( testUrl ) . toBe ( spatialAnalystURL + "/datasets/SamplesP@Interpolation/isoline.json?returnContent=true" ) ;
66
- // var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':0,'interval':2,'resampleTolerance':0,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_TMP\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}";
67
- // expect(params).toBe(expectParams);
89
+ var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':0,'interval':2,'resampleTolerance':0,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_TMP\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}" ;
90
+ expect ( params ) . toBe ( expectParams ) ;
68
91
expect ( options ) . not . toBeNull ( ) ;
69
92
return Promise . resolve ( new Response ( surfaceAnalystEscapedJson ) ) ;
70
93
} ) ;
@@ -117,13 +140,15 @@ describe('SurfaceAnalystService', () => {
117
140
resolution : 3000 ,
118
141
zValueFieldName : "AVG_WTR" ,
119
142
surfaceAnalystMethod : SurfaceAnalystMethod . ISOREGION ,
120
- resultSetting : new DataReturnOption ( { expectCount : 1 } )
143
+ resultSetting : new DataReturnOption ( {
144
+ expectCount : 1
145
+ } )
121
146
} ) ;
122
147
spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
123
148
expect ( method ) . toBe ( 'POST' ) ;
124
149
expect ( testUrl ) . toBe ( spatialAnalystURL + "/datasets/SamplesP@Interpolation/isoregion.json?returnContent=true" ) ;
125
- // var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':70,'interval':100,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_WTR\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}";
126
- // expect(params).toBe(expectParams);
150
+ var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':70,'interval':100,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'zValueFieldName':\"AVG_WTR\",'filterQueryParameter':{'attributeFilter':null,'name':null,'joinItems':null,'linkItems':null,'ids':null,'orderBy':null,'groupBy':null,'fields':null}}" ;
151
+ expect ( params ) . toBe ( expectParams ) ;
127
152
expect ( options ) . not . toBeNull ( ) ;
128
153
return Promise . resolve ( new Response ( surfaceAnalysis_Dataset_ISOREGION ) ) ;
129
154
} ) ;
@@ -172,8 +197,10 @@ describe('SurfaceAnalystService', () => {
172
197
spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
173
198
expect ( method ) . toBe ( 'POST' ) ;
174
199
expect ( testUrl ) . toBe ( spatialAnalystURL + "/geometry/isoline.json?returnContent=true" ) ;
175
- var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':-3,'interval':0.5,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'surfaceAnalystMethod':\"ISOLINE\",'points':[{'id':\"SuperMap.Geometry_1\",'bounds':null,'SRID':null,'x':-4000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_2\",'bounds':null,'SRID':null,'x':-4500,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_3\",'bounds':null,'SRID':null,'x':-3000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_4\",'bounds':null,'SRID':null,'x':-3000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_5\",'bounds':null,'SRID':null,'x':-2500,'y':2500,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_6\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_7\",'bounds':null,'SRID':null,'x':-2000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_8\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_9\",'bounds':null,'SRID':null,'x':2000,'y':4000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_10\",'bounds':null,'SRID':null,'x':0,'y':0,'tag':null,'type':\"Point\"}],'zValues':[-3,-2,0,-1,-3,0,1,0,1,1]}" ;
176
- expect ( params ) . toBe ( expectParams ) ;
200
+ var paramsObj = JSON . parse ( params . replace ( / ' / g, "\"" ) ) ;
201
+ expect ( paramsObj . extractParameter . resampleTolerance ) . toBe ( 0.7 ) ;
202
+ expect ( paramsObj . resolution ) . toBe ( 3000 ) ;
203
+ expect ( paramsObj . surfaceAnalystMethod ) . toBe ( SurfaceAnalystMethod . ISOLINE ) ;
177
204
expect ( options ) . not . toBeNull ( ) ;
178
205
return Promise . resolve ( new Response ( surfaceAnalysis_Geometry_ISOLINE ) ) ;
179
206
} ) ;
@@ -225,8 +252,10 @@ describe('SurfaceAnalystService', () => {
225
252
spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
226
253
expect ( method ) . toBe ( 'POST' ) ;
227
254
expect ( testUrl ) . toBe ( spatialAnalystURL + "/geometry/isoregion.json?returnContent=true" ) ;
228
- var expectParams = "{'resolution':3000,'extractParameter':{'datumValue':-3,'interval':0.5,'resampleTolerance':0.7,'smoothMethod':\"BSPLINE\",'smoothness':3},'resultSetting':{'expectCount':1,'dataset':null,'dataReturnMode':\"RECORDSET_ONLY\",'deleteExistResultDataset':true},'surfaceAnalystMethod':\"ISOREGION\",'points':[{'id':\"SuperMap.Geometry_1\",'bounds':null,'SRID':null,'x':-4000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_2\",'bounds':null,'SRID':null,'x':-4500,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_3\",'bounds':null,'SRID':null,'x':-3000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_4\",'bounds':null,'SRID':null,'x':-3000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_5\",'bounds':null,'SRID':null,'x':-2500,'y':2500,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_6\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_7\",'bounds':null,'SRID':null,'x':-2000,'y':3000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_8\",'bounds':null,'SRID':null,'x':-2000,'y':2000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_9\",'bounds':null,'SRID':null,'x':2000,'y':4000,'tag':null,'type':\"Point\"},{'id':\"SuperMap.Geometry_10\",'bounds':null,'SRID':null,'x':0,'y':0,'tag':null,'type':\"Point\"}],'zValues':[-3,0,10,20,13,8,5,20,10,15]}" ;
229
- expect ( params ) . toBe ( expectParams ) ;
255
+ var paramsObj = JSON . parse ( params . replace ( / ' / g, "\"" ) ) ;
256
+ expect ( paramsObj . extractParameter . resampleTolerance ) . toBe ( 0.7 ) ;
257
+ expect ( paramsObj . resolution ) . toBe ( 3000 ) ;
258
+ expect ( paramsObj . surfaceAnalystMethod ) . toBe ( SurfaceAnalystMethod . ISOREGION ) ;
230
259
expect ( options ) . not . toBeNull ( ) ;
231
260
return Promise . resolve ( new Response ( surfaceAnalysis_Geometry_ISOREGION ) ) ;
232
261
} ) ;
@@ -278,6 +307,4 @@ describe('SurfaceAnalystService', () => {
278
307
done ( ) ;
279
308
} , 1000 ) ;
280
309
} )
281
- } ) ;
282
-
283
-
310
+ } ) ;
0 commit comments