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.GxFilterPointFeatureClassesClass(); 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.getFeatureClass(outPath)); cmbSampleFeatureClass.Items.Add(outName); } else { ftrDic[outName] = geoUtil.getFeatureClass(outPath); } cmbSampleFeatureClass.SelectedItem = outName; } return; }
private void btnSample_Click(object sender, EventArgs e) { ESRI.ArcGIS.Catalog.IGxObjectFilter flt = new ESRI.ArcGIS.Catalog.GxFilterPointFeatureClassesClass(); string[] flNames; string[] flPath = frmHlp.getPath(flt, out flNames, false); if (flPath.Length > 0) { cmbSample.Items.Add(flNames[0]); ESRI.ArcGIS.Geodatabase.IFeatureClass ftrCls = geoUtil.getFeatureClass(flPath[0]); frmHlp.FeatureDictionary.Add(flNames[0], ftrCls); cmbSample.SelectedItem = flNames[0]; } }
private void btnOpenPlots_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.GxFilterPointFeatureClassesClass(); fltColl.AddFilter(flt2, false); gxDialog.Title = "Select a Point 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); cmbPlots.Items.Add(outName); } else { ftrDic[outName] = ftrCls; } gxObj = eGxObj.Next(); } cmbPlots.SelectedItem = outName; } return; }
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.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 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; }
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; }