Quantcast
Channel: DotSpatial
Viewing all articles
Browse latest Browse all 3973

New Post: Purpose of this code in AssignLayerSymbologies?

$
0
0
In DotSpatial.Controls.Serialization Manager lines 260 - 262
ILineScheme newScheme = original.Clone() as ILineScheme;
original.CopyProperties(newScheme);
original.ResumeEvents();
Why are we cloning the original LineScheme, only to copy it back?
Each time this happens a significant Label redraw hit is taken.
Can somone explain exactly what and why this is done this way?
Full sub is below:
private void AssignLayerSymbologies(IMapFrame mapFrame)
{
    foreach (ILayer layer in mapFrame.GetAllLayers())
    {
        IMapLineLayer lineLayer = layer as IMapLineLayer;
        if (lineLayer != null)
        {
            ILineScheme original = lineLayer.Symbology;
            if (original != null)
            {
                ILineScheme newScheme = original.Clone() as ILineScheme;
                original.CopyProperties(newScheme);
                original.ResumeEvents();
            }
        }

        //to correctly draw categories:
        IMapFeatureLayer featureLayer = layer as IMapFeatureLayer;
        if (featureLayer != null)
        {
            if (featureLayer.Symbology.NumCategories > 1)
            {
                featureLayer.DataSet.FillAttributes();
                featureLayer.ApplyScheme(featureLayer.Symbology);
            }
        }
    }
}

Viewing all articles
Browse latest Browse all 3973

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>