private void btnCreateOverlapMap_Click(object sender, EventArgs e) { ILayer tilelayoutlayer = _utilities.Layer(this.cboTileLayoutLayer.Text); this.btnClose.Enabled = false; try { if (tilelayoutlayer != null) { IFeatureLayer tilelayoutfeaturelayer = tilelayoutlayer as IFeatureLayer; IFeatureClass tilelayoutfeatureclass = tilelayoutfeaturelayer.FeatureClass; IFeatureSelection centerlinesfeatureselection = tilelayoutfeaturelayer as IFeatureSelection; int tilenamefieldindex = GDBUtilities.FindField(tilelayoutfeatureclass, this.cboTileNameField.Text); if ((tilenamefieldindex > -1) && (this.tbxLASFolder.Text.Length > 0)) { _bp = new BoundaryProblem(_application, _utilities); _bp.Solve(tilelayoutfeaturelayer, tilelayoutfeatureclass, this.tbxLASFolder.Text, this.tbxLASToolsFolder.Text, this.chkUseSelected.Checked, tilenamefieldindex, this.numProcesses.Value); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Boundary Problem", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { this.btnClose.Enabled = true; } }
private bool CreateShapefile(string tilename, IPolygon polygon, string shpfolder, ISpatialReference sref) { string shapefile = System.IO.Path.Combine(shpfolder, tilename); if (GDBUtilities.DoesShapefileExist(shapefile)) { return(false); } IFields outputfields = GDBUtilities.NewPolygonFields(sref); IFeatureClass outputfeatureclass = GDBUtilities.NewShapefile(shpfolder, tilename, outputfields); IFeature newfeature = outputfeatureclass.CreateFeature(); newfeature.Shape = polygon; newfeature.Store(); newfeature = null; outputfeatureclass = null; GC.Collect(); return(true); }