Arcgis Engine开发 分级渲染

问题描述

最近课程设计要实现Arcmap基本框架和分级渲染功能。基本框架只要在ArcgisEngineToolbarControl添加Arcgis已有的指令就可以了。别人帮写了打开文件代码,可以运行。自己在网上找了分级渲染的代码,但是看不懂,不知道怎样修改,恳请大神帮忙改一下,能够实现这个功能。用的是VS2005,C#。这是打开文件菜单的代码,包括打开、新建、保存、另存为、退出usingSystem;usingSystem.Drawing;usingSystem.Collections;usingSystem.ComponentModel;usingSystem.Windows.Forms;usingSystem.Data;usingSystem.IO;usingSystem.Runtime.InteropServices;usingESRI.ArcGIS.esriSystem;usingESRI.ArcGIS.Carto;usingESRI.ArcGIS.Controls;usingESRI.ArcGIS.ADF;usingESRI.ArcGIS.SystemUI;namespaceMapControlApplication1{publicsealedpartialclassMainForm:Form{#regionclassprivatemembersprivateIMapControl3m_mapControl=null;privatestringm_mapDocumentName=string.Empty;#endregion#regionclassconstructorpublicMainForm(){InitializeComponent();}#endregionprivatevoidMainForm_Load(objectsender,EventArgse){//gettheMapControlm_mapControl=(IMapControl3)axMapControl1.Object;//disabletheSavemenu(sincethereisnodocumentyet)menuSaveDoc.Enabled=false;}#regionMainMenueventhandlersprivatevoidmenuNewDoc_Click(objectsender,EventArgse){//executeNewDocumentcommandICommandcommand=newCreateNewDocument();command.OnCreate(m_mapControl.Object);command.OnClick();}privatevoidmenuOpenDoc_Click(objectsender,EventArgse){//executeOpenDocumentcommandICommandcommand=newControlsOpenDocCommandClass();command.OnCreate(m_mapControl.Object);command.OnClick();}privatevoidmenuSaveDoc_Click(objectsender,EventArgse){//executeSaveDocumentcommandif(m_mapControl.CheckMxFile(m_mapDocumentName)){//createanewinstanceofaMapDocumentIMapDocumentmapDoc=newMapDocumentClass();mapDoc.Open(m_mapDocumentName,string.Empty);//MakesurethattheMapDocumentisnotreadonlyif(mapDoc.get_IsReadOnly(m_mapDocumentName)){MessageBox.Show("Mapdocumentisreadonly!");mapDoc.Close();return;}//ReplaceitscontentswiththecurrentmapmapDoc.ReplaceContents((IMxdContents)m_mapControl.Map);//savetheMapDocumentinordertopersistitmapDoc.Save(mapDoc.UsesRelativePaths,false);//closetheMapDocumentmapDoc.Close();}}privatevoidmenuSaveAs_Click(objectsender,EventArgse){//executeSaveAsDocumentcommandICommandcommand=newControlsSaveAsDocCommandClass();command.OnCreate(m_mapControl.Object);command.OnClick();}privatevoidmenuExitApp_Click(objectsender,EventArgse){//exittheapplicationApplication.Exit();}#endregion//listentoMapReplacedevantinordertoupdatethestatusbarandtheSavemenuprivatevoidaxMapControl1_OnMapReplaced(objectsender,IMapControlEvents2_OnMapReplacedEvente){//getthecurrentdocumentnamefromtheMapControlm_mapDocumentName=m_mapControl.DocumentFilename;//ifthereisnoMapDocument,diabletheSavemenuandclearthestatusbarif(m_mapDocumentName==string.Empty){menuSaveDoc.Enabled=false;statusBarXY.Text=string.Empty;}else{//enabletheSavemanuandwritethedocnametothestatusbarmenuSaveDoc.Enabled=true;statusBarXY.Text=Path.GetFileName(m_mapDocumentName);}}privatevoidaxMapControl1_OnMouseMove(objectsender,IMapControlEvents2_OnMouseMoveEvente){statusBarXY.Text=string.Format("{0},{1}{2}",e.mapX.ToString("
解决方案二:

解决方案三:
#.##"),e.mapY.ToString("
解决方案四:

解决方案五:
#.##"),axMapControl1.MapUnits.ToString().Substring(4));}}}这是网上找的分级渲染代码///<summary>///不同颜色生成分级点符号图///</summary>///<paramname="mFeatureLayer">输入图层</param>///<paramname="mFieldName">点符号颜色字段</param>///<paramname="iBreakCount">点符号分级数</param>///<returns>点符号图层</returns>publicIFeatureLayerGisChart_ClassBreakColorMaker(IFeatureLayermFeatureLayer,IServerContextpSOC,stringmFieldName,refintiBreakCount){IGeoFeatureLayerpGeoFeatureLayer;IFillSymbolpFillSymbol;ISimpleMarkerSymbolpSimpleMarkerS;stdole.StdFontpFontDisp;ITablepTable;IQueryFilterpQueryFilter;ICursorpCursor;IDataStatisticspDataStatistics;IStatisticsResultspStatisticsResult;pGeoFeatureLayer=mFeatureLayerasIGeoFeatureLayer;//计算要素最大最小值pTable=(ITable)pGeoFeatureLayer;pQueryFilter=newQueryFilterClass();pQueryFilter.AddField("");pCursor=pTable.Search(pQueryFilter,true);pDataStatistics=newDataStatisticsClass();pDataStatistics.Cursor=pCursor;pDataStatistics.Field=mFieldName;pStatisticsResult=pDataStatistics.Statistics;//背景色pFillSymbol=pSOC.CreateObject("esriDisplay.SimpleFillSymbol")asISimpleFillSymbol;pFillSymbol.Color=GetColor(233,255,190,pSOC);//点符号样式pSimpleMarkerS=pSOC.CreateObject("esriDisplay.SimpleMarkerSymbol")asISimpleMarkerSymbol;pFontDisp=newstdole.StdFontClass();pFontDisp.Name="ESRIBusiness";pFontDisp.Size=10;pSimpleMarkerS.Outline=true;pSimpleMarkerS.OutlineColor=GetColor(0,0,0,pSOC);//分级符号图//获取统计数据及起频率ITableHistogrampTableHistogram=pSOC.CreateObject("esriCarto.BasicTableHistogram")asITableHistogram;pTableHistogram.Field=mFieldName;pTableHistogram.Table=pTable;objectdataValues,dataFrequency;IBasicHistogrampHistogram=(IBasicHistogram)pTableHistogram;pHistogram.GetHistogram(outdataValues,outdataFrequency);IClassifyGENpClassify=newNaturalBreaksClass();//产生种类pClassify.Classify(dataValues,dataFrequency,refiBreakCount);objectob=pClassify.ClassBreaks;double[]Classes=(double[])ob;intClassesCount=Classes.Length;//定义分类渲染IClassBreaksRendererpClassBreaksRenderer=(IClassBreaksRenderer)pSOC.CreateObject("esriCarto.ClassBreaksRenderer");pClassBreaksRenderer.Field=mFieldName;pClassBreaksRenderer.BreakCount=ClassesCount;pClassBreaksRenderer.SortClassesAscending=true;pClassBreaksRenderer.MinimumBreak=Classes[0];IColorpColor=GetRGBColor(124,143,0,pSOC);//设置要素的填充颜色for(inti=0;i<ClassesCount;i){ISimpleFillSymbolpFillSymbol1=newSimpleFillSymbolClass();pSimpleMarkerS.Color=pColor;pFillSymbol1.Style=esriSimpleFillStyle.esriSFSSolid;pSimpleMarkerS.Size=4*(i1);pClassBreaksRenderer.BackgroundSymbol=pFillSymbol;pClassBreaksRenderer.set_Symbol(i,(ISymbol)pSimpleMarkerS);pClassBreaksRenderer.set_Break(i,Classes[i]);}pGeoFeatureLayer.Renderer=(IFeatureRenderer)pClassBreaksRenderer;return(IFeatureLayer)pGeoFeatureLayer;}privatestaticIRgbColorGetRGBColor(intyourRed,intyourGreen,intyourBlue,IServerContextpSOC){IRgbColorpRGB=(IRgbColor)pSOC.CreateObject("esriDisplay.RgbColor");pRGB.Red=yourRed;pRGB.Green=yourGreen;pRGB.Blue=yourBlue;pRGB.UseWindowsDithering=true;returnpRGB;}///<summary>///颜色设置///</summary>///<paramname="red">R</param>///<paramname="green">G</param>///<paramname="blue">B</param>///<returns>GIS颜色对象</returns>privatestaticIColorGetColor(intred,intgreen,intblue,IServerContextpSOC){IRgbColorrgbColor=GetRGBColor(red,green,blue,pSOC);IColorcolor=rgbColorasIColor;returncolor;}

解决方案

本帖最后由 zhihuzheye123 于 2015-01-21 02:45:08 编辑
解决方案六:
嘿嘿,我也在做这个例子

时间: 2024-08-03 16:54:02

Arcgis Engine开发 分级渲染的相关文章

ArcGIS Engine开发入门教程

利用ArcGIS Engine.VS .NET和Windows控件开发GIS应用 Dixon整理 此过程说明适合那些使用.NET建立和部署应用的开发者,它描述了使用ArcGIS控件建立和部署应用的方法和步骤. 你可以在下面的目录下找到相应的样例程序: <安装目录>/DeveloperKit/Samples/Developer_Guide_Scenarios/ ArcGIS_Engine/Building_an_ArcGIS_Control_Application/Map_Viewer 注:Ar

arcgis engine开发类似arcmap的功能

问题描述 arcgis engine开发类似arcmap的功能 怎样在arcgis engine中开发类似arcmap中新建shapefile的功能..

ArcGIS Engine开发的ArcGIS 版本管理的功能

原文:ArcGIS Engine开发的ArcGIS 版本管理的功能 转自:http://blog.csdn.net/linghe301/article/details/7965901 这是以前的ArcGIS Engine开发成果,主要是Geodatabase方面的,模仿ArcGIS版本的流程系统环境: VS2010.ArcGIS Engine10.DevExpress721(第三方控件,比较常用易于下载)   -------------------------------------------

Arcgis engine开发鹰眼功能问题

问题描述 arcgisengine基于C#的二次开发鹰眼功能问题,有没有比较简单的方法,除了写代码,可不可以直接调用包或者方法之类的

ARCgis engine开发,添加指北针的时候出错了!

问题描述 pPoint=formTemp.returnPageLayoutControl().ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X,Y);xMap=pPoint.X;yMap=pPoint.Y;formTemp.returnTextbox1().Location=newSystem.Drawing.Point(X,Y);formTemp.returnTextbox1().Visible=true;formTemp.

利用ArcGIS Engine、VS .NET和Windows控件开发GIS应用

原文:利用ArcGIS Engine.VS .NET和Windows控件开发GIS应用 此过程说明适合那些使用.NET建立和部署应用的开发者,它描述了使用ArcGIS控件建立和部署应用的方法和步骤. 你可以在下面的目录下找到相应的样例程序: <安装目录>\DeveloperKit\Samples\Developer_Guide_Scenarios\ ArcGIS_Engine\Building_an_ArcGIS_Control_Application\Map_Viewer 注:ArcGIS样

ArcObjects与ArcGIS Engine

1.ArcObjects 在ArcGIS系列产品中,ArcGIS Desktop.ArcGIS Engine和ArcGIS Server都是基于核心组件库ArcObjects搭建的. 所谓ArcObjects,现在一般都是指ArcGIS Desktop版本的组件开发集,即需要安装ArcGIS桌面版软件后才能安装这些组件开发集,它是所有版本中组件最全的版本. ArcObjects组件库有3000多个对象可供开发人员调用,为开发人员集成了大量的GIS功能,可以快速的帮助开发人员进行GIS项目的开发.

ArcGIS Engine开发之旅01---产品组成、逻辑体系结构

原文:ArcGIS Engine开发之旅01---产品组成.逻辑体系结构   ArcGIS Engine 由两个产品组成:  面向开发人员的软件开发包(ArcGIS Engine Developer kit) 面向最终用户的运行时(ArcGIS Engine Runtime)ArcGIS Engine 开发工具包是一个基于组件的软件开发产品,可用于构建自定义GIS 和制图应用软件.它并不是一个终端用户产品,而是软件开发人员的工具包,支持四种开发环境(C++, COM, .NET,以及Java

控件-请问ArcGIS Engine + VS2010 怎么开发出那种统计直方图?

问题描述 请问ArcGIS Engine + VS2010 怎么开发出那种统计直方图? 2C 是配合VS2010里面自带的图表控件的那种,还有分区统计,频率统计,功能都怎么实现啊