欢迎来到天天文库
浏览记录
ID:44001524
大小:24.37 KB
页数:18页
时间:2019-10-17
《C#专题图代码》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、privatevoid点密度图ToolStripMenuItem_Click(objectsender,EventArgse){//获取当前图层,并把它设置成IGeoFeatureLayer的实例IMappMap=axMapControl1.Map;ILayerpLayer=pMap.get_Layer(0)asIFeatureLayer;IFeatureLayerpFeatureLayer=pLayerasIFeatureLayer;IGeoFeatureLayerpGeoFeatureLayer=pLayera
2、sIGeoFeatureLayer;//获取图层上的featureIFeatureClasspFeatureClass=pFeatureLayer.FeatureClass;IFeatureCursorpFeatureCursor=pFeatureClass.Search(null,false);IFeaturepFeature=pFeatureCursor.NextFeature();/////////////////////////////////////////////////////////////////
3、///////////////////////////定义点密度图渲染组件IDotDensityRendererDotDensityRenderer=newDotDensityRendererClass();//定义点密度图渲染组件对象的渲染字段对象IRendererFieldsflds=(IRendererFields)DotDensityRenderer;flds.AddField("FID","FID");//flds.AddField("Shape","Shape");//定义点密度图渲染得符号对象IDot
4、DensityFillSymbolddSym=newDotDensityFillSymbolClass();IRgbColorBackColor=newRgbColorClass();BackColor.Red=234;BackColor.Blue=128;BackColor.Green=220;IRgbColorSymbolColor=newRgbColorClass();SymbolColor.Red=234;SymbolColor.Blue=128;SymbolColor.Green=220;////点密度图
5、渲染背景颜色//ddSym.BackgroundColor=BackColor;ddSym.DotSize=8;ddSym.FixedPlacement=true;//ddSym.Color=SymbolColor;ILineSymbolpLineSymbol=newCartographicLineSymbolClass();ddSym.Outline=pLineSymbol;//定义符号数组ISymbolArraysymArray=(ISymbolArray)ddSym;//添加点密度图渲染的点符号到符号数组中去
6、ISimpleMarkerSymbolpMarkerSymbol=newSimpleMarkerSymbolClass();pMarkerSymbol.Style=esriSimpleMarkerStyle.esriSMSCircle;pMarkerSymbol.Size=2;pMarkerSymbol.Color=SymbolColor;;symArray.AddSymbol(pMarkerSymbolasISymbol);//设置点密度图渲染的点符号//DotDensityRenderer.DotDensity
7、Symbol=symArray;DotDensityRenderer.DotDensitySymbol=ddSym;//确定一个点代表多少值DotDensityRenderer.DotValue=0.2;//点密度渲染采用的颜色模式DotDensityRenderer.ColorScheme="Custom";//创建点密度图渲染图例DotDensityRenderer.CreateLegend();//设置符号大小是否固定DotDensityRenderer.MaintainSize=true;//将点密度图渲染
8、对象与渲染图层挂钩pGeoFeatureLayer.Renderer=(IFeatureRenderer)DotDensityRenderer;//刷新地图和TOOCotrolIActiveViewpActiveView=axMapControl1.MapasIActiveView;pActiveView.Refresh();axTOCControl1.Up
此文档下载收益归作者所有