ArcGIS的地图渲染问题
发布网友
发布时间:2022-05-14 18:02
我来回答
共1个回答
热心网友
时间:2023-10-18 23:44
c# + AE 的 ,你应该看得懂:
///
<summary>
///
分类显示
///
</summary>
///
<param name="dst">分类显示数据集,包含2列,字段1(STATVALUE,string,需要分类显示的字段值)字段2(COLOR,string,颜色ARGB值)</param>
public void SortDisplay(DataSet dst)
{
IFeatureLayer pFeatureLayer;
IFeatureClass pFeatureClass;
pFeatureLayer = SelectFeatureLayer("LayerName");
IGeoFeatureLayer pLyr;
pLyr = pFeatureLayer as IGeoFeatureLayer;
IUniqueValueRenderer pRender;
pRender = new ESRI.ArcGIS.Carto.UniqueValueRenderer();
ESRI.ArcGIS.Display.SimpleFillSymbol sfs;
sfs = new ESRI.ArcGIS.Display.SimpleFillSymbol();
ESRI.ArcGIS.Display.IRgbColor pRgbColor = new ESRI.ArcGIS.Display.RgbColor();
pRgbColor.Red = 196;
pRgbColor.Green = 254;
pRgbColor.Blue = 221;
sfs.Color = pRgbColor;
sfs.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid;
sfs.Outline.Width = 1;
pRender.FieldCount = 1;
pRender.set_Field(0,"FWJG"); //字段名
pRender.DefaultSymbol = sfs as ESRI.ArcGIS.Display.ISymbol;
pRender.UseDefaultSymbol = true;
int intDstIndex;
for (intDstIndex = 0; intDstIndex < dst.Tables[0].Rows.Count; intDstIndex++)
{
sfs = new ESRI.ArcGIS.Display.SimpleFillSymbol();
System.Drawing.Color color = System.Drawing.Color.FromArgb(Convert.ToInt32(dst.Tables[0].Rows[intDstIndex][1].ToString()));
pRgbColor = new ESRI.ArcGIS.Display.RgbColor();
pRgbColor.Red = color.R;
pRgbColor.Green = color.G;
pRgbColor.Blue = color.B;
sfs.Color = pRgbColor;
sfs.Style = ESRI.ArcGIS.Display.esriSimpleFillStyle.esriSFSSolid;
sfs.Outline.Width = 1;
pRender.AddValue(dst.Tables[0].Rows[intDstIndex][0].ToString(), dst.Tables[0].Rows[intDstIndex][1].ToString(), (ESRI.ArcGIS.Display.ISymbol)sfs);
}
pRender.ColorScheme = "Custom";
pRender.set_FieldType(0,true);
pLyr.Renderer = pRender as ESRI.ArcGIS.Carto.IFeatureRenderer;
_Map1.Refresh();
}