落地尘埃
路人甲
路人甲
  • 注册日期2005-04-19
  • 发帖数7
  • QQ
  • 铜币119枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1310回复:0

大家帮忙看看为什么专题图显示不出来?

楼主#
更多 发布于:2006-04-07 13:55
<P>private void thematic_display()<BR>        {<BR>            ILayer _Lyr = axMapControl1.get_Layer(0);<BR>            IFeatureLayer _FtrLyr = _Lyr as IFeatureLayer;<BR>            IGeoFeatureLayer _GeoFtrLyr = _Lyr as IGeoFeatureLayer;<BR>            <BR>            IFeatureClass _FtrCls = _FtrLyr.FeatureClass;<BR>            IQueryFilter _QFilter = new QueryFilterClass();<BR>            IFeatureCursor _FtrCurs = _FtrCls.Search(_QFilter,false);</P>
<P>            //make the color remp we will use for the symbols in the renderer<BR>            IRandomColorRamp _RCR = new RandomColorRampClass();<BR>            _RCR.MinSaturation =20;<BR>            _RCR.MaxSaturation =40;<BR>            _RCR.MinValue =85;<BR>            _RCR.MaxValue =100;<BR>            _RCR.StartHue = 76;<BR>            _RCR.EndHue = 188;<BR>            _RCR.UseSeed =true;<BR>            _RCR.Seed = 43;</P>
<P>            //make the renderer<BR>            IUniqueValueRenderer _UniqueValRen = new UniqueValueRendererClass();<BR>            ISimpleFillSymbol _SimpleFillSymbol = new SimpleFillSymbolClass();<BR>            _SimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;<BR>            _SimpleFillSymbol.Outline.Width = 1.2;</P>
<P>            //These properties should be set prior to adding values<BR>            _UniqueValRen.FieldCount = 1;<BR>            _UniqueValRen.set_Field(0, "JLS");<BR>            _UniqueValRen.DefaultSymbol = _SimpleFillSymbol as ISymbol; <BR>            _UniqueValRen.UseDefaultSymbol = true;</P>
<P>            IFeature _Ftr;<BR>            long ftrCount = _FtrCls.FeatureCount(_QFilter);<BR>            //Loop through the features<BR>            bool ValFound ;<BR>            IFields _Flds = _FtrCls.Fields;<BR>            long fieldIndex = _FtrCls.FindField("JLS");<BR>            int JLS = 0;<BR>            ILineSymbol _LineSymbol = new SimpleLineSymbolClass();<BR>            _LineSymbol.Width = 1.2;</P>
<P>            for (int i = 0; i < ftrCount; i++)<BR>            {<BR>                ISimpleFillSymbol _SimpleFillSymbol2 = new SimpleFillSymbolClass();<BR>                _SimpleFillSymbol2.Style = esriSimpleFillStyle.esriSFSSolid;</P>
<P>                _SimpleFillSymbol2.Outline=_LineSymbol;              </P>
<P>                _Ftr = _FtrCurs.NextFeature();<BR>                JLS = ((int) (_Ftr.get_Value((int)fieldIndex)));</P>
<P>                //Test to see if we've already added this value<BR>                //to the renderer, if not, then add it.<BR>                ValFound = false;<BR>                for (int j = 0; j < _UniqueValRen.ValueCount; j++)<BR>                {<BR>                    if (_UniqueValRen.get_Value(j) == JLS.ToString())<BR>                    {<BR>                        ValFound = true;<BR>                        break;<BR>                    }<BR>                }<BR>                if (ValFound == false)<BR>                {<BR>                    _UniqueValRen.AddValue(JLS.ToString(), "JLS", (_SimpleFillSymbol2 as ISymbol));<BR>                    _UniqueValRen.set_Label(JLS.ToString(), "JLS");<BR>                    //_UniqueValRen.set_Symbol(JLS.ToString(), _Symbol2);<BR>                    _UniqueValRen.set_Symbol(JLS.ToString(), (_SimpleFillSymbol2 as ISymbol));<BR>                }<BR>            }<BR>                <BR>            _RCR.Size = _UniqueValRen.ValueCount;     <BR>            bool state = true;<BR>            _RCR.CreateRamp(out state);<BR>            IEnumColors _EnumColors = _RCR.Colors;<BR>            _EnumColors.Reset();<BR>            for (int k = 0; k < _UniqueValRen.ValueCount; k++)<BR>            {<BR>                string JLS2 = _UniqueValRen.get_Value(k);<BR>                if (JLS2 != "")<BR>                {<BR>                    ISimpleFillSymbol _tmpSimpleFillSymbol =<BR>                            (_UniqueValRen.get_Symbol(JLS2) as ISimpleFillSymbol);<BR>                        _tmpSimpleFillSymbol.Color = _EnumColors.Ne();                                              <BR>                }<BR>            }</P>
<P>             //If you didn't use a color ramp that was predefined<BR>             //in a style, you need to use "Custom" here, otherwise<BR>             //use the name of the color ramp you chose.<BR>            _UniqueValRen.ColorScheme = "Custom";<BR>            _GeoFtrLyr.Renderer = _UniqueValRen as IFeatureRenderer;<BR>            _GeoFtrLyr.DisplayField = "JLS";<BR>                </P>
<P>            axMapControl1.ActiveView.Refresh();<BR>        }</P>
<P>这个函数是要为图层上的点图元生成专题图,可是调用以后,图上得点图元的symbol消失了,高手能不能给点指点</P>
喜欢0 评分0
游客

返回顶部