Exemple #1
0
        private void getRasterOrFeaturePath()
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilterCollection fltColl = (ESRI.ArcGIS.Catalog.IGxObjectFilterCollection)gxDialog;
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt  = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt2 = new ESRI.ArcGIS.Catalog.GxFilterPolygonFeatureClassesClass();
            fltColl.AddFilter(flt, true);
            fltColl.AddFilter(flt2, false);
            gxDialog.Title = "Select a Raster Polygon Dataset";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outPath = gxObj.FullName;
                    outName = gxObj.BaseName;
                    if (gxDialog.ObjectFilter is ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass)
                    {
                        IRaster rs = rsUtil.returnRaster(outPath);
                        if (!rstDic.ContainsKey(outName))
                        {
                            rstDic.Add(outName, rs);
                            cmbZoneRaster.Items.Add(outName);
                        }
                        else
                        {
                            rstDic[outName] = rs;
                        }
                    }
                    else
                    {
                        IFeatureClass ftrCls = geoUtil.getFeatureClass(outPath);
                        if (!ftrDic.ContainsKey(outName))
                        {
                            ftrDic.Add(outName, ftrCls);
                            cmbZoneRaster.Items.Add(outName);
                        }
                        else
                        {
                            ftrDic[outName] = ftrCls;
                        }
                    }
                    gxObj = eGxObj.Next();
                }
                cmbZoneRaster.SelectedItem = outName;
            }
            return;
        }
Exemple #2
0
        private void btnOpenTable_Click(object sender, EventArgs e)
        {
            ComboBox cmb = cmbStrata;

            if (((Button)sender).Name.ToLower().Contains("stands"))
            {
                cmb = cmbStands;
            }
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilterCollection fltColl = (ESRI.ArcGIS.Catalog.IGxObjectFilterCollection)gxDialog;
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt2 = new ESRI.ArcGIS.Catalog.GxFilterPolygonFeatureClassesClass();
            fltColl.AddFilter(flt2, false);
            gxDialog.Title = "Select a Feature Class";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outPath = gxObj.FullName;
                    outName = gxObj.BaseName;


                    IFeatureClass ftrCls = geoUtil.getFeatureClass(outPath);//need to check if this works for feature classes
                    if (!ftrDic.ContainsKey(outName))
                    {
                        ftrDic.Add(outName, ftrCls);
                        cmb.Items.Add(outName);
                    }
                    else
                    {
                        ftrDic[outName] = ftrCls;
                    }

                    gxObj = eGxObj.Next();
                }
                cmb.SelectedItem = outName;
            }
            return;
        }
Exemple #3
0
        private void getFeaturePath()
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = true;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            gxDialog.ObjectFilter = flt;
            ESRI.ArcGIS.Catalog.IGxObjectFilterCollection fltCol = (ESRI.ArcGIS.Catalog.IGxObjectFilterCollection)gxDialog;
            fltCol.AddFilter(new ESRI.ArcGIS.Catalog.GxFilterFilesClass(), false);
            fltCol.AddFilter(new ESRI.ArcGIS.Catalog.GxFilterTextFilesClass(), false);
            gxDialog.Title = "Select a Raster or net_Cdf";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outPath = gxObj.FullName;
                    outName = gxObj.BaseName;
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rsUtil.createIdentityRaster(outPath));
                        //cmbInRaster1.Items.Add(outName);
                        lsbRaster.Items.Add(outName);
                    }
                    else
                    {
                        rstDic[outName] = rsUtil.createIdentityRaster(outPath);
                    }
                    gxObj = eGxObj.Next();
                }
                //cmbInRaster1.SelectedItem = outName;
            }
            return;
        }
Exemple #4
0
        private void btnOpenStands_Click(object sender, EventArgs e)
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilterCollection fltColl = (ESRI.ArcGIS.Catalog.IGxObjectFilterCollection)gxDialog;
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt2 = new ESRI.ArcGIS.Catalog.GxFilterPolygonFeatureClassesClass();
            fltColl.AddFilter(flt2, false);
            gxDialog.Title = "Select a Stands Feature Class";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outPath = gxObj.FullName;
                    outName = gxObj.BaseName;

                    IFeatureClass ftrCls = geoUtil.getFeatureClass(outPath);
                    if (!ftrDic.ContainsKey(outName))
                    {
                        ftrDic.Add(outName, ftrCls);
                        cmbStands.Items.Add(outName);
                    }
                    else
                    {
                        ftrDic[outName] = ftrCls;
                    }

                    gxObj = eGxObj.Next();
                }
                cmbStands.SelectedItem = outName;
            }
            return;
        }
Exemple #5
0
        private void btnOpenTable_Click(object sender, EventArgs e)
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilterCollection fltColl = (ESRI.ArcGIS.Catalog.IGxObjectFilterCollection)gxDialog;
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt2 = new ESRI.ArcGIS.Catalog.GxFilterTablesAndFeatureClassesClass();
            fltColl.AddFilter(flt2, false);
            gxDialog.Title = "Select a Table or Feature Class";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outPath = gxObj.FullName;
                    outName = gxObj.BaseName;

                    ITable tbl = geoUtil.getTable(outPath);//need to check if this works for feature classes
                    if (!tblDic.ContainsKey(outName))
                    {
                        tblDic.Add(outName, tbl);
                        cmbTable.Items.Add(outName);
                    }
                    else
                    {
                        tblDic[outName] = tbl;
                    }

                    gxObj = eGxObj.Next();
                }
                cmbTable.SelectedItem = outName;
            }
            return;
        }
Exemple #6
0
        private void getLayer()
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilterCollection fltColl = (ESRI.ArcGIS.Catalog.IGxObjectFilterCollection)gxDialog;
            gxDialog.AllowMultiSelect = true;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt  = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt2 = new ESRI.ArcGIS.Catalog.GxFilterPolygonFeatureClassesClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt3 = new ESRI.ArcGIS.Catalog.GxFilterPointFeatureClassesClass();
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt4 = new ESRI.ArcGIS.Catalog.GxFilterTablesClass();
            fltColl.AddFilter(flt, true);
            fltColl.AddFilter(flt2, false);
            fltColl.AddFilter(flt3, false);
            fltColl.AddFilter(flt4, false);
            gxDialog.Title = "Select a Raster, Polygon, Point, or Table";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outPath = gxObj.FullName;
                    outName = gxObj.BaseName;
                    if (gxDialog.ObjectFilter is ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass)
                    {
                        IFunctionRasterDataset rs = rsUtil.createIdentityRaster(outPath);
                        if (!rstDic.ContainsKey(outName))
                        {
                            rstDic.Add(outName, rs);
                        }
                        else
                        {
                            rstDic[outName] = rs;
                        }
                    }
                    else if (gxDialog.ObjectFilter is ESRI.ArcGIS.Catalog.GxFilterTablesClass)
                    {
                        ITable tbl = geoUtil.getTable(outPath);
                        if (!tblDic.ContainsKey(outName))
                        {
                            tblDic.Add(outName, tbl);
                        }
                        else
                        {
                            tblDic[outName] = tbl;
                        }
                    }
                    else
                    {
                        IFeatureClass ftrCls = geoUtil.getFeatureClass(outPath);
                        if (!ftrDic.ContainsKey(outName))
                        {
                            ftrDic.Add(outName, ftrCls);
                        }
                        else
                        {
                            ftrDic[outName] = ftrCls;
                        }
                    }
                    if (!lyrDic.ContainsKey(outName))
                    {
                        lyrDic.Add(outName, outPath);
                        lsbLayers.Items.Add(outName);
                    }
                    else
                    {
                        lyrDic[outName] = outPath;
                    }
                    gxObj = eGxObj.Next();
                }
            }
            return;
        }