@supermapgis/vue-iclient-leaflet 11.2.1 → 11.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iclient-leaflet-vue.css +23 -9
- package/dist/iclient-leaflet-vue.js +21689 -44354
- package/dist/iclient-leaflet-vue.min.css +2 -2
- package/dist/iclient-leaflet-vue.min.js +39 -293
- package/lib/_assets/iconfont/icon-sm-components.css +21 -7
- package/lib/_assets/iconfont/icon-sm-components.ttf +0 -0
- package/lib/_assets/iconfont/icon-sm-components.woff +0 -0
- package/lib/_assets/iconfont/icon-sm-components.woff2 +0 -0
- package/lib/_lang/en.js +20 -8
- package/lib/_lang/index.js +18 -18
- package/lib/_lang/zh.js +20 -8
- package/lib/_mixin/AntdRender.js +15 -17
- package/lib/_mixin/Card.js +10 -11
- package/lib/_mixin/GridLayer.js +4 -4
- package/lib/_mixin/Layer.js +4 -4
- package/lib/_mixin/Options.js +2 -2
- package/lib/_mixin/Popper.js +2 -2
- package/lib/_mixin/Theme.js +13 -15
- package/lib/_mixin/ThirdService.js +15 -16
- package/lib/_mixin/TileLayer.js +4 -4
- package/lib/_mixin/Timer.js +8 -9
- package/lib/_mixin/VmUpdater.js +10 -11
- package/lib/_mixin/map-events.js +8 -9
- package/lib/_mixin/map-getter.js +13 -14
- package/lib/_types/AddressMatchParameter.js +2 -2
- package/lib/_types/GeoJSONParamter.js +2 -2
- package/lib/_types/RestDataParameter.js +5 -6
- package/lib/_types/RestMapParameter.js +5 -6
- package/lib/_types/RestParameter.js +2 -2
- package/lib/_types/event/BaseTypes.js +2 -2
- package/lib/_types/event/Event.js +4 -4
- package/lib/_types/event/Events.js +10 -10
- package/lib/_types/event/Pixel.js +2 -2
- package/lib/_types/event/Util.js +2 -2
- package/lib/_types/iPortalDataParameter.js +3 -2
- package/lib/_types/iServerBaseParameter.js +3 -2
- package/lib/_types/iServerDataParameter.js +5 -6
- package/lib/_types/iServerMapParameter.js +5 -6
- package/lib/_types/index.js +18 -18
- package/lib/_types/map-event.js +6 -6
- package/lib/_utils/EchartsDataService.js +24 -24
- package/lib/_utils/RestService.js +1345 -1149
- package/lib/_utils/epsg-define.js +45 -34
- package/lib/_utils/get-features.js +23 -10
- package/lib/_utils/global-event.js +6 -6
- package/lib/_utils/iPortalDataService.js +1368 -1147
- package/lib/_utils/iServerRestService.js +1518 -1269
- package/lib/_utils/props-binder.js +2 -2
- package/lib/_utils/statistics.js +8 -17
- package/lib/_utils/style/color/colorPalette.js +4 -4
- package/lib/_utils/style/color/serialColors.js +8 -8
- package/lib/_utils/style/theme/chart.js +1343 -1146
- package/lib/_utils/style/theme/set-theme.js +10 -10
- package/lib/_utils/style/theme/theme.json +6 -6
- package/lib/_utils/util.js +12 -12
- package/lib/_utils/vue-types/utils.js +2 -2
- package/lib/attribute-panel/style/attribute-panel.css +1 -0
- package/lib/attribute-panel/style/css.js +7 -0
- package/lib/attribute-panel/style/index.js +7 -0
- package/lib/avatar/index.js +25 -25
- package/lib/border/index.js +77 -77
- package/lib/breadcrumb/index.js +47 -41
- package/lib/button/index.js +53 -50
- package/lib/card/index.js +47 -41
- package/lib/chart/index.js +1437 -1238
- package/lib/checkbox/index.js +36 -33
- package/lib/collapse/index.js +39 -36
- package/lib/collapse-card/index.js +71 -76
- package/lib/color-picker/index.js +48 -49
- package/lib/date-picker/index.js +107 -95
- package/lib/dropdown/index.js +27 -27
- package/lib/empty/index.js +27 -27
- package/lib/icon/index.js +25 -25
- package/lib/identify/index.js +58 -59
- package/lib/iframe/index.js +31 -31
- package/lib/image/index.js +226 -42
- package/lib/image/style/image.css +1 -1
- package/lib/index.js +4 -4
- package/lib/indicator/index.js +70 -67
- package/lib/init.js +8 -8
- package/lib/input/index.js +150 -135
- package/lib/input-number/index.js +100 -97
- package/lib/layout/index.js +72 -60
- package/lib/liquid-fill/index.js +73 -73
- package/lib/marker/index.js +43 -44
- package/lib/menu/index.js +47 -41
- package/lib/message/index.js +3 -3
- package/lib/message/style/message.css +1 -1
- package/lib/modal/index.js +67 -67
- package/lib/modal/style/modal.css +1 -1
- package/lib/notification/index.js +6 -6
- package/lib/notification/style/notification.css +1 -1
- package/lib/pagination/index.js +34 -34
- package/lib/popup/index.js +45 -46
- package/lib/progress/index.js +440 -440
- package/lib/radio/index.js +48 -42
- package/lib/select/index.js +47 -41
- package/lib/slider/index.js +27 -27
- package/lib/slideshow/index.js +103 -160
- package/lib/spin/index.js +30 -30
- package/lib/steps/index.js +35 -32
- package/lib/switch/index.js +25 -25
- package/lib/table/index.js +50 -44
- package/lib/table/style/table.css +1 -1
- package/lib/table-popup/index.js +43 -37
- package/lib/table-popup/style/table-popup.css +1 -1
- package/lib/tabs/index.js +35 -32
- package/lib/text/index.js +39 -39
- package/lib/tile-layer/index.js +35 -36
- package/lib/time-line/index.js +41 -43
- package/lib/time-picker/index.js +27 -27
- package/lib/time-range/index.js +53 -55
- package/lib/time-slider/index.js +73 -75
- package/lib/time-text/index.js +31 -31
- package/lib/tooltip/index.js +25 -25
- package/lib/tooltip/style/tooltip.css +1 -0
- package/lib/transfer/index.js +27 -27
- package/lib/tree/index.js +48 -42
- package/lib/tree-select/index.js +37 -34
- package/lib/video-player/index.js +98 -97
- package/lib/video-player/style/video-player.css +1 -1
- package/lib/web-map/index.js +2336 -103
- package/package.json +2 -4
- package/src/common/_assets/iconfont/icon-sm-components.css +21 -7
- package/src/common/_assets/iconfont/icon-sm-components.ttf +0 -0
- package/src/common/_assets/iconfont/icon-sm-components.woff +0 -0
- package/src/common/_assets/iconfont/icon-sm-components.woff2 +0 -0
- package/src/common/_lang/en.js +19 -8
- package/src/common/_lang/zh.js +18 -6
- package/src/common/_mixin/Card.ts +1 -1
- package/src/common/_types/iPortalDataParameter.js +1 -0
- package/src/common/_types/iServerBaseParameter.ts +3 -0
- package/src/common/_utils/epsg-define.js +32 -27
- package/src/common/_utils/get-features.js +13 -2
- package/src/common/_utils/iPortalDataService.js +14 -3
- package/src/common/_utils/iServerRestService.js +144 -78
- package/src/common/_utils/statistics.js +6 -14
- package/src/common/_utils/style/theme/theme.json +6 -6
- package/src/common/attribute-panel/AttributePanel.vue +58 -0
- package/src/common/attribute-panel/__test__/AttributePanel.spec.js +39 -0
- package/src/common/attribute-panel/index.js +9 -0
- package/src/common/attribute-panel/style/attribute-panel.scss +35 -0
- package/src/common/attribute-panel/style/index.js +4 -0
- package/src/common/collapse-card/style/collapse-card.scss +2 -2
- package/src/common/iframe/Iframe.vue +1 -1
- package/src/common/image/Image.vue +68 -6
- package/src/common/image/style/image.scss +32 -0
- package/src/common/message/style/message.scss +1 -0
- package/src/common/modal/style/modal.scss +36 -0
- package/src/common/notification/style/notification.scss +9 -0
- package/src/common/slideshow/Slideshow.vue +42 -95
- package/src/common/slideshow/Swiper.js +1 -1
- package/src/common/table/style/table.scss +36 -0
- package/src/common/table-popup/TablePopup.vue +5 -0
- package/src/common/tooltip/style/tooltip.scss +3 -0
- package/src/common/video-player/style/video-player.scss +1 -1
- package/src/leaflet/entrys.json +0 -2
- package/src/leaflet/package.json +2 -4
- package/src/leaflet/web-map/WebMap.vue +4 -4
- package/src/leaflet/web-map/WebMapViewModel.ts +64 -17
- package/static/libs/iclient-common/iclient-common-webmapv2base.js +2 -0
- package/static/libs/iclient-common/iclient-common.js +1 -1
- package/static/libs/iclient-leaflet/iclient-leaflet.min.js +5 -1738
- package/lib/_assets/iconfont/icon-sm-components.eot +0 -0
- package/lib/_assets/iconfont/icon-sm-components.svg +0 -197
- package/lib/_mixin/WebMapBase.js +0 -3467
- package/lib/_utils/WebMapService.js +0 -1607
- package/src/common/_assets/iconfont/icon-sm-components.eot +0 -0
- package/src/common/_assets/iconfont/icon-sm-components.svg +0 -197
- package/src/common/_utils/WebMapService.ts +0 -1292
- package/src/common/web-map/WebMapBase.ts +0 -1178
- package/src/common/web-map/config/MunicipalCenter.json +0 -1
- package/src/common/web-map/config/ProvinceCenter.json +0 -1
|
@@ -1,1607 +0,0 @@
|
|
|
1
|
-
module.exports =
|
|
2
|
-
/******/ (function(modules) { // webpackBootstrap
|
|
3
|
-
/******/ // The module cache
|
|
4
|
-
/******/ var installedModules = {};
|
|
5
|
-
/******/
|
|
6
|
-
/******/ // The require function
|
|
7
|
-
/******/ function __webpack_require__(moduleId) {
|
|
8
|
-
/******/
|
|
9
|
-
/******/ // Check if module is in cache
|
|
10
|
-
/******/ if(installedModules[moduleId]) {
|
|
11
|
-
/******/ return installedModules[moduleId].exports;
|
|
12
|
-
/******/ }
|
|
13
|
-
/******/ // Create a new module (and put it into the cache)
|
|
14
|
-
/******/ var module = installedModules[moduleId] = {
|
|
15
|
-
/******/ i: moduleId,
|
|
16
|
-
/******/ l: false,
|
|
17
|
-
/******/ exports: {}
|
|
18
|
-
/******/ };
|
|
19
|
-
/******/
|
|
20
|
-
/******/ // Execute the module function
|
|
21
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
22
|
-
/******/
|
|
23
|
-
/******/ // Flag the module as loaded
|
|
24
|
-
/******/ module.l = true;
|
|
25
|
-
/******/
|
|
26
|
-
/******/ // Return the exports of the module
|
|
27
|
-
/******/ return module.exports;
|
|
28
|
-
/******/ }
|
|
29
|
-
/******/
|
|
30
|
-
/******/
|
|
31
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
32
|
-
/******/ __webpack_require__.m = modules;
|
|
33
|
-
/******/
|
|
34
|
-
/******/ // expose the module cache
|
|
35
|
-
/******/ __webpack_require__.c = installedModules;
|
|
36
|
-
/******/
|
|
37
|
-
/******/ // define getter function for harmony exports
|
|
38
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
39
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
40
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
41
|
-
/******/ }
|
|
42
|
-
/******/ };
|
|
43
|
-
/******/
|
|
44
|
-
/******/ // define __esModule on exports
|
|
45
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
46
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
-
/******/ }
|
|
49
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
-
/******/ };
|
|
51
|
-
/******/
|
|
52
|
-
/******/ // create a fake namespace object
|
|
53
|
-
/******/ // mode & 1: value is a module id, require it
|
|
54
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
55
|
-
/******/ // mode & 4: return value when already ns object
|
|
56
|
-
/******/ // mode & 8|1: behave like require
|
|
57
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
58
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
59
|
-
/******/ if(mode & 8) return value;
|
|
60
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
61
|
-
/******/ var ns = Object.create(null);
|
|
62
|
-
/******/ __webpack_require__.r(ns);
|
|
63
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
64
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
65
|
-
/******/ return ns;
|
|
66
|
-
/******/ };
|
|
67
|
-
/******/
|
|
68
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
69
|
-
/******/ __webpack_require__.n = function(module) {
|
|
70
|
-
/******/ var getter = module && module.__esModule ?
|
|
71
|
-
/******/ function getDefault() { return module['default']; } :
|
|
72
|
-
/******/ function getModuleExports() { return module; };
|
|
73
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
74
|
-
/******/ return getter;
|
|
75
|
-
/******/ };
|
|
76
|
-
/******/
|
|
77
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
78
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
79
|
-
/******/
|
|
80
|
-
/******/ // __webpack_public_path__
|
|
81
|
-
/******/ __webpack_require__.p = "lib/leaflet/";
|
|
82
|
-
/******/
|
|
83
|
-
/******/
|
|
84
|
-
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s = 251);
|
|
86
|
-
/******/ })
|
|
87
|
-
/************************************************************************/
|
|
88
|
-
/******/ ({
|
|
89
|
-
|
|
90
|
-
/***/ 0:
|
|
91
|
-
/***/ (function(module, exports) {
|
|
92
|
-
|
|
93
|
-
module.exports = require("@babel/runtime/helpers/interopRequireDefault");
|
|
94
|
-
|
|
95
|
-
/***/ }),
|
|
96
|
-
|
|
97
|
-
/***/ 19:
|
|
98
|
-
/***/ (function(module, exports) {
|
|
99
|
-
|
|
100
|
-
module.exports = require("@supermapgis/vue-iclient-leaflet/lib/_types/event/Events.js");
|
|
101
|
-
|
|
102
|
-
/***/ }),
|
|
103
|
-
|
|
104
|
-
/***/ 251:
|
|
105
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
106
|
-
|
|
107
|
-
"use strict";
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
var _interopRequireDefault = __webpack_require__(0);
|
|
111
|
-
|
|
112
|
-
Object.defineProperty(exports, "__esModule", {
|
|
113
|
-
value: true
|
|
114
|
-
});
|
|
115
|
-
exports.default = void 0;
|
|
116
|
-
|
|
117
|
-
var _regenerator = _interopRequireDefault(__webpack_require__(43));
|
|
118
|
-
|
|
119
|
-
var _inheritsLoose2 = _interopRequireDefault(__webpack_require__(6));
|
|
120
|
-
|
|
121
|
-
var _Events2 = __webpack_require__(19);
|
|
122
|
-
|
|
123
|
-
var _util = __webpack_require__(9);
|
|
124
|
-
|
|
125
|
-
var _statistics = __webpack_require__(38);
|
|
126
|
-
|
|
127
|
-
var convert = _interopRequireWildcard(__webpack_require__(252));
|
|
128
|
-
|
|
129
|
-
var _lodash = _interopRequireDefault(__webpack_require__(59));
|
|
130
|
-
|
|
131
|
-
var _lodash2 = _interopRequireDefault(__webpack_require__(253));
|
|
132
|
-
|
|
133
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
134
|
-
|
|
135
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
136
|
-
|
|
137
|
-
var __awaiter = void 0 && (void 0).__awaiter || function (thisArg, _arguments, P, generator) {
|
|
138
|
-
function adopt(value) {
|
|
139
|
-
return value instanceof P ? value : new P(function (resolve) {
|
|
140
|
-
resolve(value);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
145
|
-
function fulfilled(value) {
|
|
146
|
-
try {
|
|
147
|
-
step(generator.next(value));
|
|
148
|
-
} catch (e) {
|
|
149
|
-
reject(e);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function rejected(value) {
|
|
154
|
-
try {
|
|
155
|
-
step(generator["throw"](value));
|
|
156
|
-
} catch (e) {
|
|
157
|
-
reject(e);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
function step(result) {
|
|
162
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
var DEFAULT_WELLKNOWNSCALESET = ['GoogleCRS84Quad', 'GoogleMapsCompatible', 'urn:ogc:def:wkss:OGC:1.0:GoogleMapsCompatible', 'urn:ogc:def:wkss:OGC:1.0:GoogleCRS84Quad'];
|
|
170
|
-
var MB_SCALEDENOMINATOR_3857 = [559082264.0287178, 279541132.0143589, 139770566.00717944, 69885283.00358972, 34942641.50179486, 17471320.75089743, 8735660.375448715, 4367830.1877243575, 2183915.0938621787, 1091957.5469310894, 545978.7734655447, 272989.38673277234, 136494.69336638617, 68247.34668319309, 34123.67334159654, 17061.83667079827, 8530.918335399136, 4265.459167699568, 2132.729583849784, 1066.364791924892, 533.182395962446, 266.591197981223, 133.2955989906115];
|
|
171
|
-
var MB_SCALEDENOMINATOR_4326 = [559082264.0287176, 279541132.0143588, 139770566.0071794, 69885283.0035897, 34942641.50179485, 17471320.750897426, 8735660.375448713, 4367830.187724357, 2183915.0938621783, 1091957.5469310891, 545978.7734655446, 272989.3867327723, 136494.69336638614, 68247.34668319307, 34123.673341596535, 17061.836670798268, 8530.918335399134, 4265.459167699567, 2132.7295838497835, 1066.3647919248917, 533.1823959624459, 266.59119798122293, 133.29559899061147];
|
|
172
|
-
|
|
173
|
-
var WebMapService = exports.default = /*#__PURE__*/function (_Events) {
|
|
174
|
-
(0, _inheritsLoose2.default)(WebMapService, _Events);
|
|
175
|
-
|
|
176
|
-
function WebMapService(mapId, options) {
|
|
177
|
-
var _this;
|
|
178
|
-
|
|
179
|
-
if (options === void 0) {
|
|
180
|
-
options = {};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
_this = _Events.call(this) || this;
|
|
184
|
-
_this.proxyOptions = {
|
|
185
|
-
data: 'apps/viewer/getUrlResource.json?url=',
|
|
186
|
-
image: 'apps/viewer/getUrlResource.png?url='
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
if (typeof mapId === 'string' || typeof mapId === 'number') {
|
|
190
|
-
_this.mapId = mapId;
|
|
191
|
-
} else if (mapId !== null && typeof mapId === 'object') {
|
|
192
|
-
_this.mapInfo = mapId;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
_this.serverUrl = options.serverUrl || 'https://www.supermapol.com';
|
|
196
|
-
_this.accessToken = options.accessToken;
|
|
197
|
-
_this.accessKey = options.accessKey;
|
|
198
|
-
_this.tiandituKey = options.tiandituKey || '';
|
|
199
|
-
_this.withCredentials = options.withCredentials || false;
|
|
200
|
-
_this.excludePortalProxyUrl = options.excludePortalProxyUrl;
|
|
201
|
-
_this.iportalServiceProxyUrl = options.iportalServiceProxyUrlPrefix;
|
|
202
|
-
_this.proxy = options.proxy;
|
|
203
|
-
return _this;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
var _proto = WebMapService.prototype;
|
|
207
|
-
|
|
208
|
-
_proto.setMapId = function setMapId(mapId) {
|
|
209
|
-
if (typeof mapId === 'string' || typeof mapId === 'number') {
|
|
210
|
-
this.mapId = mapId;
|
|
211
|
-
this.mapInfo = null;
|
|
212
|
-
} else if (mapId !== null && typeof mapId === 'object') {
|
|
213
|
-
this.mapInfo = mapId;
|
|
214
|
-
this.mapId = '';
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
_proto.setServerUrl = function setServerUrl(serverUrl) {
|
|
219
|
-
this.serverUrl = serverUrl;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
_proto.setWithCredentials = function setWithCredentials(withCredentials) {
|
|
223
|
-
this.withCredentials = withCredentials;
|
|
224
|
-
};
|
|
225
|
-
|
|
226
|
-
_proto.setProxy = function setProxy(proxy) {
|
|
227
|
-
this.proxy = proxy;
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
_proto.handleServerUrl = function handleServerUrl(serverUrl) {
|
|
231
|
-
var urlArr = serverUrl.split('');
|
|
232
|
-
|
|
233
|
-
if (urlArr[urlArr.length - 1] !== '/') {
|
|
234
|
-
serverUrl += '/';
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
this.serverUrl = serverUrl;
|
|
238
|
-
return serverUrl;
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
_proto.getMapInfo = function getMapInfo() {
|
|
242
|
-
var _this2 = this;
|
|
243
|
-
|
|
244
|
-
if (!this.mapId && this.mapInfo) {
|
|
245
|
-
return new Promise(function (resolve) {
|
|
246
|
-
resolve(_this2.mapInfo);
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
var mapUrl = this._handleMapUrl();
|
|
251
|
-
|
|
252
|
-
return new Promise(function (resolve, reject) {
|
|
253
|
-
return __awaiter(_this2, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
254
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
255
|
-
while (1) switch (_context.prev = _context.next) {
|
|
256
|
-
case 0:
|
|
257
|
-
_context.prev = 0;
|
|
258
|
-
_context.next = 3;
|
|
259
|
-
return this.getiPortalServiceProxy();
|
|
260
|
-
|
|
261
|
-
case 3:
|
|
262
|
-
SuperMap.FetchRequest.get(mapUrl, null, {
|
|
263
|
-
withCredentials: this.withCredentials
|
|
264
|
-
}).then(function (response) {
|
|
265
|
-
return response.json();
|
|
266
|
-
}).then(function (mapInfo) {
|
|
267
|
-
if (mapInfo && mapInfo.succeed === false) {
|
|
268
|
-
var error = {
|
|
269
|
-
message: mapInfo && mapInfo.error && mapInfo.error.errorMsg
|
|
270
|
-
};
|
|
271
|
-
reject(error);
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
mapInfo.mapParams = {
|
|
276
|
-
title: mapInfo.title,
|
|
277
|
-
description: mapInfo.description
|
|
278
|
-
};
|
|
279
|
-
resolve(mapInfo);
|
|
280
|
-
}).catch(function (error) {
|
|
281
|
-
reject(error);
|
|
282
|
-
});
|
|
283
|
-
_context.next = 9;
|
|
284
|
-
break;
|
|
285
|
-
|
|
286
|
-
case 6:
|
|
287
|
-
_context.prev = 6;
|
|
288
|
-
_context.t0 = _context["catch"](0);
|
|
289
|
-
reject(_context.t0);
|
|
290
|
-
|
|
291
|
-
case 9:
|
|
292
|
-
case "end":
|
|
293
|
-
return _context.stop();
|
|
294
|
-
}
|
|
295
|
-
}, _callee, this, [[0, 6]]);
|
|
296
|
-
}));
|
|
297
|
-
});
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
_proto.getiPortalServiceProxy = function getiPortalServiceProxy() {
|
|
301
|
-
var _this3 = this;
|
|
302
|
-
|
|
303
|
-
return new Promise(function (resolve, reject) {
|
|
304
|
-
SuperMap.FetchRequest.get(_this3.serverUrl + "web/config/portal.json", {
|
|
305
|
-
scope: ['serviceProxy']
|
|
306
|
-
}).then(function (response) {
|
|
307
|
-
return response.json();
|
|
308
|
-
}).then(function (serviceProxyInfo) {
|
|
309
|
-
if (!serviceProxyInfo || !serviceProxyInfo.serviceProxy) {
|
|
310
|
-
reject('serviceProxyFailed');
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
var serviceProxy = serviceProxyInfo.serviceProxy;
|
|
315
|
-
|
|
316
|
-
if (serviceProxy.enable) {
|
|
317
|
-
if (serviceProxy.proxyServerRootUrl) {
|
|
318
|
-
_this3.iportalServiceProxyUrl = serviceProxy.proxyServerRootUrl;
|
|
319
|
-
} else if (serviceProxy.port && serviceProxy.rootUrlPostfix) {
|
|
320
|
-
_this3.iportalServiceProxyUrl = serviceProxy.port + "/" + serviceProxy.rootUrlPostfix;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (_this3.serverUrl.indexOf(_this3.iportalServiceProxyUrl) > -1) {
|
|
324
|
-
_this3.iportalServiceProxyUrl = '';
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
resolve(serviceProxy);
|
|
329
|
-
}).catch(function (error) {
|
|
330
|
-
reject(error);
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
};
|
|
334
|
-
|
|
335
|
-
_proto.getLayerFeatures = function getLayerFeatures(type, layer, baseProjection) {
|
|
336
|
-
var pro;
|
|
337
|
-
|
|
338
|
-
switch (type) {
|
|
339
|
-
case 'hosted':
|
|
340
|
-
pro = this._getFeaturesFromHosted(layer, baseProjection);
|
|
341
|
-
break;
|
|
342
|
-
|
|
343
|
-
case 'rest_data':
|
|
344
|
-
pro = this._getFeaturesFromRestData(layer, baseProjection);
|
|
345
|
-
break;
|
|
346
|
-
|
|
347
|
-
case 'rest_map':
|
|
348
|
-
pro = this._getFeaturesFromRestMap(layer);
|
|
349
|
-
break;
|
|
350
|
-
|
|
351
|
-
case 'dataflow':
|
|
352
|
-
pro = this._getFeaturesFromDataflow(layer);
|
|
353
|
-
break;
|
|
354
|
-
|
|
355
|
-
case 'user_data':
|
|
356
|
-
pro = this._getFeaturesFromUserData(layer);
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
return pro;
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
_proto.getWmsInfo = function getWmsInfo(layerInfo) {
|
|
364
|
-
var _this4 = this;
|
|
365
|
-
|
|
366
|
-
return new Promise(function (resolve) {
|
|
367
|
-
var proxy = _this4.handleProxy();
|
|
368
|
-
|
|
369
|
-
var serviceUrl = SuperMap.Util.urlAppend(layerInfo.url, 'REQUEST=GetCapabilities&SERVICE=WMS');
|
|
370
|
-
SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
371
|
-
withCredentials: _this4.handleWithCredentials(proxy, layerInfo.url, false),
|
|
372
|
-
withoutFormatSuffix: true,
|
|
373
|
-
proxy: proxy
|
|
374
|
-
}).then(function (response) {
|
|
375
|
-
return response.text();
|
|
376
|
-
}).then(function (capabilitiesText) {
|
|
377
|
-
var converts = convert || window.convert;
|
|
378
|
-
var capabilities = JSON.parse(converts.xml2json(capabilitiesText, {
|
|
379
|
-
compact: true,
|
|
380
|
-
spaces: 4
|
|
381
|
-
}));
|
|
382
|
-
var wmsCapabilities = capabilities.WMT_MS_Capabilities || capabilities.WMS_Capabilities;
|
|
383
|
-
resolve({
|
|
384
|
-
version: wmsCapabilities['_attributes']['version']
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
};
|
|
389
|
-
|
|
390
|
-
_proto.getMapBoxStyle = function getMapBoxStyle(styleURL) {
|
|
391
|
-
return new Promise(function (resolve, reject) {
|
|
392
|
-
SuperMap.FetchRequest.get(styleURL).then(function (response) {
|
|
393
|
-
return response.json();
|
|
394
|
-
}).then(function (styleJSON) {
|
|
395
|
-
resolve(styleJSON);
|
|
396
|
-
}).catch(function (error) {
|
|
397
|
-
reject(error);
|
|
398
|
-
});
|
|
399
|
-
});
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
_proto.getWmtsInfo = function getWmtsInfo(layerInfo, mapCRS) {
|
|
403
|
-
var _this5 = this;
|
|
404
|
-
|
|
405
|
-
return new Promise(function (resolve, reject) {
|
|
406
|
-
var isMatched = false;
|
|
407
|
-
var matchMaxZoom = 22;
|
|
408
|
-
var matchMinZoom = 0;
|
|
409
|
-
var style = '';
|
|
410
|
-
var bounds;
|
|
411
|
-
var restResourceURL = '';
|
|
412
|
-
var kvpResourceUrl = '';
|
|
413
|
-
|
|
414
|
-
var proxy = _this5.handleProxy();
|
|
415
|
-
|
|
416
|
-
var serviceUrl = SuperMap.Util.urlAppend(layerInfo.url, 'REQUEST=GetCapabilities&SERVICE=WMTS&VERSION=1.0.0');
|
|
417
|
-
serviceUrl = _this5.handleParentRes(serviceUrl);
|
|
418
|
-
SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
419
|
-
withCredentials: _this5.handleWithCredentials(proxy, layerInfo.url, false),
|
|
420
|
-
withoutFormatSuffix: true,
|
|
421
|
-
proxy: proxy
|
|
422
|
-
}).then(function (response) {
|
|
423
|
-
return response.text();
|
|
424
|
-
}).then(function (capabilitiesText) {
|
|
425
|
-
var converts = convert || window.convert;
|
|
426
|
-
var capabilities = JSON.parse(converts.xml2json(capabilitiesText, {
|
|
427
|
-
compact: true,
|
|
428
|
-
spaces: 4,
|
|
429
|
-
alwaysArray: ['Layer', 'TileMatrixSet', 'ows:Operation', 'ows:Get', 'ResourceURL', 'Style']
|
|
430
|
-
})).Capabilities;
|
|
431
|
-
var content = capabilities.Contents;
|
|
432
|
-
var metaData = capabilities['ows:OperationsMetadata'];
|
|
433
|
-
|
|
434
|
-
if (metaData) {
|
|
435
|
-
var operations = metaData['ows:Operation'];
|
|
436
|
-
|
|
437
|
-
if (!Array.isArray(operations)) {
|
|
438
|
-
operations = [operations];
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
var operation = operations.find(function (item) {
|
|
442
|
-
return item._attributes.name === 'GetTile';
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
if (operation) {
|
|
446
|
-
var getConstraints = operation['ows:DCP']['ows:HTTP']['ows:Get'];
|
|
447
|
-
|
|
448
|
-
if (!Array.isArray(getConstraints)) {
|
|
449
|
-
getConstraints = [getConstraints];
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
var getConstraint = getConstraints.find(function (item) {
|
|
453
|
-
return item['ows:Constraint']['ows:AllowedValues']['ows:Value']['_text'] === 'KVP';
|
|
454
|
-
});
|
|
455
|
-
|
|
456
|
-
if (getConstraint) {
|
|
457
|
-
kvpResourceUrl = getConstraint['_attributes']['xlink:href'];
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
var tileMatrixSet = content.TileMatrixSet;
|
|
463
|
-
|
|
464
|
-
for (var i = 0; i < tileMatrixSet.length; i++) {
|
|
465
|
-
if (tileMatrixSet[i]['ows:Identifier'] && tileMatrixSet[i]['ows:Identifier']['_text'] === layerInfo.tileMatrixSet) {
|
|
466
|
-
if (tileMatrixSet[i]['WellKnownScaleSet'] && DEFAULT_WELLKNOWNSCALESET.includes(tileMatrixSet[i]['WellKnownScaleSet']['_text'])) {
|
|
467
|
-
isMatched = true;
|
|
468
|
-
} else {
|
|
469
|
-
var matchedScaleDenominator = {};
|
|
470
|
-
var defaultCRSScaleDenominators = mapCRS === 'EPSG:3857' ? MB_SCALEDENOMINATOR_3857 : MB_SCALEDENOMINATOR_4326;
|
|
471
|
-
var defaultCRSTopLeftCorner = mapCRS === 'EPSG:3857' ? [-2.0037508342789248e7, 2.0037508342789087e7] : [-180, 90];
|
|
472
|
-
|
|
473
|
-
for (var j = 0; j < tileMatrixSet[i].TileMatrix.length; j++) {
|
|
474
|
-
var tileMatrix = tileMatrixSet[i].TileMatrix[j];
|
|
475
|
-
var identifier = tileMatrix['ows:Identifier']['_text'];
|
|
476
|
-
var topLeftCorner = [].concat(tileMatrix['TopLeftCorner']['_text'].split(' '));
|
|
477
|
-
|
|
478
|
-
if ((!(0, _util.numberEqual)(topLeftCorner[0], defaultCRSTopLeftCorner[0]) || !(0, _util.numberEqual)(topLeftCorner[1], defaultCRSTopLeftCorner[1])) && (!(0, _util.numberEqual)(topLeftCorner[0], defaultCRSTopLeftCorner[1]) || !(0, _util.numberEqual)(topLeftCorner[1], defaultCRSTopLeftCorner[0]))) {
|
|
479
|
-
break;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
var defaultScaleDenominator = defaultCRSScaleDenominators[+identifier];
|
|
483
|
-
|
|
484
|
-
if (!defaultScaleDenominator) {
|
|
485
|
-
break;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
var scaleDenominator = parseFloat(tileMatrixSet[i].TileMatrix[j]['ScaleDenominator']['_text']);
|
|
489
|
-
|
|
490
|
-
if ((0, _util.numberEqual)(defaultScaleDenominator, scaleDenominator)) {
|
|
491
|
-
matchedScaleDenominator[+identifier] = scaleDenominator;
|
|
492
|
-
} else {
|
|
493
|
-
if (Object.keys(matchedScaleDenominator).length > 0) {
|
|
494
|
-
break;
|
|
495
|
-
} else {
|
|
496
|
-
continue;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
var zooms = Object.keys(matchedScaleDenominator).map(function (element) {
|
|
502
|
-
return +element;
|
|
503
|
-
});
|
|
504
|
-
matchMaxZoom = (0, _lodash.default)(zooms);
|
|
505
|
-
matchMinZoom = (0, _lodash2.default)(zooms);
|
|
506
|
-
|
|
507
|
-
if (zooms.length !== 0) {
|
|
508
|
-
isMatched = true;
|
|
509
|
-
} else {
|
|
510
|
-
throw Error('TileMatrixSetNotSuppport');
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
var layer = content.Layer.find(function (item) {
|
|
519
|
-
return item['ows:Identifier']['_text'] === layerInfo.layer;
|
|
520
|
-
});
|
|
521
|
-
|
|
522
|
-
if (layer) {
|
|
523
|
-
var styles = layer.Style;
|
|
524
|
-
|
|
525
|
-
if (Array.isArray(layer.Style)) {
|
|
526
|
-
style = styles[0]['ows:Identifier'] ? styles[0]['ows:Identifier']['_text'] : '';
|
|
527
|
-
} else {
|
|
528
|
-
style = styles['ows:Identifier'] ? styles['ows:Identifier']['_text'] : '';
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
if (layer['ows:WGS84BoundingBox']) {
|
|
532
|
-
var lowerCorner = layer['ows:WGS84BoundingBox']['ows:LowerCorner']['_text'].split(' ');
|
|
533
|
-
var upperCorner = layer['ows:WGS84BoundingBox']['ows:UpperCorner']['_text'].split(' ');
|
|
534
|
-
bounds = [parseFloat(lowerCorner[0]), parseFloat(lowerCorner[1]), parseFloat(upperCorner[0]), parseFloat(upperCorner[1])];
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
var resourceUrls = layer.ResourceURL;
|
|
538
|
-
|
|
539
|
-
if (!Array.isArray(resourceUrls)) {
|
|
540
|
-
resourceUrls = [resourceUrls];
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
var resourceUrl = resourceUrls.find(function (item) {
|
|
544
|
-
return item._attributes.resourceType === 'tile';
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
if (resourceUrl) {
|
|
548
|
-
restResourceURL = resourceUrl._attributes.template;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
resolve({
|
|
553
|
-
isMatched: isMatched,
|
|
554
|
-
matchMaxZoom: matchMaxZoom,
|
|
555
|
-
matchMinZoom: matchMinZoom,
|
|
556
|
-
style: style,
|
|
557
|
-
bounds: bounds,
|
|
558
|
-
restResourceURL: restResourceURL,
|
|
559
|
-
kvpResourceUrl: kvpResourceUrl
|
|
560
|
-
});
|
|
561
|
-
}).catch(function (error) {
|
|
562
|
-
reject(error);
|
|
563
|
-
});
|
|
564
|
-
});
|
|
565
|
-
};
|
|
566
|
-
|
|
567
|
-
_proto._getFeaturesFromHosted = function _getFeaturesFromHosted(layer, baseProjection) {
|
|
568
|
-
var dataSource = layer.dataSource,
|
|
569
|
-
layerType = layer.layerType;
|
|
570
|
-
var serverId = dataSource ? dataSource.serverId : layer.serverId;
|
|
571
|
-
|
|
572
|
-
if (!serverId) {
|
|
573
|
-
return new Promise(function (resolve) {
|
|
574
|
-
resolve({
|
|
575
|
-
type: 'noServerId'
|
|
576
|
-
});
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
var getDataFromIportal = layerType === 'MARKER' || dataSource && (!dataSource.accessType || dataSource.accessType === 'DIRECT');
|
|
581
|
-
|
|
582
|
-
if (getDataFromIportal) {
|
|
583
|
-
return this._getDataFromIportal(serverId, layer);
|
|
584
|
-
} else {
|
|
585
|
-
return this._getDataFromHosted({
|
|
586
|
-
layer: layer,
|
|
587
|
-
serverId: serverId,
|
|
588
|
-
baseProjection: baseProjection
|
|
589
|
-
});
|
|
590
|
-
}
|
|
591
|
-
};
|
|
592
|
-
|
|
593
|
-
_proto._getFeaturesFromRestData = function _getFeaturesFromRestData(layer, baseProjection) {
|
|
594
|
-
var _this6 = this;
|
|
595
|
-
|
|
596
|
-
var features;
|
|
597
|
-
var dataSource = layer.dataSource;
|
|
598
|
-
return new Promise(function (resolve, reject) {
|
|
599
|
-
_this6._getFeatureBySQL(dataSource.url, [decodeURIComponent(dataSource.dataSourceName) || layer.name], function (result) {
|
|
600
|
-
features = _this6.parseGeoJsonData2Feature({
|
|
601
|
-
allDatas: {
|
|
602
|
-
features: result.result.features.features
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
resolve({
|
|
606
|
-
type: 'feature',
|
|
607
|
-
features: features
|
|
608
|
-
});
|
|
609
|
-
}, function (err) {
|
|
610
|
-
reject(err);
|
|
611
|
-
}, baseProjection);
|
|
612
|
-
});
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
_proto._getFeaturesFromRestMap = function _getFeaturesFromRestMap(layer) {
|
|
616
|
-
var _this7 = this;
|
|
617
|
-
|
|
618
|
-
return new Promise(function (resolve, reject) {
|
|
619
|
-
_this7._queryFeatureBySQL(layer.dataSource.url, layer.dataSource.layerName, function (result) {
|
|
620
|
-
var recordsets = result && result.result.recordsets;
|
|
621
|
-
var recordset = recordsets && recordsets[0];
|
|
622
|
-
var attributes = recordset.fields;
|
|
623
|
-
|
|
624
|
-
if (recordset && attributes) {
|
|
625
|
-
var fileterAttrs = [];
|
|
626
|
-
|
|
627
|
-
for (var i in attributes) {
|
|
628
|
-
var value = attributes[i];
|
|
629
|
-
|
|
630
|
-
if (value.indexOf('Sm') !== 0 || value === 'SmID') {
|
|
631
|
-
fileterAttrs.push(value);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
_this7._getFeatures(fileterAttrs, layer, function (features) {
|
|
636
|
-
resolve({
|
|
637
|
-
type: 'feature',
|
|
638
|
-
features: features
|
|
639
|
-
});
|
|
640
|
-
}, function (err) {
|
|
641
|
-
reject(err);
|
|
642
|
-
});
|
|
643
|
-
}
|
|
644
|
-
}, function (err) {
|
|
645
|
-
reject(err);
|
|
646
|
-
}, 'smid=1');
|
|
647
|
-
});
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
_proto._getFeaturesFromUserData = function _getFeaturesFromUserData(layer) {
|
|
651
|
-
var _this8 = this;
|
|
652
|
-
|
|
653
|
-
var dataSource = layer.dataSource;
|
|
654
|
-
return new Promise(function (resolve, reject) {
|
|
655
|
-
var proxy = _this8.handleProxy();
|
|
656
|
-
|
|
657
|
-
var serviceUrl = _this8.handleParentRes(dataSource.url);
|
|
658
|
-
|
|
659
|
-
SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
660
|
-
withCredentials: _this8.handleWithCredentials(proxy, serviceUrl, _this8.withCredentials),
|
|
661
|
-
proxy: proxy,
|
|
662
|
-
withoutFormatSuffix: true
|
|
663
|
-
}).then(function (response) {
|
|
664
|
-
return response.json();
|
|
665
|
-
}).then(function (data) {
|
|
666
|
-
var features;
|
|
667
|
-
|
|
668
|
-
if (data && data instanceof Object && data.type === 'FeatureCollection') {
|
|
669
|
-
features = data.features;
|
|
670
|
-
} else {
|
|
671
|
-
features = data;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
features = _this8.parseGeoJsonData2Feature({
|
|
675
|
-
allDatas: {
|
|
676
|
-
features: features
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
resolve({
|
|
680
|
-
type: 'feature',
|
|
681
|
-
features: features
|
|
682
|
-
});
|
|
683
|
-
}).catch(function (err) {
|
|
684
|
-
reject(err);
|
|
685
|
-
});
|
|
686
|
-
});
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
_proto._queryFeatureBySQL = function _queryFeatureBySQL(url, layerName, _processCompleted, processFaild, attributeFilter, fields, epsgCode, startRecord, recordLength, onlyAttribute) {
|
|
690
|
-
var queryBySQLParams = this._getQueryFeaturesParam(layerName, attributeFilter, fields, epsgCode, startRecord, recordLength, onlyAttribute);
|
|
691
|
-
|
|
692
|
-
var proxy = this.handleProxy();
|
|
693
|
-
var serviceUrl = this.handleParentRes(url);
|
|
694
|
-
var queryBySQLService = new SuperMap.QueryBySQLService(serviceUrl, {
|
|
695
|
-
proxy: proxy,
|
|
696
|
-
withCredentials: this.handleWithCredentials(proxy, url, false),
|
|
697
|
-
eventListeners: {
|
|
698
|
-
processCompleted: function processCompleted(data) {
|
|
699
|
-
_processCompleted && _processCompleted(data);
|
|
700
|
-
},
|
|
701
|
-
processFailed: function processFailed(data) {
|
|
702
|
-
processFaild && processFaild(data);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
queryBySQLService.processAsync(queryBySQLParams);
|
|
707
|
-
};
|
|
708
|
-
|
|
709
|
-
_proto._getFeatures = function _getFeatures(fields, layerInfo, resolve, reject) {
|
|
710
|
-
var _this9 = this;
|
|
711
|
-
|
|
712
|
-
var source = layerInfo.dataSource;
|
|
713
|
-
|
|
714
|
-
this._queryFeatureBySQL(source.url, source.layerName, function (result) {
|
|
715
|
-
var recordsets = result.result.recordsets[0];
|
|
716
|
-
var features = recordsets.features.features;
|
|
717
|
-
|
|
718
|
-
var featuresObj = _this9.parseGeoJsonData2Feature({
|
|
719
|
-
allDatas: {
|
|
720
|
-
features: features
|
|
721
|
-
}
|
|
722
|
-
});
|
|
723
|
-
|
|
724
|
-
resolve(featuresObj);
|
|
725
|
-
}, function (err) {
|
|
726
|
-
reject(err);
|
|
727
|
-
}, null, fields);
|
|
728
|
-
};
|
|
729
|
-
|
|
730
|
-
_proto._getQueryFeaturesParam = function _getQueryFeaturesParam(layerName, attributeFilter, fields, epsgCode, startRecord, recordLength, onlyAttribute) {
|
|
731
|
-
var queryParam = new SuperMap.FilterParameter({
|
|
732
|
-
name: layerName,
|
|
733
|
-
attributeFilter: attributeFilter
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
if (fields) {
|
|
737
|
-
queryParam.fields = fields;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
|
-
var params = {
|
|
741
|
-
queryParams: [queryParam]
|
|
742
|
-
};
|
|
743
|
-
|
|
744
|
-
if (onlyAttribute) {
|
|
745
|
-
params.queryOption = SuperMap.QueryOption.ATTRIBUTE;
|
|
746
|
-
}
|
|
747
|
-
|
|
748
|
-
startRecord && (params.startRecord = startRecord);
|
|
749
|
-
recordLength && (params.expectCount = recordLength);
|
|
750
|
-
|
|
751
|
-
if (epsgCode) {
|
|
752
|
-
params.prjCoordSys = {
|
|
753
|
-
epsgCode: epsgCode
|
|
754
|
-
};
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
var queryBySQLParams = new SuperMap.QueryBySQLParameters(params);
|
|
758
|
-
return queryBySQLParams;
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
_proto._getFeaturesFromDataflow = function _getFeaturesFromDataflow(layer) {
|
|
762
|
-
var _this10 = this;
|
|
763
|
-
|
|
764
|
-
return new Promise(function (resolve, reject) {
|
|
765
|
-
_this10._getDataflowInfo(layer, function () {
|
|
766
|
-
resolve({
|
|
767
|
-
type: 'dataflow'
|
|
768
|
-
});
|
|
769
|
-
}, function (e) {
|
|
770
|
-
reject(e);
|
|
771
|
-
});
|
|
772
|
-
});
|
|
773
|
-
};
|
|
774
|
-
|
|
775
|
-
_proto._getDataflowInfo = function _getDataflowInfo(layerInfo, success, faild) {
|
|
776
|
-
var url = layerInfo.url;
|
|
777
|
-
var token;
|
|
778
|
-
var requestUrl = url + ".json";
|
|
779
|
-
|
|
780
|
-
if (layerInfo.credential && layerInfo.credential.token) {
|
|
781
|
-
token = layerInfo.credential.token;
|
|
782
|
-
requestUrl += "?token=" + token;
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
var proxy = this.handleProxy();
|
|
786
|
-
requestUrl = this.handleParentRes(requestUrl);
|
|
787
|
-
SuperMap.FetchRequest.get(requestUrl, null, {
|
|
788
|
-
proxy: proxy,
|
|
789
|
-
withCredentials: this.handleWithCredentials(proxy, requestUrl, false)
|
|
790
|
-
}).then(function (response) {
|
|
791
|
-
return response.json();
|
|
792
|
-
}).then(function (result) {
|
|
793
|
-
if (!result) {
|
|
794
|
-
faild();
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
if (result.featureMetaData) {
|
|
799
|
-
layerInfo.featureType = result.featureMetaData.featureType.toUpperCase();
|
|
800
|
-
layerInfo.dataSource = {
|
|
801
|
-
dataTypes: {}
|
|
802
|
-
};
|
|
803
|
-
|
|
804
|
-
if (result.featureMetaData.fieldInfos && result.featureMetaData.fieldInfos.length > 0) {
|
|
805
|
-
result.featureMetaData.fieldInfos.forEach(function (data) {
|
|
806
|
-
var name = data.name.trim();
|
|
807
|
-
|
|
808
|
-
if (data.type === 'TEXT') {
|
|
809
|
-
layerInfo.dataSource.dataTypes[name] = 'STRING';
|
|
810
|
-
} else if (['DOUBLE', 'INT', 'FLOAT', 'LONG', 'SHORT'].includes(data.type)) {
|
|
811
|
-
layerInfo.dataSource.dataTypes[name] = 'NUMBER';
|
|
812
|
-
} else {
|
|
813
|
-
layerInfo.dataSource.dataTypes[name] = 'UNKNOWN';
|
|
814
|
-
}
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
layerInfo.wsUrl = result.urls[0].url;
|
|
820
|
-
layerInfo.name = result.urls[0].url.split('iserver/services/')[1].split('/dataflow')[0];
|
|
821
|
-
success();
|
|
822
|
-
}).catch(function () {
|
|
823
|
-
faild();
|
|
824
|
-
});
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
_proto.getDatasourceType = function getDatasourceType(layer) {
|
|
828
|
-
var dataSource = layer.dataSource,
|
|
829
|
-
layerType = layer.layerType;
|
|
830
|
-
|
|
831
|
-
if (dataSource && dataSource.type === 'SAMPLE_DATA') {
|
|
832
|
-
return dataSource.type;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
var type;
|
|
836
|
-
var isHosted = dataSource && dataSource.serverId || layerType === 'MARKER' || layerType === 'HOSTED_TILE';
|
|
837
|
-
var isTile = layerType === 'SUPERMAP_REST' || layerType === 'TILE' || layerType === 'WMS' || layerType === 'WMTS' || layerType === 'MAPBOXSTYLE';
|
|
838
|
-
|
|
839
|
-
if (isHosted) {
|
|
840
|
-
type = 'hosted';
|
|
841
|
-
} else if (isTile) {
|
|
842
|
-
type = 'tile';
|
|
843
|
-
} else if (dataSource && dataSource.type === 'REST_DATA') {
|
|
844
|
-
type = 'rest_data';
|
|
845
|
-
} else if (dataSource && dataSource.type === 'REST_MAP' && dataSource.url) {
|
|
846
|
-
type = 'rest_map';
|
|
847
|
-
} else if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') {
|
|
848
|
-
type = 'dataflow';
|
|
849
|
-
} else if (dataSource && dataSource.type === 'USER_DATA') {
|
|
850
|
-
type = 'user_data';
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
return type;
|
|
854
|
-
};
|
|
855
|
-
|
|
856
|
-
_proto.getFeatureProperties = function getFeatureProperties(features) {
|
|
857
|
-
var properties = [];
|
|
858
|
-
|
|
859
|
-
if (features && features.length) {
|
|
860
|
-
features.forEach(function (feature) {
|
|
861
|
-
var property = feature.properties;
|
|
862
|
-
property && properties.push(property);
|
|
863
|
-
});
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
return properties;
|
|
867
|
-
};
|
|
868
|
-
|
|
869
|
-
_proto.parseGeoJsonData2Feature = function parseGeoJsonData2Feature(metaData) {
|
|
870
|
-
var allFeatures = metaData.allDatas.features;
|
|
871
|
-
var features = [];
|
|
872
|
-
|
|
873
|
-
for (var i = 0, len = allFeatures.length; i < len; i++) {
|
|
874
|
-
var feature = allFeatures[i];
|
|
875
|
-
var coordinate = feature.geometry.coordinates;
|
|
876
|
-
|
|
877
|
-
if (allFeatures[i].geometry.type === 'Point') {
|
|
878
|
-
if (allFeatures[i].properties) {
|
|
879
|
-
allFeatures[i].properties.lon = coordinate[0];
|
|
880
|
-
allFeatures[i].properties.lat = coordinate[1];
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
feature.properties['index'] = i + '';
|
|
885
|
-
features.push(feature);
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
return features;
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
_proto._getDataFromIportal = function _getDataFromIportal(serverId, layerInfo) {
|
|
892
|
-
var _this11 = this;
|
|
893
|
-
|
|
894
|
-
var features;
|
|
895
|
-
var url = this.serverUrl + "web/datas/" + serverId + "/content.json?pageSize=9999999¤tPage=1";
|
|
896
|
-
|
|
897
|
-
if (this.accessToken) {
|
|
898
|
-
url = url + "&" + this.accessKey + "=" + this.accessToken;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
|
-
return new Promise(function (resolve, reject) {
|
|
902
|
-
url = _this11.handleParentRes(url);
|
|
903
|
-
|
|
904
|
-
var proxy = _this11.handleProxy();
|
|
905
|
-
|
|
906
|
-
SuperMap.FetchRequest.get(url, null, {
|
|
907
|
-
withCredentials: _this11.handleWithCredentials(proxy, url, _this11.withCredentials),
|
|
908
|
-
proxy: proxy
|
|
909
|
-
}).then(function (response) {
|
|
910
|
-
return response.json();
|
|
911
|
-
}).then(function (data) {
|
|
912
|
-
return __awaiter(_this11, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
913
|
-
var _layerInfo$dataSource, divisionType, divisionField, geojson;
|
|
914
|
-
|
|
915
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
916
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
917
|
-
case 0:
|
|
918
|
-
if (data.succeed === false) {
|
|
919
|
-
reject(data.error);
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
if (!(data && data.type)) {
|
|
923
|
-
_context2.next = 22;
|
|
924
|
-
break;
|
|
925
|
-
}
|
|
926
|
-
|
|
927
|
-
if (!(data.type === 'JSON' || data.type === 'GEOJSON')) {
|
|
928
|
-
_context2.next = 7;
|
|
929
|
-
break;
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
data.content = JSON.parse(data.content.trim());
|
|
933
|
-
features = this._formatGeoJSON(data.content);
|
|
934
|
-
_context2.next = 21;
|
|
935
|
-
break;
|
|
936
|
-
|
|
937
|
-
case 7:
|
|
938
|
-
if (!(data.type === 'EXCEL' || data.type === 'CSV')) {
|
|
939
|
-
_context2.next = 20;
|
|
940
|
-
break;
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
if (!(layerInfo.dataSource && layerInfo.dataSource.administrativeInfo)) {
|
|
944
|
-
_context2.next = 17;
|
|
945
|
-
break;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
data.content.rows.unshift(data.content.colTitles);
|
|
949
|
-
_layerInfo$dataSource = layerInfo.dataSource.administrativeInfo, divisionType = _layerInfo$dataSource.divisionType, divisionField = _layerInfo$dataSource.divisionField;
|
|
950
|
-
_context2.next = 13;
|
|
951
|
-
return this._excelData2FeatureByDivision(data.content, divisionType, divisionField);
|
|
952
|
-
|
|
953
|
-
case 13:
|
|
954
|
-
geojson = _context2.sent;
|
|
955
|
-
features = this._formatGeoJSON(geojson);
|
|
956
|
-
_context2.next = 18;
|
|
957
|
-
break;
|
|
958
|
-
|
|
959
|
-
case 17:
|
|
960
|
-
features = this._excelData2Feature(data.content, layerInfo && layerInfo.xyField || {});
|
|
961
|
-
|
|
962
|
-
case 18:
|
|
963
|
-
_context2.next = 21;
|
|
964
|
-
break;
|
|
965
|
-
|
|
966
|
-
case 20:
|
|
967
|
-
if (data.type === 'SHP') {
|
|
968
|
-
data.content = JSON.parse(data.content.trim());
|
|
969
|
-
features = this._formatGeoJSON(data.content.layers[0]);
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
case 21:
|
|
973
|
-
resolve({
|
|
974
|
-
type: 'feature',
|
|
975
|
-
features: features
|
|
976
|
-
});
|
|
977
|
-
|
|
978
|
-
case 22:
|
|
979
|
-
case "end":
|
|
980
|
-
return _context2.stop();
|
|
981
|
-
}
|
|
982
|
-
}, _callee2, this);
|
|
983
|
-
}));
|
|
984
|
-
}).catch(function (error) {
|
|
985
|
-
reject(error);
|
|
986
|
-
});
|
|
987
|
-
});
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
_proto._getDataFromHosted = function _getDataFromHosted(_ref) {
|
|
991
|
-
var _this12 = this;
|
|
992
|
-
|
|
993
|
-
var layer = _ref.layer,
|
|
994
|
-
serverId = _ref.serverId,
|
|
995
|
-
baseProjection = _ref.baseProjection;
|
|
996
|
-
var isMapService = layer.layerType === 'HOSTED_TILE';
|
|
997
|
-
return new Promise(function (resolve, reject) {
|
|
998
|
-
_this12._checkUploadToRelationship(serverId).then(function (result) {
|
|
999
|
-
if (result && result.length > 0) {
|
|
1000
|
-
var datasetName = result[0].name;
|
|
1001
|
-
var featureType = result[0].type.toUpperCase();
|
|
1002
|
-
|
|
1003
|
-
_this12._getDataService(serverId, datasetName).then(function (data) {
|
|
1004
|
-
var dataItemServices = data.dataItemServices;
|
|
1005
|
-
|
|
1006
|
-
if (dataItemServices.length === 0) {
|
|
1007
|
-
reject('noDataServices');
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
var param = {
|
|
1011
|
-
layer: layer,
|
|
1012
|
-
dataItemServices: dataItemServices,
|
|
1013
|
-
datasetName: datasetName,
|
|
1014
|
-
featureType: featureType,
|
|
1015
|
-
resolve: resolve,
|
|
1016
|
-
reject: reject,
|
|
1017
|
-
baseProjection: baseProjection
|
|
1018
|
-
};
|
|
1019
|
-
|
|
1020
|
-
if (isMapService) {
|
|
1021
|
-
var dataService = dataItemServices.filter(function (info) {
|
|
1022
|
-
return info && info.serviceType === 'RESTDATA';
|
|
1023
|
-
})[0];
|
|
1024
|
-
|
|
1025
|
-
_this12._isMvt(dataService.address, datasetName, baseProjection).then(function (info) {
|
|
1026
|
-
_this12._getServiceInfoFromLayer(param, info);
|
|
1027
|
-
}).catch(function () {
|
|
1028
|
-
_this12._getServiceInfoFromLayer(param);
|
|
1029
|
-
});
|
|
1030
|
-
} else {
|
|
1031
|
-
_this12._getServiceInfoFromLayer(param);
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
} else {
|
|
1035
|
-
reject('resultIsEmpty');
|
|
1036
|
-
}
|
|
1037
|
-
}).catch(function (error) {
|
|
1038
|
-
reject(error);
|
|
1039
|
-
});
|
|
1040
|
-
});
|
|
1041
|
-
};
|
|
1042
|
-
|
|
1043
|
-
_proto._isMvt = function _isMvt(serviceUrl, datasetName, baseProjection) {
|
|
1044
|
-
return this._getDatasetsInfo(serviceUrl, datasetName).then(function (info) {
|
|
1045
|
-
if (info.epsgCode == baseProjection.split('EPSG:')[1]) {
|
|
1046
|
-
return SuperMap.FetchRequest.get(info.url + "/tilefeature.mvt").then(function (response) {
|
|
1047
|
-
return response.json();
|
|
1048
|
-
}).then(function (result) {
|
|
1049
|
-
info.isMvt = result.error && result.error.code === 400;
|
|
1050
|
-
return info;
|
|
1051
|
-
}).catch(function () {
|
|
1052
|
-
return info;
|
|
1053
|
-
});
|
|
1054
|
-
}
|
|
1055
|
-
|
|
1056
|
-
return info;
|
|
1057
|
-
});
|
|
1058
|
-
};
|
|
1059
|
-
|
|
1060
|
-
_proto._getServiceInfoFromLayer = function _getServiceInfoFromLayer(_ref2, info) {
|
|
1061
|
-
var _this13 = this;
|
|
1062
|
-
|
|
1063
|
-
var layer = _ref2.layer,
|
|
1064
|
-
dataItemServices = _ref2.dataItemServices,
|
|
1065
|
-
datasetName = _ref2.datasetName,
|
|
1066
|
-
featureType = _ref2.featureType,
|
|
1067
|
-
resolve = _ref2.resolve,
|
|
1068
|
-
reject = _ref2.reject,
|
|
1069
|
-
baseProjection = _ref2.baseProjection;
|
|
1070
|
-
var isMapService = info ? !info.isMvt : layer.layerType === 'HOSTED_TILE';
|
|
1071
|
-
var isAdded = false;
|
|
1072
|
-
dataItemServices.forEach(function (service) {
|
|
1073
|
-
if (isAdded) {
|
|
1074
|
-
return;
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
|
-
if (service && isMapService && service.serviceType === 'RESTMAP') {
|
|
1078
|
-
isAdded = true;
|
|
1079
|
-
|
|
1080
|
-
_this13._getTileLayerInfo(service.address, baseProjection).then(function (restMaps) {
|
|
1081
|
-
resolve({
|
|
1082
|
-
type: 'restMap',
|
|
1083
|
-
restMaps: restMaps
|
|
1084
|
-
});
|
|
1085
|
-
});
|
|
1086
|
-
} else if (service && !isMapService && service.serviceType === 'RESTDATA') {
|
|
1087
|
-
if (info && info.isMvt) {
|
|
1088
|
-
resolve({
|
|
1089
|
-
type: 'mvt',
|
|
1090
|
-
info: info,
|
|
1091
|
-
featureType: featureType
|
|
1092
|
-
});
|
|
1093
|
-
} else {
|
|
1094
|
-
isAdded = true;
|
|
1095
|
-
|
|
1096
|
-
_this13._getDatasources(service.address).then(function (datasourceName) {
|
|
1097
|
-
layer.dataSource.dataSourceName = datasourceName + ':' + datasetName;
|
|
1098
|
-
layer.dataSource.url = service.address + "/data";
|
|
1099
|
-
|
|
1100
|
-
_this13._getFeatureBySQL(layer.dataSource.url, [layer.dataSource.dataSourceName || layer.name], function (result) {
|
|
1101
|
-
var features = _this13.parseGeoJsonData2Feature({
|
|
1102
|
-
allDatas: {
|
|
1103
|
-
features: result.result.features.features
|
|
1104
|
-
}
|
|
1105
|
-
});
|
|
1106
|
-
|
|
1107
|
-
resolve({
|
|
1108
|
-
type: 'feature',
|
|
1109
|
-
features: features
|
|
1110
|
-
});
|
|
1111
|
-
}, function (err) {
|
|
1112
|
-
reject(err);
|
|
1113
|
-
});
|
|
1114
|
-
}, function (err) {
|
|
1115
|
-
reject(err);
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
}, this);
|
|
1120
|
-
|
|
1121
|
-
if (!isAdded) {
|
|
1122
|
-
reject('noService');
|
|
1123
|
-
}
|
|
1124
|
-
};
|
|
1125
|
-
|
|
1126
|
-
_proto._getDatasetsInfo = function _getDatasetsInfo(serviceUrl, datasetName) {
|
|
1127
|
-
var _this14 = this;
|
|
1128
|
-
|
|
1129
|
-
return this._getDatasources(serviceUrl).then(function (datasourceName) {
|
|
1130
|
-
var url = serviceUrl + "/data/datasources/" + datasourceName + "/datasets/" + datasetName;
|
|
1131
|
-
|
|
1132
|
-
var proxy = _this14.handleProxy();
|
|
1133
|
-
|
|
1134
|
-
url = _this14.handleParentRes(url);
|
|
1135
|
-
return SuperMap.FetchRequest.get(url, null, {
|
|
1136
|
-
withCredentials: _this14.handleWithCredentials(proxy, url, false),
|
|
1137
|
-
proxy: proxy
|
|
1138
|
-
}).then(function (response) {
|
|
1139
|
-
return response.json();
|
|
1140
|
-
}).then(function (datasetsInfo) {
|
|
1141
|
-
return {
|
|
1142
|
-
epsgCode: datasetsInfo.datasetInfo.prjCoordSys.epsgCode,
|
|
1143
|
-
bounds: datasetsInfo.datasetInfo.bounds,
|
|
1144
|
-
datasourceName: datasourceName,
|
|
1145
|
-
datasetName: datasetName,
|
|
1146
|
-
url: url
|
|
1147
|
-
};
|
|
1148
|
-
});
|
|
1149
|
-
});
|
|
1150
|
-
};
|
|
1151
|
-
|
|
1152
|
-
_proto._getDatasources = function _getDatasources(url) {
|
|
1153
|
-
var proxy = this.handleProxy();
|
|
1154
|
-
var serviceUrl = url + "/data/datasources.json";
|
|
1155
|
-
serviceUrl = this.handleParentRes(serviceUrl);
|
|
1156
|
-
return SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
1157
|
-
withCredentials: this.handleWithCredentials(proxy, serviceUrl, false),
|
|
1158
|
-
proxy: proxy
|
|
1159
|
-
}).then(function (response) {
|
|
1160
|
-
return response.json();
|
|
1161
|
-
}).then(function (datasource) {
|
|
1162
|
-
if (datasource.code === 401) {
|
|
1163
|
-
throw Error(datasource.errorMsg);
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
var datasourceNames = datasource.datasourceNames;
|
|
1167
|
-
return datasourceNames[0];
|
|
1168
|
-
});
|
|
1169
|
-
};
|
|
1170
|
-
|
|
1171
|
-
_proto._getDataService = function _getDataService(fileId, datasetName) {
|
|
1172
|
-
var proxy = this.handleProxy();
|
|
1173
|
-
var serviceUrl = this.serverUrl + "web/datas/" + fileId + ".json";
|
|
1174
|
-
serviceUrl = this.handleParentRes(serviceUrl);
|
|
1175
|
-
return SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
1176
|
-
withCredentials: this.handleWithCredentials(proxy, serviceUrl, this.withCredentials),
|
|
1177
|
-
proxy: proxy
|
|
1178
|
-
}).then(function (response) {
|
|
1179
|
-
return response.json();
|
|
1180
|
-
}).then(function (result) {
|
|
1181
|
-
result.fileId = fileId;
|
|
1182
|
-
result.datasetName = datasetName;
|
|
1183
|
-
return result;
|
|
1184
|
-
});
|
|
1185
|
-
};
|
|
1186
|
-
|
|
1187
|
-
_proto._checkUploadToRelationship = function _checkUploadToRelationship(fileId) {
|
|
1188
|
-
var proxy = this.handleProxy();
|
|
1189
|
-
var serviceUrl = this.serverUrl + "web/datas/" + fileId + "/datasets.json";
|
|
1190
|
-
serviceUrl = this.handleParentRes(serviceUrl);
|
|
1191
|
-
return SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
1192
|
-
withCredentials: this.handleWithCredentials(proxy, serviceUrl, this.withCredentials),
|
|
1193
|
-
proxy: proxy
|
|
1194
|
-
}).then(function (response) {
|
|
1195
|
-
return response.json();
|
|
1196
|
-
}).then(function (result) {
|
|
1197
|
-
return result;
|
|
1198
|
-
});
|
|
1199
|
-
};
|
|
1200
|
-
|
|
1201
|
-
_proto._handleMapUrl = function _handleMapUrl() {
|
|
1202
|
-
var mapUrl = this.serverUrl + 'web/maps/' + this.mapId + '/map';
|
|
1203
|
-
|
|
1204
|
-
if (this.accessToken || this.accessKey) {
|
|
1205
|
-
mapUrl += true ? 'token=' + this.accessToken : undefined;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
var filter = 'getUrlResource.json?url=';
|
|
1209
|
-
|
|
1210
|
-
if (this.excludePortalProxyUrl && this.serverUrl.indexOf(filter) > -1) {
|
|
1211
|
-
var urlArray = this.serverUrl.split(filter);
|
|
1212
|
-
|
|
1213
|
-
if (urlArray.length > 1) {
|
|
1214
|
-
mapUrl = urlArray[0] + filter + this.serverUrl + 'web/maps/' + this.mapId + '/map.json';
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
|
|
1218
|
-
mapUrl = mapUrl.indexOf('.json') === -1 ? mapUrl + ".json" : mapUrl;
|
|
1219
|
-
return mapUrl;
|
|
1220
|
-
};
|
|
1221
|
-
|
|
1222
|
-
_proto.handleProxy = function handleProxy(type) {
|
|
1223
|
-
if (!this.proxy) {
|
|
1224
|
-
return null;
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
var proxySuffix = this.proxyOptions[type || 'data'];
|
|
1228
|
-
var proxy = this.serverUrl + proxySuffix;
|
|
1229
|
-
|
|
1230
|
-
if (typeof this.proxy === 'string') {
|
|
1231
|
-
proxy = this.proxy;
|
|
1232
|
-
}
|
|
1233
|
-
|
|
1234
|
-
return proxy;
|
|
1235
|
-
};
|
|
1236
|
-
|
|
1237
|
-
_proto.handleWithCredentials = function handleWithCredentials(proxyUrl, serviceUrl, defaultValue) {
|
|
1238
|
-
if (defaultValue === void 0) {
|
|
1239
|
-
defaultValue = this.withCredentials;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
if (serviceUrl === null || serviceUrl === void 0 ? void 0 : serviceUrl.includes('https://www.supermapol.com')) {
|
|
1243
|
-
return '';
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
if (proxyUrl && proxyUrl.startsWith(this.serverUrl) && (!serviceUrl || serviceUrl.startsWith(proxyUrl))) {
|
|
1247
|
-
return true;
|
|
1248
|
-
}
|
|
1249
|
-
|
|
1250
|
-
if (serviceUrl && this.iportalServiceProxyUrl && serviceUrl.indexOf(this.iportalServiceProxyUrl) >= 0) {
|
|
1251
|
-
return true;
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
return defaultValue;
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
_proto.isIportalResourceUrl = function isIportalResourceUrl(serviceUrl) {
|
|
1258
|
-
return serviceUrl.startsWith(this.serverUrl) || this.iportalServiceProxyUrl && serviceUrl.indexOf(this.iportalServiceProxyUrl) >= 0;
|
|
1259
|
-
};
|
|
1260
|
-
|
|
1261
|
-
_proto.handleParentRes = function handleParentRes(url, parentResId, parentResType) {
|
|
1262
|
-
if (parentResId === void 0) {
|
|
1263
|
-
parentResId = this.mapId;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
if (parentResType === void 0) {
|
|
1267
|
-
parentResType = 'MAP';
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
if (!this.isIportalResourceUrl(url)) {
|
|
1271
|
-
return url;
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
return (0, _util.urlAppend)(url, "parentResType=" + parentResType + "&parentResId=" + parentResId);
|
|
1275
|
-
};
|
|
1276
|
-
|
|
1277
|
-
_proto._formatGeoJSON = function _formatGeoJSON(data) {
|
|
1278
|
-
var features = data.features;
|
|
1279
|
-
features.forEach(function (row, index) {
|
|
1280
|
-
row.properties['index'] = index;
|
|
1281
|
-
});
|
|
1282
|
-
return features;
|
|
1283
|
-
};
|
|
1284
|
-
|
|
1285
|
-
_proto._excelData2Feature = function _excelData2Feature(dataContent, xyField) {
|
|
1286
|
-
if (xyField === void 0) {
|
|
1287
|
-
xyField = {};
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
var fieldCaptions = dataContent.colTitles;
|
|
1291
|
-
var xfieldIndex = fieldCaptions.indexOf(xyField.xField);
|
|
1292
|
-
var yfieldIndex = fieldCaptions.indexOf(xyField.yField);
|
|
1293
|
-
|
|
1294
|
-
if (yfieldIndex < 0 || xfieldIndex < 0) {
|
|
1295
|
-
for (var i = 0, len = fieldCaptions.length; i < len; i++) {
|
|
1296
|
-
if ((0, _util.isXField)(fieldCaptions[i])) {
|
|
1297
|
-
xfieldIndex = i;
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
if ((0, _util.isYField)(fieldCaptions[i])) {
|
|
1301
|
-
yfieldIndex = i;
|
|
1302
|
-
}
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
|
|
1306
|
-
var features = [];
|
|
1307
|
-
|
|
1308
|
-
for (var _i = 0, _len = dataContent.rows.length; _i < _len; _i++) {
|
|
1309
|
-
var row = dataContent.rows[_i];
|
|
1310
|
-
var x = Number(row[xfieldIndex]);
|
|
1311
|
-
var y = Number(row[yfieldIndex]);
|
|
1312
|
-
|
|
1313
|
-
if (isNaN(x) || isNaN(y)) {
|
|
1314
|
-
continue;
|
|
1315
|
-
}
|
|
1316
|
-
|
|
1317
|
-
var attributes = {};
|
|
1318
|
-
|
|
1319
|
-
for (var index = 0; index < dataContent.colTitles.length; index++) {
|
|
1320
|
-
var element = dataContent.colTitles[index].trim();
|
|
1321
|
-
attributes[element] = dataContent.rows[_i][index];
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
|
-
attributes['index'] = _i + '';
|
|
1325
|
-
var feature = {
|
|
1326
|
-
type: 'Feature',
|
|
1327
|
-
geometry: {
|
|
1328
|
-
type: 'Point',
|
|
1329
|
-
coordinates: [x, y]
|
|
1330
|
-
},
|
|
1331
|
-
properties: attributes
|
|
1332
|
-
};
|
|
1333
|
-
features.push(feature);
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
return features;
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
_proto._excelData2FeatureByDivision = function _excelData2FeatureByDivision(content, divisionType, divisionField) {
|
|
1340
|
-
var _this15 = this;
|
|
1341
|
-
|
|
1342
|
-
var dataName = ['城市', 'City'].includes(divisionType) ? 'MunicipalData' : 'ProvinceData';
|
|
1343
|
-
|
|
1344
|
-
if (window[dataName] && window[dataName].features) {
|
|
1345
|
-
return new Promise(function (resolve) {
|
|
1346
|
-
resolve(_this15._combineFeature(content, window[dataName], divisionField));
|
|
1347
|
-
});
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
var dataFileName = ['城市', 'City'].includes(divisionType) ? 'MunicipalData.js' : 'ProvincialData.js';
|
|
1351
|
-
var proxy = this.handleProxy();
|
|
1352
|
-
var dataUrl = this.serverUrl + "apps/dataviz/libs/administrative_data/" + dataFileName;
|
|
1353
|
-
return SuperMap.FetchRequest.get(dataUrl, null, {
|
|
1354
|
-
withCredentials: false,
|
|
1355
|
-
proxy: proxy,
|
|
1356
|
-
withoutFormatSuffix: true
|
|
1357
|
-
}).then(function (response) {
|
|
1358
|
-
return response.text();
|
|
1359
|
-
}).then(function (result) {
|
|
1360
|
-
new Function(result)();
|
|
1361
|
-
return _this15._combineFeature(content, window[dataName], divisionField);
|
|
1362
|
-
});
|
|
1363
|
-
};
|
|
1364
|
-
|
|
1365
|
-
_proto._combineFeature = function _combineFeature(properties, geoData, divisionField) {
|
|
1366
|
-
var _this16 = this;
|
|
1367
|
-
|
|
1368
|
-
var geojson = {
|
|
1369
|
-
type: 'FeatureCollection',
|
|
1370
|
-
features: []
|
|
1371
|
-
};
|
|
1372
|
-
|
|
1373
|
-
if (properties.length < 2) {
|
|
1374
|
-
return geojson;
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
var titles = properties.colTitles;
|
|
1378
|
-
var rows = properties.rows;
|
|
1379
|
-
var fieldIndex = titles.findIndex(function (title) {
|
|
1380
|
-
return title === divisionField;
|
|
1381
|
-
});
|
|
1382
|
-
rows.forEach(function (row) {
|
|
1383
|
-
var feature = geoData.features.find(function (item) {
|
|
1384
|
-
return _this16._isMatchAdministrativeName(item.properties.Name, row[fieldIndex]);
|
|
1385
|
-
});
|
|
1386
|
-
|
|
1387
|
-
if (feature) {
|
|
1388
|
-
var province = feature.properties.Province;
|
|
1389
|
-
var combineFeature = {
|
|
1390
|
-
properties: {},
|
|
1391
|
-
geometry: feature.geometry,
|
|
1392
|
-
type: 'Feature'
|
|
1393
|
-
};
|
|
1394
|
-
row.forEach(function (item, idx) {
|
|
1395
|
-
combineFeature.properties[titles[idx]] = item;
|
|
1396
|
-
});
|
|
1397
|
-
|
|
1398
|
-
if (province) {
|
|
1399
|
-
combineFeature.properties.Province = province;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
geojson.features.push(combineFeature);
|
|
1403
|
-
}
|
|
1404
|
-
});
|
|
1405
|
-
return geojson;
|
|
1406
|
-
};
|
|
1407
|
-
|
|
1408
|
-
_proto._isMatchAdministrativeName = function _isMatchAdministrativeName(featureName, fieldName) {
|
|
1409
|
-
if (featureName && typeof fieldName === 'string' && fieldName.constructor === String) {
|
|
1410
|
-
var shortName = featureName.trim().substr(0, 2);
|
|
1411
|
-
|
|
1412
|
-
if (shortName === '张家') {
|
|
1413
|
-
shortName = featureName.trim().substr(0, 3);
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1416
|
-
if (shortName === '阿拉') {
|
|
1417
|
-
shortName = featureName.trim().substr(0, 3);
|
|
1418
|
-
}
|
|
1419
|
-
|
|
1420
|
-
return !!fieldName.match(new RegExp(shortName));
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
return false;
|
|
1424
|
-
};
|
|
1425
|
-
|
|
1426
|
-
_proto._getTileLayerInfo = function _getTileLayerInfo(url, baseProjection) {
|
|
1427
|
-
var _this17 = this;
|
|
1428
|
-
|
|
1429
|
-
var proxy = this.handleProxy();
|
|
1430
|
-
var epsgCode = baseProjection.split('EPSG:')[1];
|
|
1431
|
-
var serviceUrl = url + "/maps.json";
|
|
1432
|
-
serviceUrl = this.handleParentRes(serviceUrl);
|
|
1433
|
-
return SuperMap.FetchRequest.get(serviceUrl, null, {
|
|
1434
|
-
withCredentials: this.handleWithCredentials(proxy, serviceUrl, this.withCredentials),
|
|
1435
|
-
proxy: proxy
|
|
1436
|
-
}).then(function (response) {
|
|
1437
|
-
return response.json();
|
|
1438
|
-
}).then(function (mapInfo) {
|
|
1439
|
-
var promises = [];
|
|
1440
|
-
|
|
1441
|
-
if (mapInfo) {
|
|
1442
|
-
mapInfo.forEach(function (info) {
|
|
1443
|
-
var promise = SuperMap.FetchRequest.get(info.path + ".json?prjCoordSys=" + JSON.stringify({
|
|
1444
|
-
epsgCode: epsgCode
|
|
1445
|
-
}), null, {
|
|
1446
|
-
withCredentials: _this17.withCredentials,
|
|
1447
|
-
proxy: proxy
|
|
1448
|
-
}).then(function (response) {
|
|
1449
|
-
return response.json();
|
|
1450
|
-
}).then(function (restMapInfo) {
|
|
1451
|
-
restMapInfo.url = info.path;
|
|
1452
|
-
return restMapInfo;
|
|
1453
|
-
});
|
|
1454
|
-
promises.push(promise);
|
|
1455
|
-
});
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
return Promise.all(promises).then(function (allRestMaps) {
|
|
1459
|
-
return allRestMaps;
|
|
1460
|
-
});
|
|
1461
|
-
});
|
|
1462
|
-
};
|
|
1463
|
-
|
|
1464
|
-
_proto._getFeatureBySQL = function _getFeatureBySQL(url, datasetNames, _processCompleted2, processFaild, baseProjection) {
|
|
1465
|
-
var getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
|
|
1466
|
-
getFeatureParam = new SuperMap.FilterParameter({
|
|
1467
|
-
name: datasetNames.join().replace(':', '@'),
|
|
1468
|
-
attributeFilter: null
|
|
1469
|
-
});
|
|
1470
|
-
getFeatureBySQLParams = new SuperMap.GetFeaturesBySQLParameters({
|
|
1471
|
-
queryParameter: getFeatureParam,
|
|
1472
|
-
datasetNames: datasetNames,
|
|
1473
|
-
fromIndex: 0,
|
|
1474
|
-
toIndex: -1,
|
|
1475
|
-
maxFeatures: -1,
|
|
1476
|
-
returnContent: true
|
|
1477
|
-
});
|
|
1478
|
-
|
|
1479
|
-
if (baseProjection) {
|
|
1480
|
-
if (baseProjection === 'EPSG:3857' || baseProjection === 'EPSG:-1000') {
|
|
1481
|
-
getFeatureBySQLParams.targetEpsgCode = 4326;
|
|
1482
|
-
} else {
|
|
1483
|
-
getFeatureBySQLParams.targetEpsgCode = +baseProjection.split(':')[1];
|
|
1484
|
-
}
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
|
-
var proxy = this.handleProxy();
|
|
1488
|
-
var options = {
|
|
1489
|
-
proxy: proxy,
|
|
1490
|
-
withCredentials: this.handleWithCredentials(proxy, url, false),
|
|
1491
|
-
eventListeners: {
|
|
1492
|
-
processCompleted: function processCompleted(getFeaturesEventArgs) {
|
|
1493
|
-
var result = getFeaturesEventArgs.result;
|
|
1494
|
-
|
|
1495
|
-
if (result && result.datasetInfos) {
|
|
1496
|
-
var fields = [];
|
|
1497
|
-
var fieldCaptions = [];
|
|
1498
|
-
var fieldTypes = [];
|
|
1499
|
-
var fieldInfos = result.datasetInfos[0].fieldInfos;
|
|
1500
|
-
fieldInfos.forEach(function (fieldInfo) {
|
|
1501
|
-
if (fieldInfo.name) {
|
|
1502
|
-
fields.push(fieldInfo.name.toUpperCase());
|
|
1503
|
-
fieldCaptions.push(fieldInfo.caption.toUpperCase());
|
|
1504
|
-
fieldTypes.push(fieldInfo.type);
|
|
1505
|
-
}
|
|
1506
|
-
});
|
|
1507
|
-
var data = (0, _statistics.statisticsFeatures)(result.features.features, fields, fieldCaptions, fieldTypes);
|
|
1508
|
-
getFeaturesEventArgs.result.features.features = data.features;
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
_processCompleted2 && _processCompleted2(getFeaturesEventArgs);
|
|
1512
|
-
},
|
|
1513
|
-
processFailed: function processFailed(e) {
|
|
1514
|
-
processFaild && processFaild(e);
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
};
|
|
1518
|
-
var serviceUrl = this.handleParentRes(url);
|
|
1519
|
-
getFeatureBySQLService = new SuperMap.GetFeaturesBySQLService(serviceUrl, options);
|
|
1520
|
-
getFeatureBySQLService.processAsync(getFeatureBySQLParams);
|
|
1521
|
-
};
|
|
1522
|
-
|
|
1523
|
-
_proto.getEpsgCodeInfo = function getEpsgCodeInfo(epsgCode, iPortalUrl) {
|
|
1524
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
1525
|
-
var url, codeUrl, wkt;
|
|
1526
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
1527
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
1528
|
-
case 0:
|
|
1529
|
-
url = iPortalUrl.slice(-1) === '/' ? iPortalUrl : iPortalUrl + "/";
|
|
1530
|
-
codeUrl = url + "epsgcodes/" + epsgCode + ".json";
|
|
1531
|
-
_context3.next = 4;
|
|
1532
|
-
return SuperMap.FetchRequest.get(codeUrl, null).then(function (response) {
|
|
1533
|
-
return response.json();
|
|
1534
|
-
}).then(function (epsgcodeInfo) {
|
|
1535
|
-
return epsgcodeInfo.wkt;
|
|
1536
|
-
}).catch(function (err) {
|
|
1537
|
-
console.error(err);
|
|
1538
|
-
return undefined;
|
|
1539
|
-
});
|
|
1540
|
-
|
|
1541
|
-
case 4:
|
|
1542
|
-
wkt = _context3.sent;
|
|
1543
|
-
return _context3.abrupt("return", wkt);
|
|
1544
|
-
|
|
1545
|
-
case 6:
|
|
1546
|
-
case "end":
|
|
1547
|
-
return _context3.stop();
|
|
1548
|
-
}
|
|
1549
|
-
}, _callee3);
|
|
1550
|
-
}));
|
|
1551
|
-
};
|
|
1552
|
-
|
|
1553
|
-
return WebMapService;
|
|
1554
|
-
}(_Events2.Events);
|
|
1555
|
-
|
|
1556
|
-
/***/ }),
|
|
1557
|
-
|
|
1558
|
-
/***/ 252:
|
|
1559
|
-
/***/ (function(module, exports) {
|
|
1560
|
-
|
|
1561
|
-
module.exports = require("xml-js");
|
|
1562
|
-
|
|
1563
|
-
/***/ }),
|
|
1564
|
-
|
|
1565
|
-
/***/ 253:
|
|
1566
|
-
/***/ (function(module, exports) {
|
|
1567
|
-
|
|
1568
|
-
module.exports = require("lodash.min");
|
|
1569
|
-
|
|
1570
|
-
/***/ }),
|
|
1571
|
-
|
|
1572
|
-
/***/ 38:
|
|
1573
|
-
/***/ (function(module, exports) {
|
|
1574
|
-
|
|
1575
|
-
module.exports = require("@supermapgis/vue-iclient-leaflet/lib/_utils/statistics.js");
|
|
1576
|
-
|
|
1577
|
-
/***/ }),
|
|
1578
|
-
|
|
1579
|
-
/***/ 43:
|
|
1580
|
-
/***/ (function(module, exports) {
|
|
1581
|
-
|
|
1582
|
-
module.exports = require("@babel/runtime/regenerator");
|
|
1583
|
-
|
|
1584
|
-
/***/ }),
|
|
1585
|
-
|
|
1586
|
-
/***/ 59:
|
|
1587
|
-
/***/ (function(module, exports) {
|
|
1588
|
-
|
|
1589
|
-
module.exports = require("lodash.max");
|
|
1590
|
-
|
|
1591
|
-
/***/ }),
|
|
1592
|
-
|
|
1593
|
-
/***/ 6:
|
|
1594
|
-
/***/ (function(module, exports) {
|
|
1595
|
-
|
|
1596
|
-
module.exports = require("@babel/runtime/helpers/inheritsLoose");
|
|
1597
|
-
|
|
1598
|
-
/***/ }),
|
|
1599
|
-
|
|
1600
|
-
/***/ 9:
|
|
1601
|
-
/***/ (function(module, exports) {
|
|
1602
|
-
|
|
1603
|
-
module.exports = require("@supermapgis/vue-iclient-leaflet/lib/_utils/util.js");
|
|
1604
|
-
|
|
1605
|
-
/***/ })
|
|
1606
|
-
|
|
1607
|
-
/******/ });
|