| | |
| | | const fDatas = _factorDatas; |
| | | const factor = _factor; |
| | | drawMesh(fDatas, factor); |
| | | // console.log(map.getZoom()); |
| | | } |
| | | |
| | | var _maxHeight = 1000, |
| | |
| | | /** |
| | | * 绘图 |
| | | */ |
| | | 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); |
| | | } |
| | | // const bColor = factor.bottomColor; |
| | | const bColors = factor.bottomColors; |
| | | |
| | | // eslint-disable-next-line no-undef |
| | | var cylinder = new AMap.Object3D.Mesh(); |
| | |
| | | } |
| | | } |
| | | |
| | | // var bColor = bColor |
| | | var tColor = colors[i]; |
| | | geometry.vertexColors.push.apply(geometry.vertexColors, bColor); //底部顶点颜色 |
| | | geometry.vertexColors.push.apply(geometry.vertexColors, tColor); //顶部顶点颜色 |
| | | geometry.vertexColors.push.apply(geometry.vertexColors, bColors[i]); //底部顶点颜色 |
| | | geometry.vertexColors.push.apply(geometry.vertexColors, colors[i]); //顶部顶点颜色 |
| | | } |
| | | |
| | | // 7.根据合并选项重置或新增当前缓存数据 |
| | |
| | | } |
| | | |
| | | export default { |
| | | clear() { |
| | | if (_cylinder != undefined) { |
| | | object3Dlayer.remove(_cylinder); |
| | | } |
| | | }, |
| | | |
| | | drawMesh: drawMesh, |
| | | /** |
| | | * 绘制3D走行路线图 |
| | | * @param fDatas 完整监测数据 |
| | | * @param factor 当前展示的监测因子对象 |
| | | * @param merge 是否和之前绘制的图形合并 |
| | | * @param setCenter 镜头是否自动移动至图形中心 |
| | | */ |
| | | drawRoadMap(fDatas, factor, merge, setCenter) { |
| | | drawRoadMap(fDatas, factor, merge) { |
| | | const lnglats_GD = fDatas.lnglats_GD; |
| | | const heights = factor.heights; |
| | | |
| | |
| | | _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图形 |
| | | drawMesh(fDatas, factor, center, merge); |
| | | this.drawMesh(fDatas, factor, merge); |
| | | |
| | | // 缩放地图到合适的视野级别 |
| | | // map.setFitView() |