AE分级渲染_.NET_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > .NET > AE分级渲染

AE分级渲染

 2013/12/18 18:09:11  wfmm  博客园  我要评论(0)
  • 摘要:分级渲染classbreakrenderer位于carto类库中,进行分级渲染时,首先要将相应图层按照某一Field分级。可使用esrisystem类库中的iclassifyGEN类的classify进行分类1privateISymbolGetSymbol(IColorpColor)2{3ISymbolpSymbol;4ISimpleFillSymbolpSymbolFillSymbol=newSimpleFillSymbolClass();5pSymbolFillSymbol
  • 标签:

分级渲染classbreakrenderer位于carto类库中,进行分级渲染时,首先要将相应图层按照某一Field分级。可使用esrisystem类库中的iclassifyGEN类的classify进行分类

 1 private ISymbol GetSymbol(IColor pColor)
 2         {
 3             ISymbol pSymbol;
 4             ISimpleFillSymbol pSymbolFillSymbol = new SimpleFillSymbolClass();
 5             pSymbolFillSymbol.Color = pColor;
 6             pSymbol = pSymbolFillSymbol as ISymbol;
 7             return pSymbol;
 8         }
 9 
10         private void classBreakRendererToolStripMenuItem_Click(object sender, EventArgs e)
11         {
12             double[] classes;
13             IGeoFeatureLayer pGeoFeatureLayer = this.axMapControl1.get_Layer(0) as IGeoFeatureLayer;
14             ITable pTable = pGeoFeatureLayer.FeatureClass as ITable;//Itable接口位于Geodabase类库中
15             ITableHistogram pTableHistogram = new BasicTableHistogramClass();
16             IBasicHistogram pBasicHistogram = pTableHistogram as IBasicHistogram;
17             pTableHistogram.Field = "PERIMETER";
18             pTableHistogram.Table = pTable;
19             object dataValues;
20             object dataFrequent;
21 
22             pBasicHistogram.GetHistogram(out dataValues, out dataFrequent);//获取FeatureClass中的dataValues和datafrequent
23 
24             IClassifyGEN pClassifyGEN = new EqualIntervalClass();
25 
26             int classCount = 5;
27             pClassifyGEN.Classify(dataValues, dataFrequent, ref classCount);//根据上面的dataValues和datafrequent进行分级,分级数为classcout
28 
29             classes = (double[])pClassifyGEN.ClassBreaks;//获取分段点
30 
31             IClassBreaksRenderer pClassBreakRenderer = new ClassBreaksRenderer();
32             pClassBreakRenderer.BreakCount = 5;//断点数
33             pClassBreakRenderer.Field = "PERIMETER";
34             pClassBreakRenderer.SortClassesAscending = true;//按顺序排列
35            
36             IAlgorithmicColorRamp pColorRamp = new AlgorithmicColorRampClass();
37             IRgbColor pRgbColor1 = new RgbColorClass();
38             IRgbColor pRgbColor2 = new RgbColorClass();
39             pRgbColor1.Red = 255;
40             pRgbColor1.Green = 200;
41             pRgbColor1.Blue = 200;
42             pRgbColor2.Red = 160;
43             pRgbColor2.Green = 0;
44             pRgbColor2.Blue = 0;
45             pColorRamp.FromColor = pRgbColor2;
46             pColorRamp.ToColor = pRgbColor1;
47             pColorRamp.Size = 5;//颜色带范围
48             bool ok=true;
49             pColorRamp.CreateRamp(out ok);
50             IEnumColors pEnumColors = pColorRamp.Colors;
51             for (int i = 0; i < classCount; i++)
52             {
53                 IColor pColor = pEnumColors.Next();
54                 ISymbol pSymbol = GetSymbol(pColor);
55               
56                 pClassBreakRenderer.set_Symbol(i, pSymbol);
57                 pClassBreakRenderer.set_Label(i, classes[i].ToString() + "-" + classes[i + 1].ToString());
58                 pClassBreakRenderer.set_Break(i, classes[i+1]);
59               
60                
61                
62             }
63             pGeoFeatureLayer.Renderer = pClassBreakRenderer as IFeatureRenderer;
64             this.axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
65             axTOCControl1.Update();
66 
67 
68 
69         }

过程中需要注意的:1、分级和渲染的具体字段需指明,本例以PERIMETER字段分级和渲染    2、颜色带的size需具体指定   

 

上一篇: 发邮件 下一篇: 关于session的一些问题
  • 相关文章
发表评论
用户名: 匿名