Arcgis Engine开发分级渲染.doc_第1页
Arcgis Engine开发分级渲染.doc_第2页
Arcgis Engine开发分级渲染.doc_第3页
Arcgis Engine开发分级渲染.doc_第4页
Arcgis Engine开发分级渲染.doc_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

这是网上找的分级渲染代码/ / 不同颜色生成分级点符号图 / / 输入图层 / 点符号颜色字段 / 点符号分级数 / 点符号图层 public IFeatureLayer GisChart_ClassBreakColorMaker(IFeatureLayer mFeatureLayer, IServerContext pSOC, string mFieldName, ref int iBreakCount) IGeoFeatureLayer pGeoFeatureLayer; IFillSymbol pFillSymbol; ISimpleMarkerSymbol pSimpleMarkerS; stdole.StdFont pFontDisp; ITable pTable; IQueryFilter pQueryFilter; ICursor pCursor; IDataStatistics pDataStatistics; IStatisticsResults pStatisticsResult; pGeoFeatureLayer = mFeatureLayer as IGeoFeatureLayer; /计算要素最大最小值 pTable = (ITable)pGeoFeatureLayer; pQueryFilter = new QueryFilterClass(); pQueryFilter.AddField(); pCursor = pTable.Search(pQueryFilter, true); pDataStatistics = new DataStatisticsClass(); pDataStatistics.Cursor = pCursor; pDataStatistics.Field = mFieldName; pStatisticsResult = pDataStatistics.Statistics; /背景色 pFillSymbol = pSOC.CreateObject(esriDisplay.SimpleFillSymbol) as ISimpleFillSymbol; pFillSymbol.Color = GetColor(233, 255, 190,pSOC); /点符号样式 pSimpleMarkerS = pSOC.CreateObject(esriDisplay.SimpleMarkerSymbol) as ISimpleMarkerSymbol; pFontDisp = new stdole.StdFontClass(); pFontDisp.Name = ESRI Business; pFontDisp.Size = 10; pSimpleMarkerS.Outline = true; pSimpleMarkerS.OutlineColor = GetColor(0, 0, 0, pSOC); /分级符号图 /获取统计数据及起频率 ITableHistogram pTableHistogram = pSOC.CreateObject(esriCarto.BasicTableHistogram) as ITableHistogram; pTableHistogram.Field = mFieldName; pTableHistogram.Table = pTable; object dataValues, dataFrequency; IBasicHistogram pHistogram = (IBasicHistogram)pTableHistogram; pHistogram.GetHistogram(out dataValues, out dataFrequency); IClassifyGEN pClassify = new NaturalBreaksClass(); /产生种类 pClassify.Classify(dataValues, dataFrequency, ref iBreakCount); object ob = pClassify.ClassBreaks; double Classes = (double)ob; int ClassesCount = Classes.Length; /定义分类渲染 IClassBreaksRenderer pClassBreaksRenderer = (IClassBreaksRenderer)pSOC.CreateObject(esriCarto.ClassBreaksRenderer); pClassBreaksRenderer.Field = mFieldName; pClassBreaksRenderer.BreakCount = ClassesCount; pClassBreaksRenderer.SortClassesAscending = true; pClassBreaksRenderer.MinimumBreak = Classes0; IColor pColor = GetRGBColor(124, 143, 0, pSOC); /设置要素的填充颜色 for (int i = 0; i ClassesCount; i ) ISimpleFillSymbol pFillSymbol1 = new SimpleFillSymbolClass(); pSimpleMarkerS.Color = pColor; pFillSymbol1.Style = esriSimpleFillStyle.esriSFSSolid; pSimpleMarkerS.Size = 4*(i 1); pClassBreaksRenderer.BackgroundSymbol = pFillSymbol; pClassBreaksRenderer.set_Symbol(i, (ISymbol)pSimpleMarkerS); pClassBreaksRenderer.set_Break(i, Classesi); pGeoFeatureLayer.Renderer = (IFeatureRenderer)pClassBreaksRenderer; return (IFeatureLayer)pGeoFeatureLayer; private static IRgbColor GetRGBColor(int yourRed, int yourGreen, int yourBlue, IServerContext pSOC) IRgbColor pRGB = (IRgbColor)pSOC.CreateObject(esriDisplay.RgbColor); pRGB.Red = yourRed; pRGB.Green = yourGreen; pRGB.Blue = yourBlue; pRGB.UseWindowsDithering = true; return pRGB; / / 颜色设置 / / R / G / B / GIS颜色对象 private static IColor GetColor(int red, int green, int blue, IServerContext pSOC) IRgbColor rgbColor = GetRGBColor(red, green, blue, pSOC); IColor color = rgbColor as IColor; return color; 这是打开文件菜单的代码,包括打开、新建、保存、另存为、退出using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using System.Data;using System.IO;using System.Runtime.InteropServices;using ESRI.ArcGIS.esriSystem;using ESRI.ArcGIS.Carto;using ESRI.ArcGIS.Controls;using ESRI.ArcGIS.ADF;using ESRI.ArcGIS.SystemUI;namespace MapControlApplication1 public sealed partial class MainForm : Form #region class private members private IMapControl3 m_mapControl = null; private string m_mapDocumentName = string.Empty; #endregion #region class constructor public MainForm() InitializeComponent(); #endregion private void MainForm_Load(object sender, EventArgs e) /get the MapControl m_mapControl = (IMapControl3)axMapControl1.Object; /disable the Save menu (since there is no document yet) menuSaveDoc.Enabled = false; #region Main Menu event handlers private void menuNewDoc_Click(object sender, EventArgs e) /execute New Document command ICommand command = new CreateNewDocument(); command.OnCreate(m_mapControl.Object); command.OnClick(); private void menuOpenDoc_Click(object sender, EventArgs e) /execute Open Document command ICommand command = new ControlsOpenDocCommandClass(); command.OnCreate(m_mapControl.Object); command.OnClick(); private void menuSaveDoc_Click(object sender, EventArgs e) /execute Save Document command if (m_mapControl.CheckMxFile(m_mapDocumentName) /create a new instance of a MapDocument IMapDocument mapDoc = new MapDocumentClass(); mapDoc.Open(m_mapDocumentName, string.Empty); /Make sure that the MapDocument is not readonly if (mapDoc.get_IsReadOnly(m_mapDocumentName) MessageBox.Show(Map document is read only!); mapDoc.Close(); return; /Replace its contents with the current map mapDoc.ReplaceContents(IMxdContents)m_mapControl.Map); /save the MapDocument in order to persist it mapDoc.Save(mapDoc.UsesRelativePaths, false); /close the MapDocument mapDoc.Close(); private void menuSaveAs_Click(object sender, EventArgs e) /execute SaveAs Document command ICommand command = new ControlsSaveAsDocCommandClass(); command.OnCreate(m_mapControl.Object); command.OnClick(); private void menuExitApp_Click(object sender, EventArgs e) /exit the application Application.Exit(); #endregion /listen to MapReplaced evant in order to update the statusbar and the Save menu private void axMapControl1_OnMapReplaced(object sender, IMapControlEvents2_OnMapReplacedEvent e) /get the current document name

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论