コード例 #1
0
ファイル: GeometryOperator.cs プロジェクト: secondii/Yutai
 public static void MakeOffsetZ(IGeometry igeometry_0, double double_0)
 {
     if (igeometry_0 is IZ)
     {
         GeometryOperator.MakeZMAware(igeometry_0, true);
         IZ igeometry0 = igeometry_0 as IZ;
         igeometry0.CalculateNonSimpleZs();
         igeometry0.OffsetZs(double_0);
     }
 }
コード例 #2
0
ファイル: Utils3D.cs プロジェクト: secondii/Yutai
 public static void MakeOffsetZ(IGeometry igeometry_0, double double_0)
 {
     if (igeometry_0 is IZ)
     {
         Utils3D.MakeZMAware(igeometry_0, true);
         IZ iZ = igeometry_0 as IZ;
         iZ.CalculateNonSimpleZs();
         iZ.OffsetZs(double_0);
     }
 }
コード例 #3
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);
        }