예제 #1
0
        public bool ReplaceBy(MedViewerCellBase cell)
        {
            bool needToRegisterMouseEvent = false;

            if (cell is FilmingLayoutCell)
            {
                needToRegisterMouseEvent = ReplaceBy(cell as FilmingLayoutCell);
            }
            if (cell is FilmingControlCell)
            {
                ReplaceBy(cell as FilmingControlCell);
            }
            return(needToRegisterMouseEvent);
        }
예제 #2
0
        public static McsfFilmViewport GetSelectedViewport(MedViewerCellBase selectedCellBase, List <McsfFilmViewport> viewportList)
        {
            try
            {
                Logger.LogFuncUp();

                var layoutCell = selectedCellBase as MedViewerLayoutCell;
                if (layoutCell != null && layoutCell.Control != null)
                {
                    if (layoutCell.Control.IsMouseOver)
                    {
                        if (layoutCell.Children == null || !layoutCell.Children.Any())
                        {
                            return(viewportList.FirstOrDefault(viewport => viewport.RootLayoutCell.Equals(layoutCell)));
                        }

                        foreach (var child in layoutCell.Children)
                        {
                            var subLayoutCell = child as MedViewerLayoutCell;
                            if (subLayoutCell != null)
                            {
                                var selectedFilmRegion = GetSelectedViewport(subLayoutCell, viewportList);
                                if (selectedFilmRegion != null)
                                {
                                    return(selectedFilmRegion);
                                }
                            }
                            else
                            {
                                foreach (var viewport in viewportList.Where(viewport => viewport.RootLayoutCell.Equals(layoutCell)))
                                {
                                    return(viewport);
                                }
                            }
                        }
                    }
                }

                Logger.LogFuncDown();
                return(null);
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
                //throw;
                return(null);
            }
        }
예제 #3
0
        private void GenerateAnnonationLayer(MedViewerCellBase layout, Grid grid)
        {
            if (layout is MedViewerControlCell) // leaf cell
            {
                var cell = layout as MedViewerControlCell;
                var btn  = new Button();
                //btn.Content = _count++;
                //grid.Children.Add(btn);
                FillAnnotationToGrid(cell, grid);
            }
            else if (layout is MedViewerLayoutCell) //layout cell
            {
                var root = layout as MedViewerLayoutCell;

                //Generate grid
                GenerateGrid(root, grid);

                //fill sub-grid to the grid
                FillSubAnnonationGrid(root, grid);
            }
        }
예제 #4
0
        public static int GetChildNodeCount(MedViewerCellBase cellBase)
        {
            var totalCount = 0;
            var layoutCell = cellBase as MedViewerLayoutCell;

            if (layoutCell != null)
            {
                totalCount += layoutCell.Rows * layoutCell.Columns;

                if (layoutCell.Children == null)
                {
                    totalCount += 1;
                }
                else
                {
                    totalCount += layoutCell.Children.Sum(child => GetChildNodeCount(child));
                    totalCount -= 1;
                }
            }

            return(totalCount);
        }