Newer
Older
smartwell_front / src / components / Mars3D / utils / ArcGisWfsLayer.js
wangxitong on 23 Aug 2022 1 KB Changes mars3D通用组件
import * as mars3d from 'mars3d'
import Vue from 'vue'

/**
 *
 * @param index gis图层编号
 * @param color 管线颜色
 * @param name 图层名称
 * @param radius 管径
 * @returns {ArcGisWfsLayer}
 */
export function polylineVolumeP(index, color, name, radius) {
  const wfsLayer3D = new mars3d.layer.ArcGisWfsLayer({
    enablePickFeatures: false,
    name: name,
    url: Vue.prototype.baseConfig.arcgisUrl + index,
    minimumLevel: 19,
    symbol: {
      type: 'polylineVolumeP',
      styleOptions: {
        color: color,
        shape: 'pipeline',
        radius: radius
      },
      callback: function(attr, styleOpt) {
        var val = { attr }.attr
        const height = -(Number(val.起始埋深) + Number(val.终止埋深)) / 2
        return { setHeight: height, height }
      }
    },
    popup: 'all'
  })
  window.map.addLayer(wfsLayer3D)
  return wfsLayer3D
}

/**
 *
 * @param index gis图层编号
 * @param color 管线颜色
 * @param name 图层名称
 * @param width 宽度
 * @returns {ArcGisWfsLayer}
 */

export function polylineC(index, color, name, width) {
  const wfsLayer = new mars3d.layer.ArcGisWfsLayer({
    enablePickFeatures: false,
    name: name,
    url: Vue.prototype.baseConfig.arcgisUrl + index,
    // maximumLevel: 19,
    symbol: {
      type: 'polylineC',
      styleOptions: {
        color: color,
        width: width,
        hasShadows: false
      }
    },
    popup: 'all'
  })
  window.map.addLayer(wfsLayer)
  return wfsLayer
}