コード例 #1
0
        /// <summary>
        /// Cell by cell op using using a RASTERIZED VECTOR for some purpose
        /// </summary>
        /// <param name="rRasters"></param>
        /// <param name="rPolygonMask"></param>
        /// <param name="vPolygonMask"></param>
        /// <param name="rOutputRasters"></param>
        public CellByCellOperator(List <Raster> rRasters, VectorRaster rPolygonMask, List <Raster> rOutputRasters = null) :
            base(rRasters, rOutputRasters)
        {
            _hasVectorPolymask     = false;
            _hasRasterizedPolymask = true;

            // Make sure we add the rasterized vector as the last item we can look up
            AddInputRaster(rPolygonMask);
        }
コード例 #2
0
ファイル: GetChangeStats.cs プロジェクト: tarinishukla/gcd
        /// <summary>
        /// This is the Budget Seggregation with propError Constructor using a raster mask
        /// </summary>
        /// <param name="rInput"></param>
        /// <param name="rPropError"></param>
        /// <param name="theStats"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetChangeStats(Raster rInput, Raster rPropError, DoDStats theStats,
                              VectorRaster rPolygonMask, string FieldName) :
            base(new List <Raster> {
            rInput, rPropError
        }, rPolygonMask)
        {
            Stats    = theStats;
            SegStats = new Dictionary <string, DoDStats>();

            _rasterVectorFieldVals = rPolygonMask.FieldValues;
        }
コード例 #3
0
 /// <summary>
 /// Pass in a rasterized vector mask
 /// </summary>
 /// <param name="otType"></param>
 /// <param name="rInputA"></param>
 /// <param name="rInputB"></param>
 /// <param name="rPolymask"></param>
 /// <param name="rOutputRaster"></param>
 public RasterMath(RasterOperators.MathOpType otType, Raster rInputA,
                   Raster rInputB, VectorRaster rPolymask, Raster rOutputRaster) :
     base(new List <Raster> {
     rInputA, rInputB
 }, rPolymask, new List <Raster> {
     rOutputRaster
 })
 {
     _type   = otType;
     _scalar = false;
 }
コード例 #4
0
        /// <summary>
        /// Budget Seggregation Constructor with RASTERized vector mask
        /// </summary>
        /// <param name="rDod"></param>
        /// <param name="rErr"></param>
        /// <param name="theStats"></param>
        /// <param name="rPolymask"></param>
        /// <param name="vPolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetDoDPropStats(Raster rDod, Raster rErr, DoDStats theStats, VectorRaster rPolymask,
                               string FieldName) :
            base(new List <Raster> {
            rDod, rErr
        }, rPolymask)
        {
            Stats      = theStats;
            SegStats   = new Dictionary <string, DoDStats>();
            _fieldname = FieldName;

            _rasterVectorFieldVals = rPolymask.FieldValues;
        }
コード例 #5
0
        /// <summary>
        /// Rasterized Vector Budget Seggregation constructor
        /// </summary>
        /// <param name="rawDoD"></param>
        /// <param name="thrDoD"></param>
        /// <param name="thresh"></param>
        /// <param name="theStats"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetDodMinLodStats(Raster rawDoD,
                                 decimal thresh, DoDStats theStats, VectorRaster rPolymask, string FieldName) :
            base(new List <Raster> {
            rawDoD
        }, rPolymask)
        {
            Stats    = theStats;
            _thresh  = (double)thresh;
            SegStats = new Dictionary <string, DoDStats>();

            _rasterVectorFieldVals = rPolymask.FieldValues;
        }
コード例 #6
0
        /// <summary>
        /// Multi-method Constructor (Rasterized Vector Method)
        /// </summary>
        /// <param name="rawDEM"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="MaskFieldName"></param>
        /// <param name="props"></param>
        /// <param name="rOutputRaster"></param>
        public CreateErrorRaster(Raster rawDEM, VectorRaster rPolygonMask, string MaskFieldName,
                                 Dictionary <string, ErrorRasterProperties> props, Raster rOutputRaster) :
            base(new List <Raster> {
            rawDEM
        }, rPolygonMask, new List <Raster> {
            rOutputRaster
        })
        {
            _initMultiMethod(MaskFieldName, props);

            _rasterVectorFieldVals = rPolygonMask.FieldValues;
        }
コード例 #7
0
ファイル: BinRaster.cs プロジェクト: tarinishukla/gcd
        /// <summary>
        /// Budget Seggregation constructor using a RASTERIZED vector
        /// </summary>
        /// <param name="rInput"></param>
        /// <param name="numBins"></param>
        /// <param name="rPolymask"></param>
        /// <param name="vPolygonMask"></param>
        /// <param name="FieldName"></param>
        public BinRaster(Raster rInput, int numBins, VectorRaster rPolymask,
                         string FieldName) :
            base(new List <Raster> {
            rInput
        }, rPolymask)
        {
            SegHistograms = new Dictionary <string, Histogram>();
            _fieldname    = FieldName;
            _segNumBins   = numBins;

            _rasterVectorFieldVals = rPolymask.FieldValues;
        }
コード例 #8
0
ファイル: GetChangeStats.cs プロジェクト: tarinishukla/gcd
        /// <summary>
        /// Budget Seggregation constructor using a raster mask
        /// </summary>
        /// <param name="rInput"></param>
        /// <param name="theStats"></param>
        /// <param name="PolygonMask"></param>
        /// <param name="FieldName"></param>
        public GetChangeStats(Raster rInput, DoDStats theStats, VectorRaster rPolygonMask,
                              string FieldName) :
            base(new List <Raster> {
            rInput
        }, rPolygonMask)
        {
            // Note how we don't pass the vector into the base. We're not going to do anything
            // with the geometry of the shapefile.
            Stats    = theStats;
            SegStats = new Dictionary <string, DoDStats>();

            _rasterVectorFieldVals = rPolygonMask.FieldValues;
        }
コード例 #9
0
ファイル: VectorRasterTests.cs プロジェクト: tarinishukla/gcd
        public void RasterizeTest()
        {
            Raster rTemplate        = new Raster(new FileInfo(DirHelpers.GetTestRootPath(@"VerificationProject\inputs\2005DecDEM\2005DecDEM.tif")));
            Vector vPolyMaskSimple  = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_SimpleGCDMask.shp")));
            Vector vPolyMaskComplex = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_ComplexGCDMask.shp")));

            using (ITempDir tmp = TempDir.Create())
            {
                VectorRaster.Rasterize(vPolyMaskComplex, new Raster(rTemplate, new FileInfo(Path.Combine(tmp.Name, "Complex.tif"))));
                VectorRaster.Rasterize(vPolyMaskSimple, new Raster(rTemplate, new FileInfo(Path.Combine(tmp.Name, "Simple.tif"))));

                Debug.WriteLine(tmp.Name);
            }
        }
コード例 #10
0
ファイル: VectorRasterTests.cs プロジェクト: tarinishukla/gcd
        public void VectorRasterTest()
        {
            Raster rTemplate        = new Raster(new FileInfo(DirHelpers.GetTestRootPath(@"VerificationProject\inputs\2005DecDEM\2005DecDEM.tif")));
            Vector vPolyMaskSimple  = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_SimpleGCDMask.shp")));
            Vector vPolyMaskComplex = new Vector(new FileInfo(DirHelpers.GetTestRootPath(@"SulphurGCDMASK\Sulphur_ComplexGCDMask.shp")));


            using (ITempDir tmp = TempDir.Create())
            {
                FileInfo fiPolyMaskSimpleCOPY  = new FileInfo(Path.Combine(tmp.Name, "Sulphur_SimpleGCDMask.shp"));
                FileInfo fiPolyMaskComplexCOPY = new FileInfo(Path.Combine(tmp.Name, "Sulphur_ComplexGCDMask.shp"));

                vPolyMaskSimple.Copy(fiPolyMaskSimpleCOPY);
                vPolyMaskComplex.Copy(fiPolyMaskComplexCOPY);

                Vector vPolyMaskSimpleCOPY  = new Vector(fiPolyMaskSimpleCOPY);
                Vector vPolyMaskComplexCOPY = new Vector(fiPolyMaskComplexCOPY);

                List <string> times = new List <string> {
                };
                var watch           = Stopwatch.StartNew();

                // Try with a numeric field
                watch.Restart();
                VectorRaster test1 = new VectorRaster(rTemplate, vPolyMaskComplexCOPY, "Category");
                string       time1 = string.Format("MyRasterizationTest1, , {0}.{1}", watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);

                // Try the same shape file with a string field
                watch.Restart();
                VectorRaster test2 = new VectorRaster(rTemplate, vPolyMaskComplexCOPY, "Desc_");
                string       time2 = string.Format("MyRasterizationTest1, , {0}.{1}", watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);

                // Now try a simpler shapefule with a string field
                watch.Restart();
                VectorRaster test3 = new VectorRaster(rTemplate, vPolyMaskSimpleCOPY, "Method");
                string       time3 = string.Format("MyRasterizationTest1, , {0}.{1}", watch.Elapsed.Seconds, watch.Elapsed.Milliseconds);

                Debug.WriteLine("");
                Debug.WriteLine(time1);
                Debug.WriteLine(time2);
                Debug.WriteLine(time3);
            }
        }