public void StartFlight(double x, double y) { inUse = true; globeDisplay.IsNavigating = true; ESRI.ArcGIS.GlobeCore.esriGlobeCameraOrientationMode camOrientMode = globeCamera.OrientationMode; orbitalFly = (camOrientMode == ESRI.ArcGIS.GlobeCore.esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal) ? true : false; IPoint pObs = camera.Observer; IPoint pTar = camera.Target; observer = new GlobeFlyTool.PointZ(pObs.X, pObs.Y, pObs.Z); target = new GlobeFlyTool.PointZ(pTar.X, pTar.Y, pTar.Z); viewVec = target - observer; distance = viewVec.Norm(); //avoid center of globe if (target.Norm() < 0.25) { target = target + viewVec; distance = distance * 2; } currentElevation = Math.Atan(viewVec.z / Math.Sqrt((viewVec.x * viewVec.x) + (viewVec.y + viewVec.y))); currentAzimut = Math.Atan2(viewVec.y, viewVec.x);//2.26892;// //Windows API call to get windows client coordinates System.Drawing.Point pt = new System.Drawing.Point(); bool ans = GetCursorPos(ref pt); Rectangle rect = new Rectangle(); if (GetWindowRect(globeDisplay.ActiveViewer.hWnd, ref rect) == 0) { return; } mouseX = pt.X - rect.Left; mouseY = pt.Y - rect.Top; if (!orbitalFly) { globeCamera.OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationGlobal; } else { globeCamera.OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal; } globeCamera.NavigationType = esriGlobeNavigationType.esriGlobeNavigationFree; globeCamera.RollFactor = 1.0; globeDisplay.IsNavigating = true; globeDisplay.IsNavigating = false; globeDisplay.IsNavigating = true; lastClock = theClock.TickCount; //Windows API call to set cursor SetCursor(moveFlyCur.Handle.ToInt32()); //Continue the flight Flight(); }
public void StartFlight(double x, double y) { inUse = true; globeDisplay.IsNavigating = true; ESRI.ArcGIS.GlobeCore.esriGlobeCameraOrientationMode camOrientMode = globeCamera.OrientationMode; orbitalFly = (camOrientMode == ESRI.ArcGIS.GlobeCore.esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal) ? true : false; IPoint pObs = camera.Observer; IPoint pTar = camera.Target; observer = new GlobeFlyTool.PointZ(pObs.X, pObs.Y, pObs.Z); target = new GlobeFlyTool.PointZ(pTar.X, pTar.Y, pTar.Z); viewVec = target - observer; distance = viewVec.Norm(); //avoid center of globe if (target.Norm() < 0.25) { target = target + viewVec; distance = distance * 2; } currentElevation = Math.Atan(viewVec.z / Math.Sqrt((viewVec.x * viewVec.x) + (viewVec.y + viewVec.y))); currentAzimut = Math.Atan2(viewVec.y, viewVec.x);//2.26892;// //Windows API call to get windows client coordinates System.Drawing.Point pt = new System.Drawing.Point(); bool ans = GetCursorPos(ref pt); Rectangle rect = new Rectangle(); if (GetWindowRect(globeDisplay.ActiveViewer.hWnd, ref rect) == 0) return; mouseX = pt.X - rect.Left; mouseY = pt.Y - rect.Top; if (!orbitalFly) { globeCamera.OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationGlobal; } else { globeCamera.OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal; } globeCamera.NavigationType = esriGlobeNavigationType.esriGlobeNavigationFree; globeCamera.RollFactor = 1.0; globeDisplay.IsNavigating = true; globeDisplay.IsNavigating = false; globeDisplay.IsNavigating = true; lastClock = theClock.TickCount; //Windows API call to set cursor SetCursor(moveFlyCur.Handle.ToInt32()); //Continue the flight Flight(); }