Newer
Older
smartwell_front_dz / src / components / Mars3D / utils / ArcGisWfsLayer.js
wangxitong on 8 Jul 2 KB 达州变更
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, height='') {
  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) {
        if(height === ''){
          var val = { attr }.attr
          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(id, index, color, width, popup='all') {
  const wfsLayer = new mars3d.layer.ArcGisWfsLayer({
    id,
    enablePickFeatures: false,
    url: Vue.prototype.baseConfig.arcgisUrl + index,
    // maximumLevel: 19,
    symbol: {
      type: 'polylineC',
      styleOptions: {
        color: color,
        width: width,
        hasShadows: false
      }
    },
    popup
  })
  window.map.addLayer(wfsLayer)
  return wfsLayer
}

/**
 * 添加楼宇
 */
export function building() {
  const wfsLayer = new mars3d.layer.ArcGisWfsLayer({
    name: '建筑物面矢量图层',
    url: '',
    // minimumLevel: changeLevel,
    symbol: {
      type: 'polygonC',
      styleOptions: {
        color: 'rgb(52,125,246)',
        outline: false,
        opacity: 0.8
      },
      callback: function(attr, styleOpt) {
        var val = { attr }.attr
        console.log(attr)
      }
    },
    buildings: {
      height: 100
    }
  })
  window.map.addLayer(wfsLayer)
}

//ArcGisLayer
export async function creatAicPoint(id, url, image, popup="all") {
  const arcGisLayer = new mars3d.layer.ArcGisWfsLayer({
    id,
    url,
    symbol: {
      type: "billboardP",
      allowDrillPick: true,
      styleOptions: {
        image,
        pixelOffsetY: -15,
        visibleDepth: false,
      }
    },
    popup,
    show: true
  })
  window.map.addLayer(arcGisLayer)
  return arcGisLayer
}