ArcEngine分级渲染

更新时间:2023-07-19 22:20:30 阅读: 评论:0

/// <summary>
/// 生成大小分级点符号图
/// </summary>
/// <param name="mFeatureLayer">输入图层</param>
/// <param name="mFieldName">点符号大小字段</param>
/// <param name="iBreakCount">点符号分级数</param>
/// <returns>点符号图层</returns>
public IFeatureLayer GisChart_ClassBreakSizeMaker(IFeatureLayer mFeatureLayer, string mFieldName, ref int iBreakCount)
{
IGeoFeatureLayer pGeoFeatureLayer;
// IClassBreaksRenderer pClassBreakR;
滞留英文
// IClassifyGEN pClassifyG;
IFillSymbol pFillSymbol;
ICharacterMarkerSymbol pCharaterMarkerS;
stdole.StdFont pFontDisp;
ITable pTable;
IQueryFilter pQueryFilter;
ICursor pCursor;新年快乐英文歌曲
IDataStatistics pDataStatistics;
IStatisticsResults pStatisticsResult;
//ITableHistogram pTableHis;
pGeoFeatureLayer = mFeatureLayer as IGeoFeatureLayer;
/
/计算要素最大最小值停机英文
pTable = (ITable)pGeoFeatureLayer;
pQueryFilter = new QueryFilterClass();
pQueryFilter.AddField("");
pCursor = pTable.Search(pQueryFilter, true);
pDataStatistics = new DataStatisticsClass();
pDataStatistics.Cursor = pCursor;
//Get the result of statistics
pDataStatistics.Field = mFieldName;
pStatisticsResult = pDataStatistics.Statistics;
//背景色
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetColor(233, 255, 190);
//点符号样式
pCharaterMarkerS = new CharacterMarkerSymbol();
pFontDisp = new stdole.StdFontClass();
pFontDisp.Name = "ESRI Business";
pFontDisp.Size = 8;
pCharaterMarkerS.Font = (IFontDisp)pFontDisp;
pCharaterMarkerS.CharacterIndex = 33;
pCharaterMarkerS.Color = GetColor(234, 12, 0);
//pCharaterMarkerS.Size = 15;
broswer/
/分级符号图
//获取统计数据及起频率
ITableHistogram pTableHistogram = new BasicTableHistogramClass();
pTableHistogram.Field = mFieldName;
pTableHistogram.Table = pTable;
object dataValues, dataFrequency;
IBasicHistogram pHistogram = (IBasicHistogram)pTableHistogram;
pHistogram.GetHistogram(out dataValues, out dataFrequency);
IClassifyGEN pClassify = new EqualIntervalClass();
//产生种类
pClassify.Classify(dataValues, dataFrequency, ref iBreakCount);
football
object ob = pClassify.ClassBreaks;
double[] Class = (double[])ob;
int ClassCount = Class.Length;
//定义分类渲染
IClassBreaksRenderer pClassBreaksRenderer = new
ClassBreaksRendererClass();
pClassBreaksRenderer.Field = mFieldName;
pClassBreaksRenderer.BreakCount = ClassCount;
pClassBreaksRenderer.SortClassAscending = true;
pClassBreaksRenderer.MinimumBreak = Class[0];
//定义黄色
IHsvColor pFromColor = new HsvColorClass();
pFromColor.Hue = 60;
pFromColor.Saturation = 100;
pFromColor.Value = 96;
//定义红色
IHsvColor pToColor = new HsvColorClass();
pToColor.Hue = 0;
pToColor.Saturation = 100;
pToColor.Value = 96;
//定义色带
IAlgorithmicColorRamp pAlgorithmicCR = new AlgorithmicColorRampClass();
pAlgorithmicCR.Algorithm = esriColorRampAlgorithm.esriHSVAlgorithm;
pAlgorithmicCR.FromColor = pFromColor;
cancer什么意思
pAlgorithmicCR.ToColor = pToColor;
pAlgorithmicCR.Size = ClassCount;
bool ok = fal;
pAlgorithmicCR.CreateRamp(out ok);
IEnumColors pEnumColors = pAlgorithmicCR.Colors;
//设置要素的填充颜色
for (int i = 0; i < ClassCount; i++)
{
IColor pColor = pEnumColors.Next();
ISimpleFillSymbol pFillSymbol1 = new SimpleFillSymbolClass();
pFillSymbol1.Color = pColor;
美味的英文翻译pFillSymbol1.Style = esriSimpleFillStyle.esriSFSSolid;
pCharaterMarkerS.Size = (i + 4)*2;
pClassBreaksRenderer.BackgroundSymbol = pFillSymbol;
pClassBreaksRenderer.t_Symbol(i, (ISymbol)pCharaterMarkerS);
pClassBreaksRenderer.t_Break(i, Class[i]);
}
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pClassBreaksRenderer;domesticated
return (IFeatureLayer)pGeoFeatureLayer;
}
/
// <summary>
/// 不同颜色生成分级点符号图
/// </summary>
/// <param name="mFeatureLayer">输入图层</param>
/// <param name="mFieldName">点符号颜色字段</param>
/// <param name="iBreakCount">点符号分级数</param>
/// <returns>点符号图层</returns>
public IFeatureLayer GisChart_ClassBreakColorMaker(IFeatureLayer mFeatureLayer, string mFieldName, ref int iBreakCount)
{
IGeoFeatureLayer pGeoFeatureLayer;
// IClassBreaksRenderer pClassBreakR;
// IClassifyGEN pClassifyG;
IFillSymbol pFillSymbol;
ISimpleMarkerSymbol pSimpleMarkerS;
stdole.StdFont pFontDisp;
ITable pTable;
IQueryFilter pQueryFilter;
ICursor pCursor;
IDataStatistics pDataStatistics;
IStatisticsResults pStatisticsResult;
//ITableHistogram pTableHis;
pGeoFeatureLayer = mFeatureLayer as IGeoFeatureLayer;
/
/计算要素最大最小值
pTable = (ITable)pGeoFeatureLayer;
pQueryFilter = new QueryFilterClass();
pQueryFilter.AddField("");
pCursor = pTable.Search(pQueryFilter, true);
pDataStatistics = new DataStatisticsClass();
pDataStatistics.Cursor = pCursor;
//Get the result of statistics
pDataStatistics.Field = mFieldName;
pStatisticsResult = pDataStatistics.Statistics;
//背景色
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetColor(233, 255, 190);
//点符号样式
洗衣服务
pSimpleMarkerS = new SimpleMarkerSymbolClass();
pFontDisp = new stdole.StdFontClass();
pFontDisp.Name = "ESRI Business";
pFontDisp.Size = 10;
pSimpleMarkerS.Outline=true;
pSimpleMarkerS.OutlineColor=GetColor(0,0,0);
//分级符号图
//获取统计数据及起频率
ITableHistogram pTableHistogram = new BasicTableHistogramClass();
pTableHistogram.Field = mFieldName;
pTableHistogram.Table = pTable;
object dataValues, dataFrequency;
IBasicHistogram pHistogram = (IBasicHistogram)pTableHistogram;
pHistogram.GetHistogram(out dataValues, out dataFrequency);
IClassifyGEN pClassify = new EqualIntervalClass();
//产生种类
pClassify.Classify(dataValues, dataFrequency, ref iBreakCount);
object ob = pClassify.ClassBreaks;
double[] Class = (double[])ob;
int ClassCount = Class.Length;
//定义分类渲染
IClassBreaksRenderer pClassBreaksRenderer = new ClassBreaksRendererClass();
pClassBreaksRenderer.Field = mFieldName;
pClassBreaksRenderer.BreakCount = ClassCount;
pClassBreaksRenderer.SortClassAscending = true;
pClassBreaksRenderer.MinimumBreak = Class[0];
//pSymbologyControl是Symbology的容器
ISymbologyControl pSymbologyControl = new SymbologyControlClass();
//导入style文件
pSymbologyControl.LoadStyleFile(System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\Styles\\ESRI.ServerStyle");
//使用随机色调
ISymbologyStyleClass pSymbologyStyleClass = pSymbologyControl.GetStyleClass(esriSymbologyStyleClass.esriStyleClassColorRamps);
IStyleGalleryItem pStyleGalleryItem = pSymbologyStyleClass.GetItem(22);
object pObject = pStyleGalleryItem.Item;
//使用随机色
IColorRamp pcolorramp = pObject as IColorRamp;
pcolorramp.Size = ClassCount;
bool pOk = true;
pcolorramp.CreateRamp(out pOk);
IColor pColor = null;
//设置要素的填充颜色
for (int i = 0; i < ClassCount; i++)
{
pColor = _Color(ClassCount - 1 - i);
ISimpleFillSymbol pFillSymbol1 = new SimpleFillSymbolClass();
pSimpleMarkerS.Color=pColor;
pFillSymbol1.Style = esriSimpleFillStyle.esriSFSSolid;
masqueradepSimpleMarkerS.Size = 6;
pClassBreaksRenderer.BackgroundSymbol = pFillSymbol;
pClassBreaksRenderer.t_Symbol(i, (ISymbol)pSimpleMarkerS);
pClassBreaksRenderer.t_Break(i, Class[i]);
}
pGeoFeatureLayer.Renderer = (IFeatureRenderer)pClassBreaksRenderer;
return (IFeatureLayer)pGeoFeatureLayer;
}
/// <summary>
/// 颜色设置
/// </summary>
/// <param name="red">R</param>
/// <param name="green">G</param>
/// <param name="blue">B</param>
/// <returns>GIS颜色对象</returns>
private static IColor GetColor(int red, int green, int blue)
{
IRgbColor rgbColor = new RgbColorClass();
rgbColor.Red = red;
rgbColor.Green = green;
rgbColor.Blue = blue;
IColor color = rgbColor as IColor;
return color;
}

本文发布于:2023-07-19 22:20:30,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/78/1105813.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:符号   定义   颜色   要素   渲染   分类   分级   设置
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图