Beispiel #1
0
        private void FillSubAnnonationGrid(MedViewerLayoutCell root, Grid grid)
        {
            Debug.Assert(root != null);
            Debug.Assert(grid != null);

            int rows     = root.Rows;
            int columns  = root.Columns;
            var cellIter = root.Children.GetEnumerator();

            for (int r = 0; r < rows; r++)
            {
                for (int c = 0; c < columns; c++)
                {
                    if (!cellIter.MoveNext())
                    {
                        return;
                    }
                    var childGrid = new Grid();
                    Grid.SetRow(childGrid, r);
                    Grid.SetColumn(childGrid, c);
                    grid.Children.Add(childGrid);

                    GenerateAnnonationLayer(cellIter.Current, childGrid);
                }
            }
        }
Beispiel #2
0
        public static void SelectCellsOfLayoutCell(MedViewerLayoutCell layoutCell, bool isSelected)
        {
            if (layoutCell == null || layoutCell.Children == null)
            {
                return;
            }

            foreach (var child in layoutCell.Children)
            {
                var subLayoutCell = child as MedViewerLayoutCell;
                if (subLayoutCell != null)
                {
                    SelectCellsOfLayoutCell(subLayoutCell, isSelected);
                }
                else
                {
                    var cell = child as MedViewerControlCell;
                    if (cell != null && cell.IsSelected != isSelected)
                    {
                        cell.IsSelected = isSelected;
                    }
                    // if(cell != null && cell.IsHoldedByAction) cell.ForceEndAction();
                }
            }
        }
Beispiel #3
0
        public static List <MedViewerControlCell> GetCellsOfLayoutCell(MedViewerLayoutCell layoutCell)
        {
            var cells = new List <MedViewerControlCell>();

            if (layoutCell == null || layoutCell.Children == null)
            {
                return(cells);
            }

            foreach (var child in layoutCell.Children)
            {
                var subLayoutCell = child as MedViewerLayoutCell;
                if (subLayoutCell != null)
                {
                    cells.AddRange(GetCellsOfLayoutCell(subLayoutCell));
                }
                else
                {
                    var cell = child as MedViewerControlCell;
                    if (cell != null)
                    {
                        cells.Add(cell);
                    }
                }
            }

            return(cells);
        }
Beispiel #4
0
        public McsfFilmViewport(MedViewerLayoutCell rootLayoutCell, bool isInRegularLayout = false)
        {
            RootLayoutCell = rootLayoutCell;

            _isInRegularLayout = isInRegularLayout;

            _cellLayout = new FilmLayout(rootLayoutCell.Rows, rootLayoutCell.Columns);
        }
Beispiel #5
0
        /// <summary>
        /// change a selected cell to layout cell,the selected cell will hold.
        /// </summary>
        /// <param name="replacedCell">the cell which will be replaced to layout cell</param>
        /// <param name="multiFormatLayout">the new layout cell's layout</param>
        /// <returns>the new layout cell</returns>
        public static MedViewerLayoutCell InsertMultiFormatToCell(MedViewerControlCell replacedCell, FilmLayout multiFormatLayout)
        {
            try
            {
                if (multiFormatLayout == null)
                {
                    Logger.LogError("The multiFormatLayout can not be NULL!");
                    return(null);
                }

                if (multiFormatLayout.LayoutType != LayoutTypeEnum.StandardLayout)
                {
                    Logger.LogError("MultiFormat Cell don't support defined layout, just standard layout!");
                    return(null);
                }

                if (replacedCell == null)
                {
                    Logger.LogError("The cell will be replaced is NULL!");
                    return(null);
                }

                var parentLayoutCell = replacedCell.ParentCell as MedViewerLayoutCell;
                if (parentLayoutCell != null)
                {
                    var newMultiLayoutCell = new MedViewerLayoutCell
                    {
                        Rows    = multiFormatLayout.LayoutRowsSize,
                        Columns = multiFormatLayout.LayoutColumnsSize
                    };

                    //NOTE: don't specify the cell index, need the parent child index of this cell.
                    var replacedCellIndex = parentLayoutCell.Children.ToList().IndexOf(replacedCell);
                    parentLayoutCell.ReplaceCell(newMultiLayoutCell, replacedCellIndex);
                    newMultiLayoutCell.AddCell(replacedCell);

                    parentLayoutCell.Refresh();

                    return(newMultiLayoutCell);
                }

                Logger.LogError("The cell will be replaced parent is NULL!");
                return(null);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.StackTrace);
                throw;
            }
        }
Beispiel #6
0
        private void GenerateGrid(MedViewerLayoutCell root, Grid grid)
        {
            Debug.Assert(root != null);
            Debug.Assert(grid != null);


            int rows    = root.Rows;
            int columns = root.Columns;

            for (int i = 0; i < rows; i++)
            {
                grid.RowDefinitions.Add(new RowDefinition());
            }
            for (int j = 0; j < columns; j++)
            {
                grid.ColumnDefinitions.Add(new ColumnDefinition());
            }
        }