private Dictionary <String, List <AimGraphic> > GetAimUserGraphics() { Dictionary <String, List <AimGraphic> > userGraphics = new Dictionary <string, List <AimGraphic> >(); foreach (ImageBox imageBox in Context.Viewer.PhysicalWorkspace.ImageBoxes) { foreach (Tile tile in imageBox.Tiles) { IOverlayGraphicsProvider graphicsProvider = tile.PresentationImage as IOverlayGraphicsProvider; if (graphicsProvider != null) { foreach (IGraphic graphic in graphicsProvider.OverlayGraphics) { AimGraphic aimGraphic = graphic as AimGraphic; if (aimGraphic != null) { string user = aimGraphic.UserLoginName; if (!userGraphics.ContainsKey(user)) { userGraphics.Add(user, new List <AimGraphic>()); } userGraphics[user].Add(aimGraphic); } } } } } return(userGraphics); }
// Forces re-draw of displayed images if they have AIMGraphic private static void UpdateDisplayedImages(string loginName) { foreach (DesktopWindow desktopWindow in Application.DesktopWindows) { foreach (Workspace workspace in desktopWindow.Workspaces) { IImageViewer imageViewer = ImageViewerComponent.GetAsImageViewer(workspace); if (imageViewer != null) { foreach (ImageBox imageBox in imageViewer.PhysicalWorkspace.ImageBoxes) { foreach (Tile tile in imageBox.Tiles) { IOverlayGraphicsProvider graphicsProvider = tile.PresentationImage as IOverlayGraphicsProvider; if (graphicsProvider != null) { foreach (IGraphic graphic in graphicsProvider.OverlayGraphics) { AimGraphic aimGraphic = graphic as AimGraphic; if (aimGraphic != null && (string.IsNullOrEmpty(loginName) || string.Equals(loginName, aimGraphic.UserLoginName, StringComparison.InvariantCultureIgnoreCase))) { tile.PresentationImage.Draw(); break; } } } } } } } } }
// Returns currently displayed annotations' colors and associated user names private static Dictionary <string, Color> GetDisplayedUsersAndMarkupColors() { Dictionary <string, Color> displayedUserColors = new Dictionary <string, Color>(); IImageViewer imageViewer = ImageViewerComponent.GetAsImageViewer(Application.ActiveDesktopWindow.ActiveWorkspace); if (imageViewer != null) { foreach (ImageBox imageBox in imageViewer.PhysicalWorkspace.ImageBoxes) { foreach (Tile tile in imageBox.Tiles) { IOverlayGraphicsProvider graphicsProvider = tile.PresentationImage as IOverlayGraphicsProvider; if (graphicsProvider != null) { foreach (IGraphic graphic in graphicsProvider.OverlayGraphics) { AimGraphic aimGraphic = graphic as AimGraphic; if (aimGraphic != null) // && String.Equals(loginName, aimGraphic.UserLoginName, StringComparison.InvariantCultureIgnoreCase)) { if (!displayedUserColors.ContainsKey(aimGraphic.UserLoginName)) { displayedUserColors[aimGraphic.UserLoginName] = aimGraphic.Color; } } } } } } } return(displayedUserColors); }
private void OnImageDrawing(object sender, ImageDrawingEventArgs e) { if (e.PresentationImage != null) { IOverlayGraphicsProvider graphicsProvider = e.PresentationImage as IOverlayGraphicsProvider; if (graphicsProvider != null && graphicsProvider.OverlayGraphics != null) { AimSettings aimSettings = AimSettings.Default; foreach (IGraphic overlayGraphic in graphicsProvider.OverlayGraphics) { if (overlayGraphic is AimGraphic) { AimGraphic aimGraphic = (AimGraphic)overlayGraphic; string userName = aimGraphic.UserLoginName; aimGraphic.Visible = !_displayMarkupPerUser.ContainsKey(userName) || _displayMarkupPerUser[userName]; aimGraphic.Color = aimSettings.GetAimGraphicColorForUser(userName); } } } } }