/// <summary>
        /// Cloning constructor.
        /// </summary>
        /// <param name="source">The source object from which to clone.</param>
        /// <param name="context">The cloning context object.</param>
        protected MammogramAnnotationLayoutProxy(MammogramAnnotationLayoutProxy source, ICloningContext context)
        {
            context.CloneFields(source, this);

            // clone the annotation boxes with their state!
            if (source._annotationBoxes != null)
            {
                var annotationBoxes = new Dictionary <object, AnnotationBox>();
                foreach (var sourceBox in source._annotationBoxes.Values)
                {
                    var cloneBox = (AnnotationBox)CloneBuilder.Clone(sourceBox);

                    // if the box has an item, use the item's identifier as the key
                    object key = cloneBox;
                    if (cloneBox.AnnotationItem != null)
                    {
                        key = cloneBox.AnnotationItem.GetIdentifier();

                        // if for some reason the key is a duplicate, use the box as the key (but keep it as part of the layout!)
                        if (annotationBoxes.ContainsKey(key))
                        {
                            key = cloneBox;
                        }
                    }
                    annotationBoxes.Add(key, cloneBox);
                }
                _annotationBoxes = annotationBoxes;
            }
        }
		/// <summary>
		/// Cloning constructor.
		/// </summary>
		/// <param name="source">The source object from which to clone.</param>
		/// <param name="context">The cloning context object.</param>
		protected MammogramAnnotationLayoutProxy(MammogramAnnotationLayoutProxy source, ICloningContext context)
		{
			context.CloneFields(source, this);

			// clone the annotation boxes with their state!
			if (source._annotationBoxes != null)
			{
				var annotationBoxes = new Dictionary<object, AnnotationBox>();
				foreach (var sourceBox in source._annotationBoxes.Values)
				{
					var cloneBox = (AnnotationBox) CloneBuilder.Clone(sourceBox);

					// if the box has an item, use the item's identifier as the key
					object key = cloneBox;
					if (cloneBox.AnnotationItem != null)
					{
						key = cloneBox.AnnotationItem.GetIdentifier();

						// if for some reason the key is a duplicate, use the box as the key (but keep it as part of the layout!)
						if (annotationBoxes.ContainsKey(key))
							key = cloneBox;
					}
					annotationBoxes.Add(key, cloneBox);
				}
				_annotationBoxes = annotationBoxes;
			}
		}
		/// <summary>
		/// Cloning constructor.
		/// </summary>
		/// <param name="source">The source object from which to clone.</param>
		/// <param name="context">The cloning context object.</param>
		protected MammogramAnnotationLayoutProxy(MammogramAnnotationLayoutProxy source, ICloningContext context)
		{
			context.CloneFields(source, this);

			// clone the annotation boxes with their state!
			if (source._annotationBoxes != null)
			{
				var annotationBoxes = new Dictionary<object, AnnotationBox>();
				foreach (var sourceBox in source._annotationBoxes.Values)
				{
					var cloneBox = (AnnotationBox) CloneBuilder.Clone(sourceBox);
					if (cloneBox.AnnotationItem != null)
						annotationBoxes.Add(cloneBox.AnnotationItem.GetIdentifier(), cloneBox);
					else
						annotationBoxes.Add(cloneBox, cloneBox);
				}
				_annotationBoxes = annotationBoxes;
			}
		}
Exemplo n.º 4
0
        /// <summary>
        /// Cloning constructor.
        /// </summary>
        /// <param name="source">The source object from which to clone.</param>
        /// <param name="context">The cloning context object.</param>
        protected MammogramAnnotationLayoutProxy(MammogramAnnotationLayoutProxy source, ICloningContext context)
        {
            context.CloneFields(source, this);

            // clone the annotation boxes with their state!
            if (source._annotationBoxes != null)
            {
                var annotationBoxes = new Dictionary <object, AnnotationBox>();
                foreach (var sourceBox in source._annotationBoxes.Values)
                {
                    var cloneBox = (AnnotationBox)CloneBuilder.Clone(sourceBox);
                    if (cloneBox.AnnotationItem != null)
                    {
                        annotationBoxes.Add(cloneBox.AnnotationItem.GetIdentifier(), cloneBox);
                    }
                    else
                    {
                        annotationBoxes.Add(cloneBox, cloneBox);
                    }
                }
                _annotationBoxes = annotationBoxes;
            }
        }