/// <summary> /// Cloning constructor. /// </summary> /// <param name="source">The source object from which to clone.</param> /// <param name="context">The cloning context object.</param> protected GeometricShuttersGraphic(GeometricShuttersGraphic source, ICloningContext context) : this(source._imageRectangle.Height, source._imageRectangle.Width) { context.CloneFields(source, this); foreach (GeometricShutter shutter in source._customShutters) _customShutters.Add(shutter.Clone()); foreach (GeometricShutter shutter in source._dicomShutters) _dicomShutters.Add(shutter.Clone()); }
/// <summary> /// Cloning constructor. /// </summary> /// <param name="source">The source object from which to clone.</param> /// <param name="context">The cloning context object.</param> protected GeometricShuttersGraphic(GeometricShuttersGraphic source, ICloningContext context) : this(source._imageRectangle.Height, source._imageRectangle.Width) { context.CloneFields(source, this); foreach (GeometricShutter shutter in source._customShutters) { _customShutters.Add(shutter.Clone()); } foreach (GeometricShutter shutter in source._dicomShutters) { _dicomShutters.Add(shutter.Clone()); } }
internal static GeometricShuttersGraphic GetGeometricShuttersGraphic(IDicomPresentationImage image, bool createAsNecessary = false) { DicomGraphicsPlane dicomGraphicsPlane = DicomGraphicsPlane.GetDicomGraphicsPlane(image, createAsNecessary); if (dicomGraphicsPlane == null) return null; var geometricShuttersGraphic = (GeometricShuttersGraphic) CollectionUtils.SelectFirst(dicomGraphicsPlane.Shutters, shutter => shutter is GeometricShuttersGraphic); if (createAsNecessary && geometricShuttersGraphic == null) { dicomGraphicsPlane.Shutters.Add(geometricShuttersGraphic = new GeometricShuttersGraphic(image.Frame.Rows, image.Frame.Columns)); dicomGraphicsPlane.Shutters.Activate(geometricShuttersGraphic); } return geometricShuttersGraphic; }
/// <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; }