@@ -19,15 +19,9 @@ ol.inherits(ol.supermap.GetFeaturesService, ol.supermap.ServiceBase);
1919 * 数据集ID查询服务
2020 * @param params
2121 */
22- ol . supermap . GetFeaturesService . prototype . getFeaturesByIDsService = function ( params ) {
22+ ol . supermap . GetFeaturesService . prototype . getFeaturesByIDs = function ( params ) {
2323 var me = this , param = me . _processParams ( params ) ;
24- var getFeaturesByIDsParameters = new SuperMap . REST . GetFeaturesByIDsParameters ( {
25- returnContent : param . returnContent ,
26- datasetNames : param . dataSetNames ,
27- fromIndex : param . fromIndex ,
28- toIndex : param . toIndex ,
29- IDs : param . IDs
30- } ) ;
24+ var getFeaturesByIDsParameters = new SuperMap . REST . GetFeaturesByIDsParameters ( param ) ;
3125 var getFeaturesByIDsService = new SuperMap . REST . GetFeaturesByIDsService ( me . options . url , {
3226 eventListeners : {
3327 scope : me ,
@@ -43,25 +37,9 @@ ol.supermap.GetFeaturesService.prototype.getFeaturesByIDsService = function (par
4337 * 数据集Bounds查询服务
4438 * @param params
4539 */
46- ol . supermap . GetFeaturesService . prototype . getFeaturesByBoundsService = function ( params ) {
47- var me = this , param = me . _processParams ( params ) , bounds = params . bounds , spatialQueryMode ;
48- bounds = new SuperMap . Bounds (
49- params . bounds [ 0 ] ,
50- params . bounds [ 1 ] ,
51- params . bounds [ 2 ] ,
52- params . bounds [ 3 ]
53- ) ;
54- spatialQueryMode = ( param . spatialQueryMode ) ? param . spatialQueryMode : SuperMap . REST . SpatialQueryMode . CONTAIN ;
55- var getFeaturesByBoundsParameters = new SuperMap . REST . GetFeaturesByBoundsParameters ( {
56- bounds : bounds ,
57- spatialQueryMode : spatialQueryMode ,
58- datasetNames : param . dataSetNames ,
59-
60- returnContent : param . returnContent ,
61- fromIndex : param . fromIndex ,
62- toIndex : param . toIndex
63-
64- } ) ;
40+ ol . supermap . GetFeaturesService . prototype . getFeaturesByBounds = function ( params ) {
41+ var me = this , param = me . _processParams ( params ) ;
42+ var getFeaturesByBoundsParameters = new SuperMap . REST . GetFeaturesByBoundsParameters ( param ) ;
6543 var getFeaturesByBoundsService = new SuperMap . REST . GetFeaturesByBoundsService ( me . options . url , {
6644 eventListeners : {
6745 scope : me ,
@@ -76,20 +54,9 @@ ol.supermap.GetFeaturesService.prototype.getFeaturesByBoundsService = function (
7654 * 数据集Buffer查询服务
7755 * @param params
7856 */
79- ol . supermap . GetFeaturesService . prototype . getFeaturesByBufferService = function ( params ) {
80- var me = this , geometry , param = me . _processParams ( params ) ;
81- if ( param && param . geometry && param . geometry instanceof ol . geom . Geometry ) {
82- geometry = ol . supermap . Util . toSuperMapGeometry ( JSON . parse ( ( new ol . format . GeoJSON ( ) ) . writeGeometry ( param . geometry ) ) ) ;
83- }
84- var getFeatureByBufferParameter = new SuperMap . REST . GetFeaturesByBufferParameters ( {
85- geometry : geometry ,
86- bufferDistance : param . bufferDistance ,
87- datasetNames : param . dataSetNames ,
88-
89- returnContent : param . returnContent ,
90- fromIndex : param . fromIndex ,
91- toIndex : param . toIndex
92- } ) ;
57+ ol . supermap . GetFeaturesService . prototype . getFeaturesByBuffer = function ( params ) {
58+ var me = this , param = me . _processParams ( params ) ;
59+ var getFeatureByBufferParameter = new SuperMap . REST . GetFeaturesByBufferParameters ( param ) ;
9360 var getFeatureService = new SuperMap . REST . GetFeaturesByBufferService ( me . options . url , {
9461 eventListeners : {
9562 scope : me ,
@@ -104,20 +71,10 @@ ol.supermap.GetFeaturesService.prototype.getFeaturesByBufferService = function (
10471 * 数据集SQL查询服务
10572 * @param params
10673 */
107- ol . supermap . GetFeaturesService . prototype . getFeaturesBySQLService = function ( params ) {
74+ ol . supermap . GetFeaturesService . prototype . getFeaturesBySQL = function ( params ) {
10875 var me = this , param = me . _processParams ( params ) ;
109- var getFeatureParam = new SuperMap . REST . FilterParameter ( {
110- name : param . name ,
111- attributeFilter : param . attributeFilter
112- } ) ;
113- var getFeatureBySQLParams = new SuperMap . REST . GetFeaturesBySQLParameters ( {
114- queryParameter : getFeatureParam ,
115- datasetNames : param . dataSetNames ,
116-
117- returnContent : param . returnContent ,
118- fromIndex : param . fromIndex ,
119- toIndex : param . fromIndex
120- } ) ;
76+ param . queryParameter = new SuperMap . REST . FilterParameter ( param ) ;
77+ var getFeatureBySQLParams = new SuperMap . REST . GetFeaturesBySQLParameters ( param ) ;
12178 var getFeatureBySQLService = new SuperMap . REST . GetFeaturesBySQLService ( me . options . url , {
12279 eventListeners : {
12380 scope : me ,
@@ -133,21 +90,9 @@ ol.supermap.GetFeaturesService.prototype.getFeaturesBySQLService = function (par
13390 * 数据集几何查询服务类
13491 * @param params
13592 */
136- ol . supermap . GetFeaturesService . prototype . getFeaturesByGeometryService = function ( params ) {
137- var me = this , geometry , spatialQueryMode , param = me . _processParams ( params ) ;
138- if ( param && param . geometry && param . geometry instanceof ol . geom . Geometry ) {
139- geometry = ol . supermap . Util . toSuperMapGeometry ( JSON . parse ( ( new ol . format . GeoJSON ( ) ) . writeGeometry ( param . geometry ) ) ) ;
140- }
141- spatialQueryMode = ( param . spatialQueryMode ) ? param . spatialQueryMode : SuperMap . REST . SpatialQueryMode . CONTAIN ;
142- var getFeaturesByGeometryParameters = new SuperMap . REST . GetFeaturesByGeometryParameters ( {
143- spatialQueryMode : spatialQueryMode ,
144- geometry : geometry ,
145- datasetNames : param . dataSetNames ,
146-
147- returnContent : param . returnContent ,
148- fromIndex : param . fromIndex ,
149- toIndex : param . toIndex
150- } ) ;
93+ ol . supermap . GetFeaturesService . prototype . getFeaturesByGeometry = function ( params ) {
94+ var me = this , param = me . _processParams ( params ) ;
95+ var getFeaturesByGeometryParameters = new SuperMap . REST . GetFeaturesByGeometryParameters ( param ) ;
15196 var getFeaturesByGeometryService = new SuperMap . REST . GetFeaturesByGeometryService ( me . options . url , {
15297 eventListeners : {
15398 scope : me ,
@@ -158,14 +103,27 @@ ol.supermap.GetFeaturesService.prototype.getFeaturesByGeometryService = function
158103 getFeaturesByGeometryService . processAsync ( getFeaturesByGeometryParameters ) ;
159104 return me ;
160105} ;
106+
161107ol . supermap . GetFeaturesService . prototype . _processParams = function ( params ) {
162108 if ( ! params ) {
163109 return { } ;
164110 }
165111 params . returnContent = ( params . returnContent == null ) ? true : params . returnContent ;
112+ params . datasetNames = params . dataSetNames ;
166113 params . fromIndex = params . fromIndex ? params . fromIndex : 0 ;
167114 params . toIndex = params . fromIndex ? params . fromIndex : - 1 ;
115+ if ( params . bounds ) {
116+ params . bounds = new SuperMap . Bounds (
117+ params . bounds [ 0 ] ,
118+ params . bounds [ 1 ] ,
119+ params . bounds [ 2 ] ,
120+ params . bounds [ 3 ]
121+ ) ;
122+ }
123+ if ( params . geometry ) {
124+ params . geometry = ol . supermap . Util . toSuperMapGeometry ( JSON . parse ( ( new ol . format . GeoJSON ( ) ) . writeGeometry ( params . geometry ) ) ) ;
125+ }
168126 return params ;
169- } ;
127+ }
170128
171129module . exports = ol . supermap . GetFeaturesService ;
0 commit comments