MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / createMigrationLayer

Method createMigrationLayer

src/openlayers/mapping/WebMap.js:4584–4645  ·  view source on GitHub ↗

* @private * @function WebMap.prototype.createMigrationLayer * @description 创建迁徙图 * @param {Object} layerInfo 图层信息 * @param {Array} features 要素数组 * @returns {ol.layer} 图层

(layerInfo, features)

Source from the content-addressed store, hash-verified

4582 * @returns {ol.layer} 图层
4583 */
4584 createMigrationLayer(layerInfo, features) {
4585 // 获取图层外包DOM
4586 if (!window.ol3Echarts.prototype.getContainer) {
4587 window.ol3Echarts.prototype.getContainer = function () {
4588 return this.$container;
4589 };
4590 }
4591 // 设置图层可见性
4592 if (!window.ol3Echarts.prototype.setVisible) {
4593 window.ol3Echarts.prototype.setVisible = function (visible) {
4594 if (visible) {
4595 let options = this.get('options');
4596 if (options) {
4597 this.setChartOptions(options);
4598 this.unset('options');
4599 }
4600 } else {
4601 let options = this.getChartOptions();
4602 this.set('options', options);
4603 this.clear();
4604 this.setChartOptions({});
4605 }
4606 };
4607 }
4608 // 设置图层层级
4609 if (!window.ol3Echarts.prototype.setZIndex) {
4610 window.ol3Echarts.prototype.setZIndex = function (zIndex) {
4611 let container = this.getContainer();
4612 if (container) {
4613 container.style.zIndex = zIndex;
4614 }
4615 };
4616 }
4617 /**
4618 * 设置鼠标样式
4619 * .cursor-default > div {
4620 * cursor: default !important;
4621 * }
4622 */
4623 if (!window.ol3Echarts.prototype.setCursor) {
4624 window.ol3Echarts.prototype.setCursor = function (cursor = 'default') {
4625 let container = this.getContainer();
4626 if (container && cursor === 'default') {
4627 container.classList.add('cursor-default');
4628 }
4629 };
4630 }
4631 let properties = getFeatureProperties(features);
4632 let lineData = this.createLinesData(layerInfo, properties);
4633 let pointData = this.createPointsData(lineData, layerInfo, properties);
4634 let options = this.createOptions(layerInfo, lineData, pointData);
4635 let layer = new window.ol3Echarts(options, {
4636 // hideOnMoving: true,
4637 // hideOnZooming: true
4638 //以下三个参数,如果不按照这样设置,会造成不可见图层时,缩放还会出现图层
4639 hideOnMoving: false,
4640 hideOnZooming: false,
4641 forcedPrecomposeRerender: true

Callers 1

addLayerMethod · 0.95

Calls 12

createLinesDataMethod · 0.95
createPointsDataMethod · 0.95
createOptionsMethod · 0.95
getFeaturePropertiesFunction · 0.90
setChartOptionsMethod · 0.80
unsetMethod · 0.80
getChartOptionsMethod · 0.80
getMethod · 0.45
setMethod · 0.45
clearMethod · 0.45
getContainerMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected