Exemple #1
0
        /// <summary>Initializes a new instance of the <see cref="GridBlock_4Cuboid" /> class.</summary>
        /// <param name="parent">The parent.</param>
        /// <param name="onGridCreate">The on grid create.</param>
        /// <param name="onGridRowCreate">The on grid row create.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="macroRows">The macro rows.</param>
        /// <param name="macroCols">The child rows.</param>
        /// <param name="subRows">The sub rows.</param>
        /// <param name="subCols">The sub cols.</param>
        /// <param name="microRows">The micro rows.</param>
        /// <param name="microCols">The micro cols.</param>
        public GridBlock_4Cuboid(IGridBlock_Base parent, onGrid_CreateItem onGridCreate, onGrid_CreateItem onGridRowCreate,
                                 GridControl_Settings settings, int macroRows = 1, int macroCols = 1, int subRows = 5, int subCols = 5,
                                 int microRows = 5, int microCols = 5) : base(parent, 1, 1, settings)
        {
            Child_BlockType   = enGrid_BlockType.MacroBlock;
            Child_DisplayType = enGrid_BlockDisplayType.Address;
            Child_Cols        = macroCols;
            Child_Rows        = macroRows;

            onGridCreate?.Invoke(this, enGrid_BlockType.CuboidGrid);

            // Create the child objects
            int ii = 0;

            for (int row1 = 1; row1 <= macroRows; row1++)
            {
                Name_ChildRow = GridBlock_zMethods.Name_ChildRow(this, row1);
                onGridRowCreate?.Invoke(this, Child_BlockType);

                for (int col = 1; col <= macroCols; col++)
                {
                    ii++;
                    var grid = new GridBlock_3Macro(this, onGridCreate, onGridRowCreate, settings,
                                                    ii, row1, col,
                                                    subRows, subCols,
                                                    microRows, microCols);
                    _GridBlocksDictionary.Add(grid.Name_Address, grid);
                }
            }
            Child_Count = macroRows * macroCols * subRows * subCols * microRows * microCols;
        }
        /// <summary>Creates the micro grids.</summary>
        /// <param name="onGridCreate">The on grid create.</param>
        /// <param name="onGridRowCreate">The on grid row create.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="microRows">The micro rows.</param>
        /// <param name="microCols">The micro cols.</param>
        public void CreateMicroGrids(onGrid_CreateItem onGridCreate, onGrid_CreateItem onGridRowCreate,
                                     GridControl_Settings settings, int microRows, int microCols)
        {
            // Create the child objects
            // This can be optimised by only creating a child the momemnt it is neaded in Child_GridBlockGet
            int ii = 0;

            for (int row1 = 1; row1 <= microRows; row1++)
            {
                Name_ChildRow = GridBlock_zMethods.Name_ChildRow(this, row1);
                onGridRowCreate?.Invoke(this, Child_BlockType);

                for (int col1 = 1; col1 <= microCols; col1++)
                {
                    if (GetChild_GridBlock($"{row1}_{col1}", enGrid_BlockDisplayType.Address, false) == null)
                    {
                        // The childblock does not exists
                        ii++;
                        var grid = new GridBlock_1Micro(this, onGridCreate, settings, ii, col1, row1);
                        _GridBlocksDictionary.Add(grid.Name_Address, grid);
                    }
                }
            }
            Child_Count = microRows * microCols;
        }
Exemple #3
0
        /// <summary>Creates the sub grids.</summary>
        /// <param name="onGridCreate">The on grid create.</param>
        /// <param name="onGridRowCreate">The on grid row create.</param>
        /// <param name="settings">The settings.</param>
        /// <param name="subRows">The sub rows.</param>
        /// <param name="subCols">The sub cols.</param>
        /// <param name="microRows">The micro rows.</param>
        /// <param name="microCols">The micro cols.</param>
        public void CreateSubGrids(onGrid_CreateItem onGridCreate, onGrid_CreateItem onGridRowCreate,
                                   GridControl_Settings settings, int subRows, int subCols,
                                   int microRows, int microCols)
        {
            GridBlock_2Sub gridSub = null;
            int            ii      = 0;

            for (int row1 = 1; row1 <= subRows; row1++)
            {
                Name_ChildRow = GridBlock_zMethods.Name_ChildRow(this, row1);
                onGridRowCreate?.Invoke(this, Child_BlockType);

                for (int col1 = 1; col1 <= subCols; col1++)
                {
                    if (GetChild_GridBlock($"{row1}_{col1}", enGrid_BlockDisplayType.Address, false) == null)
                    {
                        // The childblock does not exists
                        ii++;
                        gridSub = new GridBlock_2Sub(this, onGridCreate, onGridRowCreate, settings, ii, row1, col1, microRows, microCols);
                        _GridBlocksDictionary.Add(gridSub.Name_Address, gridSub);
                    }
                }
            }
            Child_Count = subRows * subCols * microCols * microRows;
        }