Ejemplo n.º 1
0
        private void getFeaturePath(bool featureClass)
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            if (featureClass)
            {
                flt            = new ESRI.ArcGIS.Catalog.GxFilterWorkspacesClass();
                gxDialog.Title = "Select a Workspace";
            }
            else
            {
                flt            = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
                gxDialog.Title = "Select a Raster";
            }
            gxDialog.ObjectFilter = flt;

            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                if (featureClass)
                {
                    if (!ftrDic.ContainsKey(outName))
                    {
                        ftrDic.Add(outName, geoUtil.OpenWorkSpace(outPath));
                        cmbSampleFeatureClass.Items.Add(outName);
                    }
                    else
                    {
                        ftrDic[outName] = geoUtil.OpenWorkSpace(outPath);
                    }
                    cmbSampleFeatureClass.SelectedItem = outName;
                }
                else
                {
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rstUtil.returnRaster(outPath));
                        cmbRasterBands.Items.Add(outName);
                    }
                    else
                    {
                        rstDic[outName] = rstUtil.returnRaster(outPath);
                    }
                    cmbRasterBands.Text = outName;
                }
            }
            return;
        }
 private void btnOpenWorkspace_Click(object sender, EventArgs e)
 {
     ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
     gxDialog.AllowMultiSelect = false;
     ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
     flt = new ESRI.ArcGIS.Catalog.GxFilterWorkspacesClass();
     gxDialog.ObjectFilter = flt;
     gxDialog.Title = "Select a Workspace";
     ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
     if (gxDialog.DoModalOpen(0, out eGxObj))
     {
         ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
         txtLandFireDir.Text = gxObj.FullName;
     }
 }
Ejemplo n.º 3
0
 private void btnOpenWorkspace_Click(object sender, EventArgs e)
 {
     ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
     gxDialog.AllowMultiSelect = false;
     ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
     flt = new ESRI.ArcGIS.Catalog.GxFilterWorkspacesClass();
     gxDialog.ObjectFilter = flt;
     gxDialog.Title        = "Select a Workspace";
     ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
     if (gxDialog.DoModalOpen(0, out eGxObj))
     {
         ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
         txtLandFireDir.Text = gxObj.FullName;
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         int rwCnt = dgvOutputs.Rows.Count;
         bool chCheck = false;
         for (int i = 0; i < rwCnt; i++)
         {
             DataGridViewCellCollection cells = dgvOutputs.Rows[i].Cells;
             bool ch = System.Convert.ToBoolean(cells[1].Value);
             if (ch)
             {
                 chCheck = true;
                 break;
             }
         }
         if (chCheck)
         {
             ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
             gxDialog.AllowMultiSelect = false;
             ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
             flt = new ESRI.ArcGIS.Catalog.GxFilterWorkspacesClass();
             gxDialog.ObjectFilter = flt;
             gxDialog.Title = "Select a Workspace";
             ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
             if (gxDialog.DoModalOpen(0, out eGxObj))
             {
                 ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                 outFunctionDatasetDir = gxObj.FullName + "\\" + funcDirNm;
                 geoUtil.check_dir(outFunctionDatasetDir);
                 for (int i = 0; i < rwCnt; i++)
                 {
                     DataGridViewCellCollection cells = dgvOutputs.Rows[i].Cells;
                     bool ch = System.Convert.ToBoolean(cells[1].Value);
                     if (ch)
                     {
                         string nm = cells[0].Value.ToString();
                         string newNm = nm;
                         char[] bChr = System.IO.Path.GetInvalidFileNameChars();
                         foreach (char c in bChr)
                         {
                             newNm = newNm.Replace(c, '_');
                         }
                         foreach (string s in new string[] { ":", ";", "?", ">", "<", "`", "~", "!", ".", ",", "@", "#", "$", "%", "^", "&", "*", "(", ")", "+", "=", "-" })
                         {
                             newNm = newNm.Replace(s, "_");
                         }
                         string outFilePath = outFunctionDatasetDir + "\\" + newNm + funcExt;
                         //Console.WriteLine(outFilePath);
                         string dsc = cells[2].Value.ToString();
                         using (System.IO.StreamWriter sWr = new System.IO.StreamWriter(outFilePath))
                         {
                             string lns = getSubFunctions(nm, dsc,null);
                             if (lns.Length > 0)
                             {
                                 sWr.WriteLine(lns);
                             }
                             sWr.Close();
                         }
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show("To save a model you must have at least 1 model checked", "No models checked!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     finally
     {
     }
 }
        private void getFeaturePath(bool featureClass)
        {
            string outPath = null;
            string outName = "";
            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            if (featureClass)
            {
                flt = new ESRI.ArcGIS.Catalog.GxFilterWorkspacesClass();
                gxDialog.Title = "Select a Workspace";
            }
            else
            {
                flt = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
                gxDialog.Title = "Select a Raster";
            }
            gxDialog.ObjectFilter = flt;
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                if (featureClass)
                {
                    if (!ftrDic.ContainsKey(outName))
                    {
                        ftrDic.Add(outName, geoUtil.OpenWorkSpace(outPath));
                        cmbSampleFeatureClass.Items.Add(outName);
                    }
                    else
                    {
                        ftrDic[outName] = geoUtil.OpenWorkSpace(outPath);
                    }
                    cmbSampleFeatureClass.SelectedItem = outName;
                }
                else
                {
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rstUtil.returnRaster(outPath));
                        cmbRasterBands.Items.Add(outName);
                    }
                    else
                    {
                        rstDic[outName] = rstUtil.returnRaster(outPath);
                    }
                    cmbRasterBands.Text = outName;
                }

            }
            return;
        }