private IDotDensityRenderer CreateRenderer() { IDotDensityRenderer pDotDensityRenderer = new DotDensityRendererClass(); IRendererFields pRendererFields = (IRendererFields)pDotDensityRenderer; IDotDensityFillSymbol pDotDensityFillS = new DotDensityFillSymbolClass(); //pDotDensityFillS.DotSize = 2 * dotSize; //pDotDensityFillS.Color = getRGB(0, 0, 0); if (gColor != null) { pDotDensityFillS.BackgroundColor = gColor; } ISymbolArray pSymbolArray = (ISymbolArray)pDotDensityFillS; string strField = string.Empty; foreach (System.Collections.DictionaryEntry de in fieldSymbolHashTable) { strField = de.Key.ToString();; ISymbol symbol = de.Value as ISymbol; pRendererFields.AddField(strField, strField); IMarkerSymbol pMarkerSymbol = symbol as IMarkerSymbol; pMarkerSymbol.Size = dotSize; pSymbolArray.AddSymbol(symbol); } pDotDensityRenderer.DotDensitySymbol = pDotDensityFillS; pDotDensityRenderer.DotValue = dotValue; pDotDensityRenderer.CreateLegend(); return(pDotDensityRenderer); }
private void DotDensity(IFeatureLayer pFeatLyr, string sFieldName, int intRendererDensity) { IGeoFeatureLayer pGeoFeatureLayer = pFeatLyr as IGeoFeatureLayer; IDotDensityRenderer pDotDensityRenderer = new DotDensityRendererClass(); IRendererFields pRendererFields = pDotDensityRenderer as IRendererFields; //设置渲染字段 pRendererFields.AddField(sFieldName); //设置填充背景色 IDotDensityFillSymbol pDotDensityFillSymbol = new DotDensityFillSymbolClass(); pDotDensityFillSymbol.DotSize = 3; pDotDensityFillSymbol.BackgroundColor = GetRgbColor(0, 255, 0); //设置渲染符号 ISymbolArray pSymbolArray = pDotDensityFillSymbol as ISymbolArray; ISimpleMarkerSymbol pSimpleMarkerSymbol = new SimpleMarkerSymbolClass(); pSimpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pSimpleMarkerSymbol.Color = GetRgbColor(0, 0, 255); pSymbolArray.AddSymbol(pSimpleMarkerSymbol as ISymbol); pDotDensityRenderer.DotDensitySymbol = pDotDensityFillSymbol; //设置渲染密度,即每个点符号所代表的数值大小 pDotDensityRenderer.DotValue = intRendererDensity; //创建图例 pDotDensityRenderer.CreateLegend(); pGeoFeatureLayer.Renderer = pDotDensityRenderer as IFeatureRenderer; axMapControl1.Refresh(); axMapControl1.Update(); Close(); }
/// <summary> /// Dot Density Render /// </summary> /// <param name="currentLayer"></param> /// <param name="breakCount"></param> /// <author>Shen Yongyuan</author> /// <date>20091114</date> public static void DotDensityRender(ILayer currentLayer, string fieldName) { IGeoFeatureLayer pGeoFeatureL = currentLayer as IGeoFeatureLayer; pGeoFeatureL.ScaleSymbols = true; //Dot Density Render IDotDensityRenderer pDotDensityRenderer = new DotDensityRendererClass(); IRendererFields pRendererFields = (IRendererFields)pDotDensityRenderer; pRendererFields.AddField(fieldName, "生态"); //Dot Style IDotDensityFillSymbol pDotDensityFillS = new DotDensityFillSymbolClass(); pDotDensityFillS.DotSize = 4; pDotDensityFillS.Color = ArcGIS.Color.ToEsriColor(System.Drawing.Color.FromArgb(0, 0, 0)); pDotDensityFillS.BackgroundColor = ArcGIS.Color.ToEsriColor(System.Drawing.Color.FromArgb(239, 228, 190)); //Symbol Array ISymbolArray pSymbolArray = (ISymbolArray)pDotDensityFillS; ISimpleMarkerSymbol pSimpleMarkerS = new SimpleMarkerSymbolClass(); pSimpleMarkerS.Style = esriSimpleMarkerStyle.esriSMSCircle; pSimpleMarkerS.Size = 4; pSimpleMarkerS.Color = ArcGIS.Color.ToEsriColor(System.Drawing.Color.FromArgb(128, 128, 255)); pSymbolArray.AddSymbol((ISymbol)pSimpleMarkerS); pDotDensityRenderer.DotDensitySymbol = pDotDensityFillS; pDotDensityRenderer.DotValue = 0.05; pDotDensityRenderer.CreateLegend(); pGeoFeatureL.Renderer = (IFeatureRenderer)pDotDensityRenderer; }
//DotDensityFillSymbol private void button8_Click(object sender, EventArgs e) { IGeoFeatureLayer geoFeatureLayer; IDotDensityFillSymbol dotDensityFillSymbol; IDotDensityRenderer dotDensityRenderer; //获取渲染图层 geoFeatureLayer = getGeoLayer("Continents"); dotDensityRenderer = new DotDensityRendererClass(); IRendererFields rendererFields = dotDensityRenderer as IRendererFields; //设置渲染字段 string field1 = "sqmi"; rendererFields.AddField(field1, field1); //设置填充颜色和背景色 dotDensityFillSymbol = new DotDensityFillSymbolClass(); dotDensityFillSymbol.DotSize = 3; dotDensityFillSymbol.Color = getRGB(255, 0, 0); dotDensityFillSymbol.BackgroundColor = getRGB(0, 255, 0); //设置渲染符号 ISymbolArray symbolArray = dotDensityFillSymbol as ISymbolArray; ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass(); simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; simpleMarkerSymbol.Size = 2; simpleMarkerSymbol.Color = getRGB(0, 0, 255); symbolArray.AddSymbol(simpleMarkerSymbol as ISymbol); dotDensityRenderer.DotDensitySymbol = dotDensityFillSymbol; //设置渲染密度 dotDensityRenderer.DotValue = 50000; //创建图例 dotDensityRenderer.CreateLegend(); geoFeatureLayer.Renderer = dotDensityRenderer as IFeatureRenderer; this.axMapControl1.Refresh(); }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { // TODO: Add DotDensityRender.OnClick implementation string strPopField = "value"; IActiveView pActiveView = m_HookHelper.ActiveView; IMap pMap = m_HookHelper.FocusMap; IGeoFeatureLayer pGeoFeatureLayer = pMap.get_Layer(0) as IGeoFeatureLayer; IDotDensityRenderer pDotDensityRenderer = new DotDensityRendererClass(); IRendererFields pRendererFields = (IRendererFields)pDotDensityRenderer; pRendererFields.AddField(strPopField, strPopField); IDotDensityFillSymbol pDotDensityFillSymbol = new DotDensityFillSymbolClass(); pDotDensityFillSymbol.DotSize = 5; pDotDensityFillSymbol.Color = GetRGB(0, 0, 0); pDotDensityFillSymbol.BackgroundColor = GetRGB(239, 228, 190); ISymbolArray pSymbolArray = (ISymbolArray)pDotDensityFillSymbol; ISimpleMarkerSymbol pSimpleMarkerSymbol = new SimpleMarkerSymbolClass(); pSimpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pSimpleMarkerSymbol.Size = 5; pSimpleMarkerSymbol.Color = GetRGB(128, 128, 255); pSymbolArray.AddSymbol((ISymbol)pSimpleMarkerSymbol); pDotDensityRenderer.DotDensitySymbol = pDotDensityFillSymbol; pDotDensityRenderer.DotValue = 0.5; pDotDensityRenderer.CreateLegend(); pGeoFeatureLayer.Renderer = (IFeatureRenderer)pDotDensityRenderer; pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
private void mnuDotDensity_Click(object sender, EventArgs e) { ILayer pLayer = MainMap.get_Layer(0); ITable pTable = pLayer as ITable; IGeoFeatureLayer pGeoFeatureLayer = pLayer as IGeoFeatureLayer; IDotDensityRenderer pDotDensityRender = new DotDensityRendererClass(); IRendererFields pRendererFields = pDotDensityRender as IRendererFields; pRendererFields.AddField("AREA"); // 建立一个用于填充的点符号 IDotDensityFillSymbol pDotDensityFillSymbol = new DotDensityFillSymbolClass(); pDotDensityFillSymbol.DotSize = 3; IRgbColor pRgbColor = new RgbColorClass(); pRgbColor.Red = 0; pRgbColor.Green = 0; pRgbColor.Blue = 0; IColor pColor = pRgbColor as IColor; pDotDensityFillSymbol.Color = pColor; pRgbColor = new RgbColorClass(); pRgbColor.Red = 239; pRgbColor.Green = 228; pRgbColor.Blue = 190; pColor = pRgbColor as IColor; pDotDensityFillSymbol.BackgroundColor = pColor; ISymbolArray pSymbolArray = pDotDensityFillSymbol as ISymbolArray; ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSSquare; pRgbColor = new RgbColorClass(); pRgbColor.Red = 0; pRgbColor.Green = 0; pRgbColor.Blue = 0; pColor = pRgbColor as IColor; pMarkerSymbol.Color = pColor; pSymbolArray.AddSymbol(pMarkerSymbol as ISymbol); // 开始着色 pDotDensityRender.DotDensitySymbol = pDotDensityFillSymbol; pDotDensityRender.DotValue = 2; pGeoFeatureLayer.Renderer = pDotDensityRender as IFeatureRenderer; MainMap.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); }
/// <summary> /// 点状密度法渲染器(DotDensityRenderer)——在多边形特征中绘制不同密度的点 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 点状密度法渲染ToolStripMenuItem_Click(object sender, EventArgs e) { //声明IGeoFeatureLayer变量, 提供一个要素图层对成员控制地理特征的入口 IGeoFeatureLayer geoFeatureLayer; //定义点密度填充符号变量, 控制点符号的属性 IDotDensityFillSymbol dotDensityFillSymbol; //定义点密度渲染对象 IDotDensityRenderer dotDensityRenderer; //获取渲染图层 geoFeatureLayer = getGeoLayer("北部湾"); //实例化点密度渲染对象 dotDensityRenderer = new DotDensityRendererClass(); //强转点密度渲染对象并强转成渲染字段对象 IRendererFields rendererFields = dotDensityRenderer as IRendererFields; //设置渲染字段 string field1 = "年"; //向渲染器添加字段(字段名、别名) rendererFields.AddField(field1, field1); //实例化点密度填充符号 dotDensityFillSymbol = new DotDensityFillSymbolClass(); dotDensityFillSymbol.DotSize = 4; //设置点的大小 dotDensityFillSymbol.Color = getRGB(0, 255, 0); //设置点的颜色 //将点密度填充符号强转为符号数组成员 ISymbolArray symbolArray = dotDensityFillSymbol as ISymbolArray; //实例化简单标记符号 ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass(); //设置点的符号为圆圈 simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; simpleMarkerSymbol.Size = 4; //设置大小 simpleMarkerSymbol.Color = getRGB(0, 255, 0); //设置颜色 //点符号的外边不填充颜色 simpleMarkerSymbol.OutlineColor = getNoRGB(); //将简单标记符号样式增加到符号数组成员中 symbolArray.AddSymbol(simpleMarkerSymbol as ISymbol); //赋值点密度渲染(dotDensityRenderer)的点密度符号(DotDensitySymbol)属性 dotDensityRenderer.DotDensitySymbol = dotDensityFillSymbol; //设置渲染密度 dotDensityRenderer.DotValue = 0.003; //设置点密度填充符号的背景色 dotDensityFillSymbol.BackgroundColor = getRGB(255, 255, 255); //创建图例 dotDensityRenderer.CreateLegend(); //赋值目标图层的渲染器属性 geoFeatureLayer.Renderer = dotDensityRenderer as IFeatureRenderer; axMapControl1.Refresh(); //刷新axMapControl1 axTOCControl1.Update(); //更新axTOCControl1 }
public IDotDensityFillSymbol CreateDotDensityFillSymbol() { IDotDensityFillSymbol symbol = new DotDensityFillSymbolClass { DotSize = 2.0 }; IColor color = new RgbColorClass { NullColor = true }; symbol.BackgroundColor = color; return(symbol); }
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 = 8; //pDotDensityFill.Color = GetRGBColor(10, 20, 0); //pDotDensityFill.BackgroundColor = GetRGBColor(100, 108, 190); //pSymbolArry = pDotDensityFill as ISymbolArray;//�ѵ����ܶȡ� //ISimpleMarkerSymbol pSimpleMark; //pSimpleMark = new SimpleMarkerSymbolClass(); //pSimpleMark.Style = esriSimpleMarkerStyle.esriSMSDiamond; //pSimpleMark.Size = 8; //pSimpleMark.Color = GetRGBColor(128, 128, 255); //pSymbolArry.AddSymbol(pSimpleMark as ISymbol); //pDotDensityRenderer.DotDensitySymbol = pDotDensityFill; //pDotDensityRenderer.DotValue = pValue; //pDotDensityRenderer.CreateLegend(); //pGeoLayer.Renderer = (IFeatureRenderer)pDotDensityRenderer; //pActiveView.Refresh(); //��ȡ��ǰͼ�� �����������ó�IGeoFeatureLayer��ʵ�� IMap pMap = pMapControl.Map; // ILayer pFtLayer = pMap.get_Layer(0) as IFeatureLayer; IFeatureLayer pFeatureLayer = pFtLayer as IFeatureLayer; IGeoFeatureLayer pGeoFeatureLayer = pFtLayer as IGeoFeatureLayer; //��ȡͼ���ϵ�feature IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false); IFeature pFeature = pFeatureCursor.NextFeature(); /////////////////////// /////////////////////////////////////////////////////////////////// //������ܶ�ͼ��Ⱦ��� IDotDensityRenderer DotDensityRenderer = new DotDensityRendererClass(); //������ܶ�ͼ��Ⱦ����������Ⱦ�ֶζ��� IRendererFields flds = (IRendererFields)DotDensityRenderer; flds.AddField(pFieldName, pFieldName); //flds.AddField("Shape", "Shape"); //������ܶ�ͼ��Ⱦ�÷��Ŷ��� IDotDensityFillSymbol ddSym = new DotDensityFillSymbolClass(); IRgbColor BackColor = new RgbColorClass(); BackColor.Red = 234; BackColor.Blue = 128; BackColor.Green = 220; IRgbColor SymbolColor = new RgbColorClass(); SymbolColor.Red = 234; SymbolColor.Blue = 128; SymbolColor.Green = 220; ////���ܶ�ͼ��Ⱦ������ɫ //ddSym.BackgroundColor = BackColor; ddSym.DotSize = 8; ddSym.FixedPlacement = true; //ddSym.Color = SymbolColor; ILineSymbol pLineSymbol = new CartographicLineSymbolClass(); ddSym.Outline = pLineSymbol; //����������� ISymbolArray symArray = (ISymbolArray)ddSym; //��ӵ��ܶ�ͼ��Ⱦ�ĵ���ŵ�����������ȥ ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pMarkerSymbol.Size = 0.2; pMarkerSymbol.Color = SymbolColor; ; symArray.AddSymbol(pMarkerSymbol as ISymbol); //���õ��ܶ�ͼ��Ⱦ�ĵ���� //DotDensityRenderer.DotDensitySymbol =symArray; DotDensityRenderer.DotDensitySymbol = ddSym; //ȷ��һ����������ֵ DotDensityRenderer.DotValue = pValue; //���ܶ���Ⱦ���õ���ɫģʽ DotDensityRenderer.ColorScheme = "Custom"; //�������ܶ�ͼ��Ⱦͼ�� DotDensityRenderer.CreateLegend(); //���÷��Ŵ�С�Ƿ�̶� DotDensityRenderer.MaintainSize = true; //�����ܶ�ͼ��Ⱦ��������Ⱦͼ��ҹ� pGeoFeatureLayer.Renderer = (IFeatureRenderer)DotDensityRenderer; //ˢ�µ�ͼ��TOOCotrol IActiveView pActiveView = pMap as IActiveView; pActiveView.Refresh(); }
private IDotDensityRenderer CreateRenderer() { IDotDensityRenderer pDotDensityRenderer = new DotDensityRendererClass(); IRendererFields pRendererFields = (IRendererFields)pDotDensityRenderer; IDotDensityFillSymbol pDotDensityFillS = new DotDensityFillSymbolClass(); //pDotDensityFillS.DotSize = 2 * dotSize; //pDotDensityFillS.Color = getRGB(0, 0, 0); if (gColor != null) pDotDensityFillS.BackgroundColor = gColor; ISymbolArray pSymbolArray = (ISymbolArray)pDotDensityFillS; string strField = string.Empty; foreach (System.Collections.DictionaryEntry de in fieldSymbolHashTable) { strField = de.Key.ToString(); ; ISymbol symbol = de.Value as ISymbol; pRendererFields.AddField(strField, strField); IMarkerSymbol pMarkerSymbol = symbol as IMarkerSymbol; pMarkerSymbol.Size = dotSize; pSymbolArray.AddSymbol(symbol); } pDotDensityRenderer.DotDensitySymbol = pDotDensityFillS; pDotDensityRenderer.DotValue = dotValue; pDotDensityRenderer.CreateLegend(); return pDotDensityRenderer; }
//DotDensityFillSymbol圆点密度图 private void button8_Click(object sender, EventArgs e) { IGeoFeatureLayer geoFeatureLayer; IDotDensityFillSymbol dotDensityFillSymbol; IDotDensityRenderer dotDensityRenderer; //获取渲染图层 geoFeatureLayer = getGeoLayer("Continents"); dotDensityRenderer = new DotDensityRendererClass(); IRendererFields rendererFields = dotDensityRenderer as IRendererFields; //设置渲染字段 string field1 = "sqmi"; rendererFields.AddField(field1, field1); //设置填充颜色和背景色 dotDensityFillSymbol = new DotDensityFillSymbolClass(); dotDensityFillSymbol.DotSize = 3; dotDensityFillSymbol.Color = getRGB(255, 0, 0); dotDensityFillSymbol.BackgroundColor = getRGB(0, 255, 0); //设置渲染符号 ISymbolArray symbolArray = dotDensityFillSymbol as ISymbolArray; ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass(); simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; simpleMarkerSymbol.Size = 2; simpleMarkerSymbol.Color = getRGB(0, 0, 255); symbolArray.AddSymbol(simpleMarkerSymbol as ISymbol); dotDensityRenderer.DotDensitySymbol = dotDensityFillSymbol; //设置渲染密度 dotDensityRenderer.DotValue = 50000; //创建图例 dotDensityRenderer.CreateLegend(); geoFeatureLayer.Renderer = dotDensityRenderer as IFeatureRenderer; this.axMapControl1.Refresh(); }
private void btnDotDensityRender_Click(object sender, EventArgs e) { IGeoFeatureLayer pGeoFeatLyr = this.mainMapControl.get_Layer(0) as IGeoFeatureLayer; //创建SimpleMarkerSymbol,将会用在DotDensitySymbol中 IMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Color = getRGBColor(255, 0, 0); //创建并设置DotDensitySymbol,以及DotDensitySymbol中的Symbol(上面的MarkerSymbol) IDotDensityFillSymbol pDotDensityFillSymbol = new DotDensityFillSymbolClass(); pDotDensityFillSymbol.DotSize = 5;//大小 pDotDensityFillSymbol.Color = getRGBColor(0, 255, 0);//此颜色不知为何物??????????? pDotDensityFillSymbol.BackgroundColor = getRGBColor(239, 228, 190); ISymbolArray pSymbolArray = pDotDensityFillSymbol as ISymbolArray; pSymbolArray.AddSymbol((ISymbol)pMarkerSymbol);//添加符号,关键 //以下创建并设置着色对象 IDotDensityRenderer pDotDensityRenderer = new DotDensityRendererClass(); pDotDensityRenderer.DotDensitySymbol = pDotDensityFillSymbol;//着色对象所用的DotDensitySymbol pDotDensityRenderer.DotValue = 100;//一个点代表的值,关键!!! pDotDensityRenderer.MaintainSize = true;//地图缩放时DotDensitySymbol符号大小保持 IRendererFields pRendererFields = pDotDensityRenderer as IRendererFields; pRendererFields.AddField("GDP_1999(", "GDP_1999(");//用于着色的字段,关键 pDotDensityRenderer.CreateLegend(); pGeoFeatLyr.Renderer = pDotDensityRenderer as IFeatureRenderer; this.mainMapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); this.axTOCControl.Update(); }
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 = 8; //pDotDensityFill.Color = GetRGBColor(10, 20, 0); //pDotDensityFill.BackgroundColor = GetRGBColor(100, 108, 190); //pSymbolArry = pDotDensityFill as ISymbolArray;//难道是密度。 //ISimpleMarkerSymbol pSimpleMark; //pSimpleMark = new SimpleMarkerSymbolClass(); //pSimpleMark.Style = esriSimpleMarkerStyle.esriSMSDiamond; //pSimpleMark.Size = 8; //pSimpleMark.Color = GetRGBColor(128, 128, 255); //pSymbolArry.AddSymbol(pSimpleMark as ISymbol); //pDotDensityRenderer.DotDensitySymbol = pDotDensityFill; //pDotDensityRenderer.DotValue = pValue; //pDotDensityRenderer.CreateLegend(); //pGeoLayer.Renderer = (IFeatureRenderer)pDotDensityRenderer; //pActiveView.Refresh(); //获取当前图层 ,并把它设置成IGeoFeatureLayer的实例 IMap pMap = pMapControl.Map; // ILayer pFtLayer = pMap.get_Layer(0) as IFeatureLayer; IFeatureLayer pFeatureLayer = pFtLayer as IFeatureLayer; IGeoFeatureLayer pGeoFeatureLayer = pFtLayer as IGeoFeatureLayer; //获取图层上的feature IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; IFeatureCursor pFeatureCursor = pFeatureClass.Search(null, false); IFeature pFeature = pFeatureCursor.NextFeature(); /////////////////////// /////////////////////////////////////////////////////////////////// //定义点密度图渲染组件 IDotDensityRenderer DotDensityRenderer = new DotDensityRendererClass(); //定义点密度图渲染组件对象的渲染字段对象 IRendererFields flds = (IRendererFields)DotDensityRenderer; flds.AddField(pFieldName, pFieldName); //flds.AddField("Shape", "Shape"); //定义点密度图渲染得符号对象 IDotDensityFillSymbol ddSym = new DotDensityFillSymbolClass(); IRgbColor BackColor = new RgbColorClass(); BackColor.Red = 234; BackColor.Blue = 128; BackColor.Green = 220; IRgbColor SymbolColor = new RgbColorClass(); SymbolColor.Red = 234; SymbolColor.Blue = 128; SymbolColor.Green = 220; ////点密度图渲染背景颜色 //ddSym.BackgroundColor = BackColor; ddSym.DotSize = 8; ddSym.FixedPlacement = true; //ddSym.Color = SymbolColor; ILineSymbol pLineSymbol = new CartographicLineSymbolClass(); ddSym.Outline = pLineSymbol; //定义符号数组 ISymbolArray symArray = (ISymbolArray)ddSym; //添加点密度图渲染的点符号到符号数组中去 ISimpleMarkerSymbol pMarkerSymbol = new SimpleMarkerSymbolClass(); pMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle; pMarkerSymbol.Size = 0.2; pMarkerSymbol.Color = SymbolColor;; symArray.AddSymbol(pMarkerSymbol as ISymbol); //设置点密度图渲染的点符号 //DotDensityRenderer.DotDensitySymbol =symArray; DotDensityRenderer.DotDensitySymbol = ddSym; //确定一个点代表多少值 DotDensityRenderer.DotValue = pValue; //点密度渲染采用的颜色模式 DotDensityRenderer.ColorScheme = "Custom"; //创建点密度图渲染图例 DotDensityRenderer.CreateLegend(); //设置符号大小是否固定 DotDensityRenderer.MaintainSize = true; //将点密度图渲染对象与渲染图层挂钩 pGeoFeatureLayer.Renderer = (IFeatureRenderer)DotDensityRenderer; //刷新地图和TOOCotrol IActiveView pActiveView = pMap as IActiveView; pActiveView.Refresh(); }