zoukankan      html  css  js  c++  java
  • 在Arcscene绘制管线三维横断面(AE绘制三维点阵文字)

    根据数据信息动态生成三维管线及横断面表格。效果图如下:

    在获取信息后,直接构造点阵进行文字绘制即可。

    绘制IElement代码:

            /// <summary>
            /// 绘制三维文字
           /// </summary>
           /// <param name="ppp">位置</param>
           /// <param name="text">文本</param>
           /// <param name="Fsize"></param>
           /// <param name="rgb">颜色</param>
           /// <param name="pTextJustification">对齐</param>
           /// <returns></returns>
            public IElement CreateElement( IPoint ppp, string text, double Fsize, int rgb,esriT3DJustification pTextJustification)
            {
                try
                {
                    IPoint point = new PointClass();
                    point = ppp;
                    //point.Z = deep;
                    IText3DElement Ptext3DElement = new Text3DElementClass();
                    Ptext3DElement.AnchorPoint = point;
                    Ptext3DElement.Text = text;
                    Ptext3DElement.BoldFont = false;
                    Ptext3DElement.Alignment = esriT3DAlignment.esriT3DAlignHorizontal;//对齐-控制字是横排还是竖排
                    Ptext3DElement.AxisRotation = esriT3DRotationAxis.esriT3DRotateAxisX;//旋转轴x y z
                    Ptext3DElement.ZAxisScale = 1;// 1.6;//z轴比例尺
                    Ptext3DElement.Justification = pTextJustification;//对齐
                    Ptext3DElement.Height = Fsize;
    
                    Ptext3DElement.Depth = Fsize/5;
                    Ptext3DElement.OrientationPlane = esriT3DOrientationPlane.esriT3DPlaneYZ;//初始方向,即文字所在平面
    
                    //字体颜色
                    IRgbColor Fcolor = new RgbColorClass();
                    Fcolor.RGB = rgb;
                    IFillSymbol pFillSymbol = new SimpleFillSymbol();
                    pFillSymbol.Color = Fcolor;
                    IFillShapeElement pFillShapeElement = Ptext3DElement as IFillShapeElement;
                    pFillShapeElement.Symbol = pFillSymbol;
    
                    return pFillShapeElement as IElement;
                }
                catch (Exception ex)
                {
                    return null;
                }
            }

    绘制线:

            public IElement CreateLineElement(IPoint pS,IPoint pE ,int rgb,double lineWidth)
            {
                try
                {
                    IRgbColor pRgbColor = new RgbColorClass();
                    pRgbColor.RGB = rgb;
                    ISimpleLine3DSymbol pSimpleLine3DSymbol = new SimpleLine3DSymbolClass();
                    pSimpleLine3DSymbol.Style = esriSimple3DLineStyle.esriS3DLSTube;
                    ILineSymbol pLineSymbol = pSimpleLine3DSymbol as ILineSymbol;
                    pLineSymbol.Color = pRgbColor;
                    pLineSymbol.Width = lineWidth;
                   
                    //将线段对象添加到多义线对象polyline  
                    IPolyline polyline = new PolylineClass();
                    object Missing1 = Type.Missing;
                    object Missing2 = Type.Missing;
                    polyline.FromPoint = pS;
                    polyline.ToPoint = pE;
    
                    //让Z值生效  
                    IZAware Zaware = polyline as IZAware;
                    Zaware.ZAware = true;
    
                    IGeometry geometry = (IGeometry)polyline;
                    IElement pElement = new LineElementClass();
                    pElement.Geometry = geometry;
                    ILineElement pLineElement = pElement as ILineElement;
                    pLineElement.Symbol = pLineSymbol;
    
                    return pLineElement as IElement;
      
                }
                catch (Exception ex)
                {
                    return null;
                }
            }

    将IElementCollection添加至控件:

            public void ADDElementCollectionToSceneControl2(AxSceneControl pSceneControl, IElementCollection pElCol)//IElementCollection
            {
                IScene pScene = pSceneControl.Scene;
                IGraphicsLayer m_GraphLayer = new GraphicsLayer3DClass();
                ILayer thisilayer = (ILayer)m_GraphLayer;
                thisilayer.Name = "label3d" + System.DateTime.Now.Minute + System.DateTime.Now.Second;
                pScene.AddLayer(thisilayer, true);
                 
                I3DProperties p3DProps = RenderClass.Get3DPropsFromLayer(thisilayer);
                if (p3DProps != null)
                {
                    p3DProps.RenderMode = esriRenderMode.esriRenderCache;
                    p3DProps.Illuminate = false;
                    p3DProps.Apply3DProperties(thisilayer);
                }
                //IGraphicsContainer3D pGC3D = (IGraphicsContainer3D)new ESRI.ArcGIS.GlobeCore.GlobeGraphicsLayer();
                //IGraphicsContainer3D pGC3D = (IGraphicsContainer3D)new ESRI.ArcGIS.GlobeCore.GlobeGraphicsLayerClass();
                IGraphicsContainer3D pGC3D = (IGraphicsContainer3D)new ESRI.ArcGIS.Analyst3D.GraphicsLayer3DClass();
                pGC3D = (IGraphicsContainer3D)m_GraphLayer; //让m_GraphLayer获得Container
                pGC3D.AddElements(pElCol);
                pScene.SceneGraph.RefreshViewers();
            }
  • 相关阅读:
    git拉取代码命令
    zookeeper(version3.6.3)安装使用《一》
    kafka(version2.1.3)安装<一>
    linux安装jdk
    linux安装支持文件上传下载的命令
    mapstruct 再也不用set不同的属性而劳累了
    RabbitMq确认消费,与重复消费避免使用冥等
    java8之非重入锁StampedLock ,并发的另一种处理方式
    微信Jssdk
    Vue-Router 的params和query传参两种方式
  • 原文地址:https://www.cnblogs.com/dullfish/p/6113917.html
Copyright © 2011-2022 走看看