コード例 #1
0
        private void btnFile_Click(object sender, EventArgs e)
        {
            MapRasterLayer snowLayer = (MapRasterLayer)MainMap.AddRasterLayer();

            //we add new categories to the snow layer

            try
            {
                snowLayer.Symbolizer = MakeSnowSymbolizer();
                snowLayer.WriteBitmap();
            }
            catch { }

            this.Close();
        }
コード例 #2
0
        private void btnInternet_Click(object sender, EventArgs e)
        {
            bool masked = true;

            lblProgress.Text = "Downloading snow data...";
            DataFetcher fetcher      = new DataFetcher();
            string      snowDataFile = null;
            DateTime    selectedDate = dtpTime.Value;

            try
            {
                snowDataFile     = fetcher.FetchSnow(selectedDate, masked);
                lblProgress.Text = "Snow data downloaded: " + snowDataFile;
            }
            catch (System.Net.WebException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            lblProgress.Text = "Reading binary grid..";
            string  snowBgdFile = snowDataFile.Replace(".dat", ".bgd");
            IRaster snowRaster  = fetcher.MakeSnowRaster(snowDataFile, snowBgdFile);

            lblProgress.Text = "Created snow raster: " + snowBgdFile;
            //finally, we add the snow raster to our map with proper color scheme
            RasterSymbolizer sym       = MakeSnowSymbolizer();
            MapRasterLayer   snowLayer = new MapRasterLayer(snowRaster);

            snowLayer.Symbolizer = sym;
            MainMap.Layers.Add(snowLayer);
            snowLayer.WriteBitmap();

            //set the date label on main map and close the form
            DateLabel.Text = "SWE (mm) " + selectedDate.Date.ToString();

            this.Close();
        }