Skip to content

Commit

Permalink
【update】common依赖@supermap/iclient-common
Browse files Browse the repository at this point in the history
  • Loading branch information
songyumeng committed May 14, 2024
1 parent c169414 commit 490b84f
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 39 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"dependencies": {
"@mapbox/point-geometry": "^0.1.0",
"@supermap/iclient-common": "^11.1.1",
"@turf/area": "^6.0.1",
"@turf/bbox": "^6.0.1",
"@turf/center": "^6.0.1",
Expand Down Expand Up @@ -69,9 +70,9 @@
"lodash.isnumber": "^3.0.3",
"lodash.isplainobject": "^4.0.6",
"lodash.max": "^4.0.1",
"lodash.min": "^4.0.1",
"lodash.merge": "^4.6.1",
"lodash.mergewith": "^4.6.2",
"lodash.min": "^4.0.1",
"lodash.orderby": "^4.6.0",
"lodash.tonumber": "^4.0.3",
"lodash.uniqueid": "^4.0.1",
Expand Down Expand Up @@ -107,14 +108,13 @@
},
"devDependencies": {
"@babel/core": "~7.15.5",
"@babel/generator": "~7.15.5",
"@babel/eslint-parser": "~7.15.5",
"istanbul-lib-instrument": "5.2.0",
"@babel/generator": "~7.15.5",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-decorators": "^7.13.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-modules-commonjs": "^7.5.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/preset-env": "~7.15.5",
"@babel/runtime": "~7.15.4",
"@storybook/addon-actions": "^6.2.8",
Expand Down Expand Up @@ -179,6 +179,7 @@
"identity-obj-proxy": "^3.0.0",
"image-size": "^0.7.2",
"isomorphic-fetch": "^2.2.1",
"istanbul-lib-instrument": "5.2.0",
"jest": "^26.0.0",
"jest-canvas-mock": "^2.1.0",
"jest-serializer-vue": "^2.0.2",
Expand Down
5 changes: 2 additions & 3 deletions src/common/_utils/RestService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance';
import 'vue-iclient/static/libs/iclient-mapboxgl/iclient-mapboxgl.min';
import { FetchRequest } from '@supermap/iclient-common/util/FetchRequest';
import { Events } from 'vue-iclient/src/common/_types/event/Events';
import { getDataType } from 'vue-iclient/src/common/_utils/util';
import { statisticsFeatures } from 'vue-iclient/src/common/_utils/statistics';
Expand Down Expand Up @@ -30,7 +29,7 @@ export default class RestService extends Events {
}
// 如果是url, 就发送请求
let url = data;
SuperMap.FetchRequest.get(url, null, { withoutFormatSuffix: true, proxy: this.options.proxy })
FetchRequest.get(url, null, { withoutFormatSuffix: true, proxy: this.options.proxy })
.then(response => {
return response.json();
})
Expand Down
34 changes: 17 additions & 17 deletions src/common/_utils/iPortalDataService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance';
import 'vue-iclient/static/libs/iclient-mapboxgl/iclient-mapboxgl.min';
import { FetchRequest } from '@supermap/iclient-common/util/FetchRequest';
import { Util } from '@supermap/iclient-common/commontypes/Util';
import iServerRestService, { vertifyEpsgCode, transformFeatures } from 'vue-iclient/src/common/_utils/iServerRestService';
import { isXField, isYField, handleWithCredentials, handleDataParentRes } from 'vue-iclient/src/common/_utils/util';
import { Events } from 'vue-iclient/src/common/_types/event/Events';
Expand Down Expand Up @@ -84,7 +84,7 @@ export default class iPortalDataService extends Events {
this._getDatafromContent(datasetUrl, queryInfo);
return;
}
SuperMap.FetchRequest.get(datasetUrl, null, {
FetchRequest.get(datasetUrl, null, {
withCredentials: this.withCredentials
})
.then(response => {
Expand Down Expand Up @@ -176,14 +176,14 @@ export default class iPortalDataService extends Events {
if (offset) {
url = url + '&offset=' + offset;
}
return SuperMap.FetchRequest.get(url, null, {
return FetchRequest.get(url, null, {
withCredentials: this.withCredentials
})
.then(response => {
return response.json();
})
.then(data => {
return data
return data;
})
.catch(error => {
console.log(error);
Expand All @@ -195,20 +195,20 @@ export default class iPortalDataService extends Events {

_getDatafromRest(serviceType, address, queryInfo) {
if (serviceType === 'RESTDATA') {
let url = SuperMap.Util.urlPathAppend(address, 'data/datasources');
let url = Util.urlPathAppend(address, 'data/datasources');
let dataSourceName;
let datasetName; // 请求获取数据源名
SuperMap.FetchRequest.get(url, null, {
FetchRequest.get(url, null, {
withCredentials: handleWithCredentials(url, this.iportalServiceProxyUrl, this.withCredentials)
})
.then(response => {
return response.json();
})
.then(data => {
dataSourceName = data.datasourceNames && data.datasourceNames[0];
url = SuperMap.Util.urlPathAppend(address, `data/datasources/${dataSourceName}/datasets`);
url = Util.urlPathAppend(address, `data/datasources/${dataSourceName}/datasets`);
// 请求获取数据集名
SuperMap.FetchRequest.get(url, null, {
FetchRequest.get(url, null, {
withCredentials: handleWithCredentials(url, this.iportalServiceProxyUrl, this.withCredentials)
})
.then(response => {
Expand All @@ -221,7 +221,7 @@ export default class iPortalDataService extends Events {
{
datasetName,
dataSourceName,
dataUrl: SuperMap.Util.urlPathAppend(address, 'data')
dataUrl: Util.urlPathAppend(address, 'data')
},
Object.assign({}, queryInfo, {
withCredentials: handleWithCredentials(url, this.iportalServiceProxyUrl, this.withCredentials)
Expand All @@ -237,11 +237,11 @@ export default class iPortalDataService extends Events {
});
} else {
// 如果是地图服务
let url = SuperMap.Util.urlPathAppend(address, 'maps');
let url = Util.urlPathAppend(address, 'maps');
let mapName;
let layerName;
let path; // 请求获取地图名
SuperMap.FetchRequest.get(url, null, {
FetchRequest.get(url, null, {
withCredentials: handleWithCredentials(url, this.iportalServiceProxyUrl, this.withCredentials)
})
.then(response => {
Expand All @@ -255,9 +255,9 @@ export default class iPortalDataService extends Events {
path = handleDataParentRes(path, this.resourceId, 'DATA');
}
}
url = SuperMap.Util.urlPathAppend(address, `maps/${mapName}/layers`);
url = Util.urlPathAppend(address, `maps/${mapName}/layers`);
// 请求获取图层名
SuperMap.FetchRequest.get(url, null, {
FetchRequest.get(url, null, {
withCredentials: handleWithCredentials(url, this.iportalServiceProxyUrl, this.withCredentials)
})
.then(response => {
Expand Down Expand Up @@ -295,10 +295,10 @@ export default class iPortalDataService extends Events {

_getDatafromContent(datasetUrl, queryInfo) {
let result = {};
datasetUrl = SuperMap.Util.urlPathAppend(datasetUrl, 'content.json');
datasetUrl = SuperMap.Util.urlAppend(datasetUrl, 'pageSize=9999999&currentPage=1');
datasetUrl = Util.urlPathAppend(datasetUrl, 'content.json');
datasetUrl = Util.urlAppend(datasetUrl, 'pageSize=9999999&currentPage=1');
// 获取图层数据
SuperMap.FetchRequest.get(datasetUrl, null, {
FetchRequest.get(datasetUrl, null, {
withCredentials: this.withCredentials
})
.then(response => {
Expand Down
35 changes: 20 additions & 15 deletions src/common/_utils/iServerRestService.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import mapboxgl from 'vue-iclient/static/libs/mapboxgl/mapbox-gl-enhance';
import 'vue-iclient/static/libs/iclient-mapboxgl/iclient-mapboxgl.min';
import { QueryBySQLParameters } from '@supermap/iclient-common/iServer/QueryBySQLParameters';
import { FilterParameter } from '@supermap/iclient-common/iServer/FilterParameter';
import { QueryBySQLService } from '@supermap/iclient-common/iServer/QueryBySQLService';
import { FetchRequest } from '@supermap/iclient-common/util/FetchRequest';
import { GetFeaturesBySQLParameters } from '@supermap/iclient-common/iServer/GetFeaturesBySQLParameters';
import { GetFeaturesBySQLService } from '@supermap/iclient-common/iServer/GetFeaturesBySQLService';
import { FeatureService } from '@supermap/iclient-common/iServer/FeatureService';
import { Events } from 'vue-iclient/src/common/_types/event/Events';
import { getProjection } from 'vue-iclient/src/common/_utils/epsg-define';
import proj4 from 'proj4';
Expand Down Expand Up @@ -75,7 +80,7 @@ export function getServerEpsgCode(projectionUrl, options) {
if (!projectionUrl) {
return;
}
return SuperMap.FetchRequest.get(projectionUrl, null, options)
return FetchRequest.get(projectionUrl, null, options)
.then(response => {
return response.json();
})
Expand Down Expand Up @@ -220,14 +225,14 @@ export default class iServerRestService extends Events {
*/
getDataFeaturesCount(datasetInfo) {
let { datasetName, dataSourceName, dataUrl } = datasetInfo;
var sqlParam = new mapboxgl.supermap.GetFeaturesBySQLParameters({
var sqlParam = new GetFeaturesBySQLParameters({
queryParameter: {
name: datasetName + '@' + dataSourceName
},
datasetNames: [dataSourceName + ':' + datasetName]
});

return new mapboxgl.supermap.FeatureService(dataUrl).getFeaturesCount(sqlParam).then(function (serviceResult) {
return new FeatureService(dataUrl).getFeaturesCount(sqlParam).then(function (serviceResult) {
return serviceResult.result.totalCount;
});
}
Expand All @@ -242,21 +247,21 @@ export default class iServerRestService extends Events {
*/
getFeaturesDatasetInfo(datasetInfo) {
let { datasetName, dataSourceName, dataUrl } = datasetInfo;
var sqlParam = new mapboxgl.supermap.GetFeaturesBySQLParameters({
var sqlParam = new GetFeaturesBySQLParameters({
queryParameter: {
name: datasetName + '@' + dataSourceName
},
datasetNames: [dataSourceName + ':' + datasetName]
});

return new mapboxgl.supermap.FeatureService(dataUrl).getFeaturesDatasetInfo(sqlParam).then(function (serviceResult) {
return new FeatureService(dataUrl).getFeaturesDatasetInfo(sqlParam).then(function (serviceResult) {
return serviceResult.result[0].fieldInfos;
});
}

_getMapFeatureBySql(url, queryInfo) {
let queryBySQLParams, queryBySQLService;
queryBySQLParams = new SuperMap.QueryBySQLParameters({
queryBySQLParams = new QueryBySQLParameters({
queryParams: [
{
name: queryInfo.name,
Expand All @@ -268,7 +273,7 @@ export default class iServerRestService extends Events {
startRecord: this.options.fromIndex,
expectCount: this.options.toIndex ? (this.options.toIndex - this.options.fromIndex + 1) : queryInfo.maxFeatures
});
queryBySQLService = new SuperMap.QueryBySQLService(url, {
queryBySQLService = new QueryBySQLService(url, {
proxy: this.options.proxy,
withCredentials: queryInfo.withCredentials,
eventListeners: {
Expand All @@ -284,7 +289,7 @@ export default class iServerRestService extends Events {

_getDataFeaturesBySql(url, queryInfo) {
let getFeatureBySQLParams, getFeatureBySQLService;
getFeatureBySQLParams = new SuperMap.GetFeaturesBySQLParameters({
getFeatureBySQLParams = new GetFeaturesBySQLParameters({
queryParameter: {
name: queryInfo.name,
attributeFilter: queryInfo.attributeFilter,
Expand All @@ -297,7 +302,7 @@ export default class iServerRestService extends Events {
maxFeatures: -1,
returnFeaturesOnly: this.options.returnFeaturesOnly
});
getFeatureBySQLService = new SuperMap.GetFeaturesBySQLService(url, {
getFeatureBySQLService = new GetFeaturesBySQLService(url, {
proxy: this.options.proxy,
withCredentials: queryInfo.withCredentials,
eventListeners: {
Expand Down Expand Up @@ -383,7 +388,7 @@ export default class iServerRestService extends Events {
}

_getRestDataFields(fieldsUrl, queryInfo, callBack) {
SuperMap.FetchRequest.get(fieldsUrl, null, {
FetchRequest.get(fieldsUrl, null, {
proxy: this.options.proxy,
withCredentials: queryInfo.withCredentials
})
Expand All @@ -401,15 +406,15 @@ export default class iServerRestService extends Events {
}

_getRestMapFields(url, layerName, callBack, withCredentials = false) {
let param = new SuperMap.QueryBySQLParameters({
let param = new QueryBySQLParameters({
queryParams: [
new SuperMap.FilterParameter({
new FilterParameter({
name: layerName,
attributeFilter: 'SMID=0'
})
]
});
const queryBySQLSerice = new SuperMap.QueryBySQLService(url, {
const queryBySQLSerice = new QueryBySQLService(url, {
proxy: this.options.proxy,
withCredentials,
eventListeners: {
Expand Down
1 change: 1 addition & 0 deletions src/leaflet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"homepage": "http://iclient.supermap.io",
"main": "lib/index",
"dependencies": {
"@supermap/iclient-common": "^11.1.1",
"@turf/area": "^6.0.1",
"@turf/bbox": "^6.0.1",
"@turf/center": "^6.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/mapboxgl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"main": "lib/index",
"dependencies": {
"@mapbox/point-geometry": "^0.1.0",
"@supermap/iclient-common": "^11.1.1",
"@turf/area": "^6.0.1",
"@turf/bbox": "^6.0.1",
"@turf/center": "^6.0.1",
Expand Down

0 comments on commit 490b84f

Please sign in to comment.