iclient9-mapboxgl.js 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323
  1. /*!
  2. *
  3. * iclient9-mapboxgl.(https://iclient.supermap.io)
  4. * Copyright© 2000-2017 SuperMap Software Co. Ltd
  5. * license: Apache-2.0
  6. * version: v9.0.0
  7. *
  8. */
  9. /******/ (function(modules) { // webpackBootstrap
  10. /******/ // The module cache
  11. /******/ var installedModules = {};
  12. /******/
  13. /******/ // The require function
  14. /******/ function __webpack_require__(moduleId) {
  15. /******/
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId]) {
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ }
  20. /******/ // Create a new module (and put it into the cache)
  21. /******/ var module = installedModules[moduleId] = {
  22. /******/ i: moduleId,
  23. /******/ l: false,
  24. /******/ exports: {}
  25. /******/ };
  26. /******/
  27. /******/ // Execute the module function
  28. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  29. /******/
  30. /******/ // Flag the module as loaded
  31. /******/ module.l = true;
  32. /******/
  33. /******/ // Return the exports of the module
  34. /******/ return module.exports;
  35. /******/ }
  36. /******/
  37. /******/
  38. /******/ // expose the modules object (__webpack_modules__)
  39. /******/ __webpack_require__.m = modules;
  40. /******/
  41. /******/ // expose the module cache
  42. /******/ __webpack_require__.c = installedModules;
  43. /******/
  44. /******/ // identity function for calling harmony imports with the correct context
  45. /******/ __webpack_require__.i = function(value) { return value; };
  46. /******/
  47. /******/ // define getter function for harmony exports
  48. /******/ __webpack_require__.d = function(exports, name, getter) {
  49. /******/ if(!__webpack_require__.o(exports, name)) {
  50. /******/ Object.defineProperty(exports, name, {
  51. /******/ configurable: false,
  52. /******/ enumerable: true,
  53. /******/ get: getter
  54. /******/ });
  55. /******/ }
  56. /******/ };
  57. /******/
  58. /******/ // getDefaultExport function for compatibility with non-harmony modules
  59. /******/ __webpack_require__.n = function(module) {
  60. /******/ var getter = module && module.__esModule ?
  61. /******/ function getDefault() { return module['default']; } :
  62. /******/ function getModuleExports() { return module; };
  63. /******/ __webpack_require__.d(getter, 'a', getter);
  64. /******/ return getter;
  65. /******/ };
  66. /******/
  67. /******/ // Object.prototype.hasOwnProperty.call
  68. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  69. /******/
  70. /******/ // __webpack_public_path__
  71. /******/ __webpack_require__.p = "";
  72. /******/
  73. /******/ // Load entry module and return exports
  74. /******/ return __webpack_require__(__webpack_require__.s = 9);
  75. /******/ })
  76. /************************************************************************/
  77. /******/ ([
  78. /* 0 */
  79. /***/ (function(module, exports) {
  80. module.exports = mapboxgl;
  81. /***/ }),
  82. /* 1 */
  83. /***/ (function(module, exports) {
  84. module.exports = function(){try{return mapv}catch(e){return {}}}();
  85. /***/ }),
  86. /* 2 */
  87. /***/ (function(module, exports, __webpack_require__) {
  88. "use strict";
  89. Object.defineProperty(exports, "__esModule", {
  90. value: true
  91. });
  92. exports.Logo = undefined;
  93. var _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; }; }();
  94. var _mapboxGl = __webpack_require__(0);
  95. var _mapboxGl2 = _interopRequireDefault(_mapboxGl);
  96. var _iClient = __webpack_require__(8);
  97. var _iClient2 = _interopRequireDefault(_iClient);
  98. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  99. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  100. /**
  101. * @class mapboxgl.supermap.LogoControl
  102. * @classdesc Logo控件。默认不显示</br>
  103. *
  104. * @example
  105. * (start code)
  106. * map.addControl(new mapboxgl.supermap.LogoControl(),'bottom-right');
  107. * (end)
  108. * @param options -{Object} logo控件配置项</br>
  109. * imageUrl - {string} logo图片地址</br>
  110. * width - {string} logo图片宽</br>
  111. * height - {string} logo图片高</br>
  112. * link - {string} 跳转链接</br>
  113. * alt - {string} logo图片失效时显示文本
  114. */
  115. var Logo = exports.Logo = function () {
  116. //logo图片高
  117. //跳转链接
  118. function Logo(options) {
  119. _classCallCheck(this, Logo);
  120. this.imageUrl = null;
  121. this.link = null;
  122. this.width = null;
  123. this.height = null;
  124. this.alt = "SuperMap iClient";
  125. this._extend(this, options);
  126. }
  127. /**
  128. * @function mapboxgl.supermap.LogoControl.prototype.onAdd
  129. * @description 添加一个logo
  130. * @return {div} 返回创建的logo元素
  131. */
  132. //logo图片失效时显示文本
  133. //logo图片宽
  134. //logo图片地址
  135. _createClass(Logo, [{
  136. key: 'onAdd',
  137. value: function onAdd(map) {
  138. this._map = map;
  139. this._container = document.createElement('div');
  140. this._container.className = 'mapboxgl-ctrl iclient-logo';
  141. this._container.style.marginTop = 0;
  142. this._container.style.marginBottom = 0;
  143. this._container.style.marginLeft = 0;
  144. this._container.style.marginRight = 0;
  145. var imgSrc = _iClient2.default;
  146. if (this.imageUrl) {
  147. imgSrc = this.imageUrl;
  148. }
  149. var alt = this.alt;
  150. var imageWidth = "94px";
  151. var imageHeight = "29px";
  152. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  153. if (this.imageUrl) {
  154. imageWidth = this.width;
  155. imageHeight = this.height;
  156. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  157. if (!imageWidth || !imageHeight) {
  158. styleSize = "";
  159. }
  160. }
  161. var link = this.link || "https://iclient.supermap.io";
  162. this._container.innerHTML = "<a href='" + link + "' target='_blank'>" + "<img src=" + imgSrc + " alt='" + alt + "' style='" + styleSize + "margin-bottom: 2px'></a>";
  163. this._createStyleSheet();
  164. return this._container;
  165. }
  166. }, {
  167. key: '_createStyleSheet',
  168. value: function _createStyleSheet() {
  169. var style = document.createElement('style');
  170. style.type = 'text/css';
  171. style.innerHTML = ".iclient-logo{" + "margin:0 !important;" + "}" + ".iclient-logo a{" + "border: none;" + "display: block;" + "height:31px;" + "}" + ".iclient-logo img{" + "border: none;" + "white-space: nowrap" + "}";
  172. document.getElementsByTagName('head')[0].appendChild(style);
  173. }
  174. }, {
  175. key: '_extend',
  176. value: function _extend(dest) {
  177. var _iteratorNormalCompletion = true;
  178. var _didIteratorError = false;
  179. var _iteratorError = undefined;
  180. try {
  181. for (var _iterator = arguments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  182. var src = _step.value;
  183. for (var k in src) {
  184. dest[k] = src[k];
  185. }
  186. }
  187. } catch (err) {
  188. _didIteratorError = true;
  189. _iteratorError = err;
  190. } finally {
  191. try {
  192. if (!_iteratorNormalCompletion && _iterator.return) {
  193. _iterator.return();
  194. }
  195. } finally {
  196. if (_didIteratorError) {
  197. throw _iteratorError;
  198. }
  199. }
  200. }
  201. return dest;
  202. }
  203. }]);
  204. return Logo;
  205. }();
  206. _mapboxGl2.default.supermap = _mapboxGl2.default.supermap || {};
  207. _mapboxGl2.default.supermap.LogoControl = Logo;
  208. /***/ }),
  209. /* 3 */
  210. /***/ (function(module, exports, __webpack_require__) {
  211. "use strict";
  212. Object.defineProperty(exports, "__esModule", {
  213. value: true
  214. });
  215. exports.MapvLayer = undefined;
  216. var _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; }; }();
  217. var _MapvRenderer = __webpack_require__(7);
  218. var _MapvRenderer2 = _interopRequireDefault(_MapvRenderer);
  219. var _mapboxGl = __webpack_require__(0);
  220. var _mapboxGl2 = _interopRequireDefault(_mapboxGl);
  221. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  222. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  223. /**
  224. * @class mapboxgl.supermap.MapvLayer
  225. * @classdesc Mapv图层
  226. * @param map - {Object} 地图
  227. * @param dataSet -{Object} 数据集
  228. * @param mapVOptions -{Object} Mapv参数
  229. */
  230. var MapvLayer = exports.MapvLayer = function () {
  231. function MapvLayer(map, dataSet, mapVOptions) {
  232. _classCallCheck(this, MapvLayer);
  233. this.map = map;
  234. this.renderer = new _MapvRenderer2.default(map, this, dataSet, mapVOptions);
  235. this.canvas = this._createCanvas();
  236. this.renderer._canvasUpdate();
  237. this.mapContainer = map.getCanvasContainer();
  238. this.mapContainer.appendChild(this.canvas);
  239. }
  240. /**
  241. * @function mapboxgl.supermap.MapvLayer.prototype.getTopLeft
  242. * @description 获取左上的距离
  243. */
  244. _createClass(MapvLayer, [{
  245. key: 'getTopLeft',
  246. value: function getTopLeft() {
  247. var map = this.map;
  248. var topLeft;
  249. if (map) {
  250. var bounds = map.getBounds();
  251. topLeft = bounds.getNorthWest();
  252. }
  253. return topLeft;
  254. }
  255. }, {
  256. key: 'show',
  257. value: function show() {
  258. if (this.renderer) {
  259. this.renderer._show();
  260. }
  261. return this;
  262. }
  263. }, {
  264. key: 'hide',
  265. value: function hide() {
  266. if (this.renderer) {
  267. this.renderer._hide();
  268. }
  269. return this;
  270. }
  271. }, {
  272. key: '_createCanvas',
  273. value: function _createCanvas() {
  274. var canvas = document.createElement('canvas');
  275. canvas.style.position = 'absolute';
  276. canvas.style.top = 0 + "px";
  277. canvas.style.left = 0 + "px";
  278. canvas.width = parseInt(this.map.getCanvas().style.width);
  279. canvas.height = parseInt(this.map.getCanvas().style.height);
  280. canvas.style.width = this.map.getCanvas().style.width;
  281. canvas.style.height = this.map.getCanvas().style.height;
  282. return canvas;
  283. }
  284. }]);
  285. return MapvLayer;
  286. }();
  287. _mapboxGl2.default.supermap = _mapboxGl2.default.supermap || {};
  288. _mapboxGl2.default.supermap.MapvLayer = MapvLayer;
  289. /***/ }),
  290. /* 4 */
  291. /***/ (function(module, exports, __webpack_require__) {
  292. "use strict";
  293. Object.defineProperty(exports, "__esModule", {
  294. value: true
  295. });
  296. exports.RankTheme3DLayer = undefined;
  297. var _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; }; }();
  298. var _mapboxGl = __webpack_require__(0);
  299. var _mapboxGl2 = _interopRequireDefault(_mapboxGl);
  300. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  301. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  302. /**
  303. * @class mapboxgl.supermap.RankTheme3DLayer
  304. * @classdesc mapbox gl分段专题图
  305. * @param id -{string} 专题图图层id
  306. * @param map -{object} mapbox gl地图对象
  307. * @param layerOptions -{Object} 专题图图层配置项<br>
  308. * opacity -{number} 图层透明度,默认1<br>
  309. * parseNumber -{boolean} 是否预处理数据,将数据转换为number,默认false<br>
  310. * baseHeightField -{string} 数据中表示基础高度的字段<br>
  311. * heightField -{string} 数据中表示高度的字段<br>
  312. * heightStops -{Array} 数据高度分段数组<br>
  313. * colorField -{string} 数据中表示颜色的字段<br>
  314. * colorStops -{Array} 数据颜色分段数组<br>
  315. * base -{number} 数据分段线性增量<br>
  316. * showLegend -{boolean} 是否显示图例,默认显示<br>
  317. * legendTitle -{string} 图例标题<br>
  318. * legendTheme -{string} 图例主题,取值:'light','dark'<br>
  319. * legendRatio -{number} 图例数值扩大系数,<br>
  320. * legendPosition -{string} 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'<br>
  321. */
  322. var RankTheme3DLayer = exports.RankTheme3DLayer = function () {
  323. /**
  324. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.legendTheme -{string}
  325. * @description 图例主题,取值:'light','dark'
  326. * @default 'light'
  327. */
  328. /**
  329. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.legendTitle -{string}
  330. * @description 图例标题
  331. */
  332. /**
  333. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.base -{number}
  334. * @description 数据分段线性增量
  335. */
  336. /**
  337. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.colorField -{string}
  338. * @description 数据中表示颜色的字段
  339. */
  340. /**
  341. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.heightField -{string}
  342. * @description 数据中表示高度的字段
  343. */
  344. /**
  345. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.parseNumber -{boolean}
  346. * @description 是否进行数据预处理,有些字段是string类型,需要转换为number
  347. */
  348. /**
  349. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.map -{object}
  350. * @description mapbox gl地图对象
  351. */
  352. function RankTheme3DLayer(id, map, layerOptions) {
  353. _classCallCheck(this, RankTheme3DLayer);
  354. this.id = null;
  355. this.map = null;
  356. this.opacity = 1;
  357. this.parseNumber = false;
  358. this.baseHeightField = null;
  359. this.heightField = null;
  360. this.heightStops = null;
  361. this.colorField = null;
  362. this.colorStops = null;
  363. this.base = null;
  364. this.showLegend = true;
  365. this.legendTitle = null;
  366. this.legendRatio = 1;
  367. this.legendTheme = 'light';
  368. this.legendPosition = 'bottom-right';
  369. this.id = id;
  370. this.map = map;
  371. this._extend(this, layerOptions);
  372. this.heightField = layerOptions.heightField || 'height';
  373. this.colorField = layerOptions.colorField || this.heightField;
  374. }
  375. /**
  376. * @function mapboxgl.supermap.RankTheme3DLayer.prototype.setLayerOptions
  377. * @description 设置图层相关参数
  378. * @param layerOptions -{object} 该专题图图层相关参数<br>
  379. * * opacity -{number} 图层透明度,默认1<br>
  380. * parseNumber -{boolean} 是否预处理数据,将数据转换为number,默认false<br>
  381. * baseHeightField -{string} 数据中表示基础高度的字段<br>
  382. * heightField -{string} 数据中表示高度的字段<br>
  383. * heightStops -{Array} 数据高度分段数组<br>
  384. * colorField -{string} 数据中表示颜色的字段<br>
  385. * colorStops -{Array} 数据颜色分段数组<br>
  386. * base -{number} 数据分段线性增量<br>
  387. * showLegend -{boolean} 是否显示图例,默认显示<br>
  388. * legendTitle -{string} 图例标题<br>
  389. * legendRatio -{number} 图例数值扩大系数,<br>
  390. * legendTheme -{string} 图例主题,取值:'light','dark'<br>
  391. * legendPosition -{string} 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'<br>
  392. * @returns {mapboxgl.supermap.RankTheme3DLayer}
  393. */
  394. /**
  395. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.legendPosition -{string}
  396. * @description 图例位置,取值:'top-right'|'top-left'|'bottom-left'|'bottom-right'
  397. * @default 'bottom-right'
  398. */
  399. /**
  400. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.legendRatio -{number}
  401. * @description 图例数值扩大系数
  402. */
  403. /**
  404. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.showLegend -{Boolean}
  405. * @description 是否显示图例
  406. */
  407. /**
  408. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.colorStops -{Array}
  409. * @description 数据颜色分段数组
  410. */
  411. /**
  412. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.heightStops -{Array}
  413. * @description 数据高度分段数组
  414. */
  415. /**
  416. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.baseHeightField -{string}
  417. * @description 数据中表示基础高度的字段
  418. */
  419. /**
  420. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.opacity -{number}
  421. * @description 图层透明度,默认1
  422. */
  423. /**
  424. * @member mapboxgl.supermap.RankTheme3DLayer.prototype.id -{string}
  425. * @description mapbox gl图层id
  426. */
  427. _createClass(RankTheme3DLayer, [{
  428. key: 'setLayerOptions',
  429. value: function setLayerOptions(layerOptions) {
  430. this._extend(this, layerOptions);
  431. return this;
  432. }
  433. /**
  434. * @function mapboxgl.supermap.RankTheme3DLayer.prototype.setData
  435. * @description 设置数据,数据格式必须为geojson格式
  436. * @param data -{object} geojson格式数据
  437. * @param parseNumber -{object} 是否进行数据预处理,有些字段是string类型,需要转换为number
  438. */
  439. }, {
  440. key: 'setData',
  441. value: function setData(data, parseNumber) {
  442. var me = this;
  443. me.data = data;
  444. if (parseNumber != null) {
  445. me.parseNumber = parseNumber;
  446. }
  447. me.parseNumber && me.data && me.data.features && me.data.features.map(function (val, index) {
  448. if (me.baseHeightField && val.properties[me.baseHeightField]) {
  449. val.properties[baseHeightField] = parseFloat(val.properties[baseHeightField]);
  450. }
  451. if (me.heightField && val.properties[me.heightField]) {
  452. val.properties[me.heightField] = parseFloat(val.properties[me.heightField]);
  453. }
  454. });
  455. return this;
  456. }
  457. /**
  458. * @function mapboxgl.supermap.RankTheme3DLayer.prototype.getData
  459. * @description 获取数据,返回的数据格式为geojson
  460. * @returns {Object}
  461. */
  462. }, {
  463. key: 'getData',
  464. value: function getData() {
  465. return this.data;
  466. }
  467. /**
  468. * @function mapboxgl.supermap.RankTheme3DLayer.prototype.show
  469. * @description 显示图层
  470. * @param options -{object} 图层相关参数,如图例标题和主题等
  471. * @returns {mapboxgl.supermap.RankTheme3DLayer}
  472. */
  473. }, {
  474. key: 'show',
  475. value: function show(options) {
  476. this._addLayer();
  477. this._extend(this, options);
  478. if (this.showLegend) {
  479. if (this.legend) {
  480. map.addControl(legend, this.legendPosition);
  481. } else {
  482. var defaultLegend = this._createLegendControl();
  483. this.map.addControl(defaultLegend, this.legendPosition);
  484. }
  485. }
  486. return this;
  487. }
  488. }, {
  489. key: '_createLegendControl',
  490. value: function _createLegendControl(html) {
  491. var me = this;
  492. function LegendControl() {}
  493. LegendControl.prototype.onAdd = function (map) {
  494. this._map = map;
  495. this._container = document.createElement('div');
  496. var className = 'mapboxgl-ctrl legend ';
  497. var theme = 'legend-light';
  498. if (me.legendTheme === 'dark') {
  499. theme = 'legend-dark';
  500. }
  501. this._container.className = className + theme;
  502. if (html) {
  503. this._container.innerHTML = html;
  504. } else {
  505. this._container.innerHTML = me._createLegendElement.call(me);
  506. }
  507. me._appendLegendCSSStyle();
  508. return this._container;
  509. };
  510. LegendControl.prototype.onRemove = function () {
  511. this._container.parentNode.removeChild(this._container);
  512. this._map = undefined;
  513. };
  514. return new LegendControl();
  515. }
  516. }, {
  517. key: '_createLegendElement',
  518. value: function _createLegendElement() {
  519. var len = this.colorStops && this.colorStops.length || 0;
  520. var titleWidth = len * 60;
  521. //图例标题
  522. var titleElement = "";
  523. var legendTitle = this.legendTitle || "";
  524. titleElement = " <p class='legend-title' style='width: " + titleWidth + ";'>" + legendTitle + "</p>";
  525. //颜色分段对应标识
  526. var colorGalleryElement = "<ul>";
  527. var valueGalleryElement = "<ul>";
  528. for (var i = 0; i < len; i++) {
  529. var value = this.colorStops[i][0];
  530. this.legendRatio = this.legendRatio == null ? 1 : this.legendRatio;
  531. value = value * this.legendRatio;
  532. var text = this._getWrapperText(value);
  533. var color = this.colorStops[i][1];
  534. colorGalleryElement += "<li style='background-color:" + color + ";'></li>";
  535. valueGalleryElement += "<li>" + text + "</li>";
  536. }
  537. colorGalleryElement += "</ul>";
  538. valueGalleryElement += "</ul>";
  539. return titleElement + colorGalleryElement + valueGalleryElement;
  540. }
  541. }, {
  542. key: '_appendLegendCSSStyle',
  543. value: function _appendLegendCSSStyle() {
  544. var legendStyle = document.createElement('style');
  545. legendStyle.type = 'text/css';
  546. legendStyle.innerHTML = " .legend {\n" + " display: inline-block;\n" + " padding: 4px 10px;\n" + " border-radius: 2px;\n" + " -moz-border-radius: 2px;\n" + " -webkit-border-radius: 2px;\n" + " font-size: 12px;\n" + " color: rgba(0, 0, 0, 0.8);\n" + " background-color: rgb(255, 255, 255);\n" + " }\n" + " .legend-light {\n" + " color: rgba(0, 0, 0, 0.8);\n" + " background-color: rgb(255, 255, 255);\n" + " }\n" + " .legend-dark {\n" + " color: rgba(255, 255, 255, 0.8);\n" + " background-color: rgb(64, 64, 64);\n" + " }\n" + " .legend ul {\n" + " clear: both;\n" + " overflow: auto;\n" + " padding: 0;\n" + " margin: 0;\n" + " height: 100%;\n" + " display: block;\n" + " list-style: none;\n" + " box-sizing: border-box;\n" + " -webkit-font-smoothing: antialiased;\n" + " }\n" + " .legend li {\n" + " float: left;\n" + " width: 50px;\n" + " height: 28px;\n" + " overflow: hidden;\n" + " text-overflow: clip;\n" + " padding: 0 4px;\n" + " line-height: 28px;\n" + " }\n" + " .legend .legend-title {\n" + " min-height: 14px;\n" + " max-width: 500px;\n" + " margin: 4px 0;\n" + " }\n" + " .legend-light .legend-title {\n" + " color: rgba(0, 0, 0, 0.8);\n" + " }\n" + " .legend-dark .legend-title {\n" + " color: rgba(255, 255, 255, 0.8);\n" + " }";
  547. document.getElementsByTagName('head')[0].appendChild(legendStyle);
  548. }
  549. }, {
  550. key: '_getWrapperText',
  551. value: function _getWrapperText(number) {
  552. //单个颜色值宽度为60px,最大只能完全显示1000000,否则就超出宽度,则显示以为k计数单位的值
  553. var num = parseFloat(number);
  554. if (num % 1000000 <= 1000000) {
  555. return num.toString();
  556. }
  557. return parseInt(num / 1000) + 'k';
  558. }
  559. }, {
  560. key: '_addLayer',
  561. value: function _addLayer() {
  562. var paintOptions = this._getPaintOptions();
  563. var id = this.id ? this.id : "rankTheme";
  564. var sourceId = id + 'Source';
  565. if (!this.map.getSource(sourceId)) {
  566. this.map.addSource(sourceId, {
  567. 'type': 'geojson',
  568. 'data': this.data
  569. });
  570. } else {
  571. this.map.removeSource(sourceId);
  572. this.map.addSource(sourceId, {
  573. 'type': 'geojson',
  574. 'data': this.data
  575. });
  576. }
  577. this.map.addLayer({
  578. 'id': id,
  579. 'type': 'fill-extrusion',
  580. 'source': sourceId,
  581. 'paint': paintOptions
  582. }, id);
  583. this.map.moveLayer(id);
  584. }
  585. }, {
  586. key: '_getPaintOptions',
  587. value: function _getPaintOptions() {
  588. var opacity = this.opacity == null ? 1 : this.opacity;
  589. opacity = isNaN(parseFloat(opacity)) ? 1 : parseFloat(opacity);
  590. var reg = /^[0-9]+.?[0-9]*$/;
  591. var options = {
  592. 'fill-extrusion-color': {
  593. 'stops': this.colorStops,
  594. 'property': this.colorField || this.heightField,
  595. 'base': reg.test(this.base) ? this.base : 1
  596. },
  597. 'fill-extrusion-opacity': opacity
  598. };
  599. if (this.heightStops) {
  600. options['fill-extrusion-height'] = {
  601. 'stops': this.heightStops,
  602. 'property': this.heightField || 'height',
  603. 'base': reg.test(this.base) ? this.base : 1
  604. };
  605. } else {
  606. options['fill-extrusion-height'] = {
  607. 'property': this.heightField || 'height',
  608. 'type': 'identity'
  609. };
  610. }
  611. if (this.baseHeightField) {
  612. options['fill-extrusion-base'] = {
  613. 'property': this.baseHeightField,
  614. 'type': 'identity'
  615. };
  616. }
  617. return options;
  618. }
  619. }, {
  620. key: '_extend',
  621. value: function _extend(dest) {
  622. var _iteratorNormalCompletion = true;
  623. var _didIteratorError = false;
  624. var _iteratorError = undefined;
  625. try {
  626. for (var _iterator = arguments[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
  627. var src = _step.value;
  628. for (var k in src) {
  629. dest[k] = src[k];
  630. }
  631. }
  632. } catch (err) {
  633. _didIteratorError = true;
  634. _iteratorError = err;
  635. } finally {
  636. try {
  637. if (!_iteratorNormalCompletion && _iterator.return) {
  638. _iterator.return();
  639. }
  640. } finally {
  641. if (_didIteratorError) {
  642. throw _iteratorError;
  643. }
  644. }
  645. }
  646. return dest;
  647. }
  648. }]);
  649. return RankTheme3DLayer;
  650. }();
  651. _mapboxGl2.default.supermap = _mapboxGl2.default.supermap || {};
  652. _mapboxGl2.default.supermap.RankTheme3DLayer = RankTheme3DLayer;
  653. /***/ }),
  654. /* 5 */
  655. /***/ (function(module, exports, __webpack_require__) {
  656. "use strict";
  657. Object.defineProperty(exports, "__esModule", {
  658. value: true
  659. });
  660. exports.setPaintProperty = exports.setBackground = exports.getDefaultVectorTileStyle = undefined;
  661. var _mapboxGl = __webpack_require__(0);
  662. var _mapboxGl2 = _interopRequireDefault(_mapboxGl);
  663. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  664. _mapboxGl2.default.supermap = _mapboxGl2.default.supermap || {};
  665. _mapboxGl2.default.supermap.map = _mapboxGl2.default.supermap.map || {};
  666. /**
  667. * 配置默认底图样式
  668. */
  669. var getDefaultVectorTileStyle = exports.getDefaultVectorTileStyle = function getDefaultVectorTileStyle(urlTemplate, options) {
  670. options = options || {};
  671. var defaultOptions = {};
  672. defaultOptions.version = options.version || 8;
  673. defaultOptions.layers = options.layers || [];
  674. defaultOptions.light = options.light || {
  675. "anchor": "viewport",
  676. "color": "#fcf6ef",
  677. "intensity": 0.5,
  678. "position": [1.15, 201, 20]
  679. };
  680. var style = {
  681. "version": defaultOptions.version,
  682. "sources": {
  683. "vector-tiles": {
  684. "type": "vector",
  685. "tiles": [urlTemplate]
  686. }
  687. },
  688. "layers": defaultOptions.layers,
  689. "light": defaultOptions.light
  690. };
  691. if (options.sprite != null) {
  692. style.sprite = options.sprite;
  693. }
  694. if (options.glyphs != null) {
  695. style.glyphs = options.glyphs;
  696. }
  697. return style;
  698. };
  699. /**
  700. * 设置地图背景
  701. */
  702. var setBackground = exports.setBackground = function setBackground(map, color) {
  703. if (color && map) {
  704. map.addLayer({
  705. "id": "background",
  706. "type": "background",
  707. "paint": {
  708. "background-color": color
  709. }
  710. }, "background");
  711. }
  712. };
  713. /**
  714. * 设置图层风格
  715. * @param map
  716. * @param layerIds
  717. * @param type
  718. * @param paint
  719. * @param source 非必填,默认vector-tiles
  720. * @param sourceLayers 非必填,默认与id对应
  721. */
  722. var setPaintProperty = exports.setPaintProperty = function setPaintProperty(map, layerIds, type, paint, source, sourceLayers) {
  723. if (layerIds && map) {
  724. if (Object.prototype.toString.call(layerIds) !== '[object Array]') {
  725. layerIds = [layerIds];
  726. }
  727. for (var i = 0; i < layerIds.length; i++) {
  728. var sourceLayer = sourceLayers ? sourceLayers[i] : null;
  729. var layer = getLayer(layerIds[i], type, source, sourceLayer, paint);
  730. map.addLayer(layer, layerIds[i]);
  731. map.moveLayer(layerIds[i]);
  732. }
  733. }
  734. };
  735. function getLayer(id, type, source, sourceLayer, paint) {
  736. var sourceType = source || "vector-tiles";
  737. var sLayer = sourceLayer || id;
  738. var layer = {
  739. "id": id,
  740. "type": type,
  741. "source": sourceType,
  742. "source-layer": sLayer,
  743. "paint": paint
  744. };
  745. return layer;
  746. }
  747. _mapboxGl2.default.supermap.map.getDefaultVectorTileStyle = getDefaultVectorTileStyle;
  748. _mapboxGl2.default.supermap.map.setBackground = setBackground;
  749. _mapboxGl2.default.supermap.map.setPaintProperty = setPaintProperty;
  750. /***/ }),
  751. /* 6 */
  752. /***/ (function(module, exports, __webpack_require__) {
  753. "use strict";
  754. Object.defineProperty(exports, "__esModule", {
  755. value: true
  756. });
  757. exports.MapvDataSet = undefined;
  758. var _mapboxGl = __webpack_require__(0);
  759. var _mapboxGl2 = _interopRequireDefault(_mapboxGl);
  760. var _mapv = __webpack_require__(1);
  761. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  762. _mapboxGl2.default.supermap = _mapboxGl2.default.supermap || {};
  763. var MapvDataSet = exports.MapvDataSet = {
  764. /**
  765. * 返回mapv点数据集
  766. */
  767. getPoint: function getPoint(center) {
  768. if (center && center instanceof Array) {
  769. return new _mapv.DataSet([{
  770. geometry: {
  771. type: 'Point',
  772. coordinates: center
  773. }
  774. }]);
  775. }
  776. },
  777. /**
  778. * 返回mapv多点数据集
  779. */
  780. getPoints: function getPoints(points) {
  781. if (points && points instanceof Array) {
  782. var mPoints = [];
  783. points.map(function (data) {
  784. mPoints.push({
  785. geometry: {
  786. type: 'Point',
  787. coordinates: data.geometry.coordinates
  788. }
  789. });
  790. });
  791. return new _mapv.DataSet(mPoints);
  792. }
  793. },
  794. /**
  795. * 返回mapv弧形线数据集
  796. */
  797. getCurveLines: function getCurveLines(startPoint, LinePoints) {
  798. if (startPoint && startPoint instanceof Array && LinePoints && LinePoints instanceof Array) {
  799. var lineData = [];
  800. LinePoints.map(function (data) {
  801. var coords = data.geometry && data.geometry.coordinates;
  802. var toCenter = { lng: coords[0], lat: coords[1] };
  803. var fromCenter = { lng: startPoint[0], lat: startPoint[1] };
  804. var cv = _mapv.utilCurve.getPoints([fromCenter, toCenter]);
  805. lineData.push({
  806. geometry: {
  807. type: 'LineString',
  808. coordinates: cv
  809. }
  810. });
  811. });
  812. return new _mapv.DataSet(lineData);
  813. }
  814. },
  815. /**
  816. * 返回mapv弧形动态点数据集
  817. */
  818. getCurveDynamicPoints: function getCurveDynamicPoints(center, endPoints) {
  819. if (center && center instanceof Array && endPoints && endPoints instanceof Array) {
  820. var timeData = [];
  821. endPoints.map(function (data) {
  822. var coords = data.geometry && data.geometry.coordinates;
  823. var toCenter = { lng: coords[0], lat: coords[1] };
  824. var fromCenter = { lng: center[0], lat: center[1] };
  825. var cv = _mapv.utilCurve.getPoints([fromCenter, toCenter]);
  826. for (var j = 0; j < cv.length; j++) {
  827. timeData.push({
  828. geometry: {
  829. type: 'Point',
  830. coordinates: cv[j]
  831. },
  832. time: j
  833. });
  834. }
  835. });
  836. return new _mapv.DataSet(timeData);
  837. }
  838. }
  839. };
  840. _mapboxGl2.default.supermap.MapvDataSet = MapvDataSet;
  841. /***/ }),
  842. /* 7 */
  843. /***/ (function(module, exports, __webpack_require__) {
  844. "use strict";
  845. Object.defineProperty(exports, "__esModule", {
  846. value: true
  847. });
  848. var _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; }; }();
  849. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  850. var _mapv = __webpack_require__(1);
  851. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  852. 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; }
  853. 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; }
  854. var BaseLayer = _mapv.baiduMapLayer ? _mapv.baiduMapLayer.__proto__ : Function;
  855. /**
  856. * @private
  857. * @class mapboxgl.supermap.MapvRenderer
  858. * @classdesc MapV图层渲染
  859. * @param map - {string} 地图
  860. * @param layer -{Object} 图层
  861. * @param dataSet -{Object} 数据集
  862. * @param options -{Object} 交互时所需可选参数。
  863. * @extends BaseLayer
  864. *
  865. */
  866. var MapvRenderer = function (_BaseLayer) {
  867. _inherits(MapvRenderer, _BaseLayer);
  868. function MapvRenderer(map, layer, dataSet, options) {
  869. _classCallCheck(this, MapvRenderer);
  870. if (!BaseLayer) {
  871. return _possibleConstructorReturn(_this);
  872. }
  873. var _this = _possibleConstructorReturn(this, (MapvRenderer.__proto__ || Object.getPrototypeOf(MapvRenderer)).call(this, map, dataSet, options));
  874. _this.map = map;
  875. var self = _this;
  876. options = options || {};
  877. self.init(options);
  878. self.argCheck(options);
  879. _this.canvasLayer = layer;
  880. _this.clickEvent = _this.clickEvent.bind(_this);
  881. _this.mousemoveEvent = _this.mousemoveEvent.bind(_this);
  882. _this.map.on('move', _this.moveEvent.bind(_this));
  883. _this.map.on('resize', _this.resizeEvent.bind(_this));
  884. _this.map.on('moveend', _this.moveEndEvent.bind(_this));
  885. _this.map.on('remove', _this.removeEvent.bind(_this));
  886. _this.bindEvent();
  887. return _this;
  888. }
  889. /**
  890. * @function mapboxgl.supermap.prototype.clickEvent
  891. * @description 点击绑定事件
  892. * @param e - {Object} 事件
  893. */
  894. _createClass(MapvRenderer, [{
  895. key: 'clickEvent',
  896. value: function clickEvent(e) {
  897. var pixel = e.layerPoint;
  898. _get(MapvRenderer.prototype.__proto__ || Object.getPrototypeOf(MapvRenderer.prototype), 'clickEvent', this).call(this, pixel, e);
  899. }
  900. /**
  901. * @function mapboxgl.supermap.prototype.mousemoveEvent
  902. * @description 鼠标移动事件
  903. * @param e - {Object} 事件
  904. */
  905. }, {
  906. key: 'mousemoveEvent',
  907. value: function mousemoveEvent(e) {
  908. var pixel = e.layerPoint;
  909. _get(MapvRenderer.prototype.__proto__ || Object.getPrototypeOf(MapvRenderer.prototype), 'mousemoveEvent', this).call(this, pixel, e);
  910. }
  911. /**
  912. * @function mapboxgl.supermap.prototype.bindEvent
  913. * @description 绑定事件
  914. * @param e - {object} 触发对象
  915. */
  916. }, {
  917. key: 'bindEvent',
  918. value: function bindEvent(e) {
  919. var map = this.map;
  920. if (this.options.methods) {
  921. if (this.options.methods.click) {
  922. map.on('click', this.clickEvent);
  923. }
  924. if (this.options.methods.mousemove) {
  925. map.on('mousemove', this.mousemoveEvent);
  926. }
  927. }
  928. }
  929. /**
  930. * @function mapboxgl.supermap.prototype.unbindEvent
  931. * @description 解绑事件
  932. * @param e - {object} 触发对象
  933. */
  934. }, {
  935. key: 'unbindEvent',
  936. value: function unbindEvent(e) {
  937. var map = this.map;
  938. if (this.options.methods) {
  939. if (this.options.methods.click) {
  940. map.off('click', this.clickEvent);
  941. }
  942. if (this.options.methods.mousemove) {
  943. map.off('mousemove', this.mousemoveEvent);
  944. }
  945. }
  946. }
  947. /**
  948. * @function mapboxgl.supermap.prototype.getContext
  949. * @description 获取信息
  950. */
  951. }, {
  952. key: 'getContext',
  953. value: function getContext() {
  954. return this.canvasLayer.canvas.getContext(this.context);
  955. }
  956. /**
  957. * @function mapboxgl.supermap.prototype.updateData
  958. * @param dataSet - {Object} 数据集
  959. * @param options - {Object} 数据项配置
  960. * @description 更新数据
  961. */
  962. }, {
  963. key: 'updateData',
  964. value: function updateData(dataSet, options) {
  965. if (dataSet && dataSet.get) {
  966. this.dataSet.set(dataSet.get());
  967. }
  968. this.update({ options: options });
  969. }
  970. }, {
  971. key: '_canvasUpdate',
  972. value: function _canvasUpdate(time) {
  973. if (!this.canvasLayer) {
  974. return;
  975. }
  976. var self = this;
  977. var animationOptions = self.options.animation;
  978. var context = this.getContext();
  979. var map = this.map;
  980. if (self.isEnabledTime()) {
  981. if (time === undefined) {
  982. this.clear(context);
  983. return;
  984. }
  985. if (this.context === '2d') {
  986. context.save();
  987. context.globalCompositeOperation = 'destination-out';
  988. context.fillStyle = 'rgba(0, 0, 0, .1)';
  989. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  990. context.restore();
  991. }
  992. } else {
  993. this.clear(context);
  994. }
  995. if (this.context === '2d') {
  996. for (var key in self.options) {
  997. context[key] = self.options[key];
  998. }
  999. } else {
  1000. context.clear(context.COLOR_BUFFER_BIT);
  1001. }
  1002. if (self.options.minZoom && map.getZoom() < self.options.minZoom || self.options.maxZoom && map.getZoom() > self.options.maxZoom) {
  1003. return;
  1004. }
  1005. var dataGetOptions = {
  1006. transferCoordinate: function transferCoordinate(coordinate) {
  1007. var worldPoint = map.project(new window.mapboxgl.LngLat(coordinate[0], coordinate[1]));
  1008. return [worldPoint.x, worldPoint.y];
  1009. }
  1010. };
  1011. if (time !== undefined) {
  1012. dataGetOptions.filter = function (item) {
  1013. var trails = animationOptions.trails || 10;
  1014. return time && item.time > time - trails && item.time < time;
  1015. };
  1016. }
  1017. var data = self.dataSet.get(dataGetOptions);
  1018. this.processData(data);
  1019. self.options._size = self.options.size;
  1020. var worldPoint = map.project(new window.mapboxgl.LngLat(0, 0));
  1021. this.drawContext(context, new mapv.DataSet(data), self.options, worldPoint);
  1022. self.options.updateCallback && self.options.updateCallback(time);
  1023. }
  1024. }, {
  1025. key: 'init',
  1026. value: function init(options) {
  1027. var self = this;
  1028. self.options = options;
  1029. this.initDataRange(options);
  1030. this.context = self.options.context || '2d';
  1031. if (self.options.zIndex) {
  1032. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  1033. }
  1034. this.initAnimator();
  1035. }
  1036. /**
  1037. * @function mapboxgl.supermap.prototype.addAnimatorEvent
  1038. * @description 添加动画事件
  1039. */
  1040. }, {
  1041. key: 'addAnimatorEvent',
  1042. value: function addAnimatorEvent() {}
  1043. /**
  1044. * @function mapboxgl.supermap.prototype.removeEvent
  1045. * @description 移除事件
  1046. */
  1047. }, {
  1048. key: 'removeEvent',
  1049. value: function removeEvent() {
  1050. this.canvasLayer.mapContainer.removeChild(this.canvasLayer.canvas);
  1051. }
  1052. /**
  1053. * @function mapboxgl.supermap.prototype.moveEvent
  1054. * @description 隐藏事件
  1055. */
  1056. }, {
  1057. key: 'moveEvent',
  1058. value: function moveEvent() {
  1059. this._hide();
  1060. }
  1061. /**
  1062. * @function mapboxgl.supermap.prototype.resizeEvent
  1063. * @description 调整事件
  1064. */
  1065. }, {
  1066. key: 'resizeEvent',
  1067. value: function resizeEvent() {
  1068. var canvas = this.canvasLayer.canvas;
  1069. canvas.style.position = 'absolute';
  1070. canvas.style.top = 0 + "px";
  1071. canvas.style.left = 0 + "px";
  1072. canvas.width = parseInt(this.map.getCanvas().style.width);
  1073. canvas.height = parseInt(this.map.getCanvas().style.height);
  1074. canvas.style.width = this.map.getCanvas().style.width;
  1075. canvas.style.height = this.map.getCanvas().style.height;
  1076. }
  1077. /**
  1078. * @function mapboxgl.supermap.prototype.moveEndEvent
  1079. * @description 移除最后事件
  1080. */
  1081. }, {
  1082. key: 'moveEndEvent',
  1083. value: function moveEndEvent() {
  1084. this._canvasUpdate();
  1085. this._show();
  1086. }
  1087. /**
  1088. * @function mapboxgl.supermap.prototype.clear
  1089. * @param context - {object} 当前环境
  1090. * @description 清除环境
  1091. */
  1092. }, {
  1093. key: 'clear',
  1094. value: function clear(context) {
  1095. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  1096. }
  1097. }, {
  1098. key: '_hide',
  1099. value: function _hide() {
  1100. this.canvasLayer.canvas.style.display = 'none';
  1101. }
  1102. }, {
  1103. key: '_show',
  1104. value: function _show() {
  1105. this.canvasLayer.canvas.style.display = 'block';
  1106. }
  1107. /**
  1108. * @function mapboxgl.supermap.prototype.draw
  1109. * @description 渲染绘制
  1110. */
  1111. }, {
  1112. key: 'draw',
  1113. value: function draw() {
  1114. this.canvasLayer.draw();
  1115. }
  1116. }]);
  1117. return MapvRenderer;
  1118. }(BaseLayer);
  1119. exports.default = MapvRenderer;
  1120. /***/ }),
  1121. /* 8 */
  1122. /***/ (function(module, exports) {
  1123. module.exports = "data:image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i/he6uxvb6JM3m0fdqvx/ATidxg2JeC7VDErAw5NzGfvwRJVheEIQ8Mg/pdwIM+UOmi9Q8ivCsrIy0tF+wVbEcLrd3Pb2XisEb4Tdlhsi4WP4RBbaLGrHfC3PrvMIezy9rTpGm5lz9LOMG15xvFxD/j5gjzjjDbMOzk+9zzt3v5bgAEAibzFeFHVgYkAAAAASUVORK5CYII="
  1124. /***/ }),
  1125. /* 9 */
  1126. /***/ (function(module, exports, __webpack_require__) {
  1127. __webpack_require__(3);
  1128. __webpack_require__(6);
  1129. __webpack_require__(5);
  1130. __webpack_require__(4);
  1131. module.exports = __webpack_require__(2);
  1132. /***/ })
  1133. /******/ ]);