Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TerrainRow"/> class.
        /// </summary>
        /// <param name="box">The box.</param>
        /// <param name="rasterReference">The dynamic surface.</param>
        /// <param name="raster">= rasterDataset.CreateFullRaster()</param>
        /// <param name="resolution">The resolution.</param>
        /// <param name="testProgress">The test progress reporting instance.</param>
        internal RasterRow([NotNull] IEnvelope box,
                           [NotNull] RasterReference rasterReference,
                           [NotNull] IRaster raster,
                           double resolution,
                           [NotNull] ITestProgress testProgress)
        {
            Assert.ArgumentNotNull(box, nameof(box));
            Assert.ArgumentNotNull(rasterReference, nameof(box));
            Assert.ArgumentNotNull(raster, nameof(raster));
            Assert.ArgumentNotNull(testProgress, nameof(testProgress));

            Extent          = box;
            RasterReference = rasterReference;
            _raster         = raster;

            _testProgress = testProgress;
            DatasetName   = Assert.NotNull(rasterReference.RasterDataset.Name);
        }
Example #2
0
        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return(false);
            }

            if (ReferenceEquals(this, obj))
            {
                return(true);
            }

            if (obj.GetType() != GetType())
            {
                return(false);
            }

            RasterReference other = obj as RasterReference;

            return(other != null && EqualsCore(other));
        }
Example #3
0
 internal int GetRasterIndex([CanBeNull] RasterReference raster, int occurrence)
 {
     // TODO there are calls with null from TestContainer.ExecuteCore()
     return(GetIndex(raster, InvolvedRasters, occurrence, (x, y) => x.EqualsCore(y)));
 }
Example #4
0
        private ISimpleSurface GetRasterSurface(
            [NotNull] IRaster sourceRaster,
            [NotNull] IEnvelope box,
            [CanBeNull] out IDataset memoryRasterDataset)
        {
            // Remark:
            // surface values outside 'raster'.envelope (but within 'box') are 0

            Assert.ArgumentNotNull(sourceRaster, nameof(sourceRaster));
            Assert.ArgumentNotNull(box, nameof(box));

            IRasterFunction        rasterFunction    = new ClipFunctionClass();
            IClipFunctionArguments functionArguments = new ClipFunctionArgumentsClass();

            functionArguments.Raster = sourceRaster;

            IEnvelope clipBox = GetClipBox(box, sourceRaster);

            functionArguments.Extent           = clipBox;
            functionArguments.ClippingGeometry = clipBox;
            functionArguments.ClippingType     = esriRasterClippingType.esriRasterClippingOutside;

            IFunctionRasterDataset functionRasterDataset = new FunctionRasterDataset();

            functionRasterDataset.Init(rasterFunction, functionArguments);
            functionRasterDataset.RasterInfo.NoData = (float)-9999;

            // unsicher, wie die memory verwaltung ist

            // zum sicherstellen der memory-verwaltung
            // --> inmemory raster erstellen
            var            save   = (ISaveAs2)functionRasterDataset;
            IWorkspaceName wsName = WorkspaceUtils.CreateInMemoryWorkspace("raster");
            var            ws     = (IWorkspace)((IName)wsName).Open();

            save.SaveAs("clipped", ws, "MEM");

            IRasterDataset rasterDataset = ((IRasterWorkspace2)ws).OpenRasterDataset("clipped");

            IRaster rasterData = rasterDataset.CreateDefaultRaster();

            // Problems and workarounds for raster(-mosaic) data in surfaces
            // -------------------------------------------------------------
            //
            // Extent completly within footprint of mosaic dataset: -> no NoDataValues -> no problems
            // Extent partly within footprint of mosaic dataset : -> double.NaN returned for values outside footprint -> no problems (TODO: verifiy)
            // Extent completely outside footprint of mosaic dataset, but within extent of mosaic data set:
            //    0-values returned for Null-raster values
            //    workaround: ((IRasterProps) rasterData).NoDataValue = (float)0; works, if ((IRasterProps) raster).NoDataValue = null and no Height == 0
            //    workaround to test: use CustomPixelFilter (see https://github.com/Esri/arcobjects-sdk-community-samples/tree/master/Net/Raster/CustomNodataFilter/CSharp
            // Extent completely outside extent of mosaic dataset
            //    0-values returned for Null-raster values, rasterData.Height = 1, rasterData.Width = 1
            //    workaround 1: use custom RasterSurface class.
            //    workaround 2: ((IRasterProps) rasterData).NoDataValue = (float)0; works, if ((IRasterProps) raster).NoDataValue = null and no Height == 0

            memoryRasterDataset = (IDataset)rasterDataset;

            ISimpleSurface rasterSurface = RasterReference.CreateSurface(rasterData);

            return(rasterSurface);
        }
Example #5
0
 public abstract bool EqualsCore([NotNull] RasterReference rasterReference);