public void ToVCT(IMap pMap) { SaveFileDialog dialog = new SaveFileDialog { Filter = "VCT文件(*.vct)|*.vct" }; if (dialog.ShowDialog() == DialogResult.OK) { List <IDataset> allDataset = this.GetAllDataset(pMap); if (allDataset.Count > 0) { this.frm = new frmProgressBar1(); this.frm.progressBar1.Maximum = allDataset.Count; this.frm.progressBar1.Value = 0; this.frm.Show(); this.frm.Text = "导出VCT"; VCTWrite write = new VCTWrite(); write.ProgressMessage += new ProgressMessageHandle(this.BatchConvertToSHP_ProgressMessage); write.Step += (new ESRI.ArcGIS.Geodatabase.IFeatureProgress_StepEventHandler(this.BatchConvertToSHP_Step)); write.SetFeatureClassNameEnvent += new SetFeatureClassNameEnventHandler(this.p_SetFeatureClassNameEnvent); write.SetFeatureCountEnvent += new SetFeatureCountEnventHandler(this.p_SetFeatureCountEnvent); for (int i = 0; i < allDataset.Count; i++) { write.AddDataset(allDataset[i]); } write.Write(dialog.FileName); this.frm.Close(); MessageBox.Show("导出完成!"); } } }
public override void OnClick() { frmClipOutSet frmClipOutSet = new frmClipOutSet(); if (frmClipOutSet.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List <IFeatureClass> list = new List <IFeatureClass>(); for (int i = 0; i < this._context.FocusMap.LayerCount; i++) { ILayer layer = this._context.FocusMap.get_Layer(i); if (layer.Visible) { if (layer is IFeatureLayer) { list.Add((layer as IFeatureLayer).FeatureClass); } else if (layer is IGroupLayer) { this.method_0(layer as IGroupLayer, list); } } } if (frmClipOutSet.Type == 0) { SDEToShapefile sde1 = new SDEToShapefile { ClipGeometry = this._context.FocusMap.ClipGeometry, IsClip = true }; sde1.AddFeatureClasses(list); sde1.Convert(frmClipOutSet.OutWorspace); ComReleaser.ReleaseCOMObject(frmClipOutSet.OutWorspace); } else if (frmClipOutSet.Type == 1) { new ExportToMiTab { InputFeatureClasses = list, OutPath = frmClipOutSet.OutPath, ClipGeometry = this._context.FocusMap.ClipGeometry, IsClip = true }.Export(); } else if (frmClipOutSet.Type == 2) { VCTWrite vCTWrite = new VCTWrite(); for (int i = 0; i < list.Count; i++) { vCTWrite.AddDataset(list[i] as IDataset); } vCTWrite.ClipGeometry = this._context.FocusMap.ClipGeometry; vCTWrite.IsClip = true; vCTWrite.Write(frmClipOutSet.OutPath); } } }
private void simpleButton1_Click(object sender, EventArgs e) { if (this.CanDo()) { this.panel1.Visible = true; this.simpleButton1.Enabled = false; this.simpleButton2.Enabled = false; VCTWrite write = new VCTWrite(); write.ProgressMessage += new ProgressMessageHandle(this.method_6); write.Step += (new IFeatureProgress_StepEventHandler(this.method_5)); for (int i = 0; i < this.ilist_0.Count; i++) { write.AddDataset(this.ilist_0[i] as IDataset); } write.Write(this.txtOutLocation.Text); this.panel1.Visible = false; this.simpleButton1.Enabled = true; this.simpleButton2.Enabled = true; base.DialogResult = DialogResult.OK; base.Close(); } }
public override void OnDblClick() { if (this.idisplayFeedback_0 == null) { return; } this.ipolygon_0 = (this.idisplayFeedback_0 as INewPolygonFeedback).Stop(); this.idisplayFeedback_0 = null; if ((this.ipolygon_0 as IArea).Area == 0.0) { this.ipolygon_0 = null; return; } (this._context.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null); if ((this.ipolygon_0 as ITopologicalOperator).IsSimple) { this.ipolygon_0.SpatialReference = this._context.FocusMap.SpatialReference; frmClipOutSet frmClipOutSet = new frmClipOutSet(); if (frmClipOutSet.ShowDialog() == System.Windows.Forms.DialogResult.OK) { List <IFeatureClass> list = new List <IFeatureClass>(); for (int i = 0; i < this._context.FocusMap.LayerCount; i++) { ILayer layer = this._context.FocusMap.get_Layer(i); if (layer.Visible) { if (layer is IFeatureLayer) { list.Add((layer as IFeatureLayer).FeatureClass); } else if (layer is IGroupLayer) { this.method_1(layer as IGroupLayer, list); } } } if (frmClipOutSet.Type == 0) { SDEToShapefile sde1 = new SDEToShapefile(); sde1.AddFeatureClasses(list); sde1.ClipGeometry = this.ipolygon_0; sde1.IsClip = true; sde1.Convert(frmClipOutSet.OutWorspace); ComReleaser.ReleaseCOMObject(frmClipOutSet.OutWorspace); } else if (frmClipOutSet.Type == 1) { new ExportToMiTab { InputFeatureClasses = list, OutPath = frmClipOutSet.OutPath, ClipGeometry = this.ipolygon_0, IsClip = true }.Export(); } else if (frmClipOutSet.Type == 2) { VCTWrite vCTWrite = new VCTWrite(); for (int i = 0; i < list.Count; i++) { vCTWrite.AddDataset(list[i] as IDataset); } vCTWrite.ClipGeometry = this.ipolygon_0; vCTWrite.IsClip = true; vCTWrite.Write(frmClipOutSet.OutPath); } } } this.ipolygon_0 = null; (this._context.FocusMap as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewForeground, null, null); }