Exemple #1
0
        // makes requested Graphic object selected
        private void SelectAimGraphic(IPresentationImage presentationImage, string aimUid)
        {
            IOverlayGraphicsProvider imageGraphicsProvider = presentationImage as IOverlayGraphicsProvider;

            if (imageGraphicsProvider != null)
            {
                foreach (IGraphic graphic in imageGraphicsProvider.OverlayGraphics)
                {
                    IAimGraphic aimGraphic = graphic as IAimGraphic;
                    if (aimGraphic != null && aimGraphic.AimAnnotation.UniqueIdentifier == aimUid)
                    {
                        IDecoratorGraphic decoratorGraphic = aimGraphic as IDecoratorGraphic;
                        if (decoratorGraphic != null)
                        {
                            presentationImage.SelectedGraphic = decoratorGraphic.DecoratedGraphic as ISelectableGraphic;
                            presentationImage.FocussedGraphic = decoratorGraphic.DecoratedGraphic as IFocussableGraphic;
                            if (presentationImage.SelectedGraphic != null)
                            {
                                presentationImage.SelectedGraphic.Selected = true;
                            }
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        // makes requested Graphic object selected
        private void SelectAimGraphic(IPresentationImage presentationImage, string aimUid)
        {
            IOverlayGraphicsProvider imageGraphicsProvider = presentationImage as IOverlayGraphicsProvider;

            if (imageGraphicsProvider != null)
            {
                bool isFound = false;
                foreach (IGraphic graphic in imageGraphicsProvider.OverlayGraphics)
                {
                    IAimGraphic aimGraphic = graphic as IAimGraphic;
                    if (aimGraphic != null && aimGraphic.AnnotationUid == aimUid)
                    {
                        IDecoratorGraphic decoratorGraphic = aimGraphic as IDecoratorGraphic;
                        if (decoratorGraphic != null)
                        {
                            presentationImage.SelectedGraphic = decoratorGraphic.DecoratedGraphic as ISelectableGraphic;
                            presentationImage.FocussedGraphic = decoratorGraphic.DecoratedGraphic as IFocussableGraphic;
                            if (presentationImage.SelectedGraphic != null)
                            {
                                presentationImage.SelectedGraphic.Selected = true;
                                isFound = true;
                            }
                            break;
                        }
                    }
                }
                if (!isFound)
                {
                    // Unselect current selection
                    if (presentationImage.SelectedGraphic != null)
                    {
                        presentationImage.SelectedGraphic.Selected = false;
                    }
                    presentationImage.SelectedGraphic = null;
                    presentationImage.FocussedGraphic = null;
                }
            }
        }