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.GxFilterDatasetsClass(); gxDialog.ObjectFilter = flt; gxDialog.Title = "Select a Feature Class or 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; if (!ftrDic.ContainsKey(outName)) { rstDic.Add(outName, rstUtil.returnRaster(outPath)); cmbRst.Items.Add(outName); } else { ftrDic[outName] = geoUtil.getFeatureClass(outPath); } cmbRst.SelectedItem = outName; } return; }
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; }
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.GxFilterDatasetsClass(); gxDialog.ObjectFilter = flt; gxDialog.Title = "Select a Feature Class, Raster Dataset, 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)); cmbSampleFeatureClass.Items.Add(outName); } else { ftrDic[outName] = geoUtil.getTable(outPath); } } else { if (!rstDic.ContainsKey(outName)) { rstDic.Add(outName, rs); cmbSampleFeatureClass.Items.Add(outName); } else { rstDic[outName] = rs; } } cmbSampleFeatureClass.SelectedItem = outName; } return; }