In DotSpatial.Controls.Serialization Manager lines 260 - 262
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:
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);
}
}
}
}