Пример #1
0
 private StatResultItem[] CountByLandRaster(IRasterDataProvider raster)
 {
     using (IRasterDictionaryTemplate <byte> temp = RasterDictionaryTemplateFactory.CreateLandRasterTemplate())
     {
         Dictionary <byte, string> paris = temp.CodeNameParis;
         if (paris == null)
         {
             return(null);
         }
         List <StatResultItem> items = new List <StatResultItem>();
         int[]  aoi;
         double totalArea;
         foreach (string value in paris.Values)
         {
             aoi = temp.GetAOI(value, raster.CoordEnvelope.MinX, raster.CoordEnvelope.MaxX, raster.CoordEnvelope.MinY, raster.CoordEnvelope.MaxY, new Size(raster.Width, raster.Height));
             if (aoi == null)
             {
                 continue;
             }
             totalArea = GetTotalArea(raster, aoi);
             if (totalArea == 0)
             {
                 continue;
             }
             StatResultItem it = new StatResultItem();
             it.Name  = value;
             it.Value = totalArea / _dayCount;
             items.Add(it);
         }
         return(items != null?items.ToArray() : null);
     }
 }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            IRasterDictionaryTemplate <int> temp = RasterDictionaryTemplateFactory.GetXjRasterTemplate();

            aoi = temp.GetAOI("北京市", 114, 124, 36, 46, new Size(1000, 1000));
            //temp.CodeNameParis
            name = temp.GetPixelName(114d, 39d);
        }
Пример #3
0
        private StatResultItem[] CountByLandRaster(IRasterDataProvider raster, Func <T, int, int> weight)
        {
            IRasterDictionaryTemplate <byte> temp  = RasterDictionaryTemplateFactory.CreateLandRasterTemplate();
            Dictionary <byte, string>        paris = temp.CodeNameParis;

            if (paris == null)
            {
                return(null);
            }
            double lon = raster.CoordEnvelope.Center.X;
            double lat = raster.CoordEnvelope.Center.Y;
            IRasterOperator <T>   oper  = new RasterOperator <T>();
            List <StatResultItem> items = new List <StatResultItem>();

            int[] aoi;
            int   count;

            foreach (string value in paris.Values)
            {
                aoi = temp.GetAOI(value, raster.CoordEnvelope.MinX, raster.CoordEnvelope.MaxX, raster.CoordEnvelope.MinY, raster.CoordEnvelope.MaxY, new Size(raster.Width, raster.Height));
                if (aoi == null)
                {
                    continue;
                }
                count = oper.Count(raster, aoi, weight);
                if (count == 0)
                {
                    continue;
                }
                StatResultItem it = new StatResultItem();
                it.Name  = value;
                it.Value = count;
                double d = AreaCountHelper.CalcArea(lon, lat, raster.ResolutionX, raster.ResolutionY) * count * Math.Pow(10, -6);
                it.Value = Math.Round(d, 3);
                items.Add(it);
            }
            return(items != null?items.ToArray() : null);
        }