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

ArcGIS Engine 10 开发手册(7-12)ArcGIS Engine中点状图的调用

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

    本文介绍使用ArcGIS Engine生成点状图的方法。


   ArcGIS Engine生成点状图示例代码

    代码如下:

 

public class DotRender

 

{

 

  IGeoFeatureLayer pGeoLayer;

 

  IDotDensityRenderer pDotDensityRenderer; //渲染对象

 

  IDotDensityFillSymbol pDotDensityFill; //渲染填充符号对象,大对象分解小对象, 独立的可看作对象。

 

  IRendererFields pRendFields; //用那个字段渲染。理解层次关系。

  ISymbolArray pSymbolArry;

 

  public DotRender (AxMapControl pMapControl, IFeatureLayer pFtLayer, double pValue, string pFieldName)

 

  {

 

    IActiveView pActiveView;

 

    this.pGeoLayer = pFtLayer as IGeoFeatureLayer;

    pActiveView = pMapControl.ActiveView;

    pDotDensityRenderer = new DotDensityRendererClass ();

    pRendFields = pDotDensityRenderer as IRendererFields;

 

    pRendFields.AddField (pFieldName, pFieldName); //同一个对象的接口的切换,很方便的。

 

    this.pDotDensityFill = new DotDensityFillSymbolClass ();

    pDotDensityFill.DotSize = 2.46;

 

    pDotDensityFill.Color = GetRGBColor (0, 100, 0);

    pDotDensityFill.BackgroundColor = GetRGBColor (255, 255, 255);

    pSymbolArry = pDotDensityFill as ISymbolArray; //难道是密度。

 

    ISimpleMarkerSymbol pSimpleMark;

    pSimpleMark = new SimpleMarkerSymbolClass ();

 

    pSimpleMark.Style = esriSimpleMarkerStyle.esriSMSDiamond;

    pSimpleMark.Size = 2.46;

 

    pSimpleMark.Color = GetRGBColor (235, 190, 89);

    pSymbolArry.AddSymbol (pSimpleMark as ISymbol);

    pDotDensityRenderer.DotDensitySymbol = pDotDensityFill;

    pDotDensityRenderer.DotValue = pValue;

 

    pDotDensityRenderer.CreateLegend ();

 

    pGeoLayer.Renderer = (IFeatureRenderer) pDotDensityRenderer;

 

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

 

  }

 

  public IRgbColor GetRGBColor (int r, int g, int b)

 

  {

 

    IRgbColor pRGB;

 

    pRGB = new RgbColorClass ();

    pRGB.Red = r;

 

    pRGB.Green = g;

    pRGB.Blue = b;

    return pRGB;

 

  }

 

}

    效果如图


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