Exemple #1
0
        public void AreaControlSet_Float_PixelWorldSizeMustBeGreaterThan0()
        {
            double siteModelCellsize = SubGridTreeConsts.DefaultCellSize;

            double pixelWorldSizeOrIntervalXY = 0;
            double userOriginXY   = 0;
            var    rotation       = Consts.NullDouble;
            var    areaControlSet = new AreaControlSet(false, pixelWorldSizeOrIntervalXY, pixelWorldSizeOrIntervalXY, userOriginXY, userOriginXY, rotation);

            double subGridWorldOriginX = 0;
            double subGridWorldOriginY = 0;
            var    assignmentContext   = new FilteredValueAssignmentContext();
            var    sieveFilterInUse    = GridRotationUtilities.ComputeSieveBitmaskFloat(subGridWorldOriginX, subGridWorldOriginY,
                                                                                        areaControlSet, siteModelCellsize, assignmentContext, out SubGridTreeBitmapSubGridBits _);

            Assert.False(sieveFilterInUse, "sieve filter should not have been generated for zero pixelWorldSize");
        }
Exemple #2
0
        public void AreaControlSet_Float_Unhappy_StepMustBeAtLeastCellSize()
        {
            double siteModelCellsize = SubGridTreeConsts.DefaultCellSize;

            // pixelWorldSizeOrInterval/siteModelCellsize will result in stepSize = 1
            double pixelWorldSizeOrIntervalXY = siteModelCellsize / 2;
            double userOriginXY   = 0;
            var    rotation       = Consts.NullDouble;
            var    areaControlSet = new AreaControlSet(false, pixelWorldSizeOrIntervalXY, pixelWorldSizeOrIntervalXY, userOriginXY, userOriginXY, rotation);

            double subGridWorldOriginX = 0;
            double subGridWorldOriginY = 0;
            var    assignmentContext   = new FilteredValueAssignmentContext();
            var    sieveFilterInUse    = GridRotationUtilities.ComputeSieveBitmaskFloat(subGridWorldOriginX, subGridWorldOriginY,
                                                                                        areaControlSet, siteModelCellsize, assignmentContext, out SubGridTreeBitmapSubGridBits _);

            Assert.False(sieveFilterInUse, "sieve filter should not have been generated where pixelWorldSize < siteModelCellSize");
        }
Exemple #3
0
        public void AreaControlSet_Float_Rotation()
        {
            double siteModelCellsize = SubGridTreeConsts.DefaultCellSize;

            double pixelWorldSizeOrIntervalXY = siteModelCellsize * 2;
            double userOriginXY   = 0;
            var    rotation       = 1.5708; // 90deg
            var    areaControlSet = new AreaControlSet(false, pixelWorldSizeOrIntervalXY, pixelWorldSizeOrIntervalXY, userOriginXY, userOriginXY, rotation);

            double subGridWorldOriginX = siteModelCellsize / 2;
            double subGridWorldOriginY = siteModelCellsize / 2;
            var    assignmentContext   = new FilteredValueAssignmentContext();
            var    sieveFilterInUse    = GridRotationUtilities.ComputeSieveBitmaskFloat(subGridWorldOriginX, subGridWorldOriginY,
                                                                                        areaControlSet, siteModelCellsize, assignmentContext, out SubGridTreeBitmapSubGridBits sieveBitmask);

            Assert.True(sieveFilterInUse, "sieve filter should have been generated");
            // 256/1024 set, first set at 0,0
            Assert.True(sieveBitmask.CountBits() == 256, $"Incorrect count of bits set. Expected 256 but got {sieveBitmask.CountBits()}");

            CheckProbePositions(assignmentContext.ProbePositions, false, 0.51, 0.68, 0.51, 0.68);
        }
Exemple #4
0
        public void AreaControlSet_Float_WorldOriginPriorToCenterCell00()
        {
            double siteModelCellsize = SubGridTreeConsts.DefaultCellSize;

            // for ComputeSieveFloat(): (differs to ComputeSieveInteger())
            //    subGridWorldOriginX is becomes the center of a cell
            //    i.e. 0,0 is seen as center of cell 1,1; cellsize/2 is ALSO seen at on cell 0,0
            double pixelWorldSizeOrIntervalXY = SubGridTreeConsts.DefaultCellSize * 2;
            double userOriginXY   = 0;
            var    rotation       = Consts.NullDouble;
            var    areaControlSet = new AreaControlSet(false, pixelWorldSizeOrIntervalXY, pixelWorldSizeOrIntervalXY, userOriginXY, userOriginXY, rotation);

            double subGridWorldOriginX = siteModelCellsize / 2;
            double subGridWorldOriginY = siteModelCellsize / 2;

            var assignmentContext = new FilteredValueAssignmentContext();
            var sieveFilterInUse  = GridRotationUtilities.ComputeSieveBitmaskFloat(subGridWorldOriginX, subGridWorldOriginY,
                                                                                   areaControlSet, siteModelCellsize, assignmentContext, out SubGridTreeBitmapSubGridBits sieveBitmask);

            Assert.True(sieveFilterInUse, "sieve filter should have been generated");
            // 256/1024 set, first set at 1,1
            Assert.True(sieveBitmask.CountBits() == 256, $"Incorrect count of bits set. Expected 256 but got {sieveBitmask.CountBits()}");

            var rowXActual   = sieveBitmask.RowToString(0);
            var rowXExpected = " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0";

            Assert.True(rowXExpected == rowXActual, "bitSet for row 0 is invalid");

            rowXActual = sieveBitmask.RowToString(2);
            Assert.True(rowXExpected == rowXActual, "bitSet for row 2 is invalid");

            rowXActual   = sieveBitmask.RowToString(1);
            rowXExpected = " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1";
            Assert.True(rowXExpected == rowXActual, "bitSet for row 1 is invalid");

            rowXActual = sieveBitmask.RowToString(3);
            Assert.True(rowXExpected == rowXActual, "bitSet for row 3 is invalid");
        }
Exemple #5
0
        public void AreaControlSet_Float_WorldOriginCenterCell00()
        {
            double siteModelCellsize = SubGridTreeConsts.DefaultCellSize;

            double pixelWorldSizeOrIntervalXY = siteModelCellsize * 2;
            double userOriginXY   = 0;
            var    rotation       = Consts.NullDouble;
            var    areaControlSet = new AreaControlSet(false, pixelWorldSizeOrIntervalXY, pixelWorldSizeOrIntervalXY, userOriginXY, userOriginXY, rotation);

            double subGridWorldOriginX = siteModelCellsize / 2;
            double subGridWorldOriginY = siteModelCellsize / 2;
            var    assignmentContext   = new FilteredValueAssignmentContext();
            var    sieveFilterInUse    = GridRotationUtilities.ComputeSieveBitmaskFloat(subGridWorldOriginX, subGridWorldOriginY,
                                                                                        areaControlSet, siteModelCellsize, assignmentContext, out SubGridTreeBitmapSubGridBits sieveBitmask);

            Assert.True(sieveFilterInUse, "sieve filter should have been generated");
            // 256/1024 set, first set at 0,0
            Assert.True(sieveBitmask.CountBits() == 256, $"Incorrect count of bits set. Expected 256 but got {sieveBitmask.CountBits()}");

            var rowXActual   = sieveBitmask.RowToString(0);
            var rowXExpected = " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0";

            Assert.True(rowXExpected == rowXActual, "bitSet for row 0 is invalid");

            rowXActual = sieveBitmask.RowToString(2);
            Assert.True(rowXExpected == rowXActual, "bitSet for row 2 is invalid");

            rowXActual   = sieveBitmask.RowToString(1);
            rowXExpected = " 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1";
            Assert.True(rowXExpected == rowXActual, "bitSet for row 1 is invalid");

            rowXActual = sieveBitmask.RowToString(3);
            Assert.True(rowXExpected == rowXActual, "bitSet for row 3 is invalid");

            Assert.True(Math.Abs(assignmentContext.ProbePositions[1, 1].XOffset - 0.51) < 0.001, "real world X offset for 1,1 is invalid");
            Assert.True(Math.Abs(assignmentContext.ProbePositions[1, 1].YOffset - 0.51) < 0.001, "real world Y offset for 1,1 is invalid");
        }
Exemple #6
0
        public void AreaControlSet_Float_UserOrigin()
        {
            double siteModelCellsize = SubGridTreeConsts.DefaultCellSize;

            double pixelWorldSizeOrIntervalXY = siteModelCellsize * 2;
            double userOriginXY   = 1000; // i.e. easting/northing // siteModelCellsize * 30;
            var    rotation       = Consts.NullDouble;
            var    areaControlSet = new AreaControlSet(false, pixelWorldSizeOrIntervalXY, pixelWorldSizeOrIntervalXY, userOriginXY, userOriginXY, rotation);

            double subGridWorldOriginX = siteModelCellsize / 2;
            double subGridWorldOriginY = siteModelCellsize / 2;
            var    assignmentContext   = new FilteredValueAssignmentContext();
            var    sieveFilterInUse    = GridRotationUtilities.ComputeSieveBitmaskFloat(subGridWorldOriginX, subGridWorldOriginY,
                                                                                        areaControlSet, siteModelCellsize, assignmentContext, out SubGridTreeBitmapSubGridBits sieveBitmask);

            Assert.True(sieveFilterInUse, "sieve filter should have been generated");
            // 256/1024 set, first set at 0,0
            Assert.True(sieveBitmask.CountBits() == 256, $"Incorrect count of bits set. Expected 256 but got {sieveBitmask.CountBits()}");

            var rowXActual   = sieveBitmask.RowToString(0);
            var rowXExpected = " 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0";

            Assert.True(rowXExpected == rowXActual, "bitSet for row 0 is invalid");

            rowXActual = sieveBitmask.RowToString(2);
            Assert.True(rowXExpected == rowXActual, "bitSet for row 2 is invalid");

            rowXActual   = sieveBitmask.RowToString(1);
            rowXExpected = " 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0";
            Assert.True(rowXExpected == rowXActual, "bitSet for row 1 is invalid");

            rowXActual = sieveBitmask.RowToString(3);
            Assert.True(rowXExpected == rowXActual, "bitSet for row 3 is invalid");

            CheckProbePositions(assignmentContext.ProbePositions, true, 0.23, 0.68, 0.23, 0.68);
        }