Mercurial > postarc > postarc
comparison Postarc/Postarc/GUI/FormExportToPostGIS.cs @ 0:1aca3d413885 tip
Initial import of Postarc
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 05 Oct 2012 23:55:06 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1aca3d413885 |
---|---|
1 /* | |
2 * Postarc | |
3 * | |
4 * Author: | |
5 * Christian Lins <christian.lins@intevation.de> | |
6 * | |
7 * Copyright: | |
8 * Copyright (C) 2012 Intevation GmbH <http://www.intevation.de/> | |
9 * | |
10 * This program is free software: you can redistribute it and/or modify | |
11 * it under the terms of the GNU Lesser General Public License as published by | |
12 * the Free Software Foundation, either version 3 of the License, or | |
13 * (at your option) any later version. | |
14 * | |
15 * This program is distributed in the hope that it will be useful, | |
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 * GNU General Public License for more details. | |
19 * | |
20 * You should have received a copy of the GNU Lesser General Public License | |
21 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
22 */ | |
23 | |
24 using System; | |
25 using System.Collections.Generic; | |
26 using System.ComponentModel; | |
27 using System.Data; | |
28 using System.Drawing; | |
29 using System.Linq; | |
30 using System.Text; | |
31 using System.Windows.Forms; | |
32 using ESRI.ArcGIS.Carto; | |
33 using Postarc.Catalog; | |
34 | |
35 namespace Postarc.GUI | |
36 { | |
37 public partial class FormExportToPostGIS : Form | |
38 { | |
39 protected IFeatureLayer layer; | |
40 | |
41 public FormExportToPostGIS(IFeatureLayer layer) | |
42 { | |
43 this.layer = layer; | |
44 InitializeComponent(); | |
45 | |
46 // Fill the database connections to the combo box and preselect one | |
47 int selIndex = this.cmbDatabaseConnections.SelectedIndex; | |
48 this.cmbDatabaseConnections.Items.Clear(); | |
49 this.cmbDatabaseConnections.Items.AddRange(Settings.LoadSavedProfiles().ToArray()); | |
50 this.cmbDatabaseConnections.Items.Add(new PostGISConnection()); | |
51 this.cmbDatabaseConnections.SelectedIndex = 0; | |
52 if (selIndex >= 0) | |
53 { | |
54 this.cmbDatabaseConnections.SelectedIndex = selIndex; | |
55 } | |
56 | |
57 this.lblDocumentLayer.Text = "Layer to export: " + layer.Name; | |
58 } | |
59 | |
60 private void FormExportToPostGIS_FormClosing(object sender, FormClosingEventArgs e) | |
61 { | |
62 e.Cancel = true; | |
63 Visible = false; | |
64 } | |
65 | |
66 private void btnExport_Click(object sender, EventArgs e) | |
67 { | |
68 PostGISConnection conn = this.cmbDatabaseConnections.SelectedItem as PostGISConnection; | |
69 | |
70 FeatureClassExporter exp = new FeatureClassExporter(layer.FeatureClass); | |
71 int numExported = exp.ExportFeatureClass(null, conn, cmbGeometryTable.Text); | |
72 | |
73 MessageBox.Show(numExported + " features exported!", "Export successful", MessageBoxButtons.OK, MessageBoxIcon.Information); | |
74 Visible = false; | |
75 } | |
76 } | |
77 } |