ArcEngine专题图制作(C#)上一篇/下一篇2010-06-2408:28:50/个人分类:ArcEngine查看(413)/评论(0)/评分(0/0)点密度图、分层设色图/等级图、单值图、柱状图、饼状图的实现代码C#privatevoid点密度图ToolStripMenuItem_Click(objectsender,EventArgse){//获取当前图层,并把它设置成IGeoFeatureLayer的实例IMappMap=axMapControl1.Map;ILayerpLayer=pMap.get_Layer(0)asIFeatureLayer;IFeatureLayerpFeatureLayer=pLayerasIFeatureLayer;IGeoFeatureLayerpGeoFeatureLayer=pLayerasIGeoFeatureLayer;//获取图层上的featureIFeatureClasspFeatureClass=pFeatureLayer.FeatureClass;IFeatureCursorpFeatureCursor=pFeatureClass.Search(null,false);IFeaturepFeature=pFeatureCursor.NextFeature();////////////////////////////////////////////////////////////////////////////////////////////定义点密度图渲染组件IDotDensityRendererDotDensityRenderer=newDotDensityRendererClass();//定义点密度图渲染组件对象的渲染字段对象IRendererFieldsflds=(IRendererFields)DotDensityRenderer;flds.AddField("FID","FID");//flds.AddField("Shape","Shape");//定义点密度图渲染得符号对象IDotDensityFillSymbolddSym=newDotDensityFillSymbolClass();IRgbColorBackColor=newRgbColorClass();BackColor.Red=234;BackColor.Blue=128;BackColor.Green=220;IRgbColorSymbolColor=newRgbColorClass();SymbolColor.Red=234;SymbolColor.Blue=128;SymbolColor.Green=220;////点密度图渲染背景颜色//ddSym.BackgroundColor=BackColor;ddSym.DotSize=8;ddSym.FixedPlacement=true;//ddSym.Color=SymbolColor;ILineSymbolpLineSymbol=newCartographicLineSymbolClass();ddSym.Outline=pLineSymbol;//定义符号数组ISymbolArraysymArray=(ISymbolArray)ddSym;//添加点密度图渲染的点符号到符号数组中去ISimpleMarkerSymbolpMarkerSymbol=newSimpleMarkerSymbolClass();pMarkerSymbol.Style.=esriSimpleMarkerStyle.esriSMSCircle;pMarkerSymbol.Size=2;pMarkerSymbol.Color=SymbolColor;;symArray.AddSymbol(pMarkerSymbolasISymbol);//设置点密度图渲染的点符号//DotDensityRenderer.DotDensitySymbol=symArray;DotDensityRenderer.DotDensitySymbol=ddSym;//确定一个点代表多少值DotDensityRenderer.DotValue=0.2;//点密度渲染采用的颜色模式DotDensityRenderer.ColorScheme="Custom";//创建点密度图渲染图例DotDensityRenderer.CreateLegend();//设置符号大小是否固定DotDensityRenderer.MaintainSize=true;//将点密度图渲染对象与渲染图层挂钩pGeoFeatureLayer.Renderer=(IFeatureRenderer)DotDensityRenderer;//刷新地图和TOOCotrolIActiveViewpActiveView=axMapControl1.MapasIActiveView;pActiveView.Refresh();axTOCControl1.Update();}privatevoid分层设色ToolStripMenuItem_Click(objectsender,EventArgse){//获取当前图层,并把它设置成IGeoFeatureLayer的实例IMappMap=axMapControl1.Map;ILayerpLayer=pMap.get_Layer(0)asIFeatureLayer;IFeatureLayerpFeatureLayer=pLayerasIFeatureLayer;IGeoFeatureLayerpGeoFeatureLayer=pLayerasIGeoFeatureLayer;//获取图层上的featureIFeatureClasspFeatureClass=pFeatureLayer.FeatureClass;IFeatureCursorpFeatureCursor=pFeatureClass.Search(null,false);IFeaturepFeature=pFeatureCursor.NextFeature();//IFeatureRendererPR=pGeoFeatureLayer.Renderer;//JoinData("县级区域","DZGB","sectioncode");//join外部表//intDC;intdesiredClasses=5;stringfieldName="AREA";intclassesCount;double[]classes;stringstrOutput="";boolok;objectdataFrequency;objectdataValues;ITablepTable;//IClassifypClassify;EqualIntervalClasspClassify;//IBasicHistogrampTableHistogram=newBasicTableHistogramClass();//IHistogrampTableHistogram=newBasicTableHistogramClass();ITableHistogrampTableHistogram=newBasicTableHistogramClass()asIT...