# qe-wall

这个组件主要用于三维中绘制墙体要素。


# 实例

隐藏代码
<template>

  <div style="height: 450px;">
  <div  style="height: 8%;">
      <el-button-group>
        <el-button 
          type="primary" 
          size="mini" 
          @click="handler('trail')">
          动态墙
        </el-button>
        <el-button 
          type="primary" 
          size="mini"
          @click="handler('imagetrail')">
          走马灯
        </el-button>
      </el-button-group>
    </div>
    <qe-viewer style="height:90%"
      :imagery-type="'AMap'"
      :fullscreen-button="true"
      :default-view="defaultView"
      @init="getApi"
    >
    <qe-entity-layer v-if="isShowLayer">
      <qe-wall
        :positions="corridorPath"
        :height="40"
        :styles="styles" 
        :attr="{name: '测试数据'}"
        @ready="getOriginInstance"
        @click="handler"
      ></qe-wall>
    </qe-entity-layer>
    </qe-viewer>
  </div>
</template>

<script>
import { QeViewer, QeEntityLayer, QeWall } from '@qycloud/vue-qearth';
import 'vue2qearth/vue2qearth.css'
import elementUI from 'element-ui'
import Vue from 'vue'
import 'element-ui/lib/theme-chalk/index.css'

Vue.use(elementUI)

export default {
  components: {
    QeViewer, 
    QeEntityLayer, 
    QeWall
  },
  data () {
    return {
      markers:[],
      defaultView: [
        118.7863,
        31.9087,
        801.6425,
        1.724684714172732,
        -53.783141852231246,
        0.008819224020548466
      ],
      isShowLayer: true,
      corridorPath: [
        [118.78653636, 31.91315607, -0.14395184],
        [118.78717476, 31.91365014, 0.9309363],
        [118.78773082, 31.91401772, 0.65392468],
        [118.78792258, 31.91435828, 4.09293584]
      ],
      styles: null,
      qEarth: null
    };
  },
  methods: {
    handler(evt) {
      switch(evt){
        case "trail":
        this.wall.setStyle({
          material: new this.qEarth.WallTrailMaterialProperty({
            color: this.qEarth.Color.GREEN,
            speed: 10
          })
        });
          break;
        case "imagetrail":
          this.wall.setStyle({
          material: new this.qEarth.WallImageTrailMaterialProperty({
          color: this.qEarth.Color.GREEN,
          repeat: { x: 20, y: 1 },
          speed: 10
        })
        });
          break;
        default:
        const attr = evt.overlay.attr;
        alert(`该要素的名称为--${attr.name}`);
        break;
      }
    },
    getApi(qEarth) {
      this.qEarth = qEarth;
    },
    getOriginInstance(wall) {
      wall.setStyle({
        material: new this.qEarth.WallTrailMaterialProperty({
          color: this.qEarth.Color.GREEN,
          speed: 10
        })
      });
      this.wall=wall;
    }
  }
}
</script>

# Attributes

参数 说明 类型 可选值 默认值
positions 墙路径坐标串,[[lng-经度,lat-纬度,alt-高度],[],...] array
height 墙体高度 number
styles wall 可选样式参数 object 参照 wall-styles
attr 用户自定义属性,支持 JavaScript API 任意数据类型 *

# wall-styles

  // 样式参数(可选)
  {
    "fill": true, //是否用提供的材料填充多边形。
    "minimumHeights":[],  // 指定 wall 底部的高度数组。
    "maximumHeights":[],  // 指定 wall  顶部的高度数组。
    "material": "red", //材质
    "outline": false, //是否显示边框
    "outlineColor": "black", //边框颜色
    "outlineWidth": 0, //边框宽度
    "shadows": 0, //阴影类型,0:禁用、1:启用 、2:投射、3:接受
    "distanceDisplayCondition": {
      "near": 0, //最近距离
      "far": Number.MAX_VALUE //最远距离
    } //根据距离设置可见
  }

# Events

覆盖物事件的使用请参照上面Wall 实例


// 覆盖物可选事件
"ready" // 组件装载后,返回当前实例对象
"click" // 鼠标点击事件
"rightclick" // 鼠标右击事件
"dblclick" // 鼠标双击事件
"mousemove" // 鼠标移动事件
"wheel" // 鼠标滚轮事件
"mouseover" // 鼠标移入事件
"mouseout" // 鼠标移出事件
最后更新时间: 8/16/2022, 10:45:53 AM