阅读:1549回复:1
[原创]用IUniqueValueRenderer对字段用不同颜色渲染的问题
我在用IUniqueValueRenderer对同一字段在不同区域用不同颜色泻染时,发现小于1的区域没有泻染,不知是什么原因请指教!代码如下: Private Sub UniqueValue(ByVal vFlayer As IFeatureLayer, ByVal vGflayer As IGeoFeatureLayer, ByVal vsfield As String) Dim pftl As IFeatureLayer = vFlayer Dim pGftl As IGeoFeatureLayer = vGflayer Dim pFtCls As IFeatureClass = pftl.FeatureClass Dim pQFilter As IQueryFilter = New QueryFilterClass Dim pFtCs As IFeatureCursor = pFtCls.Search(pQFilter, False) Dim pRC As IRandomColorRamp = New RandomColorRampClass pRC.MinSaturation = 15 pRC.MaxSaturation = 30 pRC.MinValue = 85 pRC.MaxValue = 100 pRC.StartHue = 0 pRC.EndHue = 360 pRC.Size = 1000 pRC.CreateRamp(True) Dim Rcolors As IEnumColors = pRC.Colors Rcolors.Reset() Dim pRender As IUniqueValueRenderer = New UniqueValueRendererClass pRender.FieldCount = 1 pRender.Field(0) = vsfield Dim pFeat As IFeature = pFtCs.NextFeature Dim fieldNumber As Int32 fieldNumber = pFeat.Fields.FindField(vsfield) Dim codeValue As String = "" Do While Not pFeat Is Nothing Dim pSymx As ISimpleFillSymbol = New SimpleFillSymbolClass pSymx.Color = Rcolors.Next pSymx.Style = esriSimpleFillStyle.esriSFSSolid pSymx.Outline.Width = 1 codeValue = pFeat.Value(fieldNumber).ToString pRender.AddValue(codeValue, codeValue, pSymx) pFeat = pFtCs.NextFeature Loop pGftl.Renderer = pRender 'Fire contents changed event that the TOCControl listens to ShowAxMap.ActiveView.ContentsChanged() ShowAxMap.Refresh(esriViewDrawPhase.esriViewGeography, Nothing, Nothing) End Sub
|
|
1楼#
发布于:2007-05-18 21:28
没人帮我?
|
|