比例符号渲染的最小值符号宽度设置不起作用
比例符号设置的最小值符号的宽度不起作用,没有应用到图层渲染,但颜色起作用了。符号宽度需要在符号设置页面点击确认按钮才起作用。
IGeoFeatureLayer pGeoFeatureLayer = pFeatLyr as IGeoFeatureLayer;
ITable pTable = pFeatLyr as ITable;
ICursor pCursor = pTable.Search(null, true);
//利用IDataStatistics和IStatisticsResults获取渲染字段的统计值,最主要是或得最大值和最小值
IDataStatistics pDataStatistics = new DataStatisticsClass();
pDataStatistics.Cursor = pCursor;
pDataStatistics.Field = sFieldName;
IStatisticsResults pStatisticsResult = pDataStatistics.Statistics;
IProportionalSymbolRenderer pProportionalSymbolRenderer;
if (pStatisticsResult != null) {
IColor pColor = GetRGBColor(255, 90, 0);
ISymbol pSymbol = GetDefaultSymbol(pFeatLyr.FeatureClass.ShapeType, pColor);
pProportionalSymbolRenderer = new ProportionalSymbolRendererClass();
pProportionalSymbolRenderer.ValueUnit = esriUnits.esriUnknownUnits; //设置渲染单位
pProportionalSymbolRenderer.Field = sFieldName; //设置渲染字段
pProportionalSymbolRenderer.FlanneryCompensation = false;
ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();
pLineSymbol.Color = pColor as IColor;
pLineSymbol.Width = 0.1;//注意:设置的符号宽度不起作用,显示的还是默认的宽度1,需要在符号设置页面再点一下确认按钮
pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
ISymbol pSymbol = pLineSymbol as ISymbol;
pProportionalSymbolRenderer.MinSymbol = pSymbol;
pProportionalSymbolRenderer.MinDataValue = pStatisticsResult.Minimum;
pProportionalSymbolRenderer.MaxDataValue = pStatisticsResult.Maximum;
pProportionalSymbolRenderer.LegendSymbolCount = 3;
pProportionalSymbolRenderer.CreateLegendSymbols();
pGeoFeatureLayer.Renderer = (IFeatureRenderer) pProportionalSymbolRenderer;
//刷新
(ArcMap.Document.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
IDocument document = ArcMap.Application.Document;
IMxDocument mxDocument = document as IMxDocument;
IContentsView contentView = mxDocument.CurrentContentsView;
contentView.Refresh(null);
IGeoFeatureLayer pGeoFeatureLayer = pFeatLyr as IGeoFeatureLayer;
ITable pTable = pFeatLyr as ITable;
ICursor pCursor = pTable.Search(null, true);
//利用IDataStatistics和IStatisticsResults获取渲染字段的统计值,最主要是或得最大值和最小值
IDataStatistics pDataStatistics = new DataStatisticsClass();
pDataStatistics.Cursor = pCursor;
pDataStatistics.Field = sFieldName;
IStatisticsResults pStatisticsResult = pDataStatistics.Statistics;
IProportionalSymbolRenderer pProportionalSymbolRenderer;
if (pStatisticsResult != null) {
IColor pColor = GetRGBColor(255, 90, 0);
ISymbol pSymbol = GetDefaultSymbol(pFeatLyr.FeatureClass.ShapeType, pColor);
pProportionalSymbolRenderer = new ProportionalSymbolRendererClass();
pProportionalSymbolRenderer.ValueUnit = esriUnits.esriUnknownUnits; //设置渲染单位
pProportionalSymbolRenderer.Field = sFieldName; //设置渲染字段
pProportionalSymbolRenderer.FlanneryCompensation = false;
ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();
pLineSymbol.Color = pColor as IColor;
pLineSymbol.Width = 0.1;//注意:设置的符号宽度不起作用,显示的还是默认的宽度1,需要在符号设置页面再点一下确认按钮
pLineSymbol.Style = esriSimpleLineStyle.esriSLSSolid;
ISymbol pSymbol = pLineSymbol as ISymbol;
pProportionalSymbolRenderer.MinSymbol = pSymbol;
pProportionalSymbolRenderer.MinDataValue = pStatisticsResult.Minimum;
pProportionalSymbolRenderer.MaxDataValue = pStatisticsResult.Maximum;
pProportionalSymbolRenderer.LegendSymbolCount = 3;
pProportionalSymbolRenderer.CreateLegendSymbols();
pGeoFeatureLayer.Renderer = (IFeatureRenderer) pProportionalSymbolRenderer;
//刷新
(ArcMap.Document.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);
IDocument document = ArcMap.Application.Document;
IMxDocument mxDocument = document as IMxDocument;
IContentsView contentView = mxDocument.CurrentContentsView;
contentView.Refresh(null);
1 个回复
朱新颖
赞同来自:
要回复问题请先登录或注册