# qe-plane

这个组件主要用于三维中绘制平面要素。


# 实例

隐藏代码
<template>

  <div style="height: 450px;">
    <qe-viewer
      :imagery-type="'AMap'"
      :fullscreen-button="true"
      :default-view="defaultView"
    >
    <qe-entity-layer v-if="isShowLayer">
      <qe-plane
        :position="[118.78600228, 31.9135434, 1.66113721]"
        :width="100"
        :height="150"
        :direction="{ x: 0, y: 1, z: 0 }"
        :styles="styles"
        :attr="{name: '测试数据'}"
        @click="handler"
      ></qe-plane>
    </qe-entity-layer>
    </qe-viewer>
  </div>
</template>

<script>
import { QeViewer, QeEntityLayer, QePlane } from '@qycloud/vue-qearth';
import 'vue2qearth/vue2qearth.css'

export default {
  components: {
    QeViewer, 
    QeEntityLayer, 
    QePlane
  },
  data () {
    return {
      markers:[],
      defaultView: [
        118.7863,
        31.9087,
        801.6425,
        1.724684714172732,
        -53.783141852231246,
        0.008819224020548466
      ],
      isShowLayer: true,
      styles: {
        material: "rgba(241,12,12,0.7)"
      }
    };
  },
  methods: {
    handler(evt) {
      const attr = evt.overlay.attr;
      alert(`该点的名称为--${attr.name}`)
    }
  }
}
</script>

# Attributes

参数 说明 类型 可选值 默认值
position 位置坐标,[lng-经度,lat-纬度,alt-高度] array
width 宽度 number
height 高度 number
direction 法线方向,格式: { x: 0, y: 0, z: 1 } object
styles plane 可选样式参数 object 参照 plane-styles
attr 用户自定义属性,支持 JavaScript API 任意数据类型 *

# plane-styles

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

# Events

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


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