ArcGIS Engine 10 开发手册(7-9)ArcGIS Engine中比例图接口及调用实例

本文目录
  • 正文

和比例渲染图相关的接口

IProportionalSymbolRenderer 该接口被 ProportionalSymbolRenderer 对象实现,用来控制唯一值渲染的主 要信息,如字段设置,最小值和最大值等。

示例:比例渲染代码:

代码如下:

public class ProPortialRender

{

  public ProPortialRender (AxMapControl pMapcontrol, IFeatureLayer pFtLayer, string pFieldName)

  {

    IGeoFeatureLayer pGeo = pFtLayer as IGeoFeatureLayer;

    IProportionalSymbolRenderer pProRender = new ProportionalSymbolRendererClass ();

    pProRender.Field = pFieldName;
    pProRender.ValueUnit = esriUnits.esriUnknownUnits;

    ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass ();
    pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;
    pMarkerSymbol.Size = 2;

    pMarkerSymbol.Color = GetRGBColor (255, 0, 0);
    pProRender.MinSymbol = pMarkerSymbol as ISymbol;

    IDataStatistics pDataStat = new DataStatisticsClass ();

    IFeatureCursor pFtCursor = pFtLayer.FeatureClass.Search (null, false);
    pDataStat.Cursor = pFtCursor as ICursor;

    pDataStat.Field = pFieldName;

    pProRender.MinDataValue = pDataStat.Statistics.Minimum;

    pProRender.MaxDataValue = pDataStat.Statistics.Maximum;
    IFillSymbol pFillS = new SimpleFillSymbolClass ();
    pFillS.Color = GetRGBColor (239, 228, 190);

    ILineSymbol pLineS = new SimpleLineSymbolClass ();
    pLineS.Width = 2;

    pFillS.Outline = pLineS;

    ISimpleFillSymbol pSFillS = pFillS as ISimpleFillSymbol;
    pSFillS.Color = GetRGBColor (100, 100, 253);
    pProRender.BackgroundSymbol = pFillS;

    pGeo.Renderer = pProRender as IFeatureRenderer;

    pMapcontrol.ActiveView.Refresh ();

  }

  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;

  }

}

运行结果

ArcGIS Engine 10 开发手册全集

ArcGIS Engine 10 开发手册全集: ArcGIS Engine 10 开发手册

如果本文对你有所帮助,欢迎对我们团队进行打赏捐助,让我们在传播3S的路上可以走得更远。
赞赏支持
微信捐助麻辣GIS 支付宝捐助麻辣GIS

麻辣GIS-Sailor
作者:
GIS爱好者,学GIS,更爱玩GIS。

如您有疑问,可在文末留言,或到QQ群提问。

本站QQ群(一):291616564 麻辣GIS

本站QQ群(二):166408035 麻辣GIS(二)

微信公众号:malagis,扫描右边二维码直接关注。

发表评论