コード例 #1
0
ファイル: GISLocate.cs プロジェクト: ShengXiangXiong/GisSever
        /// <summary>
        /// 处理要素数据,触发事件
        /// </summary>
        /// <param name="pLayerName"></param>
        /// <param name="pFeature"></param>
        public void HandlerFeatureData(string pLayerName, IFeature pFeature)
        {
            //清空原有的图形选择
            IGraphicsContainer3D graphicsContainer3D = (IGraphicsContainer3D)GISMapApplication.Instance.Scene.BasicGraphicsLayer;

            if (element != null)
            {
                graphicsContainer3D.DeleteElement(element);
            }


            object info = FeatureIdentity.GetFeatureInfo(pLayerName, pFeature);

            //给小区地图赋上名称
            switch (pLayerName)
            {
            case LayerNames.GSM900Cell:
            case LayerNames.GSM1800Cell:
            {
                if (info is string)
                {
                    AddCellNameOnMap(info.ToString(), pFeature.Shape);
                }
                break;
            }
            }

            if (FeatureClick != null)
            {
                FeatureClick(this, new FeatureClickEventArgs(pLayerName, info));
            }
        }
コード例 #2
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();
        }
コード例 #3
0
        //----------------------------------干扰源定位中的绘制

        // 绘制线段
        public static void DrawLine(IPoint p1, IPoint p2, int r, int g, int b)
        {
            IPolyline line     = new PolylineClass();
            object    _missing = Type.Missing;

            line.FromPoint = p1;
            line.ToPoint   = p2;

            ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();

            lineSymbol.Color = ColorUtilities.GetColor(r, g, b);
            lineSymbol.Width = 0.25;

            ILineElement lineElement = new LineElementClass();

            lineElement.Symbol = lineSymbol;

            IElement element = lineElement as IElement;

            element.Geometry = line as IGeometry;

            IGraphicsLayer       pLayer = (GISMapApplication.Instance.Scene as IBasicMap).BasicGraphicsLayer;
            IGraphicsContainer3D pGC    = pLayer as IGraphicsContainer3D;

            pGC.AddElement(element);
        }
コード例 #4
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
        public static IGraphicsContainer3D Add3DGraphicsLayer(string string_0, ISceneGraph isceneGraph_0)
        {
            IGraphicsContainer3D result = null;
            IScene scene = isceneGraph_0.Scene;
            bool   flag  = false;

            if (scene.LayerCount > 0)
            {
                IEnumLayer enumLayer = scene.get_Layers(null, true);
                enumLayer.Reset();
                for (ILayer layer = enumLayer.Next(); layer != null; layer = enumLayer.Next())
                {
                    if (layer.Name == string_0 && layer is IGraphicsContainer3D)
                    {
                        result = (layer as IGraphicsContainer3D);
                        flag   = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                ILayer layer2 = new GraphicsLayer3D();
                layer2.Name = string_0;
                scene.AddLayer(layer2, true);
                result = (layer2 as IGraphicsContainer3D);
                Utils3D.RefreshApp(isceneGraph_0);
            }
            return(result);
        }
コード例 #5
0
 public IElement this[int i]
 {
     get
     {
         IGraphicsContainer3D graphicsContainer3D = _layer as IGraphicsContainer3D;
         return(graphicsContainer3D.get_Element(i));
     }
 }
コード例 #6
0
        /// <summary>
        /// 根据输入的要素在SceneControl中绘制元素     张琪   20110621
        /// </summary>
        /// <param name="pSceneControl"></param>
        /// <param name="pGeom">几何要素</param>
        /// <param name="pSym"></param>
        public void AddGraphic(ISceneControl pSceneControl, IGeometry pGeom, ISymbol pSym)
        {
            if (pGeom == null)
            {
                return;
            }
            IElement pElement = null;

            switch (pGeom.GeometryType.ToString())
            {
            case "esriGeometryPoint":    //点要素
                pElement = new MarkerElementClass();
                IMarkerElement pPointElement = pElement as IMarkerElement;
                if (pSym != null)
                {
                    IMarkerSymbol pMarker3DSymbol = pSym as IMarkerSymbol;
                    pPointElement.Symbol = pMarker3DSymbol as IMarkerSymbol;
                }
                break;

            case "esriGeometryPolyline":    //线要素
                pElement = new LineElementClass();
                ILineElement pLineElement = pElement as ILineElement;
                if (pSym != null)
                {
                    ILineSymbol pLineSymbol = pSym as ILineSymbol;
                    pLineElement.Symbol = pLineSymbol;
                }
                break;

            case "esriGeometryPolygon":    //面要素
                pElement = new PolygonElementClass();
                IFillShapeElement pFillElement = pElement as IFillShapeElement;
                if (pSym != null)
                {
                    IFillSymbol pFillSymbol = pSym as IFillSymbol;
                    pFillElement.Symbol = pFillSymbol;
                }
                break;

            case "esriGeometryMultiPatch":    //多面体要素
                pElement = new MultiPatchElementClass();
                IFillShapeElement pMultiPatchElement = pElement as IFillShapeElement;
                if (pSym != null)
                {
                    IFillSymbol pFillSymbol = pSym as IFillSymbol;
                    pMultiPatchElement.Symbol = pFillSymbol as IFillSymbol;
                }
                break;
            }
            pElement.Geometry = pGeom;
            IGraphicsContainer3D pGCon3D = pSceneControl.Scene.BasicGraphicsLayer as IGraphicsContainer3D;

            pGCon3D.AddElement(pElement);//在SceneControl中绘制要素
            IGraphicsSelection pGS = pGCon3D as IGraphicsSelection;

            pSceneControl.Scene.SceneGraph.RefreshViewers();
        }
コード例 #7
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();
                     }
                 }
             }
         }
     }
 }
        public static void AddOutlineToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometryCollection geometryCollection, IColor color, esriSimple3DLineStyle style, double width)
        {
            for (int i = 0; i < geometryCollection.GeometryCount; i++)
            {
                IGeometry geometry = geometryCollection.get_Geometry(i);

                graphicsContainer3D.AddElement(ElementUtilities.ConstructPolylineElement(geometry, color, style, width));
            }
        }
コード例 #9
0
        public static void AddOutlineToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometryCollection geometryCollection, IColor color, esriSimple3DLineStyle style, double width)
        {
            for (int i = 0; i < geometryCollection.GeometryCount; i++)
            {
                IGeometry geometry = geometryCollection.get_Geometry(i);

                graphicsContainer3D.AddElement(ElementUtilities.ConstructPolylineElement(geometry, color, style, width));
            }
        }
コード例 #10
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
 public static void RemoveGroupElement(IGroupElement igroupElement_0, ISceneGraph isceneGraph_0)
 {
     if (igroupElement_0.ElementCount > 0)
     {
         igroupElement_0.ClearElements();
         IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
         graphicsContainer3D.DeleteElement(igroupElement_0 as IElement);
     }
 }
コード例 #11
0
        public static void DisableLighting(IGraphicsContainer3D graphicsContainer3D)
        {
            I3DProperties properties3D = new Basic3DPropertiesClass();
            properties3D.Illuminate = false;

            ILayerExtensions layerExtensions = graphicsContainer3D as ILayerExtensions;
            layerExtensions.AddExtension(properties3D);

            properties3D.Apply3DProperties(graphicsContainer3D);
        }
コード例 #12
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();
        }
コード例 #13
0
        public static void DrawLine(IGraphicsContainer3D lineGraphicsContainer3D, IPointCollection linePointCollection)
        {
            const esriSimple3DLineStyle lineStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double lineWidth = 0.25;
            IColor       lineColor = ColorUtilities.GetColor(255, 0, 0);

            GeometryUtilities.MakeZAware(linePointCollection as IGeometry);

            GraphicsLayer3DUtilities.AddLineToGraphicsLayer3D(lineGraphicsContainer3D, linePointCollection as IGeometry, lineColor, lineStyle, lineWidth);
        }
コード例 #14
0
        public static void DrawLine(IGraphicsContainer3D lineGraphicsContainer3D, List <IPoint> listPoints)
        {
            IPointCollection linePointColl = new PolylineClass();

            foreach (var point in listPoints)
            {
                linePointColl.AddPoint(point, ref _missing, ref _missing);
            }
            DrawUtilities.DrawLine(lineGraphicsContainer3D, linePointColl);
        }
コード例 #15
0
        public static void DrawPoint(IGraphicsContainer3D lineGraphicsContainer3D, IPoint point, IColor color, double size)
        {
            const esriSimple3DMarkerStyle markerStyle = esriSimple3DMarkerStyle.esriS3DMSCube;

            //const double size = 20;
            //IColor markerColor = ColorUtilities.GetColor(0, 255, 0);
            GeometryUtilities.MakeZAware(point as IGeometry);

            GraphicsLayer3DUtilities.AddPointToGraphicsLayer3D(lineGraphicsContainer3D, point as IGeometry, color, markerStyle, size);
        }
コード例 #16
0
        /// <summary>
        /// 删除所有名称为name 的 element
        /// </summary>
        public static void DeleteElement(IGraphicsContainer3D pGC, string name)
        {
            IElement pElement = null;

            pElement = GetElementByName(pGC, name);
            while (pElement != null)
            {
                pGC.DeleteElement(pElement);
                pElement = GetElementByName(pGC, name);
            }
        }
コード例 #17
0
        private static void DrawAxis(IGraphicsContainer3D axesGraphicsContainer3D, IPoint axisFromPoint, IPoint axisToPoint, IColor axisColor, esriSimple3DLineStyle axisStyle, double axisWidth)
        {
            IPointCollection axisPointCollection = new PolylineClass();

            axisPointCollection.AddPoint(axisFromPoint, ref _missing, ref _missing);
            axisPointCollection.AddPoint(axisToPoint, ref _missing, ref _missing);

            GeometryUtilities.MakeZAware(axisPointCollection as IGeometry);

            GraphicsLayer3DUtilities.AddAxisToGraphicsLayer3D(axesGraphicsContainer3D, axisPointCollection as IGeometry, axisColor, axisStyle, axisWidth);
        }
コード例 #18
0
        private static void DrawAxis(IGraphicsContainer3D axesGraphicsContainer3D, IPoint axisFromPoint, IPoint axisToPoint, IColor axisColor, esriSimple3DLineStyle axisStyle, double axisWidth)
        {
            IPointCollection axisPointCollection = new PolylineClass();

            axisPointCollection.AddPoint(axisFromPoint, ref _missing, ref _missing);
            axisPointCollection.AddPoint(axisToPoint, ref _missing, ref _missing);

            GeometryUtilities.MakeZAware(axisPointCollection as IGeometry);

            GraphicsLayer3DUtilities.AddAxisToGraphicsLayer3D(axesGraphicsContainer3D, axisPointCollection as IGeometry, axisColor, axisStyle, axisWidth);
        }
コード例 #19
0
ファイル: BuildingProperty.cs プロジェクト: secondii/Yutai
 private static void old_acctor_mc()
 {
     BuildingProperty.m_pBuildingHieght = "30";
     BuildingProperty.m_pTextureGroup   = null;
     BuildingProperty.m_CreateNewLayer  = true;
     BuildingProperty.m_pScene          = null;
     BuildingProperty.m_pTargetLayer    = null;
     BuildingProperty.m_groups          = null;
     BuildingProperty.m_pLayers         = new List <IGraphicsContainer3D>();
     BuildingProperty.m_ElemntMap       = new Dictionary <int, List <IElement> >();
 }
コード例 #20
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();
        }
コード例 #21
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);
        }
コード例 #22
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);
        }
コード例 #23
0
        public static void DisableLighting(IGraphicsContainer3D graphicsContainer3D)
        {
            I3DProperties properties3D = new Basic3DPropertiesClass();

            properties3D.Illuminate = false;

            ILayerExtensions layerExtensions = graphicsContainer3D as ILayerExtensions;

            layerExtensions.AddExtension(properties3D);

            properties3D.Apply3DProperties(graphicsContainer3D);
        }
コード例 #24
0
        public static void DrawAxes(IGraphicsContainer3D axesGraphicsContainer3D)
        {
            const esriSimple3DLineStyle AxisStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double AxisWidth = 0.25;

            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(-10, 0, 0), GeometryUtilities.ConstructPoint3D(10, 0, 0), ColorUtilities.GetColor(255, 0, 0), AxisStyle, AxisWidth);
            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, -10, 0), GeometryUtilities.ConstructPoint3D(0, 10, 0), ColorUtilities.GetColor(0, 0, 255), AxisStyle, AxisWidth);
            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 0, -10), GeometryUtilities.ConstructPoint3D(0, 0, 10), ColorUtilities.GetColor(0, 255, 0), AxisStyle, AxisWidth);

            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(10, 0, 0), GeometryUtilities.ConstructVector3D(0, 10, 0), 90, ColorUtilities.GetColor(255, 0, 0), 0.2 * AxisWidth);
            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 10, 0), GeometryUtilities.ConstructVector3D(10, 0, 0), -90, ColorUtilities.GetColor(0, 0, 255), 0.2 * AxisWidth);
            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 0, 10), null, 0, ColorUtilities.GetColor(0, 255, 0), 0.2 * AxisWidth);
        }
コード例 #25
0
        public static void DrawAxes(IGraphicsContainer3D axesGraphicsContainer3D)
        {
            const esriSimple3DLineStyle AxisStyle = esriSimple3DLineStyle.esriS3DLSTube;
            const double AxisWidth = 0.25;

            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(-10, 0, 0), GeometryUtilities.ConstructPoint3D(10, 0, 0), ColorUtilities.GetColor(255, 0, 0), AxisStyle, AxisWidth);
            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, -10, 0), GeometryUtilities.ConstructPoint3D(0, 10, 0), ColorUtilities.GetColor(0, 0, 255), AxisStyle, AxisWidth);
            DrawAxis(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 0, -10), GeometryUtilities.ConstructPoint3D(0, 0, 10), ColorUtilities.GetColor(0, 255, 0), AxisStyle, AxisWidth);

            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(10, 0, 0), GeometryUtilities.ConstructVector3D(0, 10, 0), 90, ColorUtilities.GetColor(255, 0, 0), 0.2 * AxisWidth);
            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 10, 0), GeometryUtilities.ConstructVector3D(10, 0, 0), -90, ColorUtilities.GetColor(0, 0, 255), 0.2 * AxisWidth);
            DrawEnd(axesGraphicsContainer3D, GeometryUtilities.ConstructPoint3D(0, 0, 10), null, 0, ColorUtilities.GetColor(0, 255, 0), 0.2 * AxisWidth);
        }
コード例 #26
0
ファイル: modFacades.cs プロジェクト: secondii/Yutai
 public static void AddGroupElementsToBasicGraphicsLayer(List <IElement> list_0)
 {
     try
     {
         IGraphicsContainer3D graphicsContainer3D = null;
         for (int i = 0; i < list_0.Count; i++)
         {
             IGroupElement groupElement = list_0[i] as IGroupElement;
             graphicsContainer3D.AddElement(groupElement as IElement);
         }
     }
     catch
     {
     }
 }
コード例 #27
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);
        }
コード例 #28
0
ファイル: modFacades.cs プロジェクト: secondii/Yutai
 public static void AddGroupElements(IGraphicsContainer3D igraphicsContainer3D_0, List <IElement> list_0)
 {
     try
     {
         int graphicsLayerIndex = BuildingProperty.GetGraphicsLayerIndex(igraphicsContainer3D_0);
         for (int i = 0; i < list_0.Count; i++)
         {
             IGroupElement groupElement = list_0[i] as IGroupElement;
             igraphicsContainer3D_0.AddElement(groupElement as IElement);
             BuildingProperty.AddElement(graphicsLayerIndex, groupElement as IElement);
         }
     }
     catch
     {
     }
 }
コード例 #29
0
        private void Initialize()
        {
            _axesGraphicsContainer3D = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D("Axes");
            _multiPatchGraphicsContainer3D = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D("MultiPatch");
            _outlineGraphicsContainer3D = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D("Outline");

            GraphicsLayer3DUtilities.DisableLighting(_multiPatchGraphicsContainer3D);

            axSceneControl.Scene.AddLayer(_axesGraphicsContainer3D as ILayer, true);
            axSceneControl.Scene.AddLayer(_multiPatchGraphicsContainer3D as ILayer, true);
            axSceneControl.Scene.AddLayer(_outlineGraphicsContainer3D as ILayer, true);

            DrawUtilities.DrawAxes(_axesGraphicsContainer3D);

            axSceneControl.SceneGraph.RefreshViewers();
        }
コード例 #30
0
ファイル: BuildingProperty.cs プロジェクト: secondii/Yutai
        public static int GetGraphicsLayerIndex(IGraphicsContainer3D igraphicsContainer3D_0)
        {
            int result;

            for (int i = 0; i < BuildingProperty.m_pLayers.Count; i++)
            {
                if (BuildingProperty.m_pLayers[i] == igraphicsContainer3D_0)
                {
                    result = i;
                    return(result);
                }
            }
            BuildingProperty.m_pLayers.Add(igraphicsContainer3D_0);
            result = BuildingProperty.m_pLayers.Count - 1;
            return(result);
        }
コード例 #31
0
        /// <summary>
        /// 删除名称包含在names中的所有element
        /// </summary>
        public static void DeleteElement(IGraphicsContainer3D pGC, string[] names)
        {
            string name;

            for (int i = 0; i < names.Length; i++)
            {
                name = names[i];
                IElement pElement = null;
                pElement = GetElementByName(pGC, name);
                while (pElement != null)
                {
                    pGC.DeleteElement(pElement);
                    pElement = GetElementByName(pGC, name);
                }
            }
        }
コード例 #32
0
        private void Initialize()
        {
            _axesGraphicsContainer3D       = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D("Axes");
            _multiPatchGraphicsContainer3D = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D("MultiPatch");
            _outlineGraphicsContainer3D    = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D("Outline");

            GraphicsLayer3DUtilities.DisableLighting(_multiPatchGraphicsContainer3D);

            axSceneControl.Scene.AddLayer(_axesGraphicsContainer3D as ILayer, true);
            axSceneControl.Scene.AddLayer(_multiPatchGraphicsContainer3D as ILayer, true);
            axSceneControl.Scene.AddLayer(_outlineGraphicsContainer3D as ILayer, true);

            DrawUtilities.DrawAxes(_axesGraphicsContainer3D);

            axSceneControl.SceneGraph.RefreshViewers();
        }
コード例 #33
0
        /// <summary>
        /// 在地图上绘制指定颜色的文字
        /// </summary>
        /// <param name="scene"></param>
        /// <param name="geometry"></param>
        /// <param name="OffsetZs"></param>
        /// <param name="rgbColor"></param>
        /// <param name="text"></param>
        /// <param name="fontSize"></param>
        /// <returns></returns>
        internal static IElement AddTextGraphicToScene(IScene scene, ESRI.ArcGIS.Geometry.IGeometry geometry, double OffsetZs, ESRI.ArcGIS.Display.IRgbColor rgbColor, string text, int fontSize)
        {
            IGraphicsContainer3D graphicsContainer3D = (IGraphicsContainer3D)scene.BasicGraphicsLayer;

            IText3DElement    pTextElement      = new Text3DElementClass();
            IFillShapeElement pFillShapeElement = new Text3DElementClass();

            pTextElement.Text = text;


            IFillSymbol pFillSymbol = new SimpleFillSymbol();

            pFillSymbol.Color = rgbColor;//填充的颜色

            IPoint point;

            try
            {
                IArea3D Area3D = (IArea3D)geometry;

                point = Area3D.Centroid3D;
            }
            catch
            {
                point = (IPoint)geometry;
                GeometryUtilities.MakeZAware(point);
            }
            point.Z = point.Z + OffsetZs;
            pTextElement.AnchorPoint      = point;                                     //添加文本的坐标点
            pTextElement.Justification    = esriT3DJustification.esriT3DJustifyCenter; //注记排放方式
            pTextElement.OrientationPlane = esriT3DOrientationPlane.esriT3DPlaneXY;    //注记的旋转平面
            pTextElement.AxisRotation     = esriT3DRotationAxis.esriT3DRotateAxisZ;    //注记旋转轴
            //pTextElement.RotationAngle=....;//注记的旋转角度

            pTextElement.ZAxisScale = 1;
            pTextElement.Depth      = 0.6;      //文本的深度
            pTextElement.Height     = fontSize; //文本的高度,即文字大小
            pTextElement.Update();
            pFillShapeElement        = (IFillShapeElement)pTextElement;
            pFillShapeElement.Symbol = pFillSymbol;

            graphicsContainer3D.AddElement(pTextElement as IElement);
            return(pTextElement as IElement);
        }
コード例 #34
0
        /// <summary>
        /// 找指定名称的Element
        /// </summary>
        /// <param name="pGC"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static IElement GetElementByName(IGraphicsContainer3D pGC, string name)
        {
            IElement           result     = null;
            IElement           pElement   = null;
            IElementProperties pElemProps = null;

            pGC.Reset();
            pElement = pGC.Next();
            while (pElement != null)
            {
                pElemProps = (IElementProperties)pElement;
                if (pElemProps.Name == name)
                {
                    result = pElement;
                }
                pElement = pGC.Next();
            }
            return(result);
        }
コード例 #35
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();
        }
コード例 #36
0
        /// <summary>
        /// 获取指定名称的图层
        /// </summary>
        /// <param name="layerName"></param>
        /// <returns></returns>
        public ILayer GetLayer(string layerName)
        {
            ILayer layer = null;

            if (this.m_sceneControl != null)
            {
                int n = this.m_sceneControl.Scene.LayerCount;
                for (int i = 0; i < this.m_sceneControl.Scene.LayerCount; i++)
                {
                    layer = this.SceneControl.Scene.get_Layer(i);
                    if (layer is IGroupLayer)
                    {
                        ICompositeLayer pGroupLayer = layer as ICompositeLayer;

                        IFeatureLayer pFeatLayer = null;
                        for (int j = 0; j < pGroupLayer.Count; j++)
                        {
                            if (pGroupLayer.get_Layer(j) is IFeatureLayer)
                            {
                                pFeatLayer = pGroupLayer.get_Layer(j) as IFeatureLayer;

                                if (pFeatLayer.Name.ToUpper() == layerName.ToUpper())
                                {
                                    return(pFeatLayer);
                                }
                            }
                        }
                    }
                    else if (layer.Name.ToUpper() == layerName.ToUpper())
                    {
                        return(layer);
                    }
                }
                if (layerName == LayerNames.Rays)
                {
                    IGraphicsContainer3D raysGraphicsContainer3D = GraphicsLayer3DUtilities.ConstructGraphicsLayer3D(LayerNames.Rays);
                    AddLayer(raysGraphicsContainer3D as ILayer);
                    return(raysGraphicsContainer3D as ILayer);
                }
            }
            return(null);
        }
コード例 #37
0
ファイル: ShowInfoOnMap.cs プロジェクト: BNU-Chen/3DGlobe
        public void ShowCoordinatesOnMap(AxGlobeControl axGlobeControl)
        {
            try
            {
                ITextSymbol pTextSymbol = new TextSymbolClass();
                //pTextSymbol.Font = new Font("Consolas", 10, FontStyle.Regular);    //设置字体
                pTextSymbol.Size = 12;          //字体大小
                pTextSymbol.Color = BaseGISTools.TransColorToAEColor(Color.White);    //字体颜色

                myTextElement = new TextElementClass(); ;
                myTextElement.Symbol = pTextSymbol; //设置样式
                myTextElement.Text = "这是现实的信息 \n 这是第二行 \n 这是第三行";

                graphicsLayer = axGlobeControl.GlobeDisplay.Scene.BasicGraphicsLayer;
                graphicsContain3D = (IGraphicsContainer3D)graphicsLayer;
                graphicsContain3D.AddElement(myTextElement as IElement);
                axGlobeControl.GlobeDisplay.RefreshViewers();
            }
            catch { }
        }
コード例 #38
0
        private static void DrawEnd(IGraphicsContainer3D endGraphicsContainer3D, IPoint endPoint, IVector3D axisOfRotationVector3D, double degreesOfRotation, IColor endColor, double endRadius)
        {
            IGeometry endGeometry = Vector3DExamples.GetExample2();

            ITransform3D transform3D = endGeometry as ITransform3D;

            IPoint originPoint = GeometryUtilities.ConstructPoint3D(0, 0, 0);

            transform3D.Scale3D(originPoint, endRadius, endRadius, 2 * endRadius);

            if (degreesOfRotation != 0)
            {
                double angleOfRotationInRadians = GeometryUtilities.GetRadians(degreesOfRotation);

                transform3D.RotateVector3D(axisOfRotationVector3D, angleOfRotationInRadians);
            }

            transform3D.Move3D(endPoint.X - originPoint.X, endPoint.Y - originPoint.Y, endPoint.Z - originPoint.Z);

            GraphicsLayer3DUtilities.AddMultiPatchToGraphicsLayer3D(endGraphicsContainer3D, endGeometry, endColor);
        }
コード例 #39
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);
        }
コード例 #40
0
 public static void AddAxisToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color, esriSimple3DLineStyle style, double width)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructPolylineElement(geometry, color, style, width));
 }
コード例 #41
0
 public static void AddMultiPatchToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructMultiPatchElement(geometry, color));
 }