Exemplo n.º 1
0
        /// <summary>
        /// Overridden to clone the inner objects.
        /// </summary>
        /// <returns>A deep clone of the <see cref="Map"/> field.</returns>
        public override object Clone()
        {
            // base.Clone() sets Font, which causes OnPropertyChanged,
            // which in turn disposes the clone's - i.e. OUR - image.
            // So we want to stop this bespredel:
            var tmpImage = _image;

            _image = null;
            Map clone = (Map)base.Clone();

            clone._c1mapper     = new C1Mapper(clone);
            clone.MarkerStyles  = (MarkerStyleCollection)MarkerStyles.Clone(clone);
            clone.LineStyles    = (LineStyleCollection)LineStyles.Clone(clone);
            clone.KmlItemStyles = (KmlItemStyleCollection)KmlItemStyles.Clone(clone);
            clone.Layers        = (LayerCollection)Layers.Clone(clone);
            clone.Legends       = (LegendCollection)Legends.Clone(clone);
            _image = tmpImage;
            return(clone);
        }