Skip to content

Commit 6eb88a7

Browse files
author
潘卓然ParnDeedlit
committed
Merge branch 'smaryun' of https://github.com/MapGIS/WebClient-JavaScript into smaryun
2 parents ac49952 + d201b15 commit 6eb88a7

File tree

10 files changed

+231
-29
lines changed

10 files changed

+231
-29
lines changed

src/service/ServiceBase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ServiceBase {
7171
} else {
7272
me.domainStr = me.domain;
7373
}
74-
74+
7575
url.push(encodeURI((me.domainStr + '/' + me.baseUrl + '/' + _partUrl).trim()));
7676
}
7777
}
@@ -90,4 +90,4 @@ class ServiceBase {
9090

9191
}
9292
export {ServiceBase};
93-
Zondy.Service.ServiceBase = ServiceBase;
93+
Zondy.Service.ServiceBase = ServiceBase;

src/service/baseserver/IServiceBase.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { CommonServiceBase } from './CommonServiceBase';
33

44
class IgsServiceBase extends CommonServiceBase {
55
constructor(url, options) {
6-
var options = options || {};
6+
options = options || {};
77
super(url, options);
88
this.CLASS_NAME = 'Zondy.IgsServiceBase';
99
}
10+
1011
destroy() {
1112
super.destroy();
1213
var me = this;
@@ -18,6 +19,7 @@ class IgsServiceBase extends CommonServiceBase {
1819
me.eventListeners = null;
1920
}
2021
}
22+
2123
/**
2224
* @function MapService.prototype.processAsync
2325
* @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
@@ -34,12 +36,10 @@ class IgsServiceBase extends CommonServiceBase {
3436
});
3537
}
3638

37-
/*
38-
* Method: serviceProcessCompleted
39-
* 获取地图状态完成,执行此方法。
40-
*
41-
* Parameters:
42-
* result - {Object} 服务器返回的结果对象。
39+
/**
40+
* @function serviceProcessCompleted
41+
* @description 获取地图状态完成,执行此方法。
42+
* @param {Object} result 服务器返回的结果对象。
4343
*/
4444
serviceProcessCompleted(result) {
4545
var me = this;
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
import Qs from 'qs';
2+
3+
import { ServiceBase } from '../ServiceBase';
4+
import { IgsServiceBase } from '../baseserver/IServiceBase';
5+
6+
/**
7+
* @class module:CloudDisk.CloudDiskService
8+
* @description 云工作空间的基础服务
9+
* @author 基础平台-潘卓然
10+
*/
11+
export class CloudDiskService extends ServiceBase {
12+
constructor(options) {
13+
super(options);
14+
this.fixParams(options);
15+
}
16+
17+
fixParams(option) {
18+
this.params = option;
19+
delete this.params.url;
20+
delete this.params.ip;
21+
delete this.params.port;
22+
delete this.params.domain;
23+
delete this.params.baseUrl;
24+
delete this.params.networkProtocol;
25+
delete this.params.partUrl;
26+
}
27+
28+
/**
29+
* @function module:DataStore.DataStoreService.prototype.getBaseUrl
30+
* @description 获取基地址url
31+
*/
32+
getBaseUrl() {
33+
let url = '';
34+
const { baseUrl, ip, port, domain, networkProtocol } = this;
35+
if (baseUrl) {
36+
url = baseUrl;
37+
} else if (domain) {
38+
url = domain;
39+
} else if (networkProtocol && ip && port) {
40+
url = `${networkProtocol}://${ip}:${port}`;
41+
}
42+
return url;
43+
}
44+
45+
/**
46+
* @function module:DataStore.DataStoreService.prototype.getFullUrl
47+
* @description 获取完整的url地址
48+
* @param {String}
49+
* @param {Object}
50+
* 可以使用SpaceTimeQueryByAgg.query方法,也可以使用axios,jquery进行请求
51+
*/
52+
getFullUrl(serviceurl, options) {
53+
let baseurl = this.getBaseUrl();
54+
let url = baseurl + serviceurl + '?' + Qs.stringify(options);
55+
return url;
56+
}
57+
58+
/**
59+
* @description 向服务器发送GET请求
60+
* @function module:DataStore.DataStoreService.prototype.get
61+
* @param {String} url 完整的请求地址。
62+
* @param {Function} onSuccess 查询成功回调函数。
63+
* @param {Function} onError 查询失败回调函数。
64+
*/
65+
get(url, onSuccess, onError) {
66+
var me = this;
67+
var service = new IgsServiceBase(url, {
68+
eventListeners: {
69+
scope: me,
70+
processCompleted: onSuccess,
71+
processFailed: onError
72+
}
73+
});
74+
service.processAsync();
75+
}
76+
77+
/**
78+
* @description 向服务器发送POST请求
79+
* @function module:DataStore.DataStoreService.prototype.post
80+
* @param {String} url 完整的请求地址。
81+
* @param {Function} onSuccess 查询成功回调函数。
82+
* @param {Function} onError 查询失败回调函数。
83+
*/
84+
post(url, param, onSuccess, onError) {
85+
var me = this;
86+
var service = new IgsServiceBase(url, {
87+
eventListeners: {
88+
scope: me,
89+
processCompleted: onSuccess,
90+
processFailed: onError
91+
}
92+
});
93+
service.processAsync({
94+
method: 'POST',
95+
data: JSON.stringify(param),
96+
headers: { 'Content-Type': 'text/plain;charset=UTF-8' }
97+
});
98+
}
99+
}
100+
101+
export default CloudDiskService;
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import Qs from 'qs';
2+
3+
import { Zondy } from '../../../common/Base';
4+
import { CloudDiskService } from '../../ServiceBase';
5+
6+
const SchemaPath = 'schema';
7+
const StatisticsPath = 'featureclass/statistics';
8+
9+
/**
10+
* @class module:CloudDisk.GisCore.GeoDatasetService
11+
* @description DataStore的云盘数据转换服务
12+
* @see 该方法强依赖java版本的mapgis.so动态库
13+
* @author 基础平台-潘卓然
14+
*/
15+
export class GeoDatasetService extends CloudDiskService {
16+
constructor(options) {
17+
super(options);
18+
/**
19+
* @member module:CloudDisk.GeoDatasetService.prototype.serviceUrl
20+
* @description 服务地址
21+
*/
22+
this.serviceUrl = '/giscore/dataconvert/rest/geodataset/';
23+
}
24+
25+
/**
26+
* @private 修正get/post需要的真正参数
27+
*/
28+
fixOption(option) {
29+
this.option = {
30+
};
31+
}
32+
33+
/**
34+
* @function module:CloudDisk.GeoDatasetService.prototype.schema
35+
* @param {Object} options 请求参数
36+
* @param {String} [options.epsg] 完整的请求地址。
37+
* @param {String} options.gdbp 完整的请求地址。
38+
* @param {Function} onSuccess 成功回调
39+
* @param {Function} onError 失败回调
40+
* @link http://192.168.199.53:9011/giscore/dataconvert/rest/geodataset/schema?
41+
*/
42+
schema(options, onSuccess, onError) {
43+
let { serviceUrl, option } = this;
44+
serviceUrl += SchemaPath;
45+
let url = this.getFullUrl(serviceUrl, options);
46+
this.get(url, onSuccess, onError);
47+
}
48+
49+
/**
50+
* @function module:CloudDisk.GeoDatasetService.prototype.statistics
51+
* @param {Object} options 请求参数
52+
* @param {String} options.gdbp 要素GDBP地址
53+
* @param {String} options.statisticFields 统计字段
54+
* @param {String} [options.pageSize = 100] 获取的数据量
55+
* @param {Function} onSuccess 成功回调
56+
* @param {Function} onError 失败回调
57+
* @link http://192.168.199.53:9011/giscore/dataconvert/rest/geodataset/featureclass/statistics?
58+
* @example
59+
[{"field":"USER_ID","statisticTypes":[“max","min","avg”]},{"field":"GB","statisticTypes":[“unique”]}]
60+
unique(唯一值),count(计数),min(最小值),max(最大),avg(平均),sum(求和)
61+
const obj =[{field:name, statisticTypes: ["max", "min"] }];
62+
statistics({ gdbp: gdbp, statisticFields: JSON.stringify(obj)});
63+
*/
64+
statistics(options, onSuccess, onError) {
65+
let { serviceUrl, option } = this;
66+
serviceUrl += StatisticsPath;
67+
let url = this.getFullUrl(serviceUrl, options);
68+
this.get(url, onSuccess, onError);
69+
}
70+
71+
}
72+
73+
export default GeoDatasetService;
74+
Zondy.CloudDisk.GisCore.GeoDatasetService = GeoDatasetService;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @module
3+
*/
4+
import { GeoDatasetService } from './geodataset';
5+
6+
export { GeoDatasetService };
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @module CloudDisk
3+
*/
4+
import { GeoDatasetService } from './geodataset/index.js';
5+
6+
export { GeoDatasetService };

src/service/clouddisk/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { GeoDatasetService } from './giscore';
2+
3+
export { GeoDatasetService };

src/service/common/Base.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ Zondy.DataStore.PostGIS = Zondy.DataStore.PostGIS || {};
4747
Zondy.DataStore.Hbase = Zondy.DataStore.Hbase || {};
4848
Zondy.DataStore.MongoDB = Zondy.DataStore.MongoDB || {};
4949

50+
Zondy.CloudDisk = Zondy.CloudDisk || {};
51+
Zondy.CloudDisk.GisCore = Zondy.CloudDisk.GisCore || {};
52+
5053
Zondy.IGServerX = Zondy.IGServerX || {};
5154
Zondy.IGServerX.Vector = Zondy.IGServerX.Vector || {};
5255

src/service/datastore/elasticsearch/BaseDefine.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ let SPACE_ENUM_POLYGON = "polygon";
5050

5151
export { PARAM_SUB, SPACE_ENUM_POLYGON, PARAM_COMMA, PARAM_SPLIT, PARAM_BRACKET_LEFT, PARAM_SPACE, PARAM_BRACKET_RIGHT };
5252

53-
Zondy.BaseDefine.PARAM_SUB = PARAM_SUB
54-
Zondy.BaseDefine.SPACE_ENUM_POLYGON = SPACE_ENUM_POLYGON
55-
Zondy.BaseDefine.PARAM_COMMA = PARAM_COMMA
56-
Zondy.BaseDefine.PARAM_SPLIT = PARAM_SPLIT
57-
Zondy.BaseDefine.PARAM_BRACKET_LEFT = PARAM_BRACKET_LEFT
58-
Zondy.BaseDefine.PARAM_SPACE = PARAM_SPACE
59-
Zondy.BaseDefine.PARAM_BRACKET_RIGHT = PARAM_BRACKET_RIGHT
53+
Zondy.BaseDefine.PARAM_SUB = PARAM_SUB;
54+
Zondy.BaseDefine.SPACE_ENUM_POLYGON = SPACE_ENUM_POLYGON;
55+
Zondy.BaseDefine.PARAM_COMMA = PARAM_COMMA;
56+
Zondy.BaseDefine.PARAM_SPLIT = PARAM_SPLIT;
57+
Zondy.BaseDefine.PARAM_BRACKET_LEFT = PARAM_BRACKET_LEFT;
58+
Zondy.BaseDefine.PARAM_SPACE = PARAM_SPACE;
59+
Zondy.BaseDefine.PARAM_BRACKET_RIGHT = PARAM_BRACKET_RIGHT;

src/service/index.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ import {
191191
NetAnalyse,
192192
NetAnalysisExtent,
193193
SlopLineParam
194-
} from './extend';
194+
} from './Igserver/extend';
195195

196196
export const Extend = {
197197
ContourNoteParam,
@@ -204,7 +204,7 @@ export const Extend = {
204204
SlopLineParam
205205
};
206206

207-
import { G3DMapDoc, G3DService } from './G3D';
207+
import { G3DMapDoc, G3DService } from './Igserver/G3D';
208208

209209
export const G3D = {
210210
G3DMapDoc,
@@ -223,7 +223,7 @@ export const BaseServer = {
223223
JSONFormat
224224
};
225225

226-
import { ColorInfo, GDBInfo, MapDoc, CatalogService, TileLayer, VectorLayer, SystomInfo } from './MRCS';
226+
import { ColorInfo, GDBInfo, MapDoc, CatalogService, TileLayer, VectorLayer, SystomInfo } from './Igserver/MRCS';
227227

228228
export const MRCS = {
229229
ColorInfo,
@@ -252,7 +252,7 @@ import {
252252
QueryParameterBase,
253253
QueryServiceBase,
254254
QueryUnifyParameter
255-
} from './MRFS';
255+
} from './Igserver/MRFS';
256256

257257
export const MRFS = {
258258
EditDocFeature,
@@ -293,7 +293,7 @@ import {
293293
ProjectBase,
294294
ProjectByLayer,
295295
ProjectBySRID
296-
} from './MRFWS';
296+
} from './Igserver/MRFWS';
297297

298298
export const MRFWS = {
299299
AnalysisBase,
@@ -328,7 +328,7 @@ import {
328328
ProjectRang,
329329
Smooth,
330330
TopAnalysis
331-
} from './MRGS';
331+
} from './Igserver/MRGS';
332332

333333
export const MRGS = {
334334
CalArea,
@@ -343,7 +343,7 @@ export const MRGS = {
343343
TopAnalysis
344344
};
345345

346-
import { GetDocImageService, GetLayerImageService, GetMapImageService, GetMapInfoService, GetTileImageService, MapServiceBase } from './MRMS';
346+
import { GetDocImageService, GetLayerImageService, GetMapImageService, GetMapInfoService, GetTileImageService, MapServiceBase } from './Igserver/MRMS';
347347

348348
export const MRMS = {
349349
GetDocImageService,
@@ -383,7 +383,7 @@ import {
383383
ItemValue,
384384
ThemeOper,
385385
ThemesInfo
386-
} from './theme';
386+
} from './Igserver/theme';
387387

388388
export const Info = {
389389
CAllOtherDataItemInfoSource,
@@ -417,18 +417,18 @@ export const Info = {
417417
};
418418

419419
import { WMSCapabilities, WMTSCapabilities, OGCWMTSInfo, OGCWMSInfo } from './OGC';
420-
import { WMS, WFS } from './OpenGeospatialConsortium';
421420

422421
export const OGC = {
423422
WMSCapabilities,
424423
WMTSCapabilities,
425424
OGCWMTSInfo,
426425
OGCWMSInfo,
427-
WMS,
428-
WFS
429426
};
430427

431-
import { EsCatlogType, EsCatlogName, EsGeoHashType, EsCatlogService, ESGeoCode, ESGeoDecode, ESQueryStats, EsTableService, EsSpaceTimeQueryByAgg } from './datastore/elasticsearch';
428+
import {
429+
EsCatlogType,
430+
EsCatlogName, EsGeoHashType, EsCatlogService, ESGeoCode, ESGeoDecode, ESQueryStats, EsTableService, EsSpaceTimeQueryByAgg } from './datastore/elasticsearch';
431+
432432
import {
433433
PostgisCatlogService,
434434
PostgisCustomQueryService,
@@ -469,6 +469,14 @@ export const DataStore = {
469469
EsSpaceTimeQueryByAgg
470470
};
471471

472+
import {
473+
GeoDatasetService
474+
} from './clouddisk';
475+
476+
export const CloudDisk = {
477+
GeoDatasetService
478+
};
479+
472480
import {
473481
ArcGisFeatureLayer,
474482
ArcGisFindParameters,
@@ -484,7 +492,8 @@ import {
484492
ArcGisPolygon,
485493
ArcGisGraphic,
486494
ArcGisExtent
487-
} from './ArcGis'
495+
} from './ArcGis';
496+
488497
export const ArcGis = {
489498
ArcGisFeatureLayer,
490499
ArcGisFindParameters,

0 commit comments

Comments
 (0)