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; }
private void btnExecute_Click(object sender, EventArgs e) { string ftrPath = cmbFtrCls.Text; string imgPath = txtImgWks.Text; string outPath = txtOutWks.Text; if (ftrPath == "" || ftrPath == null) { MessageBox.Show("Missing Feature Class"); return; } if (imgPath == "" || imgPath == null) { MessageBox.Show("Missing image directory\\workspace"); return; } if (outPath == "" || outPath == null) { MessageBox.Show("Missing output workspace"); return; } RunningProcess.frmRunningProcessDialog rd = new RunningProcess.frmRunningProcessDialog(false); this.Visible = false; rd.addMessage("Making Tiles. This may take a while...."); rd.stepPGBar(10); rd.TopMost = true; DateTime dt = DateTime.Now; rd.Show(); try { IFeatureClass ftrCls = ftrDic[ftrPath]; IWorkspace imgWks = geoUtil.OpenRasterWorkspace(imgPath); IWorkspace outWks = geoUtil.OpenWorkSpace(outPath); IFunctionRasterDataset[] outDset = ftrUtil.tiledMosaics(ftrCls, imgWks, outWks); for (int i = 0; i < outDset.Length; i++) { IRasterLayer lyr = new RasterLayerClass(); lyr.Name = "Tile_" + (i + 1).ToString(); lyr.CreateFromDataset((IRasterDataset)outDset[i]); frmHlp.TheMap.AddLayer(lyr); } } catch (Exception ex) { rd.addMessage(ex.ToString()); } finally { DateTime dt2 = DateTime.Now; TimeSpan ts = dt2.Subtract(dt); string t = " in " + ts.Days.ToString() + " days " + ts.Hours.ToString() + " hours " + ts.Minutes.ToString() + " minutes and " + ts.Seconds.ToString() + " seconds ."; rd.stepPGBar(100); rd.addMessage("Finished Making Tiles" + t); rd.enableClose(); this.Close(); rd.stepPGBar(100); } }
private void btnSegment_Click(object sender, EventArgs e) { int CovVl = trbCover.Value; int HtVl = trbHeight.Value; bool Asp = chbAspect.Checked; double minArea = System.Convert.ToDouble(nudMin.Value); double maxArea = System.Convert.ToDouble(nudMax.Value); string wksPath = txtLandFireDir.Text; if (wksPath == "" || wksPath == null) { MessageBox.Show("You must select a workspace that has LandFire Data"); return; } IWorkspace wks = geoUtil.OpenWorkSpace(wksPath); RunningProcess.frmRunningProcessDialog rd = new RunningProcess.frmRunningProcessDialog(false); rd.Show(this); DateTime dt1 = DateTime.Now; try { rd.addMessage("Segmenting LandFireData..."); rd.stepPGBar(25); rd.Refresh(); lf.LandFireWorkspace = wks; lf.CoverLevels = CovVl; lf.HeightLevels = HtVl; lf.UseAspect = Asp; lf.MaxArea = maxArea; lf.MinArea = minArea; rd.addMessage("Performing Raster Analyses"); rd.Refresh(); lf.segmentLandFireData(); rd.addMessage("Converting to Polygons"); rd.Refresh(); lf.convertToPolygon(); rd.addMessage("Splitting Polygons"); lf.splitPolygons(false); } catch (Exception ex) { rd.addMessage(ex.ToString()); } finally { DateTime dt2 = DateTime.Now; TimeSpan ts = dt2.Subtract(dt1); rd.addMessage("Finished Segmenting LandFire Data in " + ts.TotalMinutes.ToString() + " minutes."); rd.Refresh(); rd.stepPGBar(100); rd.enableClose(); } }
private void getWksPath() { ESRI.ArcGIS.Catalog.IGxObjectFilter flt = new ESRI.ArcGIS.Catalog.GxFilterFileGeodatabasesClass(); string[] namesArr; string[] pathArr = frmHlp.getPath(flt, out namesArr, false); string outPath = pathArr[0]; outWks = geoUtil.OpenWorkSpace(outPath); txtWorkspace.Text = namesArr[0]; return; }
public void btnExecute_Click(object sender, EventArgs e) { string tblNm = txtOutNm.Text; if (tblNm == null || tblNm == "") { MessageBox.Show("You must specify a output name", "No Output", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (lsbRaster.Items.Count < 1) { MessageBox.Show("You must select at least on Raster", "No Rasters", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } IRasterBandCollection rsBc = new RasterClass(); for (int i = 0; i < lsbRaster.Items.Count; i++) { rsBc.AppendBands((IRasterBandCollection)rstDic[lsbRaster.Items[i].ToString()]); } this.Visible = false; esriUtil.Forms.RunningProcess.frmRunningProcessDialog rp = new RunningProcess.frmRunningProcessDialog(false); DateTime dt = DateTime.Now; rp.addMessage("Building Raster Attribute Table. This may take a while..."); rp.stepPGBar(10); rp.TopMost = true; rp.Show(); try { string outDbStr = geoUtil.getDatabasePath(tblNm); string outName = System.IO.Path.GetFileNameWithoutExtension(tblNm); IWorkspace wks = geoUtil.OpenWorkSpace(outDbStr); IFunctionRasterDataset fDset = rsUtil.compositeBandFunction(rsBc); outtbl = rsUtil.calcCombinRasterFunctionTable(fDset, wks, outName); this.DialogResult = DialogResult.OK; } catch (Exception ex) { rp.addMessage(ex.ToString()); } finally { DateTime dt2 = DateTime.Now; TimeSpan ts = dt2.Subtract(dt); string t = " in " + ts.Days.ToString() + " days " + ts.Hours.ToString() + " hours " + ts.Minutes.ToString() + " minutes and " + ts.Seconds.ToString() + " seconds ."; rp.stepPGBar(100); rp.addMessage("Finished creating attribute table"); rp.enableClose(); this.Close(); } }
private void btnDownload_Click(object sender, EventArgs e) { if (!checkInputs()) { MessageBox.Show("You must have a value for all inputs"); return; } mapserviceutility msUtil = new mapserviceutility(); geoDatabaseUtility geoUtil = new geoDatabaseUtility(); IImageServerLayer svLyr = getServerLayer(); ESRI.ArcGIS.Geometry.IEnvelope ext = new ESRI.ArcGIS.Geometry.EnvelopeClass(); if (cmbExtent.Text.ToLower() == "display") { ext = av.Extent; } else { IFeatureLayer ftrLyr = getFeatureLayer(); ext = ((ESRI.ArcGIS.Geodatabase.IGeoDataset)ftrLyr).Extent; } if (svLyr == null) { MessageBox.Show("You must select a Image server layer"); return; } this.Visible = false; ESRI.ArcGIS.Geodatabase.IWorkspace wks = geoUtil.OpenWorkSpace(txtGeoDb.Text); ESRI.ArcGIS.Geodatabase.IRaster rs = null; string msg = msUtil.fillDbRaster(svLyr, wks, ext, svLyr.ServiceInfo.SpatialReference, out rs); IMap mp = (IMap)av; if (rs != null) { IRasterLayer rsLyr = new RasterLayerClass(); rsLyr.CreateFromRaster(rs); rsLyr.Name = svLyr.ServiceInfo.Name; rsLyr.Visible = false; mp.AddLayer((ILayer)rsLyr); } this.Close(); //MessageBox.Show(msg); }
private void btnDownload_Click(object sender, EventArgs e) { if (!checkInputs()) { MessageBox.Show("You must have a value for all inputs"); return; } mapserviceutility msUtil = new mapserviceutility(); geoDatabaseUtility geoUtil = new geoDatabaseUtility(); IImageServerLayer svLyr = getServerLayer(); ESRI.ArcGIS.Geometry.IEnvelope ext = new ESRI.ArcGIS.Geometry.EnvelopeClass(); if(cmbExtent.Text.ToLower()=="display") { ext = av.Extent; } else { IFeatureLayer ftrLyr = getFeatureLayer(); ext = ((ESRI.ArcGIS.Geodatabase.IGeoDataset)ftrLyr).Extent; } if(svLyr==null) { MessageBox.Show("You must select a Image server layer"); return; } this.Visible = false; ESRI.ArcGIS.Geodatabase.IWorkspace wks = geoUtil.OpenWorkSpace(txtGeoDb.Text); ESRI.ArcGIS.Geodatabase.IRaster rs = null; string msg = msUtil.fillDbRaster(svLyr,wks,ext,svLyr.ServiceInfo.SpatialReference,out rs); IMap mp = (IMap)av; if (rs != null) { IRasterLayer rsLyr = new RasterLayerClass(); rsLyr.CreateFromRaster(rs); rsLyr.Name = svLyr.ServiceInfo.Name; rsLyr.Visible = false; mp.AddLayer((ILayer)rsLyr); } this.Close(); //MessageBox.Show(msg); }
public IFeatureClass reprojectInFeatureClass(IFeatureClass InFeatureClass, ISpatialReference SpatialReference) { IWorkspace tempWorkspace = geoUtil.OpenWorkSpace(tempWksStr); string outNm = ((IDataset)InFeatureClass).BrowseName + "_PR"; outNm = geoUtil.getSafeOutputNameNonRaster(wks, outNm); IFields outFlds = new FieldsClass(); IFieldsEdit outFldsE = (IFieldsEdit)outFlds; IField inFld = InFeatureClass.Fields.get_Field(InFeatureClass.FindField(ftrField)); IField outFld = new FieldClass(); if (inFld.Type == esriFieldType.esriFieldTypeOID) { IFieldEdit outFldE = (IFieldEdit)outFld; outFldE.Type_2 = esriFieldType.esriFieldTypeInteger; outFldE.Name_2 = inFld.Name; } else { IClone cl = (IClone)inFld; outFld = (IField)cl.Clone(); } outFldsE.AddField(outFld); IFeatureClass outFtrCls = geoUtil.createFeatureClass((IWorkspace2)tempWorkspace, outNm, outFldsE, InFeatureClass.ShapeType, SpatialReference); string ozName = ftrField; int ozIndex = outFtrCls.FindField(ozName); if (ozIndex == -1) { ozName = ftrField + "_1"; ozIndex = outFtrCls.FindField(ozName); } int izIndex = InFeatureClass.FindField(ftrField); IQueryFilter qf = new QueryFilterClass(); qf.SubFields = InFeatureClass.ShapeFieldName + "," + ftrField; IFeatureCursor fCur = InFeatureClass.Search(qf, false); IFeature ftr = fCur.NextFeature(); IWorkspaceEdit wksE = (IWorkspaceEdit)tempWorkspace; bool weStart = true; if (wksE.IsBeingEdited()) { weStart = false; } else { wksE.StartEditing(false); } wksE.StartEditOperation(); try { while (ftr != null) { object vl = ftr.get_Value(izIndex); IFeatureProject ftrP = (IFeatureProject)ftr; ftrP.Project(SpatialReference); IFeature oFtr = outFtrCls.CreateFeature(); oFtr.Shape = ftr.Shape; if (ozIndex > -1) { oFtr.set_Value(ozIndex, vl); } oFtr.Store(); ftr = fCur.NextFeature(); } ftrField = ozName; } catch (Exception e) { Console.WriteLine(e.ToString()); } finally { wksE.StopEditOperation(); if (weStart) { wksE.StopEditing(true); } } return(outFtrCls); }
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 btnExecute_Click(object sender, EventArgs e) { string demStr = cmbDem.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(demStr)) { MessageBox.Show("Dem must be specified before executing"); return; } string unitsStr = cmbUnits.Text; if (unitsStr == "") { MessageBox.Show("Speed Units must be specified before executing"); return; } string roadsStr = cmbRoad.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(roadsStr) && !frmHlp.FeatureDictionary.ContainsKey(roadsStr)) { MessageBox.Show("Roads Layer or Accumulation Raster must be specified before executing"); return; } string facilityStr = cmbFacility.Text; string speedFldStr = cmbSpeed.Text; if (chbHours.Checked) { if (!frmHlp.FeatureDictionary.ContainsKey(facilityStr)) { MessageBox.Show("Facility Layer must be specified before executing"); return; } if (speedFldStr == "") { MessageBox.Show("Speed Fld must be specified before executing"); return; } } string onRateStr = cmbOnRate.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(onRateStr) && !rsUtil.isNumeric(onRateStr)) { MessageBox.Show("On Road Machine Rate must be specified before executing"); return; } float onPay = System.Convert.ToSingle(nudOnPayload.Value); string offSpeedStr = cmbOffRoadSpeed.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(offSpeedStr) && !rsUtil.isNumeric(offSpeedStr)) { MessageBox.Show("Off Road Speed or Off Road hours Raster must be specified before executing"); return; } string offRateStr = cmbOffRate.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(offRateStr) && !rsUtil.isNumeric(offRateStr)) { MessageBox.Show("Off Road Machine Rate must be specified before executing"); return; } string offBarriersStr = cmbBarrier.Text; float offPay = System.Convert.ToSingle(nudOffPayload.Value); string opsStr = cmbOps.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(opsStr) && !rsUtil.isNumeric(opsStr)) { MessageBox.Show("Operation Rate must be specified before executing"); return; } string otherStr = cmbOther.Text; if (!frmHlp.FunctionRasterDictionary.ContainsKey(otherStr) && !rsUtil.isNumeric(otherStr)) { MessageBox.Show("Other rate must be specified before executing"); return; } string wksStr = txtOutWks.Text; IWorkspace wks = geoUtil.OpenWorkSpace(wksStr); if (wks == null) { MessageBox.Show("A valid file geodatabase must be specified before executing"); return; } RunningProcess.frmRunningProcessDialog rp = new RunningProcess.frmRunningProcessDialog(); rp.addMessage("Calculating delivered cost surface...\nThis may take a while..."); rp.stepPGBar(10); rp.TopMost = true; rp.Show(); DateTime dt = DateTime.Now; this.Visible = false; try { IFunctionRasterDataset Dem = frmHlp.FunctionRasterDictionary[demStr]; TransRouting.SpeedUnits units = (TransRouting.SpeedUnits)Enum.Parse(typeof(TransRouting.SpeedUnits), unitsStr); TransRouting tr = new TransRouting(wks, Dem, units); if (rsUtil.isNumeric(onRateStr)) { tr.OnRoadMachineRate = System.Convert.ToSingle(onRateStr); } else { tr.OnRoadMachineRateRaster = frmHlp.FunctionRasterDictionary[onRateStr]; } tr.OnRoadPayLoad = onPay; if (rsUtil.isNumeric(offRateStr)) { tr.OffRoadMachineRate = System.Convert.ToSingle(offRateStr); } else { tr.OffRoadMachineRateRaster = frmHlp.FunctionRasterDictionary[offRateStr]; } tr.OffRoadPayLoad = offPay; if (rsUtil.isNumeric(opsStr)) { tr.OperationsCost = System.Convert.ToSingle(opsStr); } else { tr.OperationsCostRaster = frmHlp.FunctionRasterDictionary[opsStr]; } if (rsUtil.isNumeric(otherStr)) { tr.OtherCost = System.Convert.ToSingle(otherStr); } else { tr.OtherCostRaster = frmHlp.FunctionRasterDictionary[otherStr]; } if (chbHours.Checked) { if (frmHlp.FeatureDictionary.ContainsKey(roadsStr)) { tr.RoadFeatureClass = frmHlp.FeatureDictionary[roadsStr]; } else { tr.RoadRaster = frmHlp.FunctionRasterDictionary[roadsStr]; } tr.FacilityFeatureClass = frmHlp.FeatureDictionary[facilityStr]; tr.RoadsSpeedField = speedFldStr; if (rsUtil.isNumeric(offSpeedStr)) { tr.OffRoadSpeed = System.Convert.ToSingle(offSpeedStr); } else { tr.OffRoadSpeedRaster = frmHlp.FunctionRasterDictionary[offSpeedStr]; } if (frmHlp.FeatureDictionary.ContainsKey(offBarriersStr)) { tr.BarriersFeatureClass = frmHlp.FeatureDictionary[offBarriersStr]; } else if (frmHlp.FunctionRasterDictionary.ContainsKey(offBarriersStr)) { tr.BarrierRaster = frmHlp.FunctionRasterDictionary[offBarriersStr]; } } else { tr.FunctionAccumulatedPathAllocation = frmHlp.FunctionRasterDictionary[roadsStr]; tr.FunctionAccumulatedFromPathDistance = frmHlp.FunctionRasterDictionary[offSpeedStr]; } IFunctionRasterDataset DollarsPerTon = tr.OutDollarsTonsRaster; //IFunctionRasterDataset outraster = rsUtil.createRaster(DollarsPerTon); if (frmHlp.TheMap != null) { rp.addMessage("Calculating Statistics..."); rp.Refresh(); IRasterLayer rstLyr = new RasterLayerClass(); //rsUtil.calcStatsAndHist(((IRaster2)outraster).RasterDataset); rstLyr.CreateFromDataset((IRasterDataset)DollarsPerTon); rstLyr.Name = "DollarsPerTon"; rstLyr.Visible = false; frmHlp.TheMap.AddLayer(rstLyr); } this.DialogResult = DialogResult.OK; } catch (Exception ex) { rp.addMessage(ex.ToString()); } finally { DateTime dt2 = DateTime.Now; TimeSpan ts = dt2.Subtract(dt); string t = " in " + ts.Days.ToString() + " days " + ts.Hours.ToString() + " hours " + ts.Minutes.ToString() + " minutes and " + ts.Seconds.ToString() + " seconds ."; rp.stepPGBar(100); rp.addMessage("Finished creating delivered cost surfaces" + t); rp.enableClose(); this.Close(); } }
private void createTable() { string tblName = "catTbl.dbf"; IWorkspace wks = geoUtil.OpenWorkSpace(rsUtil.TempMosaicDir); IFields flds = new FieldsClass(); IFieldsEdit fldsE = (IFieldsEdit)flds; IField fld = new FieldClass(); IFieldEdit fldE = (IFieldEdit)fld; fldE.Name_2 = "catIndex"; fldE.Type_2 = esriFieldType.esriFieldTypeSmallInteger; fldsE.AddField(fldE); IField fld2 = new FieldClass(); IFieldEdit fldE2 = (IFieldEdit)fld2; fldE2.Name_2 = "XMIN"; fldE2.Type_2 = esriFieldType.esriFieldTypeDouble; fldsE.AddField(fldE2); IField fld3 = new FieldClass(); IFieldEdit fldE3 = (IFieldEdit)fld3; fldE3.Name_2 = "XMAX"; fldE3.Type_2 = esriFieldType.esriFieldTypeDouble; fldsE.AddField(fldE3); IField fld4 = new FieldClass(); IFieldEdit fldE4 = (IFieldEdit)fld4; fldE4.Name_2 = "YMIN"; fldE4.Type_2 = esriFieldType.esriFieldTypeDouble; fldsE.AddField(fldE4); IField fld5 = new FieldClass(); IFieldEdit fldE5 = (IFieldEdit)fld5; fldE5.Name_2 = "YMAX"; fldE5.Type_2 = esriFieldType.esriFieldTypeDouble; fldsE.AddField(fldE5); tbl = geoUtil.createTable(wks, tblName, flds); int catInd = tbl.FindField("catIndex"); int xMinInd = tbl.FindField("XMIN"); int xMaxInd = tbl.FindField("XMAX"); int yMinInd = tbl.FindField("YMIN"); int yMaxInd = tbl.FindField("YMAX"); int cnt = 0; foreach (IRaster rs in inrs) { IRow rw = tbl.CreateRow(); rw.set_Value(catInd, cnt); IEnvelope ext = ((IRasterProps)rs).Extent; rw.set_Value(xMinInd, ext.XMin); rw.set_Value(xMaxInd, ext.XMax); rw.set_Value(yMinInd, ext.YMin); rw.set_Value(yMaxInd, ext.YMax); rw.Store(); cnt++; } }
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; }