Beispiel #1
0
        public FilterConvolver(IConvolutionAccumulator <T> accumulator, double[,] filterMatrix, NullInfillMode nullInfillMode) : base(accumulator)
        {
            _infillNullValuesOnly = nullInfillMode == NullInfillMode.InfillNullValuesOnly;
            _updateNullValues     = nullInfillMode == NullInfillMode.InfillNullValuesOnly || _infillNullValuesOnly;

            FilterMatrix = filterMatrix;

            var majorDim = FilterMatrix.GetLength(0);
            var minorDim = FilterMatrix.GetLength(1);

            if (majorDim != minorDim)
            {
                throw new ArgumentException($"Major dimension ({majorDim}) and minor dimension ({minorDim}) of filterMatrix must be the same");
            }

            ContextSize = (ConvolutionMaskSize)majorDim;
        }
Beispiel #2
0
 public ElevationTreeSmoother(
     IConvolutionTools <float> convolutionTools, ConvolutionMaskSize contextSize, NullInfillMode nullInfillMode)
     : base(convolutionTools, contextSize,
            new ConvolutionAccumulator_Float(CellPassConsts.NullHeight, contextSize),
            (accum, cSize) => new MeanFilter <float>(accum, cSize, nullInfillMode))
 {
 }
Beispiel #3
0
        public async Task Test_CutFillTile_TAGFile_FlatDesign(ElevationSource elevationSource, bool useSmoothing, ConvolutionMaskSize maskSize, NullInfillMode nullInfillMode)
        {
            AddApplicationGridRouting();
            AddClusterComputeGridRouting();
            AddDesignProfilerGridRouting();

            _fixture.smoothingActive        = useSmoothing;
            _fixture.smootherMaskSize       = maskSize;
            _fixture.smootherNullInfillMode = nullInfillMode;

            // Construct a site model from a single TAG file
            var tagFiles  = new[] { Path.Combine(TestHelper.CommonTestDataPath, "TestTAGFile.tag") };
            var siteModel = DITAGFileAndSubGridRequestsFixture.BuildModel(tagFiles, out _);

            // Add a flat design to the site model at the minimum elevation in the site model

            var elevation = elevationSource switch
            {
                ElevationSource.MinimumElevation => (float)siteModel.SiteModelExtent.MinZ,
                ElevationSource.MaximumElevation => (float)siteModel.SiteModelExtent.MaxZ,
                _ => (float)siteModel.SiteModelExtent.MinZ
            };

            var designUid       = DITAGFileAndSubGridRequestsWithIgniteFixture.ConstructFlatTTMDesignEncompassingSiteModel(ref siteModel, elevation);
            var referenceDesign = new DesignOffset(designUid, 0.0);
            var palette         = PVMPaletteFactory.GetPalette(siteModel, DisplayMode.CutFill, siteModel.SiteModelExtent);
            var request         = new TileRenderRequest();
            var arg             = SimpleTileRequestArgument(siteModel, DisplayMode.CutFill, palette, volumeType: VolumeComputationType.BetweenFilterAndDesign);

            // Add the cut/fill design reference to the request, and set the rendering extents to the cell in question,
            // with an additional 1 meter border around the cell
            arg.ReferenceDesign = referenceDesign;
            arg.Extents         = siteModel.SiteModelExtent;
            arg.Extents.Expand(1.0, 1.0);

            var response = await request.ExecuteAsync(arg);

            var fileName = @$ "Flat-Elevation-{elevation}-Smoothing-{useSmoothing}-{maskSize}-{nullInfillMode}.bmp";
            var path     = Path.Combine("TestData", "RenderedTiles", "CutFillTile", fileName);

            var saveFileName = ""; // @$"C:\Temp\Flat-Elevation-{elevation}-Smoothing-{useSmoothing}-{maskSize}-{nullInfillMode}.bmp";

            CheckSimpleRenderTileResponse(response, DisplayMode.CutFill, saveFileName, path);
        }
Beispiel #4
0
 public WeightedMeanFilter(IConvolutionAccumulator <T> accumulator,
                           ConvolutionMaskSize contextSize, double centerWeight, NullInfillMode nullInfillMode)
     : base(accumulator, CreateFilter(contextSize, centerWeight), nullInfillMode)
 {
 }
Beispiel #5
0
 public MeanFilter(IConvolutionAccumulator <T> accumulator, double[,] filterMatrix, NullInfillMode nullInfillMode) : base(accumulator, filterMatrix, nullInfillMode)
 {
 }
Beispiel #6
0
 public MeanFilter(IConvolutionAccumulator <T> accumulator, ConvolutionMaskSize contextSize, NullInfillMode nullInfillMode) : base(accumulator, CreateFilter(contextSize, 1), nullInfillMode)
 {
 }