コード例 #1
0
        public void DisplaySymbol()
        {
            IGraphicsLayer layer;

            if (this.axSceneControl1.SceneGraph.Scene.LayerCount == 0)
            {
                layer = new GraphicsLayer3DClass();
                this.axSceneControl1.SceneGraph.Scene.AddLayer(layer as ILayer, false);
            }
            else
            {
                layer = this.axSceneControl1.SceneGraph.Scene.get_Layer(0) as IGraphicsLayer;
            }
            IGraphicsContainer3D containerd = layer as IGraphicsContainer3D;

            containerd.DeleteAllElements();
            if (this.m_pCharacterMarker3DSymbol != null)
            {
                IPoint  point = new PointClass();
                IZAware aware = point as IZAware;
                aware.ZAware = true;
                point.X      = 0.0;
                point.Y      = 0.0;
                point.Z      = 0.0;
                IElement       element  = new MarkerElementClass();
                IMarkerElement element2 = element as IMarkerElement;
                element2.Symbol  = this.m_pCharacterMarker3DSymbol;
                element.Geometry = point;
                containerd.AddElement(element);
            }
            this.axSceneControl1.SceneGraph.RefreshViewers();
        }
コード例 #2
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
 public static void DeleteAllElementsByName(object object_0, string string_0)
 {
     if (object_0 is IScenePlugin)
     {
         IGraphicsContainer3D graphicsContainer3D = (object_0 as IScenePlugin).Scene.BasicGraphicsLayer as IGraphicsContainer3D;
         graphicsContainer3D.Reset();
         for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties))
         {
             if (elementProperties.Name.ToLower() == string_0.ToLower())
             {
                 graphicsContainer3D.DeleteElement(elementProperties as IElement);
                 graphicsContainer3D.Reset();
             }
         }
         if (graphicsContainer3D.ElementCount > 0)
         {
             if (string_0 == "")
             {
                 graphicsContainer3D.DeleteAllElements();
             }
             else
             {
                 graphicsContainer3D.Reset();
                 for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties))
                 {
                     if (elementProperties.Name.ToLower() == string_0.ToLower())
                     {
                         graphicsContainer3D.DeleteElement(elementProperties as IElement);
                         graphicsContainer3D.Reset();
                     }
                 }
             }
         }
     }
     else if (object_0 is IGraphicsContainer3D)
     {
         IGraphicsContainer3D graphicsContainer3D = object_0 as IGraphicsContainer3D;
         if (graphicsContainer3D.ElementCount > 0)
         {
             if (string_0 == "")
             {
                 graphicsContainer3D.DeleteAllElements();
             }
             else
             {
                 graphicsContainer3D.Reset();
                 for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties))
                 {
                     if (elementProperties.Name.ToLower() == string_0.ToLower())
                     {
                         graphicsContainer3D.DeleteElement(elementProperties as IElement);
                         graphicsContainer3D.Reset();
                     }
                 }
             }
         }
     }
 }
コード例 #3
0
        private void frm3DSpacedistance_FormClosing(object sender, FormClosingEventArgs e)
        {
            IGraphicsLayer       player = m_pCurrentSceneControl.Scene.BasicGraphicsLayer;
            IGraphicsContainer3D pgraphiccontainer3d = (IGraphicsContainer3D)player;

            pgraphiccontainer3d.DeleteAllElements();
            m_pCurrentSceneControl.SceneGraph.RefreshViewers();
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pgraphiccontainer3d);
            Dispose();
        }
コード例 #4
0
        private void frm3DLineOfSight_FormClosing(object sender, FormClosingEventArgs e)
        {
            //当窗口关闭时清除绘制的要素
            IGraphicsContainer3D pGCon3D = m_pCurrentSceneControl.Scene.BasicGraphicsLayer as IGraphicsContainer3D;

            pGCon3D.DeleteAllElements();
            m_pCurrentSceneControl.SceneGraph.RefreshViewers();
            System.Runtime.InteropServices.Marshal.ReleaseComObject(pGCon3D);
            m_pCurrentSceneControl.CurrentTool = null;//释放使用工具
            this.Dispose();
        }
コード例 #5
0
        public static void DrawMultiPatch(IGraphicsContainer3D multiPatchGraphicsContainer3D, IGeometry geometry)
        {
            const int Yellow_R = 255;
            const int Yellow_G = 255;
            const int Yellow_B = 0;

            IColor multiPatchColor = ColorUtilities.GetColor(Yellow_R, Yellow_G, Yellow_B);

            multiPatchGraphicsContainer3D.DeleteAllElements();

            GraphicsLayer3DUtilities.AddMultiPatchToGraphicsLayer3D(multiPatchGraphicsContainer3D, geometry, multiPatchColor);
        }
コード例 #6
0
        public static void DrawMultiPatch(IGraphicsContainer3D multiPatchGraphicsContainer3D, IGeometry geometry)
        {
            const int Yellow_R = 255;
            const int Yellow_G = 255;
            const int Yellow_B = 0;

            IColor multiPatchColor = ColorUtilities.GetColor(Yellow_R, Yellow_G, Yellow_B);

            multiPatchGraphicsContainer3D.DeleteAllElements();

            GraphicsLayer3DUtilities.AddMultiPatchToGraphicsLayer3D(multiPatchGraphicsContainer3D, geometry, multiPatchColor);
        }
コード例 #7
0
        public static void DrawOutline(IGraphicsContainer3D outlineGraphicsContainer3D, IGeometry geometry)
        {
            const esriSimple3DLineStyle OutlineStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double OutlineWidth = 0.1;

            const int Black_R = 0;
            const int Black_G = 0;
            const int Black_B = 0;

            IColor outlineColor = ColorUtilities.GetColor(Black_R, Black_G, Black_B);

            outlineGraphicsContainer3D.DeleteAllElements();

            GraphicsLayer3DUtilities.AddOutlineToGraphicsLayer3D(outlineGraphicsContainer3D, GeometryUtilities.ConstructMultiPatchOutline(geometry), outlineColor, OutlineStyle, OutlineWidth);
        }
コード例 #8
0
        public void DisplaySymbol()
        {
            IGraphicsLayer layer;

            if (this.axSceneControl1.SceneGraph.Scene.LayerCount == 0)
            {
                layer = new GraphicsLayer3DClass();
                this.axSceneControl1.SceneGraph.Scene.AddLayer(layer as ILayer, false);
            }
            else
            {
                layer = this.axSceneControl1.SceneGraph.Scene.get_Layer(0) as IGraphicsLayer;
            }
            IGraphicsContainer3D containerd = layer as IGraphicsContainer3D;

            containerd.DeleteAllElements();
            if (this.m_pSimpleLine3DSymbol != null)
            {
                IPoint           inPoint = new PointClass();
                IPointCollection points  = new PolylineClass();
                (points as IZAware).ZAware = true;
                IZAware aware = inPoint as IZAware;
                aware.ZAware = true;
                inPoint.X    = 0.0;
                inPoint.Y    = 0.0;
                inPoint.Z    = 0.0;
                object before = Missing.Value;
                points.AddPoint(inPoint, ref before, ref before);
                inPoint      = new PointClass();
                aware        = inPoint as IZAware;
                aware.ZAware = true;
                inPoint.X    = 1.0;
                inPoint.Y    = 0.0;
                inPoint.Z    = 0.0;
                points.AddPoint(inPoint, ref before, ref before);
                IElement     element  = new LineElementClass();
                ILineElement element2 = element as ILineElement;
                element2.Symbol  = this.m_pSimpleLine3DSymbol as ILineSymbol;
                element.Geometry = points as IGeometry;
                containerd.AddElement(element);
            }
            this.axSceneControl1.SceneGraph.RefreshViewers();
        }
コード例 #9
0
        public static void DrawOutline(IGraphicsContainer3D outlineGraphicsContainer3D, IGeometry geometry)
        {
            const esriSimple3DLineStyle OutlineStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double OutlineWidth = 0.1;

            const int Black_R = 0;
            const int Black_G = 0;
            const int Black_B = 0;

            IColor outlineColor = ColorUtilities.GetColor(Black_R, Black_G, Black_B);

            outlineGraphicsContainer3D.DeleteAllElements();

            GraphicsLayer3DUtilities.AddOutlineToGraphicsLayer3D(outlineGraphicsContainer3D, GeometryUtilities.ConstructMultiPatchOutline(geometry), outlineColor, OutlineStyle, OutlineWidth);
        }
コード例 #10
0
ファイル: FrmVertor.cs プロジェクト: eglrp/TESTPROJECT-1
        private void btn3D_Click(object sender, EventArgs e)
        {
            try
            {
                IGraphicsContainer3D graphicsContainer3D = pSceneControl.Scene.ActiveGraphicsLayer as IGraphicsContainer3D;
                graphicsContainer3D.DeleteAllElements();
                pSceneControl.Scene.SceneGraph.RefreshViewers();
                //屏幕大小
                double PageX    = pSceneControl.SceneGraph.Extent.Envelope.XMax;
                double PageY    = pSceneControl.SceneGraph.Extent.Envelope.YMax;
                double PageZ    = pSceneControl.SceneGraph.Extent.Envelope.ZMax;
                double PageXmin = pSceneControl.SceneGraph.Extent.Envelope.XMin;

                double pMarkerSize = (PageX - PageXmin) / 10;

                IMarkerElement pMarkerElement = new MarkerElementClass();
                //正北方向
                IMarker3DSymbol pMarker3DSymbolNorth = new Marker3DSymbolClass();
                string          NorthPath            = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\BMP\NorthArrow.3DS";
                pMarker3DSymbolNorth.CreateFromFile(NorthPath);
                IMarker3DPlacement pMarker3DPlacement = pMarker3DSymbolNorth as IMarker3DPlacement;

                pMarker3DPlacement.Size = pMarkerSize;
                pMarker3DPlacement.SetRotationAngles(-90, 0, 0);

                //IRgbColor pRgbColorNorth = new RgbColorClass();
                //pRgbColorNorth.Red = Color.Black.R;
                //pRgbColorNorth.Green = Color.Black.G;
                //pRgbColorNorth.Blue = Color.Black.B;
                pMarker3DPlacement.Color = ClsGDBDataCommon.ColorToIColor(Color.Black);

                //太阳方向
                IMarker3DSymbol pMarker3DSymbolSun = new Marker3DSymbolClass();
                string          SunPath            = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\BMP\SunArrow.3DS";
                pMarker3DSymbolSun.CreateFromFile(SunPath);
                IMarker3DPlacement pMarker3DPlacement1 = pMarker3DSymbolSun as IMarker3DPlacement;
                pMarker3DPlacement1.Size = pMarkerSize;
                double SunAngleX = SunIncli.Value - 90;
                double SunAngleY = 0;
                double SunAngleZ = 0 - SunAzimuth.Value;
                pMarker3DPlacement1.SetRotationAngles(SunAngleX, SunAngleY, SunAngleZ);

                //IRgbColor pRgbColorSun = new RgbColorClass();
                //pRgbColorSun.Red = Color.Red.R;
                //pRgbColorSun.Green = Color.Red.G;
                //pRgbColorSun.Blue = Color.Red.B;
                pMarker3DPlacement1.Color = ClsGDBDataCommon.ColorToIColor(Color.Red);

                //地球方向
                IMarker3DSymbol pMarker3DSymbolEarth = new Marker3DSymbolClass();
                string          EarthPath            = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\BMP\EarthArrow.3DS";
                pMarker3DSymbolEarth.CreateFromFile(EarthPath);
                IMarker3DPlacement pMarker3DPlacement2 = pMarker3DSymbolEarth as IMarker3DPlacement;
                pMarker3DPlacement2.Size = pMarkerSize;

                double EarthAngleX = EarIncli.Value - 90;
                double EarthAngleY = 0;
                double EarthAngleZ = 0 - EarAzimuth.Value;
                pMarker3DPlacement2.SetRotationAngles(EarthAngleX, EarthAngleY, EarthAngleZ);

                //IRgbColor pRgbColorEarth = new RgbColorClass();
                //pRgbColorEarth.Red = Color.BlueViolet.R;
                //pRgbColorEarth.Green = Color.BlueViolet.G;
                //pRgbColorEarth.Blue = Color.BlueViolet.B;
                pMarker3DPlacement2.Color = ClsGDBDataCommon.ColorToIColor(Color.BlueViolet);

                //合并成一个整体
                IMultiLayerMarkerSymbol pMultiLayerMarkerSymbol = new MultiLayerMarkerSymbolClass();
                pMultiLayerMarkerSymbol.AddLayer(pMarker3DSymbolNorth as IMarkerSymbol);
                pMultiLayerMarkerSymbol.AddLayer(pMarker3DSymbolSun as IMarkerSymbol);
                pMultiLayerMarkerSymbol.AddLayer(pMarker3DSymbolEarth as IMarkerSymbol);

                pMarkerElement.Symbol = pMultiLayerMarkerSymbol;
                IElement pElement = pMarkerElement as IElement;

                //确定添加位置
                IPoint pPoint = new PointClass();
                pPoint.X = PageX;
                pPoint.Y = PageY;
                pPoint.Z = PageZ + PageZ / 10;

                IZAware zAware = pPoint as IZAware;
                zAware.ZAware = true;
                IGeometry pointGeometry = pPoint as IGeometry;
                pointGeometry.SpatialReference = pSceneControl.Scene.SpatialReference;
                pElement.Geometry = pointGeometry;

                graphicsContainer3D.AddElement(pElement);
                pSceneControl.Scene.SceneGraph.RefreshViewers();
            }
            catch
            {
                MessageBox.Show(e.ToString());
            }

            this.Close();
        }