private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e) { if (tabControl1.SelectedIndex == 1) { if (m_layer is IRasterLayer) { panel1.Visible = false; panel2.Visible = true; listBox1.SelectedIndex = 0; panel3.Visible = true; } else { panel1.Visible = true; panel2.Visible = false; } } if (panel3.Visible == true) { //加载波段 comboBoxBand.Items.Clear(); string strFilepath = GetFileNameByLayer.GetRasterFileName(m_layer); m_pRasterDataset = OpenFileRasterDataset(strFilepath); m_pRasterBandCollection = (IRasterBandCollection)m_pRasterDataset; int BandCount = m_pRasterBandCollection.Count; for (int i = 0; i < BandCount; i++) { IRasterBand band = m_pRasterBandCollection.Item(i); comboBoxBand.Items.Add(band.Bandname); } comboBoxBand.SelectedIndex = 0; } }
private void bt_OK_Click(object sender, EventArgs e) { if (comboBoxSelect.SelectedItem == null) { MessageBox.Show("文件不能为空!"); return; } //pCreatRalyr = (IRasterLayer)pMap.get_Layer(comboBoxOpen.SelectedIndex); string strFilePath = GetFileNameByLayer.GetRasterFileName(m_pMap.get_Layer(comboBoxSelect.SelectedIndex)); //初始化ENVI COM_IDL_connectLib.COM_IDL_connectClass oComIDL = new COM_IDL_connectLib.COM_IDL_connectClass(); oComIDL.CreateObject(0, 0, 0); oComIDL.ExecuteString(".compile '" + System.IO.Directory.GetCurrentDirectory() + @"\green.pro'"); oComIDL.ExecuteString(@"green,'" + strFilePath + "','" + textBoxOutPut.Text + "'"); oComIDL.DestroyObject(); openraster_1 openrasterfile = new openraster_1(); openrasterfile.pMap = m_pMap; openrasterfile.OpenRaster(textBoxOutPut.Text); this.Close(); }
private void bt_OK_Click(object sender, EventArgs e) { { if (comboBoxSelect.SelectedItem == null) { MessageBox.Show("文件不能为空!"); return; } if (textBoxZoom.Text == "") { MessageBox.Show("请输入放缩比例!"); return; } if (textBoxOutPut.Text == "") { MessageBox.Show("请选择输出路径!"); return; } string strRasterPath = GetFileNameByLayer.GetRasterFileName(m_pMap.get_Layer(comboBoxSelect.SelectedIndex)); string strOutPut = textBoxOutPut.Text; //float zoom = Convert.ToSingle(textBoxZoom.Text); COM_IDL_connectLib.COM_IDL_connectClass oComIDL = new COM_IDL_connectLib.COM_IDL_connectClass(); oComIDL.CreateObject(0, 0, 0); //执行重采样 oComIDL.ExecuteString(".compile '" + System.IO.Directory.GetCurrentDirectory() + @"\object_envi_resize__define.pro'"); oComIDL.ExecuteString(@"s = obj_new('object_envi_resize','" + strRasterPath + "','" + strOutPut + "')"); oComIDL.ExecuteString("s.EXECUTERESIZE," + textBoxZoom.Text + "," + textBoxZoom.Text + "," + cobox_method.SelectedIndex.ToString()); //oComIDL.ExecuteString("Obj_destroy,s"); oComIDL.DestroyObject(); //加载放大后影像 OpenRaster(strOutPut); this.Close(); } }
private void comboBoxSelect_SelectedIndexChanged(object sender, EventArgs e) { m_pRasterDataset = OpenFileRasterDataset(GetFileNameByLayer.GetRasterFileName(m_pMap.get_Layer(comboBoxSelect.SelectedIndex))); m_pRasterBandCollection = (IRasterBandCollection)m_pRasterDataset; comboBoxRed.Items.Clear(); comboBoxGreen.Items.Clear(); comboBoxBlue.Items.Clear(); for (int i = 0; i < m_pRasterBandCollection.Count; i++) { IRasterBand band = m_pRasterBandCollection.Item(i); comboBoxRed.Items.Add(band.Bandname); comboBoxGreen.Items.Add(band.Bandname); comboBoxBlue.Items.Add(band.Bandname); } }
//添加波段函数 private int AddBand() { comboBoxBand.Items.Clear(); string strFilepath = GetFileNameByLayer.GetRasterFileName(m_layer); m_pRasterDataset = OpenFileRasterDataset(strFilepath); m_pRasterBandCollection = (IRasterBandCollection)m_pRasterDataset; int BandCount = m_pRasterBandCollection.Count; for (int i = 0; i < BandCount; i++) { IRasterBand band = m_pRasterBandCollection.Item(i); comboBoxBand.Items.Add(band.Bandname); } comboBoxBand.SelectedIndex = 0; return(BandCount); }