public static void UniqueValueRenderer(ILayer layer)
{
IFeatureLayer pFLayer = layer as IFeatureLayer;
IGeoFeatureLayer geoLayer = layer as IGeoFeatureLayer;
IFeatureClass fcls = pFLayer.FeatureClass;
IQueryFilter pQueryFilter = new QueryFilterClass();
IFeatureCursor fCursor = fcls.Search(pQueryFilter,false);
IRandomColorRamp rx = new RandomColorRampClass();
rx.MinSaturation = 15;
rx.MaxSaturation = 30;
rx.MinValue = 85;
rx.MaxValue = 100;
rx.StartHue = 0;
rx.EndHue = 360;
rx.Size =100;
bool ok;;
rx.CreateRamp(out ok);
IEnumColors RColors = rx.Colors;
RColors.Reset();
IUniqueValueRenderer pRender = new UniqueValueRendererClass();
pRender.FieldCount=1;
pRender.set_Field(0,"乡名");
IFeature pFeat = fCursor.NextFeature();
int index = pFeat.Fields.FindField("乡名");
while(pFeat!=null)
{
ISimpleFillSymbol symd = new SimpleFillSymbolClass();
symd.Style=esriSimpleFillStyle.esriSFSSolid;
symd.Outline.Width=1;
symd.Color = RColors.Next();
string valuestr = pFeat.get_Value(index).ToString();
pRender.AddValue(valuestr,valuestr,symd as ISymbol);
pFeat = fCursor.NextFeature();
}
geoLayer.Renderer = pRender as IFeatureRenderer;
}
【推荐】腾讯云新用户域名抢购1元起,抓紧抢购
· 精准率首次超过人类!阿里巴巴机器阅读理解打破世界纪录
· 技术帖:每天被今日头条推送文章 背后的算法技术是什么?
· 支付宝实体版老黄历问世:全球限量1000册
· 趣店被蚂蚁金服送上纽交所,现在是时候该独立了
· 蚂蚁宝卡升级:支付宝/微博即将免流
» 更多新闻...
· 以操作系统的角度述说线程与进程
· 软件测试转型之路
· 门内门外看招聘
· 大道至简,职场上做人做事做管理