riku
2024-07-17 264880703c677d63b7e35b5eb085e6bc3214e3ed
src/utils/map/3dLayer.js
@@ -30,6 +30,7 @@
  const fDatas = _factorDatas;
  const factor = _factor;
  drawMesh(fDatas, factor);
  // console.log(map.getZoom());
}
var _maxHeight = 1000,
@@ -90,15 +91,12 @@
/**
 * 绘图
 */
function drawMesh(fDatas, factor, center, merge) {
function drawMesh(fDatas, factor, merge) {
  const lnglats_GD = fDatas.lnglats_GD;
  const coors = fDatas.coors_GD;
  const heights = factor.heights;
  const colors = factor.colors;
  const bColor = factor.bottomColor;
  if (center) {
    map.setZoomAndCenter(16, center);
  }
  // eslint-disable-next-line no-undef
  var cylinder = new AMap.Object3D.Mesh();
@@ -198,23 +196,8 @@
      _maxH = maxH;
    }
    // 3.确定定位坐标点
    var center;
    if (setCenter && lnglats_GD.length > 0) {
      var p = lnglats_GD[0];
      for (let i = 0; i < lnglats_GD.length; i++) {
        const e = lnglats_GD[i];
        if (e[0] != 0) {
          p = e;
          break;
        }
      }
      // eslint-disable-next-line no-undef
      center = new AMap.LngLat(...p);
    }
    // 5.绘制3D图形
    this.drawMesh(fDatas, factor, center, merge);
    this.drawMesh(fDatas, factor, merge);
    // 缩放地图到合适的视野级别
    // map.setFitView()