AnsweredAssumed Answered

Scale Dependent Renderer doesn't work

Question asked by geonetadmin on May 27, 2010
Latest reply on Jun 1, 2010 by geonetadmin
Original User: Nordberg1983

Hi all!

I have following issue:

I have a point feature class which I want to thin out scale dependently. For that I'm using the class IScaleDependentRenderer.

Please check the code below. The problem is that I don't see any symbols on the map after running that piece of code.

Any ideas?

Thanks!!!

 

            IFeatureLayer layer = _selectedLayer as IFeatureLayer;
            IScaleDependentRenderer renderer = new ScaleDependentRendererClass();           
            List<double> breaks = new List<double>();
            breaks.Add(500.0);
            breaks.Add(1000.0);
            breaks.Add(2000.0);
            breaks.Add(5000.0);  
     
            IGeoFeatureLayer geoFeatureLayer;
            geoFeatureLayer = (IGeoFeatureLayer)layer;  
            List<int> frequencySteps = _frequencySteps;               

                for (int i = 0; i < frequencySteps.Count; i++)
                {
                    IFeatureCursor featureCursor = pFeatureClass.Search(null, false);
                 
                    int sum = 1;
                    int freq = frequencySteps[i];
                    IFeature feature = featureCursor.NextFeature();
                    IFeatureIDSet exclusionSet = new FeatureIDSetClass();
                    ISimpleRenderer sRenderer = new SimpleRendererClass();
                    ISimpleMarkerSymbol sym = new SimpleMarkerSymbolClass();
                    sym.Style = esriSimpleMarkerStyle.esriSMSCircle;
                    sym.Size = 30;              
                    sRenderer.Symbol = (ISymbol)sym;
                    
                    IFeatureRenderer fRenderer = (IFeatureRenderer)sRenderer;

                    while (feature != null)
                    {
                        if (sum == freq)
                        {                           
                            sum = 1;                           
                        }
                        else
                        {
                            exclusionSet.Add(feature.OID);                         
                        }
                        sum++;
                        feature = featureCursor.NextFeature();
                    }

                    fRenderer.ExclusionSet = exclusionSet;
                    renderer.AddRenderer(fRenderer);
                    renderer.set_Break(i, breaks[i]);
                   
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);              
                    geoFeatureLayer.Renderer = (IFeatureRenderer)renderer;
                }
         
            

Attachments

Outcomes