diff --git a/examples/leaflet/config.js b/examples/leaflet/config.js index c1342d769..9714b1873 100644 --- a/examples/leaflet/config.js +++ b/examples/leaflet/config.js @@ -581,6 +581,13 @@ var exampleConfig = { version: "10.2.0", thumbnail: "imageService.png", fileName: "imageService" + }, + { + name: "多时相播放", + name_en: "Multiphase play", + version: '11.3.0', + thumbnail: "multiphaseplay.png", + fileName: "multiphaseplay" } ] }, diff --git a/examples/leaflet/img/multiphaseplay.png b/examples/leaflet/img/multiphaseplay.png new file mode 100644 index 000000000..804828966 Binary files /dev/null and b/examples/leaflet/img/multiphaseplay.png differ diff --git a/examples/leaflet/multiphaseplay.html b/examples/leaflet/multiphaseplay.html new file mode 100644 index 000000000..3ec45dfcb --- /dev/null +++ b/examples/leaflet/multiphaseplay.html @@ -0,0 +1,189 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + diff --git a/examples/locales/en-US/resources.js b/examples/locales/en-US/resources.js index a38394192..4881e8361 100644 --- a/examples/locales/en-US/resources.js +++ b/examples/locales/en-US/resources.js @@ -812,6 +812,7 @@ window.examplesResources = { "title_ugcResample": "Resample Analysis", "title_ugcPointPosition": "Point And Line Analysis", "title_ugcSpatial": "Spacial Analysis", + "title_multiphaseplay": "Multiphase Play", "text_graphmap_shortest_analysis": "Shortest Path Analysis", "text_startNode": "start node", @@ -1692,6 +1693,8 @@ window.examplesResources = { "text_lastPage": "Last", "text_queryDistance": "Query Distance(Degree)", "text_queryDistanceLimit": "The query distance must be greater than zero", + "text_multiphaseplay": "Multiphase Play(2009-2016 years of NDVI)", + "text_2009To2016NDVI": "2009-2016 years of NDVI", "btn_previous":"Previous", "btn_next":"Next", diff --git a/examples/locales/zh-CN/resources.js b/examples/locales/zh-CN/resources.js index d5f15ac28..ae8e5c6b6 100644 --- a/examples/locales/zh-CN/resources.js +++ b/examples/locales/zh-CN/resources.js @@ -777,6 +777,7 @@ window.examplesResources = { "title_l7_3d_terrain": "自定义3D地形(LOD)", "title_l7_snow_particle": "雪花粒子", "title_l7_rain_particle": "雨滴粒子", + "title_multiphaseplay": "多时相播放", "text_district_search": "行政区检索", "text_rectangle_search": "矩形检索", @@ -1648,6 +1649,8 @@ window.examplesResources = { "text_lastPage": "尾页", "text_queryDistance": "查询距离(度)", "text_queryDistanceLimit": "查询距离必须大于零", + "text_multiphaseplay": "多时相播放", + "text_2009To2016NDVI": "2009-2016年5月植被指数", diff --git a/examples/mapboxgl/config.js b/examples/mapboxgl/config.js index 82cdf2fd2..e5cb3e40a 100644 --- a/examples/mapboxgl/config.js +++ b/examples/mapboxgl/config.js @@ -522,6 +522,13 @@ var exampleConfig = { version: "10.2.0", thumbnail: "imageService.png", fileName: "imageService" + }, + { + name: "多时相播放", + name_en: "Multiphase play", + version: '11.3.0', + thumbnail: "multiphaseplay.png", + fileName: "multiphaseplay" } ] }, diff --git a/examples/mapboxgl/img/multiphaseplay.png b/examples/mapboxgl/img/multiphaseplay.png new file mode 100644 index 000000000..804828966 Binary files /dev/null and b/examples/mapboxgl/img/multiphaseplay.png differ diff --git a/examples/mapboxgl/multiphaseplay.html b/examples/mapboxgl/multiphaseplay.html new file mode 100644 index 000000000..5a00dd681 --- /dev/null +++ b/examples/mapboxgl/multiphaseplay.html @@ -0,0 +1,223 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + diff --git a/examples/maplibregl/config.js b/examples/maplibregl/config.js index 8a56607ab..90d7a22c5 100644 --- a/examples/maplibregl/config.js +++ b/examples/maplibregl/config.js @@ -487,6 +487,13 @@ var exampleConfig = { version: "11.2.0", thumbnail: "imageService.png", fileName: "imageService" + }, + { + name: "多时相播放", + name_en: "Multiphase play", + version: '11.3.0', + thumbnail: "multiphaseplay.png", + fileName: "multiphaseplay" } ] }, diff --git a/examples/maplibregl/img/multiphaseplay.png b/examples/maplibregl/img/multiphaseplay.png new file mode 100644 index 000000000..804828966 Binary files /dev/null and b/examples/maplibregl/img/multiphaseplay.png differ diff --git a/examples/maplibregl/multiphaseplay.html b/examples/maplibregl/multiphaseplay.html new file mode 100644 index 000000000..5c4ef453e --- /dev/null +++ b/examples/maplibregl/multiphaseplay.html @@ -0,0 +1,223 @@ + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + diff --git a/examples/openlayers/config.js b/examples/openlayers/config.js index a92171b6b..6d4362ce5 100644 --- a/examples/openlayers/config.js +++ b/examples/openlayers/config.js @@ -560,6 +560,13 @@ var exampleConfig = { version: "10.2.0", thumbnail: "imageService.png", fileName: "imageService" + }, + { + name: "多时相播放", + name_en: "Multiphase play", + version: '11.3.0', + thumbnail: "multiphaseplay.png", + fileName: "multiphaseplay" } ] }, diff --git a/examples/openlayers/img/multiphaseplay.png b/examples/openlayers/img/multiphaseplay.png new file mode 100644 index 000000000..804828966 Binary files /dev/null and b/examples/openlayers/img/multiphaseplay.png differ diff --git a/examples/openlayers/multiphaseplay.html b/examples/openlayers/multiphaseplay.html new file mode 100644 index 000000000..ebf7e6588 --- /dev/null +++ b/examples/openlayers/multiphaseplay.html @@ -0,0 +1,208 @@ + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + diff --git a/src/common/index.common.js b/src/common/index.common.js index 1b5d1d341..35768da70 100644 --- a/src/common/index.common.js +++ b/src/common/index.common.js @@ -324,7 +324,7 @@ import { FilterField, OnlineServiceBase } from './online'; -import { KeyServiceParameter, SecurityManager, ServerInfo, TokenServiceParameter } from './security'; +import { KeyServiceParameter, SecurityManager, ServerInfo, TokenServiceParameter, decrypt } from './security'; import { ElasticSearch } from './thirdparty'; import { isCORS, @@ -745,7 +745,7 @@ export { FeatureTheme, Transform }; -export { KeyServiceParameter, SecurityManager, ServerInfo, TokenServiceParameter }; +export { KeyServiceParameter, SecurityManager, ServerInfo, TokenServiceParameter, decrypt }; export { CartoCSS, ThemeStyle }; export { ElasticSearch }; export { Lang }; diff --git a/src/common/namespace.js b/src/common/namespace.js index 2ec287644..7b681260b 100644 --- a/src/common/namespace.js +++ b/src/common/namespace.js @@ -326,6 +326,7 @@ import { FilterField, OnlineServiceBase, KeyServiceParameter, + decrypt, SecurityManager, ServerInfo, TokenServiceParameter, @@ -890,6 +891,7 @@ SuperMap.KeyServiceParameter = KeyServiceParameter; SuperMap.SecurityManager = SecurityManager; SuperMap.ServerInfo = ServerInfo; SuperMap.TokenServiceParameter = TokenServiceParameter; +SuperMap.decrypt= decrypt; // style SuperMap.ThemeStyle = ThemeStyle; SuperMap.CartoCSS = CartoCSS; diff --git a/src/common/package.json b/src/common/package.json index f7819cc43..f514120c8 100644 --- a/src/common/package.json +++ b/src/common/package.json @@ -16,6 +16,7 @@ "dependencies": { "@antv/g2": "^4.2.11", "@antv/g6": "^4.8.14", + "@supermapgis/tile-decryptor": "^1.0.0", "@turf/meta": "^6.5.0", "echarts": "5.5.0", "fast-xml-parser": "^4.2.7", diff --git a/src/common/security/decrypt.js b/src/common/security/decrypt.js new file mode 100644 index 000000000..45c7f5d2d --- /dev/null +++ b/src/common/security/decrypt.js @@ -0,0 +1,39 @@ +/* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved. + * This program are made available under the terms of the Apache License, Version 2.0 + * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ +import decryptUtil from '@supermapgis/tile-decryptor'; + +/** + * @category Security + * @function decrypt + * @description 隧道解密ArrayBuffer数据。 + * @param {Object} options - 参数。 + * @param {ArrayBuffer} options.arrayBuffer - 解密数据,数据格式为ArrayBuffer。 + * @param {string} options.key - 秘钥 + * @param {string} options.algorithm - 加密算法, 可选值: "AES"、"AES/CTR"、"SM4"、"SM4/CTR"。 + * @param {number} [options.decodeSize=256] - 需要解密的数据大小。 + * @param {Array} [options.ivKey] - 当algorithm为'AES'或者"AES/CTR", 默认值为:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];当algorithm为'SM4'或者"SM4/CTR", 默认值为:[48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102]。 + * @returns {string} 解密后的数据。 + * @usage + * ``` + * // 浏览器 + * + * + * + * // ES6 Import + * import { decrypt } from '{npm}'; + * + * const result = decrypt(options); + * ``` + */ +const decrypt = (options) => { + const res = decryptUtil({ ...options }); + const decoder = new TextDecoder(); + const decodeStr = decoder.decode(new Uint8Array(res)); + return decodeStr; +}; + +export { decrypt }; diff --git a/src/common/security/index.js b/src/common/security/index.js index 7eae1556c..8fbc5de8e 100644 --- a/src/common/security/index.js +++ b/src/common/security/index.js @@ -1,12 +1,14 @@ /* Copyright© 2000 - 2024 SuperMap Software Co.Ltd. All rights reserved. * This program are made available under the terms of the Apache License, Version 2.0 * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/ -import {KeyServiceParameter} from './KeyServiceParameter'; -import {SecurityManager} from './SecurityManager'; -import {ServerInfo} from './ServerInfo'; -import {TokenServiceParameter} from './TokenServiceParameter'; +import { KeyServiceParameter } from './KeyServiceParameter'; +import { SecurityManager } from './SecurityManager'; +import { ServerInfo } from './ServerInfo'; +import { TokenServiceParameter } from './TokenServiceParameter'; +import { decrypt } from './decrypt'; -export {KeyServiceParameter} ; -export {SecurityManager} ; -export {ServerInfo} ; -export {TokenServiceParameter} ; \ No newline at end of file +export { KeyServiceParameter }; +export { SecurityManager }; +export { ServerInfo }; +export { TokenServiceParameter }; +export { decrypt }; diff --git a/test/common/security/decryptSpec.js b/test/common/security/decryptSpec.js new file mode 100644 index 000000000..3bece5804 --- /dev/null +++ b/test/common/security/decryptSpec.js @@ -0,0 +1,14 @@ +import { decrypt } from '../../../src/common/security/decrypt'; + +describe('decrypt', () => { + it('decrypt AFS', () => { + const unit8 = Uint8Array.from([65, 254, 189, 210, 176, 155, 38, 120, 236, 244]); + var options = { + arrayBuffer: unit8.buffer, + key: 'nSDXTzVXy93lc4dmhokTyWvMbiAroF8cSmIfulJG9bg=', + algorithm: 'AES' + }; + var parameter = decrypt(options); + expect(parameter).toEqual('{"recordse'); + }); +});