Пример #1
0
        private void addPostGIS_Click(object sender, EventArgs e)
        {
            // get selected map first
            MG_Map map = this.getSelectedMap();
            ArrayList tables = m_pgOper.GetTableNames();
            MG_DlgListTableNames dlg = new MG_DlgListTableNames();
            dlg.InitializeTableNames(tables);
            dlg.ShowDialog();
            string selectedTable = dlg.GetSelectedTableName();
            if (selectedTable != null)
            {
                MG_Layer layer = new MG_Layer();
                layer = m_pgOper.ExportLayer(selectedTable);
                map.AddLayer(layer);

                // update m_gMapView
                this.updateMapView();

                // add to treeview
                TreeNode layerNode = new TreeNode();
                layerNode.Text = layer.GetLayerName();
                layerNode.Checked = true;
                this.forceSelectedNodeToMap();
                this.m_gSelectedNode.Nodes.Add(layerNode);
                this.m_gSelectedNode.ExpandAll();
                // set selected node to layer node
                this.m_gSelectedNode = layerNode;
                this.treeViewContent.SelectedNode = this.m_gSelectedNode;
            }

            this.Refresh();
            // set state
            this.setState();
        }
Пример #2
0
        private void ribbonButton_ExportToFile_Click(object sender, EventArgs e)
        {
            ArrayList tables = m_pgOper.GetTableNames();
            MG_DlgListTableNames dlg = new MG_DlgListTableNames();
            dlg.InitializeTableNames(tables);
            dlg.ShowDialog();
            string selectedTable = dlg.GetSelectedTableName();
            if (selectedTable != null)
            {
                SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                saveFileDialog1.InitialDirectory = this.getDataPath();
                saveFileDialog1.Filter = "ArcGIS Shape Files|*.shp";
                saveFileDialog1.Title = "Input file name";
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string savePath = saveFileDialog1.FileName;
                    m_pgOper.ExportToFile(selectedTable, savePath);
                    MessageBox.Show("Import to DB successfully!");
                }
            }

            // set state
            this.setState();
        }