Пример #1
0
        private void axSceneControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.ISceneControlEvents_OnMouseDownEvent e)
        {
            IPoint pPoint    = null;
            object objOwner  = null;
            object objObject = null;

            axSceneControl1.SceneGraph.Locate(axSceneControl1.SceneViewer, e.x, e.y, esriScenePickMode.esriScenePickGeography, true, out pPoint, out objOwner, out objObject);


            ITextElement pTextElement = new TextElementClass();

            pTextElement.Text = "dddddd";

            IGraphicsContainer3D pGCon3D       = axSceneControl1.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
            IElement             pElement      = new MarkerElementClass();
            IMarkerElement       pPointElement = pElement as MarkerElementClass;
            ILineElement         pLineElement  = pElement as ILineElement;
            ISimpleLineSymbol    pLSymbol      = new SimpleLineSymbolClass();
            ISimpleMarkerSymbol  pMSym         = new SimpleMarkerSymbolClass();
            IColor    pFromColor = new RgbColorClass();
            IRgbColor pRgbColor  = pFromColor as IRgbColor;

            pRgbColor.Red        = 255;
            pRgbColor.Green      = 0;
            pRgbColor.Blue       = 0;
            pMSym.Size           = 10;
            pMSym.Color          = pFromColor;
            pMSym.Style          = esriSimpleMarkerStyle.esriSMSDiamond;
            pPointElement.Symbol = pMSym;
            pLSymbol.Style       = esriSimpleLineStyle.esriSLSSolid;
            pElement.Geometry    = pPoint;


            pGCon3D.AddElement(pElement as IElement);
            axSceneControl1.Scene.SceneGraph.RefreshViewers();
            IDisplay3D pIDisplay3D = axSceneControl1.Scene.SceneGraph as IDisplay3D;

            pIDisplay3D.FlashLocation(pPoint);
        }
Пример #2
0
 public static void FlashFeature(IBasicMap ibasicMap_0, IFeature ifeature_0)
 {
     if (ifeature_0 != null)
     {
         if (ibasicMap_0 is IGlobe)
         {
             IDisplay3D globeDisplay = (ibasicMap_0 as IGlobe).GlobeDisplay as IDisplay3D;
             IPoint     pointClass   = new ESRI.ArcGIS.Geometry.Point();
             IEnvelope  envelope     = ifeature_0.Shape.Envelope;
             pointClass.X = (envelope.XMin + envelope.XMax) / 2;
             pointClass.Y = (envelope.YMin + envelope.YMax) / 2;
             globeDisplay.FlashLocation(pointClass);
         }
         else if (ibasicMap_0 is IScene)
         {
             ((ibasicMap_0 as IScene).SceneGraph as IDisplay3D).AddFlashFeature(ifeature_0.Shape);
             ((ibasicMap_0 as IScene).SceneGraph as IDisplay3D).FlashFeatures();
         }
         else if (ibasicMap_0 is IActiveView)
         {
             Flash.FlashGeometry((ibasicMap_0 as IActiveView).ScreenDisplay, ifeature_0.Shape);
         }
     }
 }
Пример #3
0
        public override void OnMouseDown(int int_2, int int_3, int int_4, int int_5)
        {
            IPoint point;
            object obj;
            object obj2;

            this._plugin.SceneGraph.Locate(this._plugin.ActiveViewer, int_4, int_5, esriScenePickMode.esriScenePickGeography, true, out point, out obj, out obj2);
            if (point != null)
            {
                IClone clone  = point as IClone;
                IPoint point2 = clone.Clone() as IPoint;
                point2.Z /= this._plugin.SceneGraph.VerticalExaggeration;
                point2.SpatialReference = this._plugin.Scene.SpatialReference;
                IDisplay3D display3D = this._plugin.SceneGraph as IDisplay3D;
                display3D.FlashLocation(point2);
                if (this.ipointCollection_0 == null)
                {
                    this.ipointCollection_0 = new Polyline();
                    (this.ipointCollection_0 as IGeometry).SpatialReference = this._plugin.Scene.SpatialReference;
                }
                object value = Missing.Value;
                this.ipointCollection_0.AddPoint(point, ref value, ref value);
                IPolyline polyline = null;
                if (this.ipointCollection_0.PointCount == 2)
                {
                    clone    = (this.ipointCollection_0 as IClone);
                    polyline = (clone.Clone() as IPolyline);
                    this.ipointCollection_0 = null;
                }
                if (polyline != null)
                {
                    this.bool_0             = false;
                    this.ipointCollection_0 = null;
                    IPoint fromPoint = polyline.FromPoint;
                    fromPoint.Z = this.isurface_0.GetElevation(fromPoint);
                    IPoint toPoint = polyline.ToPoint;
                    toPoint.Z = this.isurface_0.GetElevation(toPoint);
                    if (!this.isurface_0.IsVoidZ(fromPoint.Z) && !this.isurface_0.IsVoidZ(toPoint.Z))
                    {
                        fromPoint.Z += ToolSceneLineOfSight.ObserverOffset;
                        toPoint.Z   += ToolSceneLineOfSight.TargetOffset;
                        object    obj3 = 1;
                        IPoint    point3;
                        IPolyline ipolyline_;
                        IPolyline ipolyline_2;
                        bool      flag;
                        this.isurface_0.GetLineOfSight(fromPoint, toPoint, out point3, out ipolyline_, out ipolyline_2, out flag, ToolSceneLineOfSight.bCurvEnabled, ToolSceneLineOfSight.bCurvEnabled, ref obj3);
                        ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();
                        IRgbColor         rgbColor         = new RgbColor();
                        simpleLineSymbol.Width = 2.0;
                        simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                        ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol();
                        IMultiPatch       multiPatch       = new MultiPatch() as IMultiPatch;
                        multiPatch.SpatialReference = this._plugin.Scene.SpatialReference;
                        IMultiPatch multiPatch2 = new MultiPatch() as IMultiPatch;
                        multiPatch2.SpatialReference = this._plugin.Scene.SpatialReference;
                        double num;
                        GeometryOperator.CreateVerticalLOSPatches(flag, fromPoint, toPoint, ipolyline_, ipolyline_2, multiPatch as IGeometryCollection, multiPatch2 as IGeometryCollection, out num);
                        if (!multiPatch.IsEmpty)
                        {
                            rgbColor.Green         = 255;
                            rgbColor.Red           = 0;
                            simpleFillSymbol.Color = rgbColor;
                            this.AddGraphic(this._plugin.Scene, multiPatch, simpleFillSymbol as ISymbol, false, false, "");
                        }
                        if (!multiPatch2.IsEmpty)
                        {
                            rgbColor.Green         = 0;
                            rgbColor.Red           = 255;
                            simpleFillSymbol.Color = rgbColor;
                            this.AddGraphic(this._plugin.Scene, multiPatch2, simpleFillSymbol as ISymbol, false, false, "");
                        }
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        /// 通过鼠标点击获取观察点与被观察点同时进行两点间通视分析
        /// </summary>
        /// <param name="Button"></param>
        /// <param name="Shift"></param>
        /// <param name="X"></param>
        /// <param name="Y"></param>
        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            if (m_frm3DLineOfSight.m_Layer == null || m_frm3DLineOfSight.m_Surface == null)
            {
                MessageBox.Show("请设置有效的表面数据", "提示!");
                return;
            }
            if (m_frm3DLineOfSight.txtObsOffset.Text == "" || m_frm3DLineOfSight.txtTarOffset.Text == "")
            {
                MessageBox.Show("观察点高度和被观察点高度不能为空", "提示!");
                return;
            }
            m_frm3DLineOfSight.TopMost = true;
            ISceneGraph pSceneGraph = m_sceneHookHelper.SceneGraph;

            m_pNewLineFeedback = new NewLineFeedbackClass();
            IPolyline       pPolyline        = m_pNewLineFeedback.Stop(); //用于判断是否已经获取两点
            ISceneControl   pSceneControl    = m_sceneHookHelper.Hook as ISceneControl;
            Cls3DModulsefun pCls3DModulsefun = new Cls3DModulsefun();     //用于绘制通视分析结果的方法
            object          pOwner;
            object          pObject;

            ESRI.ArcGIS.Geometry.IPoint pPoint = new ESRI.ArcGIS.Geometry.PointClass();
            pSceneGraph.Locate(pSceneGraph.ActiveViewer, X, Y, esriScenePickMode.esriScenePickGeography, true, out pPoint, out pOwner, out pObject);//获取鼠标点击的位置并转化为地理坐标
            if (pPoint == null)
            {
                return;
            }
            ESRI.ArcGIS.Geometry.IPoint pFlashPoint = new ESRI.ArcGIS.Geometry.PointClass();
            IClone pClone = pPoint as IClone;

            pFlashPoint   = pClone.Clone() as ESRI.ArcGIS.Geometry.IPoint;
            pFlashPoint.Z = pFlashPoint.Z / pSceneGraph.VerticalExaggeration;
            pFlashPoint.SpatialReference = pSceneGraph.Scene.SpatialReference;
            IDisplay3D pDisplay = pSceneGraph as IDisplay3D;

            pDisplay.FlashLocation(pFlashPoint);//闪烁显示被点击的位置
            IGeometry pGeometry = null;

            if (m_pScenePoints == null)
            {
                m_pScenePoints             = new PolylineClass();
                pGeometry                  = m_pScenePoints as IGeometry;
                pGeometry.SpatialReference = pSceneGraph.Scene.SpatialReference;
            }
            object before = Type.Missing;
            object after  = Type.Missing;

            m_pScenePoints.AddPoint(pPoint, ref before, ref after);//添加获取的点到点集合中
            if (m_pScenePoints.PointCount == 2)
            {
                pClone         = m_pScenePoints as IClone;
                pPolyline      = pClone.Clone() as  ESRI.ArcGIS.Geometry.IPolyline;//当点集合中点数达到两个时生成一条线用于判断观察点与被观察点是否确定
                m_pScenePoints = null;
            }
            if (pPolyline != null)
            {
                m_pScenePoints = null;
                ISurface pSurface = m_SurFace;
                ESRI.ArcGIS.Geometry.IPoint fPoint = pPolyline.FromPoint; //获取观察点
                fPoint.Z = pSurface.GetElevation(fPoint);                 //获取观察点的高程
                ESRI.ArcGIS.Geometry.IPoint tPoint = pPolyline.ToPoint;
                tPoint.Z = pSurface.GetElevation(tPoint);
                if (pSurface.IsVoidZ(fPoint.Z) || pSurface.IsVoidZ(tPoint.Z))
                {
                    return;
                }
                fPoint.Z = fPoint.Z + Convert.ToDouble(m_frm3DLineOfSight.txtObsOffset.Text);//观察者的高度加上观察者所在的高程才是观察点实际的高程
                tPoint.Z = tPoint.Z + Convert.ToDouble(m_frm3DLineOfSight.txtTarOffset.Text);
                ESRI.ArcGIS.Geometry.IPoint pObstruct;
                IPolyline pVisPolyline;
                IPolyline pInVisPolyline;
                bool      bIsVis;
                object    pRefractionFactor = Type.Missing;
                //进行两点间的通视分析
                pSurface.GetLineOfSight(fPoint, tPoint, out pObstruct, out pVisPolyline, out pInVisPolyline, out bIsVis, m_frm3DLineOfSight.checkBoxCurv.Checked, m_frm3DLineOfSight.checkBoxCurv.Checked, ref pRefractionFactor);

                ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
                pSimpleLineSymbol.Width = 2;
                pSimpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                //绘制可视与不可视的沿地表线要素
                if (pVisPolyline != null)
                {
                    pSimpleLineSymbol.Color = Cls3DMarkDraw.getRGB(0, 255, 0);
                    pCls3DModulsefun.AddGraphic(pSceneControl, pVisPolyline as IGeometry, pSimpleLineSymbol as ISymbol);
                }
                if (pInVisPolyline != null)
                {
                    pSimpleLineSymbol.Color = Cls3DMarkDraw.getRGB(255, 0, 0);
                    pCls3DModulsefun.AddGraphic(pSceneControl, pInVisPolyline as IGeometry, pSimpleLineSymbol as ISymbol);
                }
                IGeometryCollection pVisPatch = new MultiPatchClass();//用于存储可视域的要素
                pGeometry = pVisPatch as IGeometry;
                pGeometry.SpatialReference = pSceneGraph.Scene.SpatialReference;
                double              dTargetHeightForVis = 0;
                ISimpleFillSymbol   pSimpleFillSymbol   = new SimpleFillSymbolClass();
                IGeometryCollection pInVisPatch         = new MultiPatchClass();//存储不可视域的要素
                pGeometry = pInVisPatch as IGeometry;
                pGeometry.SpatialReference = pSceneGraph.Scene.SpatialReference;
                IGeometryCollection pPathGeo = pInVisPolyline as IGeometryCollection;
                if (pPathGeo != null)
                {
                    //下面的作用是将不可视域线每段path生成线要素进行绘制       张琪  20110623
                    for (int i = 0; i < pPathGeo.GeometryCount; i++)
                    {
                        IGeometryCollection pInPolyline = new PolylineClass();
                        IPath path = pPathGeo.get_Geometry(i) as IPath;
                        pInPolyline.AddGeometry(path as IGeometry, ref before, ref after);
                        pCls3DModulsefun.CreateVerticalLOSPatches(bIsVis, fPoint, tPoint, pVisPolyline, pInPolyline as IPolyline, pVisPatch, pInVisPatch, dTargetHeightForVis);
                    }
                }
                else//当不可视域为空时,直接分析生成可视域与不可视域
                {
                    pCls3DModulsefun.CreateVerticalLOSPatches(bIsVis, fPoint, tPoint, pVisPolyline, pInVisPolyline, pVisPatch, pInVisPatch, dTargetHeightForVis);
                }
                //
                // 对可视域与不可视域要素在场景中绘制出来
                if (pInVisPatch != null)
                {
                    pSimpleFillSymbol.Color = Cls3DMarkDraw.getRGB(255, 0, 0);
                    pCls3DModulsefun.AddGraphic(pSceneControl, pInVisPatch as IGeometry, pSimpleFillSymbol as ISymbol);
                }
                if (pVisPatch != null)
                {
                    pSimpleFillSymbol.Color = Cls3DMarkDraw.getRGB(0, 255, 0);
                    pCls3DModulsefun.AddGraphic(pSceneControl, pVisPatch as IGeometry, pSimpleFillSymbol as ISymbol);
                }
            }
        }
Пример #5
0
        public static void FlashLocation3D(ISceneGraph isceneGraph_0, IPoint ipoint_0)
        {
            IDisplay3D display3D = isceneGraph_0 as IDisplay3D;

            display3D.FlashLocation(ipoint_0);
        }