-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathSimpleRender.cs
99 lines (59 loc) · 2.2 KB
/
SimpleRender.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.GlobeCore;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.DataSourcesGDB;
namespace EngineApplication
{
public class SimpleRender
{
public SimpleRender(AxMapControl pMapcontrol, IFeatureLayer pFtLayer, String Field)
{
IGeoFeatureLayer pGeolayer;
IActiveView pActiveView;
pGeolayer = pFtLayer as IGeoFeatureLayer;
pActiveView = pMapcontrol.ActiveView;
IFillSymbol pFillSymbol;
ILineSymbol pLineSymbol;
pFillSymbol = new SimpleFillSymbolClass();
pFillSymbol.Color = GetRGBColor(220, 110, 200);
pLineSymbol = new SimpleLineSymbolClass();
pLineSymbol.Color = GetRGBColor(255, 120, 105);
pLineSymbol.Width = 2;
pFillSymbol.Outline = pLineSymbol;
ISimpleRenderer pSimpleRender;//用什么符号渲染
pSimpleRender = new SimpleRendererClass();
pSimpleRender.Symbol = pFillSymbol as ISymbol ;
pSimpleRender.Description = "China";
pSimpleRender.Label = "SimpleRender";
ITransparencyRenderer pTrans;
pTrans = pSimpleRender as ITransparencyRenderer;
pTrans.TransparencyField = Field;
pGeolayer.Renderer = pTrans as IFeatureRenderer;
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
//地理图层的渲染对象是一个要素渲染对象,而这个对象是由一些相关对象组成的。
//属性也是一个对象,说明大对象是由小对象组成的。
}
private IRgbColor GetRGBColor(int R, int G, int B)//子类赋给父类
{
IRgbColor pRGB;
pRGB = new RgbColorClass();
pRGB.Red = R;
pRGB.Green = G;
pRGB.Green = B;
return pRGB;
}
}
}