public override void RcCameraUndoRedoStatusChanged(object sender, EventArgs e) { if (DF3DApplication.Application != null && DF3DApplication.Application.Current3DMapControl != null) { IVector3 pos = new Vector3(); IEulerAngle ang = new EulerAngleClass(); DF3DApplication.Application.Current3DMapControl.Camera.GetCamera(out pos, out ang); //int width = DF3DApplication.Application.Current3DMapControl.Width; //int height = DF3DApplication.Application.Current3DMapControl.Height; //Gvitech.CityMaker.FdeGeometry.IPoint pt = null; //IPickResult pr = DF3DApplication.Application.Current3DMapControl.Camera.ScreenToWorld(width / 2, height / 2, out pt); //if (pt != null && pr != null && pr.Type != gviObjectType.gviObjectSkyBox && pr.Type != gviObjectType.gviObjectNone) //{ // if (pos.Z > pt.Z) _3DLink2D(pt.X, pt.Y, pos.Z - pt.Z); //} //double height = DF3DApplication.Application.Current3DMapControl.Terrain.GetElevation(pos.X, pos.Y, gviGetElevationType.gviGetElevationFromDatabase); //if (pos.Z > height) _3DLink2D(pos.X, pos.Y, pos.Z); } }
public void SetCamera(double x, double y, double z, double heading, double tilt, double roll) { DF3DApplication app = DF3DApplication.Application; if (app == null || app.Current3DMapControl == null) { return; } if (app.Current3DMapControl.Camera.FlyTime != 3.0) { app.Current3DMapControl.Camera.FlyTime = 3.0; } app.Current3DMapControl.Viewport.ActiveView = 0; IVector3 vector = new Vector3Class(); vector.Set(x, y, z); IEulerAngle eulerAngle = new EulerAngleClass(); eulerAngle.Heading = heading; eulerAngle.Tilt = tilt; eulerAngle.Roll = roll; app.Current3DMapControl.Camera.SetCamera(vector, eulerAngle, gviSetCameraFlags.gviSetCameraNoFlags); }