/// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         if (TextParameters != null)
         {
             hashCode = hashCode * 59 + TextParameters.GetHashCode();
         }
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Subject != null)
         {
             hashCode = hashCode * 59 + Subject.GetHashCode();
         }
         hashCode = hashCode * 59 + ShowBorder.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         hashCode = hashCode * 59 + StickyNoteIcon.GetHashCode();
         if (Author != null)
         {
             hashCode = hashCode * 59 + Author.GetHashCode();
         }
         if (Subject != null)
         {
             hashCode = hashCode * 59 + Subject.GetHashCode();
         }
         if (Content != null)
         {
             hashCode = hashCode * 59 + Content.GetHashCode();
         }
         hashCode = hashCode * 59 + OpenPopup.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         hashCode = hashCode * 59 + RubberStampIcon.GetHashCode();
         if (Title != null)
         {
             hashCode = hashCode * 59 + Title.GetHashCode();
         }
         if (Content != null)
         {
             hashCode = hashCode * 59 + Content.GetHashCode();
         }
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if RubberStampAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of RubberStampAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(RubberStampAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnnotationLayout == input.AnnotationLayout ||
                     (AnnotationLayout != null &&
                      AnnotationLayout.Equals(input.AnnotationLayout))
                     ) &&
                 (
                     RubberStampIcon == input.RubberStampIcon ||
                     RubberStampIcon.Equals(input.RubberStampIcon)
                 ) &&
                 (
                     Title == input.Title ||
                     (Title != null &&
                      Title.Equals(input.Title))
                 ) &&
                 (
                     Content == input.Content ||
                     (Content != null &&
                      Content.Equals(input.Content))
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
		private static AnnotationLayout CreateLayout(bool isVisible, params bool[] annotationBoxVisibility)
		{
			var layout = new AnnotationLayout {Visible = isVisible};
			if (annotationBoxVisibility != null)
				foreach (var visibility in annotationBoxVisibility)
					layout.AnnotationBoxes.Add(new AnnotationBox{ Visible = visibility });
		
			return layout;
		}
Beispiel #6
0
        private static AnnotationLayout CreateLayout(bool isVisible, params bool[] annotationBoxVisibility)
        {
            var layout = new AnnotationLayout {
                Visible = isVisible
            };

            if (annotationBoxVisibility != null)
            {
                foreach (var visibility in annotationBoxVisibility)
                {
                    layout.AnnotationBoxes.Add(new AnnotationBox {
                        Visible = visibility
                    });
                }
            }

            return(layout);
        }
        /// <summary>
        /// Returns true if StickyNoteAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of StickyNoteAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(StickyNoteAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnnotationLayout == input.AnnotationLayout ||
                     (AnnotationLayout != null &&
                      AnnotationLayout.Equals(input.AnnotationLayout))
                     ) &&
                 (
                     StickyNoteIcon == input.StickyNoteIcon ||
                     StickyNoteIcon.Equals(input.StickyNoteIcon)
                 ) &&
                 (
                     Author == input.Author ||
                     (Author != null &&
                      Author.Equals(input.Author))
                 ) &&
                 (
                     Subject == input.Subject ||
                     (Subject != null &&
                      Subject.Equals(input.Subject))
                 ) &&
                 (
                     Content == input.Content ||
                     (Content != null &&
                      Content.Equals(input.Content))
                 ) &&
                 (
                     OpenPopup == input.OpenPopup ||
                     OpenPopup.Equals(input.OpenPopup)
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
        private void HideOverlays()
        {
            if (_magnificationImage is IAnnotationLayoutProvider)
            {
                string                  magFactor = String.Format("{0:F1}x", ToolSettings.DefaultInstance.MagnificationFactor);
                AnnotationLayout        layout    = new AnnotationLayout();
                BasicTextAnnotationItem item      = new BasicTextAnnotationItem("mag", "mag", "mag", magFactor);
                AnnotationBox           box       = new AnnotationBox(new RectangleF(0.8F, 0F, .2F, .05F), item);
                box.Justification     = AnnotationBox.JustificationBehaviour.Right;
                box.VerticalAlignment = AnnotationBox.VerticalAlignmentBehaviour.Top;
                layout.AnnotationBoxes.Add(box);
                ((BasicPresentationImage)_magnificationImage).AnnotationLayout = layout;
            }

            if (_magnificationImage is IOverlayGraphicsProvider)
            {
                GraphicCollection graphics = ((IOverlayGraphicsProvider)_magnificationImage).OverlayGraphics;
                foreach (IGraphic graphic in graphics)
                {
                    graphic.Visible = false;
                }
            }

            if (_magnificationImage is IApplicationGraphicsProvider)
            {
                GraphicCollection graphics = ((IApplicationGraphicsProvider)_magnificationImage).ApplicationGraphics;
                foreach (IGraphic graphic in graphics)
                {
                    graphic.Visible = false;
                }
            }

            //we want the Dicom graphics to be visible (e.g. shutter and embedded overlays)

            //if (_magnificationImage is IDicomPresentationImage)
            //{
            //    GraphicCollection graphics = ((IDicomPresentationImage)_magnificationImage).DicomGraphics;
            //    foreach (IGraphic graphic in graphics)
            //        graphic.Visible = false;
            //}
        }
        /// <summary>
        /// Returns true if FreeTextAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of FreeTextAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(FreeTextAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnnotationLayout == input.AnnotationLayout ||
                     (AnnotationLayout != null &&
                      AnnotationLayout.Equals(input.AnnotationLayout))
                     ) &&
                 (
                     TextParameters == input.TextParameters ||
                     (TextParameters != null &&
                      TextParameters.Equals(input.TextParameters))
                 ) &&
                 (
                     Title == input.Title ||
                     (Title != null &&
                      Title.Equals(input.Title))
                 ) &&
                 (
                     Subject == input.Subject ||
                     (Subject != null &&
                      Subject.Equals(input.Subject))
                 ) &&
                 (
                     ShowBorder == input.ShowBorder ||
                     ShowBorder.Equals(input.ShowBorder)
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (AnnotationLayout != null)
         {
             hashCode = hashCode * 59 + AnnotationLayout.GetHashCode();
         }
         hashCode = hashCode * 59 + LinkType.GetHashCode();
         hashCode = hashCode * 59 + LinkPage.GetHashCode();
         if (LinkUri != null)
         {
             hashCode = hashCode * 59 + LinkUri.GetHashCode();
         }
         hashCode = hashCode * 59 + ShowBorder.GetHashCode();
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         return(hashCode);
     }
 }
        /// <summary>
        /// Returns true if SquareAndCircleAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of SquareAndCircleAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(SquareAndCircleAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnnotationLayout == input.AnnotationLayout ||
                     (AnnotationLayout != null &&
                      AnnotationLayout.Equals(input.AnnotationLayout))
                     ) &&
                 (
                     Title == input.Title ||
                     (Title != null &&
                      Title.Equals(input.Title))
                 ) &&
                 (
                     Content == input.Content ||
                     (Content != null &&
                      Content.Equals(input.Content))
                 ) &&
                 (
                     LineWidth == input.LineWidth ||
                     LineWidth.Equals(input.LineWidth)
                 ) &&
                 (
                     AbsoluteAnnotationLineWidth == input.AbsoluteAnnotationLineWidth ||
                     AbsoluteAnnotationLineWidth.Equals(input.AbsoluteAnnotationLineWidth)
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
        /// <summary>
        /// Returns true if LinkAnnotationParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of LinkAnnotationParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LinkAnnotationParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     AnnotationLayout == input.AnnotationLayout ||
                     (AnnotationLayout != null &&
                      AnnotationLayout.Equals(input.AnnotationLayout))
                     ) &&
                 (
                     LinkType == input.LinkType ||
                     LinkType.Equals(input.LinkType)
                 ) &&
                 (
                     LinkPage == input.LinkPage ||
                     LinkPage.Equals(input.LinkPage)
                 ) &&
                 (
                     LinkUri == input.LinkUri ||
                     (LinkUri != null &&
                      LinkUri.Equals(input.LinkUri))
                 ) &&
                 (
                     ShowBorder == input.ShowBorder ||
                     ShowBorder.Equals(input.ShowBorder)
                 ) &&
                 (
                     Color == input.Color ||
                     (Color != null &&
                      Color.Equals(input.Color))
                 ));
        }
		public AnnotationLayout Create()
		{
			AnnotationLayout layout = new AnnotationLayout();

			int numberOfBoxesPerQuadrant = 15;
			float boxheight = 1 / 32.0F;

			float x = 0F, y = 0F, dx = 0.5F, dy = boxheight;

			AnnotationBox newBox;
			AnnotationBox defaultBoxSettings = new AnnotationBox();
			defaultBoxSettings.Bold = true;
			defaultBoxSettings.Font = "Century Gothic";
			//TL
			for (int i = 0; i < numberOfBoxesPerQuadrant; ++i)
			{
				dx = (i > 0) ? 0.5F : 0.4F; //make room for directional markers.

				RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
				newBox = defaultBoxSettings.Clone();
				newBox.NormalizedRectangle = normalizedRectangle;
				newBox.AnnotationItem = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsTopLeft[i]);

				layout.AnnotationBoxes.Add(newBox);
				y += boxheight;
			}

			defaultBoxSettings = new AnnotationBox();
			defaultBoxSettings.Color = "OrangeRed";
			defaultBoxSettings.Font = "Century Gothic";
			defaultBoxSettings.Justification = AnnotationBox.JustificationBehaviour.Right;
			y = 0.0F;
			//TR
			for (int i = 0; i < numberOfBoxesPerQuadrant; ++i)
			{
				x = (i > 0) ? 0.5F : 0.6F; //make room for directional markers.
				dx = (i > 0) ? 0.5F : 0.4F; //make room for directional markers.

				RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
				newBox = defaultBoxSettings.Clone();
				newBox.NormalizedRectangle = normalizedRectangle;
				newBox.AnnotationItem = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsTopRight[i]);

				layout.AnnotationBoxes.Add(newBox);
				y += boxheight;
			}

			defaultBoxSettings = new AnnotationBox();
			defaultBoxSettings.Color = "Cyan";
			defaultBoxSettings.Font = "Century Gothic";
			x = 0F;
			y = 1.0F - boxheight;
			//BL
			for (int i = numberOfBoxesPerQuadrant - 1; i >= 0; --i)
			{
				dx = (i < (numberOfBoxesPerQuadrant - 1)) ? 0.5F : 0.4F; //make room for directional markers.

				RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
				newBox = defaultBoxSettings.Clone();
				newBox.NormalizedRectangle = normalizedRectangle;
				newBox.AnnotationItem = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsBottomLeft[i]);

				if (i < numberOfBoxesPerQuadrant - 4 && !String.IsNullOrEmpty(_AssignmentsBottomLeft[i]))
				{
					newBox.ConfigurationOptions = new AnnotationItemConfigurationOptions();
					newBox.ConfigurationOptions.ShowLabel = true;
				}

				layout.AnnotationBoxes.Add(newBox);
				y -= boxheight;
			}

			defaultBoxSettings = new AnnotationBox();
			defaultBoxSettings.Color = "Yellow";
			defaultBoxSettings.Font = "Century Gothic";
			defaultBoxSettings.NumberOfLines = 2;
			defaultBoxSettings.Justification = AnnotationBox.JustificationBehaviour.Right;

			y = 1.0F - boxheight;
			//BR
			for (int i = numberOfBoxesPerQuadrant - 1; i >= 0; --i)
			{
				x = (i < (numberOfBoxesPerQuadrant - 1)) ? 0.5F : 0.6F; //make room for directional markers.
				dx = (i < (numberOfBoxesPerQuadrant - 1)) ? 0.5F : 0.4F; //make room for directional markers.

				RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
				newBox = defaultBoxSettings.Clone();
				newBox.NormalizedRectangle = normalizedRectangle;
				newBox.AnnotationItem = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsBottomRight[i]);
				if (!String.IsNullOrEmpty(_AssignmentsBottomRight[i]))
					newBox.NumberOfLines = 2;

				layout.AnnotationBoxes.Add(newBox);
				y -= boxheight;
			}

			defaultBoxSettings = new AnnotationBox();
			defaultBoxSettings.Color = "White";
			defaultBoxSettings.Bold = true;
			defaultBoxSettings.Font = "Century Gothic";
			defaultBoxSettings.NumberOfLines = 1;

			newBox = defaultBoxSettings.Clone();
			CreateDirectionalMarkerBox(0.00F, (1F - boxheight) / 2F, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Left, "Presentation.DirectionalMarkers.Left", newBox);
			layout.AnnotationBoxes.Add(newBox);

			newBox = defaultBoxSettings.Clone();
			CreateDirectionalMarkerBox(0.90F, (1F - boxheight) / 2F, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Right, "Presentation.DirectionalMarkers.Right", newBox);
			layout.AnnotationBoxes.Add(newBox);

			newBox = defaultBoxSettings.Clone();
			CreateDirectionalMarkerBox(0.45F, 0F, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Center, "Presentation.DirectionalMarkers.Top", newBox);
			layout.AnnotationBoxes.Add(newBox);

			newBox = defaultBoxSettings.Clone();
			CreateDirectionalMarkerBox(0.45F, 1F - boxheight, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Center, "Presentation.DirectionalMarkers.Bottom", newBox);
			layout.AnnotationBoxes.Add(newBox);

			return layout;
		}
        public AnnotationLayout Create()
        {
            AnnotationLayout layout = new AnnotationLayout();

            int   numberOfBoxesPerQuadrant = 15;
            float boxheight = 1 / 32.0F;

            float x = 0F, y = 0F, dx = 0.5F, dy = boxheight;

            AnnotationBox newBox;
            AnnotationBox defaultBoxSettings = new AnnotationBox();

            defaultBoxSettings.Bold = true;
            defaultBoxSettings.Font = "Century Gothic";
            //TL
            for (int i = 0; i < numberOfBoxesPerQuadrant; ++i)
            {
                dx = (i > 0) ? 0.5F : 0.4F;                 //make room for directional markers.

                RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
                newBox = defaultBoxSettings.Clone();
                newBox.NormalizedRectangle = normalizedRectangle;
                newBox.AnnotationItem      = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsTopLeft[i]);

                layout.AnnotationBoxes.Add(newBox);
                y += boxheight;
            }

            defaultBoxSettings               = new AnnotationBox();
            defaultBoxSettings.Color         = "OrangeRed";
            defaultBoxSettings.Font          = "Century Gothic";
            defaultBoxSettings.Justification = AnnotationBox.JustificationBehaviour.Right;
            y = 0.0F;
            //TR
            for (int i = 0; i < numberOfBoxesPerQuadrant; ++i)
            {
                x  = (i > 0) ? 0.5F : 0.6F;                //make room for directional markers.
                dx = (i > 0) ? 0.5F : 0.4F;                //make room for directional markers.

                RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
                newBox = defaultBoxSettings.Clone();
                newBox.NormalizedRectangle = normalizedRectangle;
                newBox.AnnotationItem      = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsTopRight[i]);

                layout.AnnotationBoxes.Add(newBox);
                y += boxheight;
            }

            defaultBoxSettings       = new AnnotationBox();
            defaultBoxSettings.Color = "Cyan";
            defaultBoxSettings.Font  = "Century Gothic";
            x = 0F;
            y = 1.0F - boxheight;
            //BL
            for (int i = numberOfBoxesPerQuadrant - 1; i >= 0; --i)
            {
                dx = (i < (numberOfBoxesPerQuadrant - 1)) ? 0.5F : 0.4F;                 //make room for directional markers.

                RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
                newBox = defaultBoxSettings.Clone();
                newBox.NormalizedRectangle = normalizedRectangle;
                newBox.AnnotationItem      = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsBottomLeft[i]);

                if (i < numberOfBoxesPerQuadrant - 4 && !String.IsNullOrEmpty(_AssignmentsBottomLeft[i]))
                {
                    newBox.ConfigurationOptions           = new AnnotationItemConfigurationOptions();
                    newBox.ConfigurationOptions.ShowLabel = true;
                }

                layout.AnnotationBoxes.Add(newBox);
                y -= boxheight;
            }

            defaultBoxSettings               = new AnnotationBox();
            defaultBoxSettings.Color         = "Yellow";
            defaultBoxSettings.Font          = "Century Gothic";
            defaultBoxSettings.NumberOfLines = 2;
            defaultBoxSettings.Justification = AnnotationBox.JustificationBehaviour.Right;

            y = 1.0F - boxheight;
            //BR
            for (int i = numberOfBoxesPerQuadrant - 1; i >= 0; --i)
            {
                x  = (i < (numberOfBoxesPerQuadrant - 1)) ? 0.5F : 0.6F;                //make room for directional markers.
                dx = (i < (numberOfBoxesPerQuadrant - 1)) ? 0.5F : 0.4F;                //make room for directional markers.

                RectangleF normalizedRectangle = new RectangleF(x, y, dx, dy);
                newBox = defaultBoxSettings.Clone();
                newBox.NormalizedRectangle = normalizedRectangle;
                newBox.AnnotationItem      = AnnotationLayoutFactory.GetAnnotationItem(_AssignmentsBottomRight[i]);
                if (!String.IsNullOrEmpty(_AssignmentsBottomRight[i]))
                {
                    newBox.NumberOfLines = 2;
                }

                layout.AnnotationBoxes.Add(newBox);
                y -= boxheight;
            }

            defaultBoxSettings               = new AnnotationBox();
            defaultBoxSettings.Color         = "White";
            defaultBoxSettings.Bold          = true;
            defaultBoxSettings.Font          = "Century Gothic";
            defaultBoxSettings.NumberOfLines = 1;

            newBox = defaultBoxSettings.Clone();
            CreateDirectionalMarkerBox(0.00F, (1F - boxheight) / 2F, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Left, "Presentation.DirectionalMarkers.Left", newBox);
            layout.AnnotationBoxes.Add(newBox);

            newBox = defaultBoxSettings.Clone();
            CreateDirectionalMarkerBox(0.90F, (1F - boxheight) / 2F, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Right, "Presentation.DirectionalMarkers.Right", newBox);
            layout.AnnotationBoxes.Add(newBox);

            newBox = defaultBoxSettings.Clone();
            CreateDirectionalMarkerBox(0.45F, 0F, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Center, "Presentation.DirectionalMarkers.Top", newBox);
            layout.AnnotationBoxes.Add(newBox);

            newBox = defaultBoxSettings.Clone();
            CreateDirectionalMarkerBox(0.45F, 1F - boxheight, 0.1F, boxheight, AnnotationBox.JustificationBehaviour.Center, "Presentation.DirectionalMarkers.Bottom", newBox);
            layout.AnnotationBoxes.Add(newBox);

            return(layout);
        }