public void ActivateAsLayer(int index, string layerId)
            {
                OverlayPlaneGraphic overlay = _overlays[index];

                if (overlay != null)
                {
                    if (overlay.ParentGraphic is ShutterCollection)
                    {
                        ShutterCollection shutterCollection = (ShutterCollection)overlay.ParentGraphic;
                        shutterCollection.Deactivate(overlay);
                        shutterCollection.Graphics.Remove(overlay);
                    }

                    ILayer layer = _owner.Layers[layerId];
                    if (overlay.ParentGraphic is CompositeGraphic && overlay.ParentGraphic != layer)
                    {
                        ((CompositeGraphic)overlay.ParentGraphic).Graphics.Remove(overlay);
                    }
                    if (overlay.ParentGraphic == null)
                    {
                        layer.Graphics.Add(overlay);
                    }
                    overlay.Visible = true;
                }
            }
 public string GetLayer(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection.");
     if (overlay.ParentGraphic is ILayer && overlay.ParentGraphic.ParentGraphic == _owner.Layers)
     {
         return(((ILayer)overlay.ParentGraphic).Id);
     }
     return(null);
 }
 public void Add(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(CanAdd(overlay), "Overlay is already part of a different collection.");
     if (overlay.ParentGraphic == null)
     {
         _owner.Layers.InactiveLayer.Graphics.Add(overlay);
     }
     _overlays.Add(overlay);
 }
            public void Deactivate(int index)
            {
                OverlayPlaneGraphic overlay = _overlays[index];

                if (overlay != null)
                {
                    if (overlay.ParentGraphic == _owner.Shutters)
                    {
                        _owner.Shutters.Deactivate(overlay);
                    }
                    if (overlay.ParentGraphic is LayerGraphic && _owner._layers.Graphics.Contains(overlay.ParentGraphic))
                    {
                        ActivateAsLayer(index, string.Empty);
                    }
                }
            }
Esempio n. 5
0
            public void Deactivate(int index)
            {
                Platform.CheckArgumentRange(index, 0, 15, "index");
                OverlayPlaneGraphic overlay = _overlays[index];

                if (overlay != null)
                {
                    if (overlay.ParentGraphic == _owner.Shutters)
                    {
                        _owner.Shutters.Deactivate(overlay);
                    }
                    if (overlay.ParentGraphic is LayerGraphic && _owner._layers.Graphics.Contains(overlay.ParentGraphic))
                    {
                        this.ActivateAsLayer(index, string.Empty);
                    }
                }
            }
            public void ActivateAsShutter(int index)
            {
                OverlayPlaneGraphic overlay = _overlays[index];

                if (overlay != null)
                {
                    if (overlay.ParentGraphic is CompositeGraphic && overlay.ParentGraphic != _owner.Shutters)
                    {
                        ((CompositeGraphic)overlay.ParentGraphic).Graphics.Remove(overlay);
                    }
                    if (overlay.ParentGraphic == null)
                    {
                        _owner.Shutters.Add(overlay);
                    }
                    _owner.Shutters.Activate(overlay);
                }
                else
                {
                    _owner.Shutters.DeactivateAll();
                }
            }
            private bool CanAdd(OverlayPlaneGraphic overlay)
            {
                if (overlay.ParentGraphic == null)
                {
                    // The overlay has no current parent
                    return(true);
                }

                if (overlay.ParentGraphic is LayerGraphic)
                {
                    // The owning DicomGraphicsPlane should be the parent of the LayerCollection that is the parent of the LayerGraphic
                    return(overlay.ParentGraphic.ParentGraphic is LayerCollection && overlay.ParentGraphic.ParentGraphic.ParentGraphic == _owner);
                }

                if (overlay.ParentGraphic is ShutterCollection)
                {
                    // The owning DicomGraphicsPlane should be the parent of the ShutterCollection that is the parent of the overlay
                    return(overlay.ParentGraphic.ParentGraphic == _owner);
                }

                return(false);
            }
 public void ActivateAsShutter(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection.");
     ActivateAsShutter(_overlays.IndexOf(overlay));
 }
 public bool IsLayer(OverlayPlaneGraphic overlay)
 {
     return(!string.IsNullOrEmpty(GetLayer(overlay)));
 }
 public bool IsShutter(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection.");
     return(overlay.ParentGraphic == _owner.Shutters);
 }
 public bool Contains(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     return(_overlays.Contains(overlay));
 }
 public void Remove(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(_overlays.Contains(overlay), "Overlay must be part of collection.");
     _overlays.Remove(overlay);
 }
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 /// <param name="source">The source object from which to clone.</param>
 /// <param name="context">The cloning context object.</param>
 protected OverlayPlaneGraphic(OverlayPlaneGraphic source, ICloningContext context) : base()
 {
     context.CloneFields(source, this);
 }
Esempio n. 14
0
 public void Remove(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(_overlays[overlay.Index] == overlay, "Overlay must be part of collection.");
     _overlays[overlay.Index] = null;
 }
Esempio n. 15
0
 public void ActivateAsShutter(OverlayPlaneGraphic overlay)
 {
     Platform.CheckForNullReference(overlay, "overlay");
     Platform.CheckTrue(_overlays[overlay.Index] == overlay, "Overlay must be part of collection.");
     ActivateAsShutter(overlay.Index);
 }
 /// <summary>
 /// Cloning constructor.
 /// </summary>
 private ErrorOverlayPlaneGraphic(OverlayPlaneGraphic source, ICloningContext context)
     : base(source, context)
 {
 }