@@ -17,7 +17,7 @@ const FEATURE_SERVICE_MAP = {
1717 bounds : GetFeaturesByBoundsService ,
1818 buffer : GetFeaturesByBufferService ,
1919 geometry : GetFeaturesByGeometryService
20- }
20+ } ;
2121
2222/**
2323 * @class FeatureService
@@ -34,11 +34,11 @@ const FEATURE_SERVICE_MAP = {
3434 * @param {boolean } [options.withCredentials=false] - 请求是否携带 cookie。
3535 * @param {boolean } [options.crossOrigin] - 是否允许跨域请求。
3636 * @param {Object } [options.headers] - 请求头。
37+ * @param {boolean } [options.preferServer=false] - 当resultFormat=DataFormat.GEOJSON时,使用服务器直接返回geojson。
3738 * @extends {ServiceBase }
3839 * @usage
3940 */
4041export class FeatureService {
41-
4242 constructor ( url , options ) {
4343 this . url = url ;
4444 this . options = options || { } ;
@@ -59,7 +59,8 @@ export class FeatureService {
5959 withCredentials : me . options . withCredentials ,
6060 crossOrigin : me . options . crossOrigin ,
6161 headers : me . options . headers ,
62- format : resultFormat
62+ format : resultFormat ,
63+ preferServer : me . options . preferServer
6364 } ) ;
6465 return getFeaturesByIDsService . processAsync ( params , callback ) ;
6566 }
@@ -79,7 +80,8 @@ export class FeatureService {
7980 withCredentials : me . options . withCredentials ,
8081 crossOrigin : me . options . crossOrigin ,
8182 headers : me . options . headers ,
82- format : me . _processFormat ( resultFormat )
83+ format : me . _processFormat ( resultFormat ) ,
84+ preferServer : me . options . preferServer
8385 } ) ;
8486 return getFeaturesByBoundsService . processAsync ( params , callback ) ;
8587 }
@@ -99,7 +101,8 @@ export class FeatureService {
99101 withCredentials : me . options . withCredentials ,
100102 crossOrigin : me . options . crossOrigin ,
101103 headers : me . options . headers ,
102- format : me . _processFormat ( resultFormat )
104+ format : me . _processFormat ( resultFormat ) ,
105+ preferServer : me . options . preferServer
103106 } ) ;
104107 return getFeatureService . processAsync ( params , callback ) ;
105108 }
@@ -119,7 +122,8 @@ export class FeatureService {
119122 withCredentials : me . options . withCredentials ,
120123 crossOrigin : me . options . crossOrigin ,
121124 headers : me . options . headers ,
122- format : me . _processFormat ( resultFormat )
125+ format : me . _processFormat ( resultFormat ) ,
126+ preferServer : me . options . preferServer
123127 } ) ;
124128 return getFeatureBySQLService . processAsync ( params , callback ) ;
125129 }
@@ -139,7 +143,8 @@ export class FeatureService {
139143 withCredentials : me . options . withCredentials ,
140144 crossOrigin : me . options . crossOrigin ,
141145 headers : me . options . headers ,
142- format : me . _processFormat ( resultFormat )
146+ format : me . _processFormat ( resultFormat ) ,
147+ preferServer : me . options . preferServer
143148 } ) ;
144149 return getFeaturesByGeometryService . processAsync ( params , callback ) ;
145150 }
@@ -159,7 +164,7 @@ export class FeatureService {
159164 url = me . url ,
160165 dataSourceName = params . dataSourceName ,
161166 dataSetName = params . dataSetName ;
162- url = CommonUtil . urlPathAppend ( url , " datasources/" + dataSourceName + " /datasets/" + dataSetName ) ;
167+ url = CommonUtil . urlPathAppend ( url , ' datasources/' + dataSourceName + ' /datasets/' + dataSetName ) ;
163168
164169 var editFeatureService = new EditFeaturesService ( url , {
165170 proxy : me . options . proxy ,
@@ -182,7 +187,7 @@ export class FeatureService {
182187 url = me . url ,
183188 dataSourceName = params . dataSourceName ,
184189 dataSetName = params . dataSetName ;
185- url = CommonUtil . urlPathAppend ( url , " datasources/" + dataSourceName + " /datasets/" + dataSetName ) ;
190+ url = CommonUtil . urlPathAppend ( url , ' datasources/' + dataSourceName + ' /datasets/' + dataSetName ) ;
186191 var editFeatureService = new EditFeaturesService ( url , {
187192 proxy : me . options . proxy ,
188193 withCredentials : me . options . withCredentials ,
@@ -207,7 +212,7 @@ export class FeatureService {
207212 url = me . url ,
208213 dataSourceName = params . dataSourceName ,
209214 dataSetName = params . dataSetName ;
210- url = CommonUtil . urlPathAppend ( url , " datasources/" + dataSourceName + " /datasets/" + dataSetName ) ;
215+ url = CommonUtil . urlPathAppend ( url , ' datasources/' + dataSourceName + ' /datasets/' + dataSetName ) ;
211216 var featureAttachmentsService = new FeatureAttachmentsService ( url , {
212217 proxy : me . options . proxy ,
213218 withCredentials : me . options . withCredentials ,
@@ -233,7 +238,7 @@ export class FeatureService {
233238 url = me . url ,
234239 dataSourceName = params . dataSourceName ,
235240 dataSetName = params . dataSetName ;
236- url = CommonUtil . urlPathAppend ( url , " datasources/" + dataSourceName + " /datasets/" + dataSetName ) ;
241+ url = CommonUtil . urlPathAppend ( url , ' datasources/' + dataSourceName + ' /datasets/' + dataSetName ) ;
237242 var featureAttachmentsService = new FeatureAttachmentsService ( url , {
238243 proxy : me . options . proxy ,
239244 withCredentials : me . options . withCredentials ,
0 commit comments