/// <summary> /// Clones the layer. /// </summary> /// <returns>cloned object</returns> public virtual object Clone() { //make sure you have a parameterless constructor to be cloneable var clone = (Layer)Activator.CreateInstance(GetType()); clone.Name = Name; clone.labelLayer = labelLayer != null ? (LabelLayer)labelLayer.Clone() : null; if (clone.LabelLayer != null) { clone.LabelLayer.Parent = clone; } clone.DataSource = DataSource; clone.Theme = theme != null ? (ITheme)theme.Clone() : null; clone.ThemeGroup = ThemeGroup; clone.CustomRenderers = CustomRenderers; clone.CoordinateTransformation = CoordinateTransformation; clone.Visible = Visible; clone.RenderOrder = RenderOrder; clone.Selectable = Selectable; clone.ReadOnly = ReadOnly; clone.CanBeRemovedByUser = canBeRemovedByUser; clone.ShowAttributeTable = ShowAttributeTable; clone.ShowInLegend = ShowInLegend; clone.ShowInTreeView = ShowInTreeView; clone.MinVisible = MinVisible; clone.MaxVisible = MaxVisible; clone.NameIsReadOnly = NameIsReadOnly; clone.AutoUpdateThemeOnDataSourceChanged = AutoUpdateThemeOnDataSourceChanged; if (LabelLayer != null) { clone.ShowLabels = ShowLabels; } return(clone); }