Commit 9daec95b authored by 张启明's avatar 张启明

style: 完善 flyManager

parent 61911759
......@@ -10,7 +10,8 @@ export class FlyManagerComponent implements OnInit {
private viewer;
private flyManager;
private flyMnaagerOptions;
private flyManagerOptions;
private handler;
constructor(
private viewerService: ViewerService,
......@@ -19,26 +20,41 @@ export class FlyManagerComponent implements OnInit {
ngOnInit() {
this.viewer = this.viewerService.viewer;
this.flyMnaagerOptions = {
perspective: smart3d.FlyPerspective.THIRD,
duration: 100,
this.flyManagerOptions = {
perspective: smart3d.FlyPerspective.FIRST,
duration: 3,
infinite: false,
// camera: { followX: 200, followZ: 100 }, // FlyPerspective.FIRST
camera: { followX: 100, followZ: 100 }, // FlyPerspective.FIRST
path: { width: 4, material: new Cesium.PolylineGlowMaterialProperty({ color: Cesium.Color.RED }) },
point: { pixelSize: 0 },
model: { uri: 'assets/models/boat.gltf' },
// label
// site
};
this.flyManager = new smart3d.FlyManager(this.viewer, this.flyMnaagerOptions);
this.flyManager = new smart3d.FlyManager(this.viewer, this.flyManagerOptions);
this.flyManager.stopArrived.addEventListener(() => {
this.flyManager.clear();
});
this.handler = new smart3d.DrawHandler(this.viewer, smart3d.DrawMode.Line);
this.handler.drewEvent.addEventListener(cartesians => {
const updatedCartesians = cartesians.map(cartesian => {
const cartographic = Cesium.Cartographic.fromCartesian(cartesian);
return Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, cartographic.height + 1000);
});
this.flyManager.addRouteFromPositions(updatedCartesians, this.flyManagerOptions);
this.handler.clear();
});
}
handleDrawPath(options: {
clampToGround?: boolean
}) {
this.flyManager.drawNewRoute({
isGround: undefined !== options.clampToGround ? options.clampToGround : true,
});
this.handler.activate();
// this.flyManager.drawNewRoute({
// isGround: undefined !== options.clampToGround ? options.clampToGround : true,
// });
}
startFly() {
......
......@@ -29,6 +29,12 @@ export class PickComponent implements OnInit {
const degreesCartographic = this.viewerService.cartesianToDegreesCartographic(cartesian);
alert('拾取到的坐标:(' + degreesCartographic.longitude + ', ' + degreesCartographic.latitude + ', ' + degreesCartographic.height + ')');
});
// const tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
// url: 'http://www.south-smart.com/w3d-data/modeldata/nanfangcehuiBIM/NFCH0911/CHDLFC/tileset.json'
// }));
// const pick = new smart3d.Pick(viewer, smart3d.PickMode[type.toUpperCase()]);
// pick.start();
// viewer.flyTo(tileset);
}
clearPick() {
......
......@@ -41,12 +41,12 @@ export class TilesetEditorComponent implements OnInit {
if (undefined !== this.tilesetEdit) {
this.tilesetEdit.save();
// 测试缩放、旋转、平移
// 取消下面任一行注释,测试缩放、旋转、平移
// this.tilesetEdit.scale(2);
// this.tilesetEdit.rotation(smart3d.EditAxisMode.Z, 45);
// this.tilesetEdit.translation(smart3d.EditAxisMode.Y, 30);
// 测试设置 3D tiles 的 modelMatrix
// 取消下面一行注释,测试设置 3D tiles 的 modelMatrix
// this.tilesetEdit.pasteMatrix(Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, 100)));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment