Beispiel #1
0
        private void getRasterPath(ComboBox cntr)
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Feature";
            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 (!rstDic.ContainsKey(outName))
                {
                    rstDic.Add(outName, rsUtil.returnRaster(outPath));
                    cntr.Items.Add(outName);
                }
                else
                {
                    rstDic[outName] = rsUtil.returnRaster(outPath);
                }
                cntr.Text = outName;
            }
            return;
        }
Beispiel #2
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;
            gxDialog.Title        = "Select a Raster";
            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;
        }
Beispiel #3
0
        private void btnStrataRst_Click(object sender, EventArgs e)
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Raster Dataset";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                IRaster rs = rsUtil.returnRaster(outPath);
                if (!rstDic.ContainsKey(outName))
                {
                    rstDic.Add(outName, rs);
                    cmbStrataField.Items.Add(outName);
                }
                else
                {
                    rstDic[outName] = rs;
                }
                cmbStrataField.SelectedItem = outName;
            }
            return;
        }
Beispiel #4
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.GxFilterTablesAndFeatureClassesClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a ";
            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 rs = geoUtil.getTable(outPath);
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rs);
                        cmbdataset.Items.Add(outName);
                    }
                    else
                    {
                        rstDic[outName] = rs;
                    }
                    gxObj = eGxObj.Next();
                }
                cmbdataset.SelectedItem = outName;
            }
            return;
        }
Beispiel #5
0
        private void getRasterPath()
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Raster 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;
                    IRaster rs = rsUtil.returnRaster(outPath);
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rs);
                        cmbValueRaster.Items.Add(outName);
                    }
                    else
                    {
                        rstDic[outName] = rs;
                    }
                    gxObj = eGxObj.Next();
                }
            }
            cmbValueRaster.SelectedItem = outName;
            return;
        }
Beispiel #6
0
        private void getFeaturePath()
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterTablesAndFeatureClassesClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Feature";
            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 (!ftrDic.ContainsKey(outName))
                {
                    ftrDic.Add(outName, geoUtil.getTable(outPath));
                    cmbSampleFeatureClass.Items.Add(outName);
                }
                else
                {
                    ftrDic[outName] = geoUtil.getTable(outPath);
                }
                cmbSampleFeatureClass.SelectedItem = outName;
            }
            return;
        }
Beispiel #7
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;
            gxDialog.Title        = "Select a Feature";
            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;
                    IRaster rs = rsUtil.returnRaster(outPath);
                    if (((IRasterBandCollection)rs).Count > 1)
                    {
                        IRasterBandCollection rsBc = (IRasterBandCollection)rs;
                        for (int r = 0; r < rsBc.Count; r++)
                        {
                            string  nNm = outName + "_Band_" + (r + 1).ToString();
                            IRaster rsB = rsUtil.returnRaster(rsUtil.getBand(rs, r));
                            if (!rstDic.ContainsKey(nNm))
                            {
                                rstDic.Add(nNm, rsB);
                                //cmbInRaster1.Items.Add(nNm);
                                dgvRasterSlopes.Rows.Add(nNm, 0);
                            }
                            else
                            {
                                rstDic[nNm] = rsB;
                            }
                        }
                    }
                    else
                    {
                        if (!rstDic.ContainsKey(outName))
                        {
                            rstDic.Add(outName, rs);
                            //cmbInRaster1.Items.Add(outName);
                            dgvRasterSlopes.Rows.Add(outName, 0);
                        }
                        else
                        {
                            rstDic[outName] = rs;
                        }
                    }
                    gxObj = eGxObj.Next();
                }
            }
            return;
        }
Beispiel #8
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;
        }
Beispiel #9
0
        private void getFeaturePath(object sender, EventArgs e)
        {
            Control cnt     = (Control)sender;
            string  cntName = cnt.Name;
            TextBox txtBox  = txtPop;

            if (cntName == btnSamp.Name)
            {
                txtBox = txtSamp;
            }
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterTablesAndFeatureClassesClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Feature Class or Table";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                IRaster rs = rsUtil.returnRaster(outPath);
                if (rs == null)
                {
                    if (!ftrDic.ContainsKey(outName))
                    {
                        ftrDic.Add(outName, geoUtil.getTable(outPath));
                    }
                    else
                    {
                        ftrDic[outName] = geoUtil.getTable(outPath);
                    }
                }
                else
                {
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rs);
                    }
                    else
                    {
                        rstDic[outName] = rs;
                    }
                }
                txtBox.Text = outName;
            }
            updateFieldComboBox();
            return;
        }
Beispiel #10
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;
        }
Beispiel #11
0
 private void btnGeoDb_Click(object sender, EventArgs e)
 {
     ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
     gxDialog.AllowMultiSelect = false;
     ESRI.ArcGIS.Catalog.IGxObjectFilter flt = new ESRI.ArcGIS.Catalog.GxFilterFileGeodatabasesClass();
     gxDialog.ObjectFilter = flt;
     gxDialog.Title        = "Select a File geodatabase to store tiles";
     ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
     if (gxDialog.DoModalOpen(0, out eGxObj))
     {
         ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
         txtGeoDb.Text = gxObj.FullName;
     }
 }
Beispiel #12
0
        private void openFileDialogue(object sender, EventArgs e)
        {
            this.btIdentifyCurveAreas.Enabled = false;

            IGxDialog igxDialog = new GxDialog();

            igxDialog.AllowMultiSelect = false;
            igxDialog.ObjectFilter     = new ESRI.ArcGIS.Catalog.GxFilterPolylineFeatureClasses();

            ESRI.ArcGIS.Catalog.IEnumGxObject selection;
            igxDialog.DoModalOpen(this.Handle.ToInt32(), out selection);

            ESRI.ArcGIS.Catalog.IGxObject nextObj = selection.Next();

            this.rIDField.Items.Clear();

            if (nextObj == null)
            {
                this.txtInput.Clear();
                this.txtOutput.Clear();
                this.run = null;
            }
            else
            {
                this.run            = new ClassLib.Run(nextObj.FullName, this.AngleVariation.Value, isDissolved: cbDisslv.Checked);
                this.txtInput.Text  = this.run.inputPath;
                this.txtOutput.Text = this.run.outputPath;

                if (!run.isFeetOrMeters)
                {
                    MessageBox.Show("The input coordinate system must be in meters or feet");

                    return;
                }

                this.btIdentifyCurveAreas.Enabled = true;

                this.cbFeet.Checked = this.run.isFeet;

                this.rIDField.Items.Clear();

                this.rIDField.Items.AddRange(run.fieldNames.ToArray());

                if (this.rIDField.Items.Count > 0)
                {
                    this.rIDField.SelectedIndex = 0;
                }
            }
        }
Beispiel #13
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;
     }
 }
Beispiel #14
0
        private void getFeaturePathMap()
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterGeoDatasetsClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Feature or Raster Class";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                IRaster rs = rsUtil.returnRaster(outPath);
                if (rs == null)
                {
                    if (!ftrDic.ContainsKey(outName))
                    {
                        ftrDic.Add(outName, geoUtil.getFeatureClass(outPath));
                        cmbMap.Items.Add(outName);
                    }
                    else
                    {
                        ftrDic[outName] = geoUtil.getFeatureClass(outPath);
                    }
                }
                else
                {
                    if (!rstDic.ContainsKey(outName))
                    {
                        rstDic.Add(outName, rsUtil.returnRaster(outPath));
                        cmbMap.Items.Add(outName);
                    }
                    else
                    {
                        rstDic[outName] = rsUtil.returnRaster(outPath);
                    }
                }
                cmbMap.SelectedItem = outName;
            }
            return;
        }
Beispiel #15
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;
        }
Beispiel #16
0
 private void btnOpenFeatureClass_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.GxFilterPolygonFeatureClassesClass();
     gxDialog.ObjectFilter = flt;
     gxDialog.Title        = "Select a RCZ Layer";
     ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
     if (gxDialog.DoModalOpen(0, out eGxObj))
     {
         ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
         string        nm     = gxObj.Name;
         IFeatureClass ftrCls = geoUtil.getFeatureClass(gxObj.FullName);
         ftrDic.Add(nm, ftrCls);
         cmbInFeatureClass.Items.Add(nm);
         cmbInFeatureClass.SelectedItem = nm;
     }
 }
Beispiel #17
0
        private void getFeaturePath(Control cmb, ESRI.ArcGIS.Catalog.IGxObjectFilter flt)
        {
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            gxDialog.ObjectFilter     = flt;
            gxDialog.Title            = "Select a Feature";
            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 (cmb.Name.ToLower() == "cmbraster")
                {
                    IRaster oRs = null;
                    if (!rstDic.ContainsKey(outName))
                    {
                        oRs = rsUtil.returnRaster(outPath);
                        rstDic.Add(outName, oRs);
                        cmbRaster.Items.Add(outName);
                    }
                    else
                    {
                        oRs             = rsUtil.returnRaster(outPath);
                        rstDic[outName] = oRs;
                    }
                    object ndv = ((IRasterProps)((IRasterBandCollection)oRs).Item(0)).NoDataValue;
                    //txtNoData.Text = (ndv.ToString());
                }
                else
                {
                    outWks = geoUtil.OpenRasterWorkspace(outPath);
                }
                cmb.Text = outName;
            }
            return;
        }
Beispiel #18
0
        private ITable getTableFromUser()
        {
            ITable outTbl  = null;
            string outPath = null;
            string outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterTablesAndFeatureClassesClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Supplemental Table";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                outTbl  = geoUtil.getTable(outPath);
            }
            return(outTbl);
        }
Beispiel #19
0
        private IRaster getSeedRaster()
        {
            IRaster rsOut   = null;
            string  outPath = null;
            string  outName = "";

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = false;
            ESRI.ArcGIS.Catalog.IGxObjectFilter flt = null;
            flt = new ESRI.ArcGIS.Catalog.GxFilterRasterDatasetsClass();
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Seed Raster";
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                outPath = gxObj.FullName;
                outName = gxObj.BaseName;
                rsOut   = rstUtil.returnRaster(outPath);
            }
            return(rsOut);
        }
Beispiel #20
0
        public string[] getPath(ESRI.ArcGIS.Catalog.IGxObjectFilter filter, out string[] outName, bool MultiSelect = false)
        {
            List <string> outLst     = new List <string>();
            List <string> outNameLst = new List <string>();

            ESRI.ArcGIS.CatalogUI.IGxDialog gxDialog = new ESRI.ArcGIS.CatalogUI.GxDialogClass();
            gxDialog.AllowMultiSelect = MultiSelect;
            gxDialog.ObjectFilter     = filter;
            gxDialog.Title            = filter.Description;
            ESRI.ArcGIS.Catalog.IEnumGxObject eGxObj;
            if (gxDialog.DoModalOpen(0, out eGxObj))
            {
                ESRI.ArcGIS.Catalog.IGxObject gxObj = eGxObj.Next();
                while (gxObj != null)
                {
                    outLst.Add(gxObj.FullName);
                    outNameLst.Add(gxObj.BaseName);
                    gxObj = eGxObj.Next();
                }
            }
            outName = outNameLst.ToArray();
            return(outLst.ToArray());
        }
Beispiel #21
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;
        }
Beispiel #22
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;
        }
Beispiel #23
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.GxFilterPointFeatureClassesClass();
            }
            else
            {
                flt = new ESRI.ArcGIS.Catalog.GxFilterDatasets();
            }
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select";
            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)
                {
                    ftrDic[outName] = geoUtil.getFeatureClass(outPath);
                    cmbSampleFeatureClass.Items.Add(outName);
                    cmbSampleFeatureClass.Text = outName;
                }
                else
                {
                    string       wksPath = geoUtil.getDatabasePath(outPath);
                    IWorkspace   wks     = geoUtil.OpenWorkSpace(wksPath);
                    IEnumDataset rsDset  = wks.get_Datasets(esriDatasetType.esriDTAny);
                    bool         rsCheck = false;
                    IDataset     ds      = rsDset.Next();
                    while (ds != null)
                    {
                        if (outName.ToLower() == ds.Name.ToLower() && (ds.Type == esriDatasetType.esriDTMosaicDataset || ds.Type == esriDatasetType.esriDTRasterDataset || ds.Type == esriDatasetType.esriDTRasterCatalog))
                        {
                            rsCheck = true;
                            break;
                        }
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(ds);
                        ds = rsDset.Next();
                    }
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(rsDset);
                    if (rsCheck)
                    {
                        rstDic[outName] = rsUtil.createIdentityRaster(outPath);
                        cmbRaster.Items.Add(outName);
                        cmbRaster.Text = outName;
                    }
                    else
                    {
                        ftrDic[outName] = geoUtil.getFeatureClass(outPath);
                        cmbRaster.Items.Add(outName);
                        cmbRaster.Text = outName;
                    }
                }
            }
            return;
        }
Beispiel #24
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;
        }
Beispiel #25
0
        private void getPath(bool isRaster)
        {
            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 (isRaster)
            {
                flt = new ESRI.ArcGIS.Catalog.GxFilterDatasetsClass();
            }
            else
            {
                flt = new ESRI.ArcGIS.Catalog.GxFilterFileGeodatabasesClass();
            }
            gxDialog.ObjectFilter = flt;
            gxDialog.Title        = "Select a Feature";
            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 (isRaster)
                {
                    string           wksPath    = geoUtil.getDatabasePath(outPath);
                    IWorkspace       wks        = geoUtil.OpenWorkSpace(wksPath);
                    IEnumDatasetName rsDsetName = wks.get_DatasetNames(esriDatasetType.esriDTRasterDataset);
                    bool             rsCheck    = false;
                    IDatasetName     dsName     = rsDsetName.Next();
                    while (dsName != null)
                    {
                        if (outName.ToLower() == dsName.Name.ToLower())
                        {
                            rsCheck = true;
                            break;
                        }
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(dsName);
                        dsName = rsDsetName.Next();
                    }
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(rsDsetName);
                    if (rsCheck)
                    {
                        if (!rstDic.ContainsKey(outName))
                        {
                            rstDic.Add(outName, rsUtil.createIdentityRaster(outPath));
                            cmbRst.Items.Add(outName);
                        }
                        else
                        {
                            rstDic[outName] = rsUtil.createIdentityRaster(outPath);
                        }
                    }
                    else
                    {
                        ftrDic[outName] = geoUtil.getFeatureClass(outPath);
                    }
                    cmbRst.Text = outName;
                }
                else
                {
                    txtOutWorkspace.Text = outPath;
                }
            }
            return;
        }