예제 #1
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);
        }
예제 #2
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();
                }
            }
        }
예제 #3
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);
        }