void globeDispEvent_AfterDraw(ISceneViewer pViewer)
        {
            double obsLat;
            double obsLon;
            double obsAlt;
            double tarLat;
            double tarLon;
            double tarAlt;

            globeCamera.GetObserverLatLonAlt(out obsLat, out obsLon, out obsAlt);
            globeCamera.GetTargetLatLonAlt(out tarLat, out tarLon, out tarAlt);
            //set the observer and target of the secondary viewer to be the same as main viewer if top-down view = false
            if (topDownView == false || globeCamera.OrientationMode == esriGlobeCameraOrientationMode.esriGlobeCameraOrientationGlobal)
            {
                viewerGlobeCamera.OrientationMode = globeCamera.OrientationMode;
                viewerGlobeCamera.SetObserverLatLonAlt(obsLat, obsLon, obsAlt);
                viewerGlobeCamera.SetTargetLatLonAlt(tarLat, tarLon, tarAlt);
            }
            //set the observer top down view for the secondary viewer
            else if (topDownView == true && globeCamera.OrientationMode == esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal)
            {
                viewerGlobeCamera.OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal;
                tarLat = obsLat + 0.0000001;
                tarLon = obsLon + 0.0000001;
                viewerGlobeCamera.SetTargetLatLonAlt(tarLat, tarLon, tarAlt);
            }
        }
コード例 #2
0
ファイル: CmdLinkMapAndScene.cs プロジェクト: secondii/Yutai
        private void SceneEventsOnAfterDraw(ISceneViewer pViewer)
        {
            if (!_isLinked)
            {
                return;
            }
            if (_isInternal)
            {
                return;
            }

            _isInternal = true;

            ICamera   scenecamera = _plugin.Camera;
            IVector3D pvector3D   = new Vector3D() as IVector3D;

            pvector3D.ConstructDifference(scenecamera.Observer, scenecamera.Target);
            ISphere pShere = new Sphere();

            pShere.Center = scenecamera.Target;
            pShere.Radius = scenecamera.ViewingDistance * Math.Sin(scenecamera.ViewFieldAngle * Math.PI / 180) * 0.5;
            IEnvelope   penve    = pShere.Envelope;
            IActiveView focusMap = (IActiveView)_context.FocusMap;

            focusMap.Extent = penve;
            focusMap.Refresh();
        }
コード例 #3
0
 private void CreateSceneViewImage()
 {
     try
     {
         string ImageType = "";
         //文件路径和名称
         if (txtImagePath.Text != null)
         {
             //文件类型
             ImageType = System.IO.Path.GetExtension(txtImagePath.Text).Substring(1);
         }
         ISceneViewer pSceneView = pSceneControl.SceneViewer;
         if (ImageType == "BMP")
         {
             pSceneView.GetScreenShot(esri3DOutputImageType.BMP, txtImagePath.Text);
         }
         else if (ImageType == "JPEG")
         {
             pSceneView.GetScreenShot(esri3DOutputImageType.JPEG, txtImagePath.Text);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #4
0
        private void OnAfterDraw(ISceneViewer pViewer)
        {
            double pLatDD = 0; double pLonDD = 0; double pAltKms = 0; double pRoll = 0; double pIncl = 0;

            GetObserVerLatLong(pViewer, out pLatDD, out pLonDD, out pAltKms, out pRoll, out pIncl);
            UpdateCustomHUD(pLatDD, pLonDD, pAltKms, pRoll, pIncl);
        }
コード例 #5
0
        public void getGlobeCoodinates(AxGlobeControl axGlobeControl, int x, int y, out double X, out double Y, out double Z)
        {
            //string coordInfo = "坐标信息";
            try
            {
                //获取点击坐标的X、Y
                IPoint        globePoint   = new PointClass();
                IGlobeDisplay globeDisplay = axGlobeControl.GlobeDisplay;
                ISceneViewer  sceneViewer  = globeDisplay.ActiveViewer;
                System.Object owner        = System.Type.Missing;
                System.Object object1      = System.Type.Missing;
                globeDisplay.Locate(sceneViewer, x, y, false, false, out globePoint, out owner, out object1);

                //coordInfo = globePoint.X.ToString("F8") + "," + globePoint.Y.ToString("F8") + "," + globePoint.Z.ToString("F4");
                X = globePoint.X;
                Y = globePoint.Y;
                Z = globePoint.Z;
                //return coordInfo;
            }
            catch
            {
                X = 0;
                Y = 0;
                Z = 0;
                //return coordInfo;
            }
        }
コード例 #6
0
 private void cboViewers_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.cboViewers.SelectedIndex != -1)
     {
         ISceneViewer sceneViewer = (this.cboViewers.SelectedItem as frmViewSettings.Class0).SceneViewer;
         IPoint       point       = sceneViewer.Camera.Observer;
         if (!point.IsEmpty)
         {
             this.txtObserverX.Text = point.X.ToString("0.###");
             this.txtObserverY.Text = point.Y.ToString("0.###");
             this.txtObserverZ.Text = point.Z.ToString("0.###");
         }
         point = sceneViewer.Camera.Target;
         this.rdoProjectionType.SelectedIndex = (sceneViewer.Camera.ProjectionType - esri3DProjectionType.esriPerspectiveProjection);
         if (!point.IsEmpty)
         {
             this.txtTargetX.Text = point.X.ToString("0.###");
             this.txtTargetY.Text = point.Y.ToString("0.###");
             this.txtTargetZ.Text = point.Z.ToString("0.###");
         }
         this.lblDistance.Text         = sceneViewer.Camera.ViewingDistance.ToString("0");
         this.spinRollAngle.Value      = ((decimal)sceneViewer.Camera.RollAngle);
         this.spinViewFieldAngle.Value = ((decimal)sceneViewer.Camera.ViewFieldAngle);
     }
 }
コード例 #7
0
 private void glbDisplay_AfterDraw(ISceneViewer pViewer)
 {
     // load 3dd on first time render only, let the WPF drawing thread render the window controls first
     if (globeControl.DocumentFilename == null)
     {
         globeControl.Load3dFile(mapPath + _map.MapName + ".3dd");
     }
 }
コード例 #8
0
ファイル: ToolSceneZoomIn.cs プロジェクト: secondii/Yutai
 public override void OnKeyDown(int int_0, int int_1)
 {
     if (this.bool_0 && int_0 == 27)
     {
         ISceneViewer activeViewer = this._plugin.ActiveViewer;
         activeViewer.Redraw(true);
         this.bool_0 = false;
     }
 }
コード例 #9
0
 private void rdoProjectionType_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.bool_0)
     {
         ISceneViewer sceneViewer = (this.cboViewers.SelectedItem as frmViewSettings.Class0).SceneViewer;
         sceneViewer.Camera.ProjectionType = this.rdoProjectionType.SelectedIndex + esri3DProjectionType.esriPerspectiveProjection;
         sceneViewer.Camera.Apply();
         sceneViewer.SceneGraph.RefreshViewers();
     }
 }
コード例 #10
0
        public override void OnClick()
        {
            ICamera camera         = this._plugin.Camera;
            double  viewFieldAngle = camera.ViewFieldAngle;

            camera.ViewFieldAngle = viewFieldAngle * 0.9;
            ISceneViewer activeViewer = this._plugin.ActiveViewer;

            activeViewer.Redraw(false);
        }
コード例 #11
0
 public SunPositionTool()
 {
     //get the different members
     m_globe = ArcGlobe.Globe;
     m_globeDisplay = m_globe.GlobeDisplay as IGlobeDisplay3;
     m_globeDisplayRendering = m_globeDisplay as IGlobeDisplayRendering;
     m_globeCamera = m_globeDisplay.ActiveViewer.Camera as IGlobeCamera;
     m_globeViewUtil = m_globeCamera as IGlobeViewUtil;
     m_sceneViewer = m_globeDisplay.ActiveViewer;
 }
コード例 #12
0
        private void GetObserVerLatLong(ISceneViewer pViewer, out double pLatDD, out double pLonDD, out double pAltKms, out double pRoll, out double pIncl)
        {
            IGlobeCamera pCam = (IGlobeCamera)pViewer.Camera;

            pCam.GetObserverLatLonAlt(out pLatDD, out pLonDD, out pAltKms);
            ICamera pIcam = (ICamera)pCam;

            pRoll = pIcam.RollAngle;
            pIncl = pIcam.Inclination;
        }
コード例 #13
0
 public SunPositionTool()
 {
     //get the different members
     m_globe                 = ArcGlobe.Globe;
     m_globeDisplay          = m_globe.GlobeDisplay as IGlobeDisplay3;
     m_globeDisplayRendering = m_globeDisplay as IGlobeDisplayRendering;
     m_globeCamera           = m_globeDisplay.ActiveViewer.Camera as IGlobeCamera;
     m_globeViewUtil         = m_globeCamera as IGlobeViewUtil;
     m_sceneViewer           = m_globeDisplay.ActiveViewer;
 }
コード例 #14
0
ファイル: ToolBox.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 定位
        /// </summary>
        /// <param name="lngLat"></param>
        /// <param name="zoomLevel"></param>
        public void ZoomToPosition(Core.Model.MapLngLat lngLat, int?zoomLevel = null)
        {
            ISceneViewer m_ActiveView = mapControl.Globe.GlobeDisplay.ActiveViewer;
            IEnvelope    enve         = new EnvelopeClass();

            enve.PutCoords(lngLat.Lng, lngLat.Lat, lngLat.Lng, lngLat.Lat);
            enve.ZMin = lngLat.Alt * 10;
            enve.ZMax = lngLat.Alt * 10;
            mapControl.GlobeCamera.SetToZoomToExtents(enve, mapControl.Globe, m_ActiveView);
            m_ActiveView.Redraw(false);
        }
コード例 #15
0
ファイル: ToolBox.cs プロジェクト: AnuoF/MapFrame
        /// <summary>
        /// 屏幕坐标转地理坐标
        /// </summary>
        /// <param name="x">屏幕X</param>
        /// <param name="y">屏幕Y</param>
        /// <returns></returns>
        public MapLngLat SceneToGeographyPoint(int x, int y)
        {
            double         dLat, dLon, dAlt;
            IGlobeDisplay  pGlobeDisplay  = mapControl.GlobeDisplay;
            ISceneViewer   pViewer        = mapControl.GlobeDisplay.ActiveViewer;
            IGlobeViewUtil pGlobeViewUtil = mapControl.GlobeCamera as IGlobeViewUtil;

            pGlobeViewUtil.WindowToGeographic(pGlobeDisplay, pViewer, x, y, true, out dLon, out dLat, out dAlt);
            Core.Model.MapLngLat lnglat = new Core.Model.MapLngLat(dLon, dLat, dAlt);
            return(lnglat);
        }
コード例 #16
0
ファイル: Form1.cs プロジェクト: yangfan616/school3D
        //放大至图层方法
        private void ZoomToGlobeLayer(IGlobe globe, int layerindex)
        {
            IGlobeDisplay globeDisplay = globe.GlobeDisplay;
            ISceneViewer  sceneViewer  = globeDisplay.ActiveViewer;
            ICamera       camera       = sceneViewer.Camera;
            IGlobeCamera  globeCamera  = camera as IGlobeCamera;
            IScene        scene        = globe as IScene;
            ILayer        layer        = scene.get_Layer(layerindex);
            IEnvelope     extent       = layer.AreaOfInterest.Envelope;

            globeCamera.SetToZoomToExtents(extent, globe, sceneViewer);
        }
コード例 #17
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            //Initialize mouse coordinates
            m_bInUse  = true;
            m_lMouseX = X;
            m_lMouseY = Y;

            //Get the scene viewer
            ISceneViewer pSceneViewer = (ISceneViewer)m_pSceneHookHelper.ActiveViewer;

            SetCapture(m_pSceneHookHelper.ActiveViewer.hWnd);
        }
コード例 #18
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
        public static IPoint XYToPoint(ISceneGraph isceneGraph_0, int int_0, int int_1)
        {
            IPoint       result       = null;
            ISceneViewer activeViewer = isceneGraph_0.ActiveViewer;
            object       obj;
            object       obj2;

            isceneGraph_0.Locate(activeViewer, int_0, int_1, esriScenePickMode.esriScenePickGeography, true, out result, out obj, out obj2);
            obj  = null;
            obj2 = null;
            return(result);
        }
コード例 #19
0
        private void GetGeographicCoordinates(IGlobe globe, int screenX, int screenY, ref double longitude, ref double latitude, ref double altitudeInKilometers)
        {
            IGlobeDisplay globeDisplay = globe.GlobeDisplay;

            ISceneViewer sceneViewer = globeDisplay.ActiveViewer;

            ICamera camera = globeDisplay.ActiveViewer.Camera;

            IGlobeViewUtil globeViewUtil = camera as IGlobeViewUtil;

            globeViewUtil.WindowToGeographic(globeDisplay, sceneViewer, screenX, screenY, true, out longitude, out latitude, out altitudeInKilometers);
        }
コード例 #20
0
ファイル: Form1.cs プロジェクト: yangfan616/school3D
        private void Form1_Load(object sender, EventArgs e)
        {
            m_Globe         = axGlobeControl1.Globe;
            m_GlobeDisplay  = m_Globe.GlobeDisplay;
            m_SceneView     = m_GlobeDisplay.ActiveViewer;
            m_GlobeViewUtil = axGlobeControl1.GlobeCamera as IGlobeViewUtil;

            IGlobeDisplayEvents_Event m_GlobeDisplayEvents = axGlobeControl1.Globe.GlobeDisplay as IGlobeDisplayEvents_Event;

            //将三维视图重绘事件委托给m_GlobeDisplayEvents_AfterDraw方法
            m_GlobeDisplayEvents.AfterDraw += new IGlobeDisplayEvents_AfterDrawEventHandler(m_GlobeDisplayEvents_AfterDraw);

            axMapControl1.Extent    = axMapControl1.FullExtent;
            comboBox1.SelectedIndex = 0;
        }
コード例 #21
0
ファイル: Form1.cs プロジェクト: yangfan616/school3D
        /// <summary>
        /// 获得三维视图的显示范围,并在二维地图上显示
        /// </summary>
        /// <param name="pViewer"></param>
        void m_GlobeDisplayEvents_AfterDraw(ISceneViewer pViewer)
        {
            m_MapExtent = new EnvelopeClass();

            m_GlobeViewUtil.QueryVisibleGeographicExtent(m_MapExtent);

            IGraphicsContainer pGra = axMapControl1.Map as IGraphicsContainer;
            IActiveView        pAv  = pGra as IActiveView;

            pGra.DeleteAllElements();

            IRectangleElement rec = new RectangleElementClass();
            IElement          ele = rec as IElement;

            ele.Geometry = m_MapExtent;
            //创建颜色对象
            IRgbColor pColor = new RgbColorClass();

            pColor.Red   = 255;
            pColor.Green = 0;
            pColor.Blue  = 0;
            //创建线型对象并设置颜色和宽度
            ILineSymbol line = new SimpleLineSymbolClass();

            line.Color = pColor;
            line.Width = 2;

            pColor              = new RgbColorClass();
            pColor.Red          = 255;
            pColor.Green        = 0;
            pColor.Blue         = 0;
            pColor.Transparency = 0;//设置透明度

            IFillSymbol fill = new SimpleFillSymbolClass();

            fill.Outline = line;
            fill.Color   = pColor;

            IFillShapeElement pFillElement = ele as IFillShapeElement;

            pFillElement.Symbol = fill;



            pGra.AddElement((IElement)pFillElement, 0);

            pAv.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
        }
コード例 #22
0
ファイル: NarrowFOV.cs プロジェクト: ShengXiangXiong/GisSever
        public override void OnClick()
        {
            //Get scene viewer's camera
            ICamera pCamera = (ICamera)m_pSceneHookHelper.Camera;

            //Widen the field of view
            double dAngle;

            dAngle = pCamera.ViewFieldAngle;
            pCamera.ViewFieldAngle = dAngle * 0.9;

            //Redraw the scene viewer
            ISceneViewer pSceneViewer = (ISceneViewer)m_pSceneHookHelper.ActiveViewer;

            pSceneViewer.Redraw(false);
        }
コード例 #23
0
ファイル: ZoomOut.cs プロジェクト: ShengXiangXiong/GisSever
        public void DrawRectangle(IEnvelope pEnvelope)
        {
            //Get the scene viewer
            ISceneViewer pSceneViewer = (ISceneViewer)m_pSceneHookHelper.ActiveViewer;

            //Redraw the rectangle
            pSceneViewer.Redraw(true);

            //GDI+ call to fill a rectangle with a hollow brush
            myGraphics.FillRectangle(m_brush, (int)pEnvelope.XMin, (int)pEnvelope.YMin,
                                     (int)pEnvelope.Width, (int)pEnvelope.Height);

            //GDI+ call to draw a rectangle with a specified pen
            myGraphics.DrawRectangle(m_pen, (int)pEnvelope.XMin, (int)pEnvelope.YMin,
                                     (int)pEnvelope.Width, (int)pEnvelope.Height);
        }
コード例 #24
0
        public override void OnKeyDown(int keyCode, int Shift)
        {
            if (m_bInUse == true)
            {
                if (keyCode == 27)                //If ESC was pressed
                {
                    //Redraw the scene viewer
                    ISceneViewer pSceneViewer = (ISceneViewer)m_pSceneHookHelper.ActiveViewer;
                    pSceneViewer.Redraw(true);

                    ReleaseCapture(m_pSceneHookHelper.ActiveViewer.hWnd);

                    m_bInUse = false;
                }
            }
        }
コード例 #25
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            //Initialize mouse coordinates
            m_bInUse  = true;
            m_lMouseX = X;
            m_lMouseY = Y;

            //Get the scene viewer
            ISceneViewer pSceneViewer = (ISceneViewer)m_pSceneHookHelper.ActiveViewer;

            SetCapture(m_pSceneHookHelper.ActiveViewer.hWnd);

            //Create a point in map coordinates
            IActiveView pActiveView = (IActiveView)m_pSceneHookHelper.Scene;

            m_point = pActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
        }
コード例 #26
0
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (null == m_weatherLayer)
            {
                return;
            }

            object owner;
            object obj;

            IPoint        hitPoint;
            IGlobeDisplay globedisplay = ((IGlobe)m_scene).GlobeDisplay;

            ISceneViewer sceneViewer = globedisplay.ActiveViewer;

            globedisplay.Locate(sceneViewer, X, Y, false, false, out hitPoint, out owner, out obj);

            if (obj != null)
            {
                if (!(obj is IPropertySet))
                {
                    return;
                }

                IPropertySet propset = obj as IPropertySet;

                if (!(owner is RSSWeatherLayer3DClass))
                {
                    return;
                }

                if (propset == null)
                {
                    return;
                }

                //get the zip code
                object o       = propset.GetProperty("ZIPCODE");
                long   zipcode = Convert.ToInt64(o);
                m_weatherLayer.Select(zipcode, Shift != 1);
            }
            else
            {
                m_weatherLayer.Select(-1L, true);
            }
        }
コード例 #27
0
 /// <summary>
 /// 初始化的一些方法
 /// </summary>
 public void Init(AxSceneControl axSceneControl)
 {
     if (axSceneControl != null)
     {
         try
         {
             this.m_axSceneControl = axSceneControl;
             m_sceneControl        = axSceneControl.Object as ISceneControl;
             m_SceneGraph          = m_sceneControl.SceneGraph;
             m_Scene       = m_sceneControl.Scene;
             m_SceneViewer = m_SceneGraph.ActiveViewer;
             m_Camera      = m_sceneControl.Camera;
         }
         catch (Exception e)
         {
         }
     }
 }
コード例 #28
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
        public static IPoint XYToPoint2(ISceneGraph isceneGraph_0, int int_0, int int_1, esriScenePickMode esriScenePickMode_0)
        {
            IPoint       result       = null;
            ISceneViewer activeViewer = isceneGraph_0.ActiveViewer;
            IHit3DSet    hit3DSet;

            isceneGraph_0.LocateMultiple(activeViewer, int_0, int_1, esriScenePickMode_0, true, out hit3DSet);
            if (hit3DSet != null)
            {
                hit3DSet.OnePerLayer();
                IArray hits = hit3DSet.Hits;
                for (int i = 0; i <= hits.Count - 1; i++)
                {
                    IHit3D hit3D = hits.get_Element(i) as IHit3D;
                    result = hit3D.Point;
                }
            }
            return(result);
        }
コード例 #29
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
        public static IPoint XYToFeature(ISceneGraph isceneGraph_0, int int_0, int int_1, out IFeature ifeature_0, out IFeatureLayer ifeatureLayer_0)
        {
            ifeature_0      = null;
            ifeatureLayer_0 = null;
            ISceneViewer activeViewer = isceneGraph_0.ActiveViewer;
            IPoint       result;
            object       obj;
            object       obj2;

            isceneGraph_0.Locate(activeViewer, int_0, int_1, esriScenePickMode.esriScenePickGeography, true, out result, out obj, out obj2);
            if (obj2 != null && obj2 is IFeature)
            {
                ifeature_0      = (obj2 as IFeature);
                ifeatureLayer_0 = (obj as IFeatureLayer);
            }
            obj  = null;
            obj2 = null;
            return(result);
        }
コード例 #30
0
ファイル: frmLngLatCalculate.cs プロジェクト: AnuoF/MapFrame
 /// <summary>
 /// 定位
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnPosition_Click(object sender, EventArgs e)
 {
     try
     {
         ISceneViewer m_ActiveView = globe.GlobeDisplay.ActiveViewer;
         IEnvelope    enve         = new EnvelopeClass();
         double       newLng       = Convert.ToDouble(countLong);
         double       newLat       = Convert.ToDouble(countLat);
         enve.PutCoords(newLng, newLat, newLng + 2, newLat + 2);
         enve.ZMin = 0;
         enve.ZMax = 0;
         globe.GlobeCamera.SetToZoomToExtents(enve, globe.Globe, m_ActiveView);
         m_ActiveView.Redraw(false);
     }
     catch (Exception ex)
     {
         Log4Allen.WriteLog(typeof(frmLngLatCalculate), ex.Message);
     }
 }
コード例 #31
0
ファイル: ToolSceneZoomIn.cs プロジェクト: secondii/Yutai
        public void DrawRectangle(IEnvelope ienvelope_1)
        {
            ISceneViewer activeViewer = this._plugin.ActiveViewer;

            System.Drawing.Rectangle r        = default(System.Drawing.Rectangle);
            System.Drawing.Point     location = default(System.Drawing.Point);
            IPoint lowerLeft = ienvelope_1.LowerLeft;

            location.X = (int)lowerLeft.X;
            location.Y = (int)lowerLeft.Y;
            int width  = (int)ienvelope_1.Width;
            int height = (int)ienvelope_1.Height;

            r.Location = location;
            r.Width    = width;
            r.Height   = height;
            System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle(new IntPtr(activeViewer.hWnd));
            System.Windows.Forms.ControlPaint.DrawReversibleFrame(control.RectangleToScreen(r), System.Drawing.Color.Black, System.Windows.Forms.FrameStyle.Thick);
        }
コード例 #32
0
 private void CreateSceneViewer()
 {
     m_sceneViewer = new SceneViewer(this);
 }
コード例 #33
0
		private void OnAfterDraw(ISceneViewer pViewer) 
		{
			double pLatDD=0; double pLonDD=0; double pAltKms=0; double pRoll=0; double pIncl=0;
			GetObserVerLatLong(pViewer, out pLatDD, out pLonDD, out pAltKms, out pRoll, out pIncl);
			UpdateCustomHUD(pLatDD, pLonDD, pAltKms, pRoll, pIncl);
		}
コード例 #34
0
    /// <summary>
    /// Occurs when this command is clicked
    /// </summary>
    public override void OnClick()
    {
      try
      {

        if (!m_bConnected)
        {
          //show the tracking type selection dialog (whether to track the element from above or follow it from behind)
          TrackSelectionDlg dlg = new TrackSelectionDlg();
          if (System.Windows.Forms.DialogResult.OK != dlg.ShowDialog())
            return;

          //get the required tracking mode
          m_bTrackAboveTarget = dlg.UseOrthoTrackingMode;

          //do only once initializations
          if (m_once)
          {
            //create the graphics layer to manage the dynamic object
            m_globeGraphicsLayer = new GlobeGraphicsLayerClass();
            ((ILayer)m_globeGraphicsLayer).Name = "DynamicObjects";

            IScene scene = (IScene)m_globeDisplay.Globe;

            //add the new graphic layer to the globe
            scene.AddLayer((ILayer)m_globeGraphicsLayer, false);

            //activate the graphics layer
            scene.ActiveGraphicsLayer = (ILayer)m_globeGraphicsLayer;

            //redraw the GlobeDisplay
            m_globeDisplay.RefreshViewers();

            //open a polyline featurelayer that would serve the real-time feed GPS simulator
            IFeatureLayer featureLayer = GetFeatureLayer();
            if (featureLayer == null)
              return;
            
            //assign the featurelayer to the GPS simulator
            m_realTimeFeedManager.RealTimeFeedSimulator.FeatureLayer = featureLayer;

            m_once = false;
          }

          //get the GlobeViewUtil which is needed for coordinate transformations
          m_sceneViwer = m_globeDisplay.ActiveViewer;

          //Set the globe mode to terrain mode, since otherwise it will not be possible to set the target position
         ((IGlobeCamera)m_sceneViwer.Camera).OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal;


          //set the simulator elapsed time
          m_realTimeFeedManager.RealTimeFeedSimulator.TimeIncrement = 0.1; //sec

          //wire the real-time feed PositionUpdate event
          ((IRealTimeFeedEvents_Event)m_realTimeFeed).PositionUpdated += new IRealTimeFeedEvents_PositionUpdatedEventHandler(OnPositionUpdated);

          //start the real-time listener
          m_realTimeFeed.Start();
        }
        else
        {
          //stop the real-time listener
          m_realTimeFeed.Stop();

          //un-wire the PositionUpdated event handler
          ((IRealTimeFeedEvents_Event)m_realTimeFeed).PositionUpdated -= new IRealTimeFeedEvents_PositionUpdatedEventHandler(OnPositionUpdated);
        }

        //switch the connection flag
        m_bConnected = !m_bConnected;
      }
      catch (Exception ex)
      {
        System.Diagnostics.Trace.WriteLine(ex.Message);
      }
    }
コード例 #35
0
		private void Form1_Load(object sender, System.EventArgs e)
		{
			//Initialize member variables
			m_ActiveView = axGlobeControl1.GlobeDisplay.ActiveViewer;
			m_Camera = m_ActiveView.Camera;
		}
コード例 #36
0
		private void GetObserVerLatLong(ISceneViewer pViewer, out double pLatDD, out double pLonDD, out double pAltKms, out double pRoll, out double pIncl)
		{
			IGlobeCamera pCam = (IGlobeCamera) pViewer.Camera;
			pCam.GetObserverLatLonAlt( out pLatDD, out pLonDD, out pAltKms);
			ICamera pIcam = (ICamera) pCam;
			pRoll = pIcam.RollAngle;
			pIncl = pIcam.Inclination;
		}
コード例 #37
0
ファイル: ScenePresence.cs プロジェクト: NovaGrid/opensim
        public ScenePresence(
            IClientAPI client, Scene world, AvatarAppearance appearance, PresenceType type)
        {
            AttachmentsSyncLock = new Object();

            m_sendCourseLocationsMethod = SendCoarseLocationsDefault;
            m_sceneViewer = new SceneViewer(this);
            m_animator = new ScenePresenceAnimator(this);
            PresenceType = type;
            m_DrawDistance = world.DefaultDrawDistance;
            m_rootRegionHandle = world.RegionInfo.RegionHandle;
            m_controllingClient = client;
            m_firstname = m_controllingClient.FirstName;
            m_lastname = m_controllingClient.LastName;
            m_name = String.Format("{0} {1}", m_firstname, m_lastname);
            m_scene = world;
            m_uuid = client.AgentId;
            m_localId = m_scene.AllocateLocalId();

            UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, m_uuid);

            if (account != null)
                m_userLevel = account.UserLevel;

            IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
            if (gm != null)
                m_grouptitle = gm.GetGroupTitle(m_uuid);

            m_scriptEngines = m_scene.RequestModuleInterfaces<IScriptModule>();
            
            AbsolutePosition = posLastSignificantMove = m_CameraCenter =
                m_lastCameraCenter = m_controllingClient.StartPos;

            m_reprioritization_timer = new Timer(world.ReprioritizationInterval);
            m_reprioritization_timer.Elapsed += new ElapsedEventHandler(Reprioritize);
            m_reprioritization_timer.AutoReset = false;

            AdjustKnownSeeds();

            // TODO: I think, this won't send anything, as we are still a child here...
            Animator.TrySetMovementAnimation("STAND"); 

            // we created a new ScenePresence (a new child agent) in a fresh region.
            // Request info about all the (root) agents in this region
            // Note: This won't send data *to* other clients in that region (children don't send)

// MIC: This gets called again in CompleteMovement
            // SendInitialFullUpdateToAllClients();
            SendOtherAgentsAvatarDataToMe();
            SendOtherAgentsAppearanceToMe();

            RegisterToEvents();
            SetDirectionVectors();

            m_appearance = appearance;
        }
コード例 #38
0
        private void glbDisplay_AfterDraw(ISceneViewer pViewer)
        {
					// load 3dd on first time render only, let the WPF drawing thread render the window controls first
          if (globeControl.DocumentFilename == null)
              globeControl.Load3dFile(mapPath + _map.MapName + ".3dd");   
        }
コード例 #39
0
 void globeDispEvent_AfterDraw(ISceneViewer pViewer)
 {
     double obsLat;
     double obsLon;
     double obsAlt;
     double tarLat;
     double tarLon;
     double tarAlt;
     globeCamera.GetObserverLatLonAlt(out obsLat, out obsLon, out obsAlt);
     globeCamera.GetTargetLatLonAlt(out tarLat, out tarLon, out tarAlt);
     //set the observer and target of the secondary viewer to be the same as main viewer if top-down view = false
     if (topDownView == false || globeCamera.OrientationMode == esriGlobeCameraOrientationMode.esriGlobeCameraOrientationGlobal)
     {
         viewerGlobeCamera.OrientationMode = globeCamera.OrientationMode;
         viewerGlobeCamera.SetObserverLatLonAlt(obsLat, obsLon, obsAlt);
         viewerGlobeCamera.SetTargetLatLonAlt(tarLat, tarLon, tarAlt);
     }
     //set the observer top down view for the secondary viewer
     else if (topDownView == true && globeCamera.OrientationMode == esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal)
     {
         viewerGlobeCamera.OrientationMode = esriGlobeCameraOrientationMode.esriGlobeCameraOrientationLocal;
         tarLat = obsLat + 0.0000001;
         tarLon = obsLon + 0.0000001;
         viewerGlobeCamera.SetTargetLatLonAlt(tarLat, tarLon, tarAlt);
     }
 }