『公告』 预祝您龙年大吉,万事如意, 过节期间, 大家如需数据服务,请拨打400 或直接添加客服微信,再祝大家龙年,心想事成。
关注我们 新浪 腾讯

ArcGIS Engine 10 开发手册(7-10)ArcGIS Engine中简单图的调用

ArcGIS Engine 10 开发手册(7-10)ArcGIS Engine中简单图的调用
本文介绍使用ArcGIS Engine生成简单图的方法。

    本文介绍使用ArcGIS Engine生成简单图的方法。


    ArcGIS Engine生成简单图示例代码

    代码如下:

 

public class SimpleRender

 

{

 

  public SimpleRender (AxMapControl pMapcontrol, IFeatureLayer pFtLayer, String Field)

 

  {

 

    IGeoFeatureLayer pGeolayer;

    IActiveView pActiveView;

 

    pGeolayer = pFtLayer as IGeoFeatureLayer;

    pActiveView = pMapcontrol.ActiveView;

    IFillSymbol pFillSymbol;

 

    ILineSymbol pLineSymbol;

 

    pFillSymbol = new SimpleFillSymbolClass ();

    pFillSymbol.Color = GetRGBColor (220, 110, 200);

    pLineSymbol = new SimpleLineSymbolClass ();

    pLineSymbol.Color = GetRGBColor (255, 120, 105);

    pLineSymbol.Width = 2;

 

    pFillSymbol.Outline = pLineSymbol;

    ISimpleRenderer pSimpleRender; //用什么符号渲染

    pSimpleRender = new SimpleRendererClass ();

    pSimpleRender.Symbol = pFillSymbol as ISymbol;

    pSimpleRender.Description = "China";

    pSimpleRender.Label = "SimpleRender";

 

    ITransparencyRenderer pTrans;

 

    pTrans = pSimpleRender as ITransparencyRenderer;

    pTrans.TransparencyField = Field;

    pGeolayer.Renderer = pTrans as IFeatureRenderer;

 

    pActiveView.PartialRefresh (esriViewDrawPhase.esriViewGeography, null, null);

 

    //地理图层的渲染对象是一个要素渲染对象,而这个对象是由一些相关对象组成的。

 

    //属性也是一个对象,说明大对象是由小对象组成的。

 

  }

 

  private IRgbColor GetRGBColor (int R, int G, int B) //子类赋给父类

 

  {

 

    IRgbColor pRGB;

 

    pRGB = new RgbColorClass ();

    pRGB.Red = R;

 

    pRGB.Green = G;

    pRGB.Green = B;

    return pRGB;

 

  }

 

}

      效果如图


      京ICP备08100627号-22 京公网安备 11010802030428号