gis-common 1.0.19 → 1.1.3

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.
Files changed (2) hide show
  1. package/dist/resource.min.js +42 -184
  2. package/package.json +1 -4
@@ -1,13 +1,13 @@
1
1
  (function webpackUniversalModuleDefinition(root, factory) {
2
2
  if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory(require("mqtt"));
3
+ module.exports = factory();
4
4
  else if(typeof define === 'function' && define.amd)
5
- define("Gis", ["mqtt"], factory);
5
+ define("Gis", [], factory);
6
6
  else if(typeof exports === 'object')
7
- exports["Gis"] = factory(require("mqtt"));
7
+ exports["Gis"] = factory();
8
8
  else
9
- root["Gis"] = factory(root["mqtt"]);
10
- })(window, function(__WEBPACK_EXTERNAL_MODULE__0__) {
9
+ root["Gis"] = factory();
10
+ })(window, function() {
11
11
  return /******/ (function(modules) { // webpackBootstrap
12
12
  /******/ // The module cache
13
13
  /******/ var installedModules = {};
@@ -91,17 +91,11 @@ return /******/ (function(modules) { // webpackBootstrap
91
91
  /******/
92
92
  /******/
93
93
  /******/ // Load entry module and return exports
94
- /******/ return __webpack_require__(__webpack_require__.s = 1);
94
+ /******/ return __webpack_require__(__webpack_require__.s = 0);
95
95
  /******/ })
96
96
  /************************************************************************/
97
97
  /******/ ([
98
98
  /* 0 */
99
- /***/ (function(module, exports) {
100
-
101
- module.exports = __WEBPACK_EXTERNAL_MODULE__0__;
102
-
103
- /***/ }),
104
- /* 1 */
105
99
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
106
100
 
107
101
  "use strict";
@@ -125,12 +119,13 @@ __webpack_require__.d(__webpack_exports__, "Utils", function() { return /* reexp
125
119
  __webpack_require__.d(__webpack_exports__, "EventType", function() { return /* reexport */ EventTypeConstant; });
126
120
  __webpack_require__.d(__webpack_exports__, "ErrorType", function() { return /* reexport */ ErrorTypeConstant; });
127
121
  __webpack_require__.d(__webpack_exports__, "LayerType", function() { return /* reexport */ LayerType; });
122
+ __webpack_require__.d(__webpack_exports__, "GraphicType", function() { return /* reexport */ GraphicType; });
123
+ __webpack_require__.d(__webpack_exports__, "MeasureMode", function() { return /* reexport */ MeasureMode; });
128
124
  __webpack_require__.d(__webpack_exports__, "AudioPlayer", function() { return /* reexport */ core_AudioPlayer; });
129
125
  __webpack_require__.d(__webpack_exports__, "CanvasDrawer", function() { return /* reexport */ core_CanvasDrawer; });
130
126
  __webpack_require__.d(__webpack_exports__, "ElQuery", function() { return /* reexport */ core_ElQuery; });
131
127
  __webpack_require__.d(__webpack_exports__, "EventDispatcher", function() { return /* reexport */ core_EventDispatcher; });
132
128
  __webpack_require__.d(__webpack_exports__, "HashMap", function() { return /* reexport */ core_HashMap; });
133
- __webpack_require__.d(__webpack_exports__, "MqttClient", function() { return /* reexport */ core_MqttClient; });
134
129
  __webpack_require__.d(__webpack_exports__, "WebSocketClient", function() { return /* reexport */ core_WebSocketClient; });
135
130
  __webpack_require__.d(__webpack_exports__, "WebStorage", function() { return /* reexport */ core_WebStorage; });
136
131
 
@@ -262,10 +257,28 @@ __webpack_require__.d(__webpack_exports__, "WebStorage", function() { return /*
262
257
  S3M_GROUP: "S3MGroup", // addS3MGroupLayer(url, options, index) 添加S3M分组图层。
263
258
  TERRAIN_LAYER: "TerrainFileLayer" // 地形图层, 需要单独处理
264
259
  });
260
+ // CONCATENATED MODULE: ./src/constant/GraphicConstant.js
261
+ var GraphicType = {
262
+ POINT: 'point',
263
+ POLYLINE: 'polyline',
264
+ POLYGON: 'polygon',
265
+ BILLBOARD: 'billboard',
266
+ CYLINDER: 'cylinder',
267
+ ELLIPSOID: 'ellipsoid',
268
+ LABEL: 'label',
269
+ MODEL: 'model',
270
+ WALL: 'wall'
271
+ };
272
+ var MeasureMode = {
273
+ DISTANCE: 'distance',
274
+ AREA: 'area',
275
+ HEIGHT: 'height'
276
+ };
265
277
  // CONCATENATED MODULE: ./src/constant/index.js
266
278
 
267
279
 
268
280
 
281
+
269
282
  // CONCATENATED MODULE: ./src/utils/CommUtils.js
270
283
 
271
284
 
@@ -1448,9 +1461,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
1448
1461
  */
1449
1462
  throttle: function throttle(func, wait, type) {
1450
1463
  if (type === 1) {
1451
- var _previous = 0;
1464
+ var previous = 0;
1452
1465
  } else if (type === 2) {
1453
- var _timeout = void 0;
1466
+ var timeout;
1454
1467
  }
1455
1468
  return function () {
1456
1469
  var context = this;
@@ -2092,184 +2105,27 @@ var HashMap = function () {
2092
2105
  }();
2093
2106
 
2094
2107
  /* harmony default export */ var core_HashMap = (HashMap);
2095
- // EXTERNAL MODULE: external "mqtt"
2096
- var external_mqtt_ = __webpack_require__(0);
2097
-
2098
- // CONCATENATED MODULE: ./src/core/MqttClient.js
2099
- var MqttClient_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2100
-
2101
- function MqttClient_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2102
-
2103
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2104
-
2105
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2106
-
2107
-
2108
-
2109
-
2110
-
2111
-
2112
-
2113
- var MqttClient_MqttClient = function (_EventDispatcher) {
2114
- _inherits(MqttClient, _EventDispatcher);
2115
-
2116
- /**
2117
- * Creates an instance of MqttClient.
2118
- * @param {*} config mqtt实例参数
2119
- */
2120
- function MqttClient() {
2121
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2122
-
2123
- MqttClient_classCallCheck(this, MqttClient);
2124
-
2125
- var _this = _possibleConstructorReturn(this, (MqttClient.__proto__ || Object.getPrototypeOf(MqttClient)).call(this));
2126
-
2127
- _this.context = CommUtils.extend(MqttClient.defaultContext, config);
2128
- _this.options = {
2129
- connectTimeout: _this.context.MQTT_TIMEOUTM,
2130
- clientId: CommUtils.generateGuid(),
2131
- username: _this.context.MQTT_USERNAME,
2132
- password: _this.context.MQTT_PASSWORD,
2133
- clean: true
2134
- };
2135
- _this.client = Object(external_mqtt_["connect"])(_this.context.MQTT_SERVICE, _this.options);
2136
- _this._onConnect();
2137
- _this._onMessage();
2138
- MqttClient.instance = _this;
2139
- return _this;
2140
- }
2141
-
2142
- MqttClient_createClass(MqttClient, [{
2143
- key: "_onConnect",
2144
- value: function _onConnect() {
2145
- var _this2 = this;
2146
-
2147
- this.client.on("connect", function () {
2148
- console.log("链接mqtt成功==>" + _this2.context.MQTT_SERVICE);
2149
- _this2.dispatchEvent({ type: EventTypeConstant.MQTT_CONNECT, message: _this2 });
2150
- });
2151
- this.client.on("error", function (err) {
2152
- console.log("链接mqtt报错", err);
2153
- _this2.dispatchEvent({ type: EventTypeConstant.MQTT_ERROR, message: _this2 });
2154
- _this2.client.end();
2155
- _this2.client.reconnect();
2156
- });
2157
- }
2158
- }, {
2159
- key: "_onMessage",
2160
- value: function _onMessage() {
2161
- var _this3 = this;
2162
-
2163
- this.client.on("message", function (topic, message) {
2164
- var dataString = message;
2165
- var data = "";
2166
- if (message instanceof Uint8Array) {
2167
- dataString = message.toString();
2168
- }
2169
- try {
2170
- data = JSON.parse(dataString);
2171
- } catch (error) {
2172
- throw new Error(ErrorTypeConstant.JSON_PARSE_ERROR);
2173
- }
2174
- _this3.dispatchEvent({
2175
- type: EventTypeConstant.MQTT_MESSAGE,
2176
- message: { topic: topic, data: data }
2177
- });
2178
- });
2179
- }
2180
- }, {
2181
- key: "sendMsg",
2182
- value: function sendMsg(topic, msg) {
2183
- if (!this.client.connected) {
2184
- console.error("客户端未连接");
2185
- return;
2186
- }
2187
- this.client.publish(topic, msg, { qos: 1, retain: true });
2188
- }
2189
- }, {
2190
- key: "subscribe",
2191
- value: function subscribe(topic) {
2192
- this.client.subscribe(topic, { qos: 1 }, function (error, res) {
2193
- if (error instanceof Error || res.length === 0) {
2194
- console.error("\u8BA2\u9605\u5931\u8D25==>" + topic, error);
2195
- } else {
2196
- console.log("\u8BA2\u9605\u6210\u529F==>" + topic);
2197
- }
2198
- });
2199
- return this;
2200
- }
2201
- }, {
2202
- key: "unsubscribe",
2203
- value: function unsubscribe(topic) {
2204
- this.client.unsubscribe(topic, { qos: 1 }, function (error, res) {
2205
- if (error instanceof Error || res.length === 0) {
2206
- console.error("\u53D6\u6D88\u8BA2\u9605\u5931\u8D25==>" + topic, error);
2207
- } else {
2208
- console.log("\u53D6\u6D88\u8BA2\u9605\u6210\u529F==>" + topic);
2209
- }
2210
- });
2211
- return this;
2212
- }
2213
- }, {
2214
- key: "unconnect",
2215
- value: function unconnect() {
2216
- this.client.end();
2217
- this.client = null;
2218
- this.dispatchEvent({ type: EventTypeConstant.MQTT_CLOSE, message: null });
2219
- console.log("断开mqtt成功==>" + this.context.MQTT_SERVICE);
2220
- }
2221
- /**
2222
- * @description 获取并冻结mqtt实例
2223
- * @static
2224
- * @param {*} [config={}]
2225
- * @returns {MqttClient}
2226
- */
2227
-
2228
- }], [{
2229
- key: "getInstance",
2230
- value: function getInstance() {
2231
- var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
2232
-
2233
- if (MqttClient.instance) {
2234
- return Object.freeze(MqttClient.instance);
2235
- } else {
2236
- return Object.freeze(new MqttClient(config));
2237
- }
2238
- }
2239
- }]);
2240
-
2241
- return MqttClient;
2242
- }(core_EventDispatcher);
2243
-
2244
- /* harmony default export */ var core_MqttClient = (MqttClient_MqttClient);
2245
-
2246
- MqttClient_MqttClient.defaultContext = {
2247
- MQTT_TIMEOUTM: 20000,
2248
- MQTT_USERNAME: "iRVMS-WEB",
2249
- MQTT_PASSWORD: "novasky888",
2250
- MQTT_SERVICE: "ws://" + window.document.domain + ":20007/mqtt"
2251
- };
2252
2108
  // CONCATENATED MODULE: ./src/core/WebSocketClient.js
2253
2109
  var WebSocketClient_createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2254
2110
 
2255
2111
  function WebSocketClient_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2256
2112
 
2257
- function WebSocketClient_possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2113
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
2258
2114
 
2259
- function WebSocketClient_inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2115
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
2260
2116
 
2261
2117
 
2262
2118
 
2263
2119
 
2264
2120
  var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
2265
- WebSocketClient_inherits(WebSocketClient, _EventDispatcher);
2121
+ _inherits(WebSocketClient, _EventDispatcher);
2266
2122
 
2267
2123
  function WebSocketClient() {
2268
2124
  var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'ws://127.0.0.1:10088';
2269
2125
 
2270
2126
  WebSocketClient_classCallCheck(this, WebSocketClient);
2271
2127
 
2272
- var _this = WebSocketClient_possibleConstructorReturn(this, (WebSocketClient.__proto__ || Object.getPrototypeOf(WebSocketClient)).call(this));
2128
+ var _this = _possibleConstructorReturn(this, (WebSocketClient.__proto__ || Object.getPrototypeOf(WebSocketClient)).call(this));
2273
2129
 
2274
2130
  _this.maxCheckTimes = 10;
2275
2131
  _this.url = url;
@@ -2285,7 +2141,6 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
2285
2141
  WebSocketClient_createClass(WebSocketClient, [{
2286
2142
  key: 'connect',
2287
2143
  value: function connect() {
2288
- this.checkTimes++;
2289
2144
  this.disconnect();
2290
2145
  if (this.url) {
2291
2146
  try {
@@ -2312,12 +2167,14 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
2312
2167
  message: message
2313
2168
  });
2314
2169
  };
2315
- this.client.onerror = function (message) {
2316
- self.dispatchEvent({
2317
- type: EventTypeConstant.WEB_SOCKET_ERROR,
2318
- message: message
2319
- });
2320
- };
2170
+ if (this.checkTimes === this.maxCheckTimes) {
2171
+ this.client.onerror = function (message) {
2172
+ self.dispatchEvent({
2173
+ type: EventTypeConstant.WEB_SOCKET_ERROR,
2174
+ message: message
2175
+ });
2176
+ };
2177
+ }
2321
2178
  }
2322
2179
  } catch (ex) {
2323
2180
  console.error('创建ws连接失败' + this.url + ':' + ex);
@@ -2344,6 +2201,7 @@ var WebSocketClient_WebSocketClient = function (_EventDispatcher) {
2344
2201
 
2345
2202
  if (this.checkTimes > times) return;
2346
2203
  setTimeout(function () {
2204
+ _this2.checkTimes++;
2347
2205
  if (_this2.client && _this2.client.readyState !== 0 && _this2.client.readyState !== 1) {
2348
2206
  _this2.connect();
2349
2207
  }
@@ -2504,7 +2362,7 @@ var WebStorage_WebStorage = function () {
2504
2362
 
2505
2363
 
2506
2364
 
2507
-
2365
+ // export { default as MqttClient } from "./core/MqttClient";
2508
2366
 
2509
2367
 
2510
2368
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "gis-common",
3
3
  "description": "gis-common",
4
4
  "main": "dist/resource.min.js",
5
- "version": "1.0.19",
5
+ "version": "1.1.3",
6
6
  "author": "Guo.Yan <luv02@vip.qq.com>",
7
7
  "license": "MIT",
8
8
  "private": false,
@@ -10,9 +10,6 @@
10
10
  "dev": "cross-env NODE_ENV=development webpack-dev-server --hot --port 7000",
11
11
  "build": "cross-env NODE_ENV=production webpack --progress"
12
12
  },
13
- "dependencies": {
14
- "mqtt": "^4.2.8"
15
- },
16
13
  "browserslist": [
17
14
  "> 1%",
18
15
  "last 2 versions",