zoukankan      html  css  js  c++  java
  • ArcGIS Engine 线段绘制

    转自ArcGIS Engine 线段绘制研究

    基本步骤

    构建形状

    1. 创建 IPoint
    IPoint m_Point = new PointClass();
    m_Point.PutCoords(x, y);

    2. 创建 IPointCollection
    IPointCollection m_PointCollection = new PolylineClass();
    m_PointCollection.AddPoint(m_Point, ref Type.Missing, ref Type.Missing);

    3. 创建 IPolyline
    IPolyline m_Polyline = new PolylineClass();
    m_Polyline = m_PointCollection as IPolyline;

    4. 创建 IElement
    // Element 不能实例化,需要用其派生类实例化
    IElement m_Element = m_SimpleLineSymbol as IElement;
    m_Element.Geometry = m_Polyline;

    设置形状样式
    1. 创建 ISimpleLineSymbol
    ISimpleLineSymbol m_SimpleLineSymbol = new SimpleLineSymbolClass();

    2. 创建 ILineElement
    ILineElement m_LineElement = new LineElementClass();
    m_LineElement.Symbol = m_SimpleLineSymbol;

    加载到地图
    IMap m_Map = axMapControl1.Map;
    IActiveView m_ActiveView = m_Map as IActiveView;
    IGraphicsContainer m_Container = m_Map as IGraphicsContainer;

    m_Container.AddElement(m_Element, 0);

    m_Active.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);


    -----------------------------------------------------------------------------------------------------------

    其他方法

    private void DrawLine()  
    {  
                    ILineElement pLineElement;  
                    IElement pLElement;  
          
                    IPolyline pLine;  
          
                    RgbColor pColor = new RgbColor();  
                    pColor.Red = 0;  
                    pColor.Green = 0;  
                    pColor.Blue = 255;  
                      
                    ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();  
                    pSimpleLineSymbol.Color = pColor;  
                    pSimpleLineSymbol.Width = 5;  
          
                    pLineElement = new LineElementClass();  
                    pLineElement.Symbol = pSimpleLineSymbol;  
          
                    pLElement = pLineElement as IElement;  
          
                    IRubberBand pRubberBand;  
                    pRubberBand = new RubberLineClass();  
                    pLine = pRubberBand.TrackNew(axMapControl1.ActiveView.ScreenDisplay, null) as IPolyline;  
          
                    pLElement.Geometry = pLine;  
          
                    IGraphicsContainer pGraphicsContainer;  
                    pGraphicsContainer = axMapControl1.ActiveView as IGraphicsContainer;//把地图的当前view作为图片的容器  
                      
                    pGraphicsContainer.AddElement(pLElement, 0);//把刚刚的element转到容器上  
                axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);  
    
    }      
    
  • 相关阅读:
    centos7-关闭 rpcbind 服务
    nginx进行获取阿里云slb真实ip配置操作
    rsync同步时,删除目标目录比源目录多余文件的方法(--delete)
    nfs安装
    Selenium+PhantomJS使用时报错原因及解决方案
    python json转对象 指定字段名称
    大地坐标系和空间直角坐标系的转换
    python日志输出的内容修改为json格式
    Java String的intern方法
    python 超时重试的方法 signal手段
  • 原文地址:https://www.cnblogs.com/arxive/p/6816945.html
Copyright © 2011-2022 走看看