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.GxFilterGeoDatasetsClass();//.GxFilterPolygonFeatureClassesClass(); } else { 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 (featureClass) { if (!ftrDic.ContainsKey(outName)) { ftrDic.Add(outName, geoUtil.getFeatureClass(outPath)); cmbSampleFeatureClass.Items.Add(outName); } else { ftrDic[outName] = geoUtil.getFeatureClass(outPath); } cmbSampleFeatureClass.Text = outName; } else { if (!rstDic.ContainsKey(outName)) { rstDic.Add(outName, rsUtil.returnRaster(outPath)); cmbRaster.Items.Add(outName); } else { rstDic[outName] = rsUtil.returnRaster(outPath); } cmbRaster.Text = outName; } } return; }
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; }