根据图层获取要素的渲染颜色
2008-03-19 10:31
501 查看
根据图层获取要素的渲染颜色
public IColor GetFeatureLayerColor(IFeatureLayer pFeatureLayer,IFeature pFeature)
{
if (pFeature == null || pFeature == null) return null;
IColor _result = new RgbColorClass();
IGeoFeatureLayer pGeoFT = pFeatureLayer as IGeoFeatureLayer;
IFeatureRenderer pFeatureRender = pGeoFT.Renderer;
if (pFeatureRender != null)
{
if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
{
ILineSymbol pLineSymbol = null;
pLineSymbol = (ILineSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
_result = pLineSymbol.Color;
}
else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
{
IFillSymbol pFillSymboll = (IFillSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
_result = pFillSymboll.Color;
}
else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
{
IMarkerSymbol pMarkerSymbol = (IMarkerSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
_result = pMarkerSymbol.Color;
}
}
return _result;
}
通过IFeatureRender.get_SymbolByFeature(IFeature pFeature)方法获取要素的渲染方式,再根据不同类型图层的渲染方法转换到相应的接口获取颜色。
public IColor GetFeatureLayerColor(IFeatureLayer pFeatureLayer,IFeature pFeature)
{
if (pFeature == null || pFeature == null) return null;
IColor _result = new RgbColorClass();
IGeoFeatureLayer pGeoFT = pFeatureLayer as IGeoFeatureLayer;
IFeatureRenderer pFeatureRender = pGeoFT.Renderer;
if (pFeatureRender != null)
{
if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
{
ILineSymbol pLineSymbol = null;
pLineSymbol = (ILineSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
_result = pLineSymbol.Color;
}
else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon)
{
IFillSymbol pFillSymboll = (IFillSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
_result = pFillSymboll.Color;
}
else if (pFeatureLayer.FeatureClass.ShapeType == esriGeometryType.esriGeometryPoint)
{
IMarkerSymbol pMarkerSymbol = (IMarkerSymbol)pFeatureRender.get_SymbolByFeature(pFeature);
_result = pMarkerSymbol.Color;
}
}
return _result;
}
通过IFeatureRender.get_SymbolByFeature(IFeature pFeature)方法获取要素的渲染方式,再根据不同类型图层的渲染方法转换到相应的接口获取颜色。
相关文章推荐
- ArcEngine开发——根据图层名称获取对应图层
- 根据图层名获取图层和图层序号
- ArcGIS Desktop和Engine中对点要素图层Graduated Symbols渲染的实现 Rotation Symbol (转)
- Flex 的DataGrid列 的字体,根据不同情况 渲染不同颜色
- ArcEngine如何获取mxd中feature所在图层的渲染方式
- QGis(五)矢量图层根据指定字段分级渲染显示
- ArcEngine渲染图层只显示一种颜色的问题
- Flex 的DataGrid列 的字体,根据不同情况 渲染不同颜色
- 根据颜色值获取颜色常量名: ColorToIdent
- Android 根据color id 获取颜色16进制值
- iOS 获取十六进制颜色显示RGB,根据颜色画图片
- 根据要素选择集,创建新图层
- ArcGis Engine编程之图层渲染与输入坐标画要素
- 根据颜色获取图片
- 根据颜色获取相应的字符串形式的十六进制值
- WMS GetFeatureInfo (Image Layer)——WMS获取要素信息(图像图层)
- WMS GetFeatureInfo (Layers)——WMS获取要素信息(图层)
- 获取mxd中feature所在图层的渲染方式
- 根据要素选择集,创建新图层
- Flex 的DataGrid列 的字体,根据不同情况 渲染不同颜色