Exemple #1
0
        public void Test_SubGrid_NodeSubgridProperties()
        {
            ISubGrid    nodeSubgrid = null;
            SubGridTree tree        = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>());

            // Create a new base subgrid node instance directly
            nodeSubgrid = new SubGrid(tree, null, SubGridTreeConsts.SubGridTreeLevels - 1);
            Assert.False(nodeSubgrid.IsLeafSubGrid());

            Assert.False(nodeSubgrid.Dirty);
            Assert.Equal(nodeSubgrid.Level, SubGridTreeConsts.SubGridTreeLevels - 1);

            // A subgrid one level above a leaf subgrid covers sqr(SubGridTreeConsts.SubGridTreeDimension) cells in each dimension (X & Y)
            Assert.Equal((int)nodeSubgrid.AxialCellCoverageByThisSubGrid(), SubGridTreeConsts.SubGridTreeCellsPerSubGrid);

            // A child subgrid of this parent should ahve an axial coverage of SubGridTreeConsts.SubGridTreeDimension cells in each dimension (X & Y)
            // (as there are SubGridTreeConsts.SubGridTreeDimension children cells in the X and Y dimensions
            Assert.Equal(nodeSubgrid.AxialCellCoverageByChildSubGrid(), SubGridTreeConsts.SubGridTreeDimension);
        }
Exemple #2
0
        public void Test_SubGrid_LeafSubgridProperties()
        {
            ISubGrid    leafSubgrid = null;
            SubGridTree tree        = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>());

            // Create a new base subgrid leaf instance directly
            leafSubgrid = new SubGrid(tree, null, SubGridTreeConsts.SubGridTreeLevels);

            Assert.True(leafSubgrid.IsLeafSubGrid());

            Assert.False(leafSubgrid.Dirty);
            Assert.Equal(leafSubgrid.Level, SubGridTreeConsts.SubGridTreeLevels);
            Assert.Equal(leafSubgrid.AxialCellCoverageByThisSubGrid(), SubGridTreeConsts.SubGridTreeDimension);

            Assert.Equal(0, leafSubgrid.OriginX);
            Assert.Equal(0, leafSubgrid.OriginY);
            Assert.Equal("0:0", leafSubgrid.Moniker());

            // Does the dirty flag change?
            leafSubgrid.SetDirty();
            Assert.True(leafSubgrid.Dirty, "Leaf sub grid is not marked as dirty after setting it to dirty");
        }