相机工具
- 调用
-
let line = cw5.geometryCreator.createPolyline([[150139, 37917, 64],
-
[150180, 37854, 64],
-
[150258, 37887, 64]]);
-
switch (type) {
-
case "lookPosition":
-
cw5.cameraUtils.lookAtPosition(150139, 37917, 64)
-
break;
-
case "lookGeometry":
-
cw5.cameraUtils.lookAtGeometry(line)
-
break;
-
case "flyToLayer":
-
cw5.cameraUtils.flyToLayer("buildingA05JZ019")
-
break;
-
}
- cameraUtils
```javascript
import { cw5 } from "../index.js";
export const cameraUtils = {};
/**
-
飞到观察点
-
x y z 观察点坐标
-
flyTime 飞行时间
-
rule 详细参数:
-
Distance 相机与观察点(视点)之间的距离。
-
heading 相机的(左右)摇摆角 正北方向为0,值域[0,360)
-
tilt 相机的(上下)俯仰角,单位为度,平视为0,值域[-90,90]度,低头为负,抬头为正,默认为-70
-
roll 相机的倾斜角 水平为0
* -
*/
cameraUtils.lookAtPosition = function(x, y, z,flyTime, rule) {var __g = cw5.__g;
var geoFactory = __g.geometryFactory;
var point = geoFactory.createGeometry(cw5.innerConfig.gviGeometryType.gviGeometryPoint,
cw5.innerConfig.gviVertexAttribute.gviVertexAttributeZ);
point.setCoords(x, y, z, 0, 0);var angle = __g.new_EulerAngle;
var tilt = -70;
var heading = 300;
var flyTime = flyTime||7;
let distance = 20;
if (rule && rule.tilt && rule.heading && rule.distance) {
更多参考 https://xiaozhuanlan.com/topic/5031649278