コード例 #1
0
        /// <summary>
        ///  树视图点击捕捉,用于邮件弹出功能栏
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Map_treeView_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            Bitmap2           bmp2 = _imageDic[map_treeView.SelectedNode.Text];

            switch (item.Name)
            {
            case "bandCombine_ToolStripMenuItem":
                BandForm bandModal = new BandForm
                {
                    GdalLayer = bmp2.GdalLayer
                };
                if (bandModal.ShowDialog() == DialogResult.OK)
                {
                    List <int> combineIndex = bandModal.BanCombineIndex;
                    Bitmap     layerBitmap  = GRGBCombine.Run(
                        bandModal.GdalLayer.BandCollection[combineIndex[0]].GetByteData(),
                        bandModal.GdalLayer.BandCollection[combineIndex[1]].GetByteData(),
                        bandModal.GdalLayer.BandCollection[combineIndex[2]].GetByteData());
                    Bitmap2 layerBitmap2 = new Bitmap2(bmp: layerBitmap, name: bandModal.GdalLayer.Name, gdalLayer: bandModal.GdalLayer);
                    //获取band对应的bitmap格式图像,载入treedNode中
                    _imageDic[bandModal.GdalLayer.Name] = layerBitmap2;
                    map_pictureBox.Image = layerBitmap2.BMP;
                }
                break;

            default:
                break;
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: DragonEmperorG/kiwi.server
        /// <summary>
        ///  树视图点击捕捉,用于邮件弹出功能栏
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Map_treeView_Click(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            Bitmap2           bmp2 = _imageDic[map_treeView.SelectedNode.Text];

            switch (item.Name)
            {
            case "bandExport_ToolStripMenuItem":
                if (bmp2.GdalBand == null)
                {
                    return;
                }
                BandExportForm bandExportModel = new BandExportForm()
                {
                    RasterLayer = bmp2.GdalLayer,
                    RasterDic   = _rasterDic,
                    Index       = bmp2.GdalBand.Index - 1
                };
                if (bandExportModel.ShowDialog() == DialogResult.OK)
                {
                    if (!bandExportModel.HasChecked)
                    {
                        return;
                    }
                    bandExportModel.Save();
                    MessageBox.Show("导出成功", "结果", MessageBoxButtons.OK, icon: MessageBoxIcon.Information);
                }
                break;

            case "bandCombine_ToolStripMenuItem":
                BandForm bandModal = new BandForm
                {
                    GdalLayer = bmp2.GdalLayer
                };
                if (bandModal.ShowDialog() == DialogResult.OK)
                {
                    List <int> combineIndex = bandModal.BanCombineIndex;
                    Bitmap     layerBitmap  = GRGBCombine.Run(
                        bandModal.GdalLayer.BandCollection[combineIndex[0]].GetByteBuffer(),
                        bandModal.GdalLayer.BandCollection[combineIndex[1]].GetByteBuffer(),
                        bandModal.GdalLayer.BandCollection[combineIndex[2]].GetByteBuffer());
                    Bitmap2 layerBitmap2 = new Bitmap2(bmp: layerBitmap, name: bandModal.GdalLayer.Name, gdalLayer: bandModal.GdalLayer);
                    //获取band对应的bitmap格式图像,载入treedNode中
                    _imageDic[bandModal.GdalLayer.Name] = layerBitmap2;
                    map_pictureBox.Image = layerBitmap2.BMP;
                }
                break;

            default:
                break;
            }
        }