예제 #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
        //----------------------------------干扰源定位中的绘制

        // 绘制线段
        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);
        }
예제 #3
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();
        }
        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));
            }
        }
예제 #5
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));
            }
        }
예제 #6
0
 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
     {
     }
 }
예제 #7
0
 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
     {
     }
 }
예제 #8
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);
        }
예제 #9
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();
        }
예제 #10
0
        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 { }
        }
예제 #11
0
        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 { }
        }
예제 #12
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);
        }
예제 #13
0
        public static void drawSector(LTE.Geometric.Point p, double fromAngle, double toAngle, double radius)
        {
            IPoint centralPoint = GeometryUtilities.ConstructPoint2D(p.X, p.Y);

            double arithmeticToAngle = GeometricUtilities.GetRadians(GeometricUtilities.ConvertGeometricArithmeticAngle(toAngle));

            double angle = (toAngle - fromAngle) % 360;
            bool   isCCW = true;

            if (angle > 180)
            {
                angle = 360 - angle;
                isCCW = false;
            }
            if (angle == 0)
            {
                angle = 360;
            }
            double arcDistance = radius * GeometricUtilities.GetRadians(angle);

            IPoint       fromPoint   = GeometryUtilities.ConstructPoint_AngleDistance(centralPoint, arithmeticToAngle, radius);
            ICircularArc circularArc = GeometryUtilities.ConstructCircularArc(centralPoint, fromPoint, isCCW, arcDistance);
            IPoint       toPoint     = circularArc.ToPoint;

            ISegment fromSegment = GeometryUtilities.ConstructLine(centralPoint, fromPoint) as ISegment;
            ISegment toSegment   = GeometryUtilities.ConstructLine(toPoint, centralPoint) as ISegment;

            ISegment[]          segmentArray = new ISegment[] { fromSegment, circularArc as ISegment, toSegment };
            IGeometryCollection polygon      = GeometryUtilities.ConstructPolygon(segmentArray);

            //画扇形
            IGraphicsContainer3D graphicsContainer3D = GISMapApplication.Instance.GetLayer(LayerNames.Rays) as IGraphicsContainer3D;
            IPolygonElement      polygonElement      = new PolygonElementClass();
            IElement             element             = polygonElement as IElement;

            element.Geometry = polygon as IGeometry;
            graphicsContainer3D.AddElement(element);
        }
예제 #14
0
        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();
        }
예제 #15
0
파일: Utils3D.cs 프로젝트: secondii/Yutai
        public static void AddGroupElement(IGroupElement igroupElement_0, ISceneGraph isceneGraph_0)
        {
            IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D;

            graphicsContainer3D.AddElement(igroupElement_0 as IElement);
        }
예제 #16
0
        ///<summary>在地图上绘制指定颜色的图形</summary>
        ///<param name="scene">地图</param>
        ///<param name="geometry">feature 的shape</param>
        ///<param name="rgbColor">颜色</param>
        ///<param name="outlineRgbColor">边框颜色</param>
        ///<param name="OffsetZs">Z偏值</param>
        ///
        ///<remarks>Calling this function will not automatically make the graphics appear in the map area. Refresh the map area after after calling this function with Methods like IActiveView.Refresh or IActiveView.PartialRefresh.</remarks>
        internal static IElement AddGraphicToScene(IScene scene, ESRI.ArcGIS.Geometry.IGeometry geometry, ESRI.ArcGIS.Display.IRgbColor rgbColor, ESRI.ArcGIS.Display.IRgbColor outlineRgbColor, double OffsetZs)
        {
            //ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = (ESRI.ArcGIS.Carto.IGraphicsContainer)map; //IGraphicsContainer接口能删除
            IGraphicsContainer3D graphicsContainer3D = (IGraphicsContainer3D)scene.BasicGraphicsLayer;

            ESRI.ArcGIS.Carto.IElement element = null;
            if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint)
            {
                IPoint point = (Point)geometry;

                try
                {
                    double X = point.X;
                    double Y = point.Y;
                }
                catch
                {
                    return(null);
                }
                point = GeometryUtilities.ConstructPoint3D(point, OffsetZs);
                // Marker symbols
                ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
                simpleMarkerSymbol.Color        = rgbColor;
                simpleMarkerSymbol.Outline      = true;
                simpleMarkerSymbol.OutlineColor = rgbColor;
                simpleMarkerSymbol.Size         = 12;
                simpleMarkerSymbol.Style        = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;

                ESRI.ArcGIS.Carto.IMarkerElement markerElement = new ESRI.ArcGIS.Carto.MarkerElementClass();
                markerElement.Symbol = simpleMarkerSymbol;
                element = (ESRI.ArcGIS.Carto.IElement)markerElement; // Explicit Cast

                if (!(element == null))
                {
                    element.Geometry = point;

                    graphicsContainer3D.AddElement(element);
                }
            }
            else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline)
            {
                // Marker symbols
                ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
                simpleLineSymbol.Color = rgbColor;
                simpleLineSymbol.Style = ESRI.ArcGIS.Display.esriSimpleLineStyle.esriSLSSolid;
                simpleLineSymbol.Width = 1;

                ESRI.ArcGIS.Carto.ILineElement lineElement = new ESRI.ArcGIS.Carto.LineElementClass();
                lineElement.Symbol = simpleLineSymbol;
                element            = (ESRI.ArcGIS.Carto.IElement)lineElement; // Explicit Cast

                if (!(element == null))
                {
                    element.Geometry = geometry;
                    graphicsContainer3D.AddElement(element);
                }
            }
            else if ((geometry.GeometryType) == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon)
            {
                IZ iz = (IZ)geometry;
                iz.OffsetZs(OffsetZs);//z值向上偏移

                // Polygon elements
                ESRI.ArcGIS.Display.ISimpleFillSymbol simpleFillSymbol = new ESRI.ArcGIS.Display.SimpleFillSymbolClass();
                simpleFillSymbol.Color = rgbColor;
                simpleFillSymbol.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSForwardDiagonal;
                ESRI.ArcGIS.Carto.IFillShapeElement fillShapeElement = new ESRI.ArcGIS.Carto.PolygonElementClass();
                fillShapeElement.Symbol = simpleFillSymbol;
                element = (ESRI.ArcGIS.Carto.IElement)fillShapeElement; // Explicit Cast

                if (!(element == null))
                {
                    element.Geometry = geometry;
                    graphicsContainer3D.AddElement(element);
                }
            }



            return(element);
        }
예제 #17
0
 public static void AddMultiPatchToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructMultiPatchElement(geometry, color));
 }
예제 #18
0
 public static void AddPointToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color, esriSimple3DMarkerStyle style, double size)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructPointElement(geometry, color, style, size));
 }
예제 #19
0
 public static void AddLineToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color, esriSimple3DLineStyle style, double width)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructPolylineElement(geometry, color, style, width));
 }
 public static void AddAxisToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color, esriSimple3DLineStyle style, double width)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructPolylineElement(geometry, color, style, width));
 }
 public static void AddMultiPatchToGraphicsLayer3D(IGraphicsContainer3D graphicsContainer3D, IGeometry geometry, IColor color)
 {
     graphicsContainer3D.AddElement(ElementUtilities.ConstructMultiPatchElement(geometry, color));
 }
예제 #22
0
        /// <summary>
        /// 绘制三维对象 张琪  20110628
        /// </summary>
        /// <param name="pGeometry">三维对象</param>
        /// <param name="pColor">颜色</param>
        /// <param name="lSize">绘制的大小</param>
        /// <param name="sName">名称</param>
        /// <param name="pScene"></param>
        /// <param name="pGroup"></param>
        public static void AddSimpleGraphic(IGeometry pGeometry, IRgbColor pColor, int lSize, string sName, IScene pScene, IGroupElement pGroup)
        {
            if (pGeometry == null)
            {
                return;
            }
            IElement pElement = null;

            //ISymbol pSym;
            //根据绘制的对象类型对IElement进行不同的定义
            switch (pGeometry.GeometryType.ToString())
            {
            case "esriGeometryPoint":
                pElement = new MarkerElementClass();
                IMarkerElement      pPointElement = pElement as IMarkerElement;
                ISimpleMarkerSymbol pMSym         = new SimpleMarkerSymbolClass();
                pMSym.Color = pColor;
                pMSym.Size  = lSize;
                pMSym.Style = esriSimpleMarkerStyle.esriSMSCircle;
                IMarkerSymbol pMarkerSymbol = pMSym as IMarkerSymbol;
                pPointElement.Symbol = pMarkerSymbol;
                break;

            case "esriGeometryPolyline":
                pElement = new LineElementClass();
                ILineElement      pLineElement = pElement as ILineElement;
                ISimpleLineSymbol pLSym        = new SimpleLineSymbolClass();
                pLSym.Width = lSize;
                pLSym.Style = esriSimpleLineStyle.esriSLSSolid;
                pLSym.Color = pColor;
                ILineSymbol pLineSymbol = pLSym as ILineSymbol;
                pLineElement.Symbol = pLineSymbol;
                break;

            case "esriGeometryPolygon":
                ISimpleLineSymbol pOutlineSym = new SimpleLineSymbolClass();
                pOutlineSym.Color = pColor;
                pOutlineSym.Width = lSize;
                pOutlineSym.Style = esriSimpleLineStyle.esriSLSSolid;
                if (sName == "_ReferancePlane_")
                {
                    pColor.Transparency = Convert.ToByte(Convert.ToInt32(255 / 2));
                }
                pElement = new PolygonElementClass();
                IFillShapeElement pPolygonElement = pElement as IFillShapeElement;
                IFillSymbol       pFSym           = new SimpleFillSymbolClass();
                pFSym.Color = pColor;
                ILineSymbol pLineSymbol1 = pOutlineSym as ILineSymbol;
                pFSym.Outline          = pLineSymbol1;
                pPolygonElement.Symbol = pFSym;
                break;

            case "esriGeometryMultiPatch":
                pElement = new MultiPatchElementClass();
                IFillShapeElement pFElement = pElement as IFillShapeElement;
                IFillSymbol       pFSymbol  = pFElement.Symbol;
                if (sName == "_ReferancePlane_")
                {
                    pColor.Transparency = Convert.ToByte(Convert.ToInt32(255 / 2));
                }
                pFSymbol.Color   = pColor;
                pFElement.Symbol = pFSymbol;
                break;

            default:
                break;
            }
            pElement.Geometry = pGeometry;
            IElementProperties pElemProps = pElement as IElementProperties;

            pElemProps.Name = sName;
            if (pGroup == null)
            {
                IGraphicsContainer3D pGCon3D = pScene.BasicGraphicsLayer as IGraphicsContainer3D;
                pGCon3D.AddElement(pElement);
            }
            else
            {
                pGroup.AddElement(pElement);
            }
        }
예제 #23
0
파일: Utils3D.cs 프로젝트: secondii/Yutai
        public static IElement AddSimpleGraphic(IGeometry igeometry_0, IRgbColor irgbColor_0, int int_0, string string_0, object object_0)
        {
            IElement element = null;
            IElement result;

            if (igeometry_0.IsEmpty)
            {
                result = null;
            }
            else
            {
                esriGeometryType geometryType = igeometry_0.GeometryType;
                IElement         element2;
                switch (geometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                {
                    element2 = new MarkerElement();
                    IMarkerElement markerElement = element2 as IMarkerElement;
                    markerElement.Symbol = new SimpleMarkerSymbol
                    {
                        Color = irgbColor_0,
                        Size  = (double)int_0,
                        Style = esriSimpleMarkerStyle.esriSMSCircle
                    };
                    goto IL_132;
                }

                case esriGeometryType.esriGeometryMultipoint:
                    break;

                case esriGeometryType.esriGeometryPolyline:
                {
                    element2 = new LineElement();
                    ILineElement lineElement = element2 as ILineElement;
                    lineElement.Symbol = new SimpleLineSymbol
                    {
                        Width = (double)int_0,
                        Color = irgbColor_0,
                        Style = esriSimpleLineStyle.esriSLSSolid
                    };
                    goto IL_132;
                }

                case esriGeometryType.esriGeometryPolygon:
                {
                    ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();
                    simpleLineSymbol.Width = (double)int_0;
                    simpleLineSymbol.Color = irgbColor_0;
                    simpleLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
                    element2 = new PolygonElement();
                    IFillShapeElement fillShapeElement = element2 as IFillShapeElement;
                    fillShapeElement.Symbol = new SimpleFillSymbol
                    {
                        Color   = irgbColor_0,
                        Outline = simpleLineSymbol
                    };
                    goto IL_132;
                }

                default:
                    if (geometryType == esriGeometryType.esriGeometryMultiPatch)
                    {
                        element2 = new MultiPatchElement();
                        IFillShapeElement fillShapeElement2 = element2 as IFillShapeElement;
                        IFillSymbol       symbol            = fillShapeElement2.Symbol;
                        symbol.Color             = irgbColor_0;
                        fillShapeElement2.Symbol = symbol;
                        goto IL_132;
                    }
                    break;
                }
                result = element;
                return(result);

IL_132:
                Utils3D.MakeZMAware(igeometry_0, true);
                element2.Geometry = igeometry_0;
                IElementProperties elementProperties = element2 as IElementProperties;
                elementProperties.Name = string_0;
                if (object_0 is IGraphicsContainer3D)
                {
                    IGraphicsContainer3D graphicsContainer3D = object_0 as IGraphicsContainer3D;
                    graphicsContainer3D.AddElement(element2);
                }
                else if (object_0 is IScenePlugin)
                {
                    IGraphicsContainer3D graphicsContainer3D2 = (object_0 as IScenePlugin).Scene.BasicGraphicsLayer as IGraphicsContainer3D;
                    graphicsContainer3D2.AddElement(element2);
                }
                else if (object_0 is IGroupElement)
                {
                    IGroupElement groupElement = object_0 as IGroupElement;
                    groupElement.AddElement(element2);
                }
                result = element2;
            }
            return(result);
        }
예제 #24
0
        public static IElement AddGraphic(IGeometry igeometry_0, ISymbol isymbol_0, string string_0, IGraphicsContainer3D igraphicsContainer3D_0)
        {
            IElement element = null;
            IElement result;

            try
            {
                if (igeometry_0.IsEmpty)
                {
                    result = element;
                    return(result);
                }
                if (modFacades.g_pGCon == null)
                {
                    result = element;
                    return(result);
                }
                IElement         element2     = null;
                esriGeometryType geometryType = igeometry_0.GeometryType;
                switch (geometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                    element2 = new MarkerElement();
                    if (isymbol_0 != null)
                    {
                        IMarkerElement markerElement = element2 as IMarkerElement;
                        markerElement.Symbol = (isymbol_0 as IMarkerSymbol);
                    }
                    break;

                case esriGeometryType.esriGeometryMultipoint:
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    element2 = new LineElement();
                    if (isymbol_0 != null)
                    {
                        ILineElement lineElement = element2 as ILineElement;
                        lineElement.Symbol = (isymbol_0 as ILineSymbol);
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    element2 = new PolygonElement();
                    if (isymbol_0 != null)
                    {
                        IFillShapeElement fillShapeElement = element2 as IFillShapeElement;
                        fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                    }
                    break;

                default:
                    if (geometryType == esriGeometryType.esriGeometryMultiPatch)
                    {
                        element2 = new MultiPatchElement();
                        if (isymbol_0 != null)
                        {
                            IFillShapeElement fillShapeElement = element2 as IFillShapeElement;
                            fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                        }
                    }
                    break;
                }
                if (string_0.Length > 0)
                {
                    IElementProperties elementProperties = element2 as IElementProperties;
                    elementProperties.Name = string_0;
                }
                element2.Geometry = igeometry_0;
                if (igraphicsContainer3D_0 != null)
                {
                    igraphicsContainer3D_0.AddElement(element2);
                }
                element = element2;
                result  = element;
                return(result);
            }
            catch
            {
            }
            result = element;
            return(result);
        }
예제 #25
0
        public void AddGraphic(IScene iscene_0, IGeometry igeometry_0, ISymbol isymbol_0, bool bool_1, bool bool_2, string string_0)
        {
            if (!igeometry_0.IsEmpty)
            {
                IGraphicsLayer   basicGraphicsLayer = iscene_0.BasicGraphicsLayer;
                IElement         element            = null;
                esriGeometryType geometryType       = igeometry_0.GeometryType;
                switch (geometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                {
                    element = new MarkerElement();
                    IMarkerElement markerElement = element as IMarkerElement;
                    if (isymbol_0 != null)
                    {
                        markerElement.Symbol = (isymbol_0 as IMarkerSymbol);
                    }
                    else
                    {
                        markerElement.Symbol = new SimpleMarkerSymbol();
                    }
                    break;
                }

                case esriGeometryType.esriGeometryMultipoint:
                    break;

                case esriGeometryType.esriGeometryPolyline:
                {
                    element = new LineElement();
                    ILineElement lineElement = element as ILineElement;
                    if (isymbol_0 != null)
                    {
                        lineElement.Symbol = (isymbol_0 as ILineSymbol);
                    }
                    else
                    {
                        lineElement.Symbol = new SimpleLineSymbol();
                    }
                    break;
                }

                case esriGeometryType.esriGeometryPolygon:
                {
                    element = new PolygonElement();
                    IFillShapeElement fillShapeElement = element as IFillShapeElement;
                    if (isymbol_0 != null)
                    {
                        fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                    }
                    else
                    {
                        fillShapeElement.Symbol = new SimpleFillSymbol();
                    }
                    break;
                }

                default:
                    if (geometryType == esriGeometryType.esriGeometryMultiPatch)
                    {
                        element = new MultiPatchElement();
                        IFillShapeElement fillShapeElement = element as IFillShapeElement;
                        if (isymbol_0 != null)
                        {
                            fillShapeElement.Symbol = (isymbol_0 as IFillSymbol);
                        }
                        else
                        {
                            fillShapeElement.Symbol = new SimpleFillSymbol();
                        }
                    }
                    break;
                }
                if (element != null)
                {
                    element.Geometry = igeometry_0;
                    if (string_0.Length > 0)
                    {
                        IElementProperties elementProperties = element as IElementProperties;
                        elementProperties.Name = string_0;
                    }
                    IGraphicsContainer3D graphicsContainer3D = basicGraphicsLayer as IGraphicsContainer3D;
                    graphicsContainer3D.AddElement(element);
                    IGraphicsSelection graphicsSelection = graphicsContainer3D as IGraphicsSelection;
                    if (bool_2)
                    {
                        if (!bool_1)
                        {
                            graphicsSelection.UnselectAllElements();
                        }
                        graphicsSelection.SelectElement(element);
                    }
                    iscene_0.SceneGraph.RefreshViewers();
                }
            }
        }
예제 #26
0
        public static void AddFlyByGraphic(ISceneGraph isceneGraph_0, IGeometry igeometry_0, FlyByUtils.FlyByElementType flyByElementType_0, System.Drawing.Color color_0, System.Drawing.Color color_1, System.Drawing.Color color_2, System.Drawing.Color color_3, bool bool_0)
        {
            if (!igeometry_0.IsEmpty)
            {
                IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D;
                if (!FlyByUtils.LayerIsExist(isceneGraph_0.Scene, graphicsContainer3D as ILayer))
                {
                    isceneGraph_0.Scene.AddLayer(graphicsContainer3D as ILayer, true);
                }
                switch (flyByElementType_0)
                {
                case FlyByUtils.FlyByElementType.FLYBY_PATH:
                    if (FlyByUtils.pPathElem != null)
                    {
                        graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem);
                    }
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_OBSERVER:
                    if (FlyByUtils.pObserverElem != null)
                    {
                        graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem);
                    }
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_TARGET:
                    if (FlyByUtils.pTargetElem != null)
                    {
                        graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem);
                    }
                    break;
                }
                ISymbol  flyBySymbol = FlyByUtils.GetFlyBySymbol(color_0, color_1, color_2, color_3, flyByElementType_0);
                IElement element;
                switch (igeometry_0.GeometryType)
                {
                case esriGeometryType.esriGeometryPoint:
                {
                    element = new MarkerElement();
                    IMarkerElement markerElement = element as IMarkerElement;
                    markerElement.Symbol = (flyBySymbol as IMarkerSymbol);
                    break;
                }

                case esriGeometryType.esriGeometryMultipoint:
                    return;

                case esriGeometryType.esriGeometryPolyline:
                {
                    element = new LineElement();
                    ILineElement lineElement = element as ILineElement;
                    lineElement.Symbol = (flyBySymbol as ILineSymbol);
                    break;
                }

                default:
                    return;
                }
                switch (flyByElementType_0)
                {
                case FlyByUtils.FlyByElementType.FLYBY_ANCHORS:
                {
                    IElementProperties elementProperties = element as IElementProperties;
                    elementProperties.Name = "SceneFlyBy.AnchorPoint";
                    break;
                }

                case FlyByUtils.FlyByElementType.FLYBY_PATH:
                    FlyByUtils.pPathElem = element;
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_OBSERVER:
                    FlyByUtils.pObserverElem = element;
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_TARGET:
                    FlyByUtils.pTargetElem = element;
                    break;

                case FlyByUtils.FlyByElementType.FLYBY_STATIC:
                {
                    IElementProperties elementProperties = element as IElementProperties;
                    elementProperties.Name = "SceneFlyBy.StaticLoc";
                    break;
                }
                }
                element.Geometry = igeometry_0;
                graphicsContainer3D.AddElement(element);
                if (bool_0)
                {
                    isceneGraph_0.RefreshViewers();
                }
            }
        }