Exemple #1
0
        private void OnGraphicComplete(object sender, GraphicEventArgs e)
        {
            _graphicBuilder.GraphicCancelled -= OnGraphicCancelled;
            _graphicBuilder.GraphicComplete  -= OnGraphicComplete;
            _graphicBuilder = null;

            if (_primitiveGraphic != null)
            {
                bool boundingBoxTooSmall = false;
                _primitiveGraphic.CoordinateSystem = CoordinateSystem.Destination;
                if (_primitiveGraphic.BoundingBox.Width < 50 || _primitiveGraphic.BoundingBox.Height < 50)
                {
                    boundingBoxTooSmall = true;
                }
                _primitiveGraphic.ResetCoordinateSystem();

                if (boundingBoxTooSmall)
                {
                    RemoveDrawShutterGraphic();
                    base.SelectedPresentationImage.Draw();
                }
                else
                {
                    GeometricShutter         shutter         = ConvertToGeometricShutter();
                    GeometricShuttersGraphic shuttersGraphic =
                        GetGeometricShuttersGraphic((IDicomPresentationImage)base.SelectedPresentationImage);
                    DrawableUndoableCommand command = new DrawableUndoableCommand(shuttersGraphic);
                    command.Name = SR.CommandDrawShutter;
                    command.Enqueue(new AddGeometricShutterUndoableCommand(shuttersGraphic, shutter));
                    command.Execute();

                    base.ImageViewer.CommandHistory.AddCommand(command);
                }
            }
        }
Exemple #2
0
        public override bool Stop(IMouseInformation mouseInformation)
        {
            if (!Enabled)
            {
                return(false);
            }

            if (_graphicBuilder != null && _graphicBuilder.Stop(mouseInformation))
            {
                _primitiveGraphic.Draw();
                return(true);
            }

            if (_graphicBuilder == null && _primitiveGraphic != null)
            {
                bool boundingBoxTooSmall = false;
                _primitiveGraphic.CoordinateSystem = CoordinateSystem.Destination;
                if (_primitiveGraphic.BoundingBox.Width < 50 || _primitiveGraphic.BoundingBox.Height < 50)
                {
                    boundingBoxTooSmall = true;
                }
                _primitiveGraphic.ResetCoordinateSystem();

                if (boundingBoxTooSmall)
                {
                    RemoveDrawShutterGraphic();
                    base.SelectedPresentationImage.Draw();
                }
                else
                {
                    GeometricShutter         shutter         = ConvertToGeometricShutter();
                    GeometricShuttersGraphic shuttersGraphic =
                        GetGeometricShuttersGraphic((IDicomPresentationImage)base.SelectedPresentationImage);
                    DrawableUndoableCommand command = new DrawableUndoableCommand(shuttersGraphic);
                    command.Name = SR.CommandDrawShutter;
                    command.Enqueue(new AddGeometricShutterUndoableCommand(shuttersGraphic, shutter));
                    command.Execute();

                    base.ImageViewer.CommandHistory.AddCommand(command);
                }
            }

            return(false);
        }
		internal void AddDicomShutter(GeometricShutter dicomShutter)
		{
			_dicomShutters.Add(dicomShutter);
			Invalidate();
		}
 /// <summary>
 /// Constructs a new <see cref="RemoveGeometricShutterUndoableCommand"/>.
 /// </summary>
 /// <param name="parent">The parent <see cref="GeometricShuttersGraphic"/>.</param>
 /// <param name="shutter">The <see cref="GeometricShutter"/> to add to <paramref name="parent"/>.</param>
 public RemoveGeometricShutterUndoableCommand(GeometricShuttersGraphic parent, GeometricShutter shutter)
 {
     _parent  = parent;
     _shutter = shutter;
 }
		/// <summary>
		/// Constructs a new <see cref="RemoveGeometricShutterUndoableCommand"/>.
		/// </summary>
		/// <param name="parent">The parent <see cref="GeometricShuttersGraphic"/>.</param>
		/// <param name="shutter">The <see cref="GeometricShutter"/> to add to <paramref name="parent"/>.</param>
		public RemoveGeometricShutterUndoableCommand(GeometricShuttersGraphic parent, GeometricShutter shutter)
		{
			_parent = parent;
			_shutter = shutter;
		}