@@ -4,9 +4,7 @@ import { FetchRequest } from '../../../src/common/util/FetchRequest';
44import Polygon from 'ol/geom/Polygon' ;
55
66var featureServiceURL = 'http://supermap:8090/iserver/services/data-world/rest/data' ;
7- var options = {
8-
9- } ;
7+ var options = { } ;
108describe ( 'openlayers_FeatureService_getFeaturesByBuffer' , ( ) => {
119 var serviceResult = null ;
1210 var originalTimeout ;
@@ -127,68 +125,4 @@ describe('openlayers_FeatureService_getFeaturesByBuffer', () => {
127125 done ( ) ;
128126 } ) ;
129127 } ) ;
130- it ( 'MetricsAggParameter' , done => {
131- var aggregations = new SuperMap . MetricsAggParameter ( { aggName : 'test' , aggFieldName : 'SMID' } ) ;
132- var polygon = new Polygon ( [
133- [
134- [ - 20 , 20 ] ,
135- [ - 20 , - 20 ] ,
136- [ 20 , - 20 ] ,
137- [ 20 , 20 ] ,
138- [ - 20 , 20 ]
139- ]
140- ] ) ;
141- var bufferParam = new GetFeaturesByBufferParameters ( {
142- datasetNames : [ 'World:Capitals' ] ,
143- bufferDistance : 10 ,
144- geometry : polygon ,
145- targetPrj : { epsgCode : 4326 } ,
146- aggregations : aggregations
147- } ) ;
148- var getFeaturesByBuffeService = new FeatureService ( featureServiceURL , options ) ;
149- spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
150- var paramsObj = JSON . parse ( params . replace ( / ' / g, '"' ) ) ;
151- expect ( paramsObj . aggregations . aggName ) . toEqual ( 'test' ) ;
152- expect ( paramsObj . aggregations . aggFieldName ) . toEqual ( 'SMID' ) ;
153- expect ( paramsObj . aggregations . aggType ) . toEqual ( 'avg' ) ;
154- return Promise . resolve ( new Response ( JSON . stringify ( getFeaturesResultJson ) ) ) ;
155- } ) ;
156- getFeaturesByBuffeService . getFeaturesByBuffer ( bufferParam , result => {
157- serviceResult = result ;
158- bufferParam . destroy ( ) ;
159- done ( ) ;
160- } ) ;
161- } ) ;
162- it ( 'GeoHashGridAggParameter' , done => {
163- var aggregations = new SuperMap . GeoHashGridAggParameter ( { aggName : 'test' , aggFieldName : 'SMID' } ) ;
164- var polygon = new Polygon ( [
165- [
166- [ - 20 , 20 ] ,
167- [ - 20 , - 20 ] ,
168- [ 20 , - 20 ] ,
169- [ 20 , 20 ] ,
170- [ - 20 , 20 ]
171- ]
172- ] ) ;
173- var bufferParam = new GetFeaturesByBufferParameters ( {
174- datasetNames : [ 'World:Capitals' ] ,
175- bufferDistance : 10 ,
176- geometry : polygon ,
177- targetPrj : { epsgCode : 4326 } ,
178- aggregations : aggregations
179- } ) ;
180- var getFeaturesByBuffeService = new FeatureService ( featureServiceURL , options ) ;
181- spyOn ( FetchRequest , 'commit' ) . and . callFake ( ( method , testUrl , params , options ) => {
182- var paramsObj = JSON . parse ( params . replace ( / ' / g, '"' ) ) ;
183- expect ( paramsObj . aggregations . aggName ) . toEqual ( 'test' ) ;
184- expect ( paramsObj . aggregations . aggFieldName ) . toEqual ( 'SMID' ) ;
185- expect ( paramsObj . aggregations . aggType ) . toEqual ( 'geohash_grid' ) ;
186- return Promise . resolve ( new Response ( JSON . stringify ( getFeaturesResultJson ) ) ) ;
187- } ) ;
188- getFeaturesByBuffeService . getFeaturesByBuffer ( bufferParam , result => {
189- serviceResult = result ;
190- bufferParam . destroy ( ) ;
191- done ( ) ;
192- } ) ;
193- } ) ;
194128} ) ;
0 commit comments