private void selectRasterCmb_SelectedIndexChanged(object sender, EventArgs e) { if (selectDBCmb.Text == null || selectRasterCmb.Text == null) { return; } RBandCmb.Items.Clear(); GBandCmb.Items.Clear(); BBandCmb.Items.Clear(); rds = new RasterDataSet(GDB); rds.Open(selectRasterCmb.Text, 0); //将波段添加到各个comoBox中 for (int i = 0; i < rds.GetBandNum(); i++) { RasBand = rds.GetRasterBand(i + 1); RBandCmb.Items.Add("波段" + (i + 1)); GBandCmb.Items.Add("波段" + (i + 1)); BBandCmb.Items.Add("波段" + (i + 1)); } //在地图空间中显示该图层 Map map = new Map(); themeLayer = new RasterLayer(); if (rds != null) { themeLayer.AttachData(rds); } map.Append(themeLayer); this.mapControl.ActiveMap = map; this.mapControl.Restore(); RBandCmb.Text = ""; GBandCmb.Text = ""; BBandCmb.Text = ""; if (RBandCmb.Items.Count >= 3 && GBandCmb.Items.Count >= 3 && BBandCmb.Items.Count >= 3) { RBandCmb.Enabled = true; GBandCmb.Enabled = true; BBandCmb.Enabled = true; RBandCmb.SelectedIndex = 0; GBandCmb.SelectedIndex = 1; BBandCmb.SelectedIndex = 2; } else { RBandCmb.Enabled = false; GBandCmb.Enabled = false; BBandCmb.Enabled = false; } //显示图像信息 height = rds.GetPixelHeight(); width = rds.GetPixelWidth(); labelHeight.Text = height.ToString(); labelWidth.Text = Width.ToString(); labelHeight.Visible = true; labelWidth.Visible = true; //显示图像分辨率 resolutionX = rds.GetResolutionX(); resolutionY = rds.GetResolutionY(); labelResolutionX.Text = resolutionX.ToString(); labelResolutionY.Text = resolutionY.ToString(); labelResolutionX.Visible = true; labelResolutionY.Visible = true; //给分类器设置参数 /* * textBox2.Text = "4"; * textBox3.Text = "16"; * textBox4.Text = "20"; * textBox5.Text = "0.01"; * textBox9.Text = "0.005"; * textBox8.Text = "9.8"; * textBox7.Text = "5"; * textBox6.Text = "6.4"; */ }