Skip to content

Commit

Permalink
update issue #450
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Jul 13, 2016
1 parent 3a5fd16 commit 26efdf5
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 65 deletions.
8 changes: 6 additions & 2 deletions DialogTools/ExportDataDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ void ExportDataDlg::OnOkClick( wxCommandEvent& event )
// cases: e.g. sqlite, ESRI FileGDB
if (datasource_type == 0) {
if (wxFileExists(ds_name)) {
if (ds_name.EndsWith(".sqlite")) {
if (ds_name.EndsWith(".sqlite") || ds_name.EndsWith(".gpkg")) {
// add new layer to existing sqlite
is_update = true;
} else {
Expand Down Expand Up @@ -394,9 +394,13 @@ void ExportDataDlg::OnOkClick( wxCommandEvent& event )
} catch (GdaException& e) {
if (e.type() == GdaException::NORMAL)
return;

// special clean up for file datasource
if ( !tmp_ds_name.empty() ) {
if ( wxFileExists(tmp_ds_name) && !tmp_ds_name.EndsWith(".sqlite")){
if ( wxFileExists(tmp_ds_name) &&
!tmp_ds_name.EndsWith(".sqlite") &&
!tmp_ds_name.EndsWith(".gpkg") )
{
wxRemoveFile(ds_name);
wxCopyFile(tmp_ds_name, ds_name);
wxRemoveFile(tmp_ds_name);
Expand Down
10 changes: 10 additions & 0 deletions GeoDa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ EVT_CHAR_HOOK(GdaFrame::OnKeyEvent)

EVT_MENU(XRCID("ID_NEW_PROJ_FROM_SHP"), GdaFrame::OnNewProjectFromShp)
EVT_MENU(XRCID("ID_NEW_PROJ_FROM_SQLITE"), GdaFrame::OnNewProjectFromSqlite)
EVT_MENU(XRCID("ID_NEW_PROJ_FROM_GPKG"), GdaFrame::OnNewProjectFromGpkg)
EVT_MENU(XRCID("ID_NEW_PROJ_FROM_CSV"), GdaFrame::OnNewProjectFromCsv)
EVT_MENU(XRCID("ID_NEW_PROJ_FROM_DBF"), GdaFrame::OnNewProjectFromDbf)
EVT_MENU(XRCID("ID_NEW_PROJ_FROM_GDB"), GdaFrame::OnNewProjectFromGdb)
Expand Down Expand Up @@ -1223,6 +1224,7 @@ void GdaFrame::UpdateToolbarAndMenus()

GeneralWxUtils::EnableMenuItem(mb, "File", XRCID("ID_NEW_PROJ_FROM_SHP"), !proj_open);
GeneralWxUtils::EnableMenuItem(mb, "File", XRCID("ID_NEW_PROJ_FROM_SQLITE"), !proj_open);
GeneralWxUtils::EnableMenuItem(mb, "File", XRCID("ID_NEW_PROJ_FROM_GPKG"), !proj_open);
GeneralWxUtils::EnableMenuItem(mb, "File", XRCID("ID_NEW_PROJ_FROM_CSV"), !proj_open);
GeneralWxUtils::EnableMenuItem(mb, "File", XRCID("ID_NEW_PROJ_FROM_DBF"), !proj_open);
GeneralWxUtils::EnableMenuItem(mb, "File", XRCID("ID_NEW_PROJ_FROM_GDB"), !proj_open);
Expand Down Expand Up @@ -1874,6 +1876,14 @@ void GdaFrame::OnNewProjectFromSqlite(wxCommandEvent& event)
NewProjectFromFile(dlg.GetPath());
}

void GdaFrame::OnNewProjectFromGpkg(wxCommandEvent& event)
{
wxString wc = "GeoPacakge (*.gpkg)|*.gpkg";
wxFileDialog dlg(this,"New Project From GeoPackage", "", "", wc);
if (dlg.ShowModal() != wxID_OK) return;
NewProjectFromFile(dlg.GetPath());
}

void GdaFrame::OnNewProjectFromCsv(wxCommandEvent& event)
{
wxString wc = "Comma Separated Value (*.csv)|*.csv";
Expand Down
1 change: 1 addition & 0 deletions GeoDa.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class GdaFrame: public wxFrame
void OnNewProject(wxCommandEvent& event);
void OnNewProjectFromShp(wxCommandEvent& event);
void OnNewProjectFromSqlite(wxCommandEvent& event);
void OnNewProjectFromGpkg(wxCommandEvent& event);
void OnNewProjectFromCsv(wxCommandEvent& event);
void OnNewProjectFromDbf(wxCommandEvent& event);
void OnNewProjectFromGdb(wxCommandEvent& event);
Expand Down
130 changes: 68 additions & 62 deletions rc/GdaAppResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20188,7 +20188,7 @@ static unsigned char xml_res_file_8[] = {
76,79,83,69,95,66,79,88,60,47,115,116,121,108,101,62,10,32,32,60,47,111,
98,106,101,99,116,62,10,60,47,114,101,115,111,117,114,99,101,62,10};

static size_t xml_res_size_9 = 159785;
static size_t xml_res_size_9 = 159913;
static unsigned char xml_res_file_9[] = {
60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101,
110,99,111,100,105,110,103,61,34,73,83,79,45,56,56,53,57,45,49,53,34,63,
Expand Down Expand Up @@ -20218,73 +20218,79 @@ static unsigned char xml_res_file_9[] = {
32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,111,
98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,
116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,79,74,
95,70,82,79,77,95,67,83,86,34,62,10,32,32,32,32,32,32,32,32,32,32,60,108,
97,98,101,108,62,67,111,109,109,97,32,83,101,112,97,114,97,116,101,100,
32,86,97,108,117,101,32,40,42,46,99,115,118,41,60,47,108,97,98,101,108,
62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,
32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,
120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,
69,87,95,80,82,79,74,95,70,82,79,77,95,68,66,70,34,62,10,32,32,32,32,32,
32,32,32,32,32,60,108,97,98,101,108,62,100,66,97,115,101,32,68,97,116,97,
98,97,115,101,32,70,105,108,101,32,40,42,46,100,98,102,41,60,47,108,97,
95,70,82,79,77,95,71,80,75,71,34,62,10,32,32,32,32,32,32,32,32,32,32,60,
108,97,98,101,108,62,71,101,111,80,97,99,107,97,103,101,32,40,42,46,103,
112,107,103,41,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,60,
47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,111,98,106,101,
99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,
34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,79,74,95,70,82,79,
77,95,67,83,86,34,62,10,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,
108,62,67,111,109,109,97,32,83,101,112,97,114,97,116,101,100,32,86,97,108,
117,101,32,40,42,46,99,115,118,41,60,47,108,97,98,101,108,62,10,32,32,32,
32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,
60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,
117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,
79,74,95,70,82,79,77,95,68,66,70,34,62,10,32,32,32,32,32,32,32,32,32,32,
60,108,97,98,101,108,62,100,66,97,115,101,32,68,97,116,97,98,97,115,101,
32,70,105,108,101,32,40,42,46,100,98,102,41,60,47,108,97,98,101,108,62,
10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,
32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,
77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,
87,95,80,82,79,74,95,70,82,79,77,95,74,83,79,78,34,62,10,32,32,32,32,32,
32,32,32,32,32,60,108,97,98,101,108,62,71,101,111,74,83,79,78,32,40,42,
46,106,115,111,110,41,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,
32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,111,98,
106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116,
101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,79,74,95,
70,82,79,77,95,71,77,76,34,62,10,32,32,32,32,32,32,32,32,32,32,60,108,97,
98,101,108,62,71,101,111,103,114,97,112,104,121,32,77,97,114,107,117,112,
32,76,97,110,103,117,97,103,101,32,40,42,46,103,109,108,41,60,47,108,97,
98,101,108,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,
10,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,
61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,
73,68,95,78,69,87,95,80,82,79,74,95,70,82,79,77,95,74,83,79,78,34,62,10,
32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,71,101,111,74,83,
79,78,32,40,42,46,106,115,111,110,41,60,47,108,97,98,101,108,62,10,32,32,
32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,
32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,
117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,
79,74,95,70,82,79,77,95,71,77,76,34,62,10,32,32,32,32,32,32,32,32,32,32,
60,108,97,98,101,108,62,71,101,111,103,114,97,112,104,121,32,77,97,114,
107,117,112,32,76,97,110,103,117,97,103,101,32,40,42,46,103,109,108,41,
60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,
101,99,116,62,10,32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,
108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,
109,101,61,34,73,68,95,78,69,87,95,80,82,79,74,95,70,82,79,77,95,75,77,
76,34,62,10,32,32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,75,101,
121,104,111,108,101,32,77,97,114,107,117,112,32,76,97,110,103,117,97,103,
101,32,40,42,46,107,109,108,41,60,47,108,97,98,101,108,62,10,32,32,32,32,
32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,
111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,
73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,79,
74,95,70,82,79,77,95,77,65,80,73,78,70,79,34,62,10,32,32,32,32,32,32,32,
32,32,32,60,108,97,98,101,108,62,77,97,112,73,110,102,111,32,40,42,46,116,
97,98,44,32,42,46,109,105,102,44,32,42,46,109,105,100,41,60,47,108,97,98,
101,108,62,10,32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,
32,32,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,
34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,
68,95,78,69,87,95,80,82,79,74,95,70,82,79,77,95,88,76,83,34,62,10,32,32,
32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,77,83,32,69,120,99,101,
108,32,40,42,46,120,108,115,41,60,47,108,97,98,101,108,62,10,32,32,32,32,
32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,47,111,
73,68,95,78,69,87,95,80,82,79,74,95,70,82,79,77,95,75,77,76,34,62,10,32,
32,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,75,101,121,104,111,108,
101,32,77,97,114,107,117,112,32,76,97,110,103,117,97,103,101,32,40,42,46,
107,109,108,41,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,60,
47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,32,32,60,111,98,106,101,
99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,
34,32,110,97,109,101,61,34,73,68,95,78,69,87,95,80,82,79,74,95,70,82,79,
77,95,77,65,80,73,78,70,79,34,62,10,32,32,32,32,32,32,32,32,32,32,60,108,
97,98,101,108,62,77,97,112,73,110,102,111,32,40,42,46,116,97,98,44,32,42,
46,109,105,102,44,32,42,46,109,105,100,41,60,47,108,97,98,101,108,62,10,
32,32,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,
32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,
101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,78,69,87,
95,80,82,79,74,95,70,82,79,77,95,88,76,83,34,62,10,32,32,32,32,32,32,32,
32,32,32,60,108,97,98,101,108,62,77,83,32,69,120,99,101,108,32,40,42,46,
120,108,115,41,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,60,
47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,
116,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,
61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,
73,68,95,78,69,87,95,80,82,79,74,69,67,84,34,62,10,32,32,32,32,32,32,32,
32,60,108,97,98,101,108,62,38,97,109,112,59,78,101,119,32,80,114,111,106,
101,99,116,60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,60,97,
99,99,101,108,62,67,116,114,108,43,78,60,47,97,99,99,101,108,62,10,32,32,
32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,
98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,
116,101,109,34,32,110,97,109,101,61,34,73,68,95,79,80,69,78,95,80,82,79,
74,69,67,84,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,38,
97,109,112,59,79,112,101,110,32,80,114,111,106,101,99,116,60,47,108,97,
98,101,108,62,10,32,32,32,32,32,32,32,32,60,97,99,99,101,108,62,67,116,
114,108,43,79,60,47,97,99,99,101,108,62,10,32,32,32,32,32,32,60,47,111,
98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,
108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,
109,101,61,34,73,68,95,78,69,87,95,80,82,79,74,69,67,84,34,62,10,32,32,
32,32,32,32,32,32,60,108,97,98,101,108,62,38,97,109,112,59,78,101,119,32,
109,101,61,34,73,68,95,83,65,86,69,95,65,83,95,80,82,79,74,69,67,84,34,
62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,83,97,118,101,32,
80,114,111,106,101,99,116,60,47,108,97,98,101,108,62,10,32,32,32,32,32,
32,32,32,60,97,99,99,101,108,62,67,116,114,108,43,78,60,47,97,99,99,101,
108,62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,
32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,
101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,79,80,69,
78,95,80,82,79,74,69,67,84,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,
101,108,62,38,97,109,112,59,79,112,101,110,32,80,114,111,106,101,99,116,
60,47,108,97,98,101,108,62,10,32,32,32,32,32,32,32,32,60,97,99,99,101,108,
62,67,116,114,108,43,79,60,47,97,99,99,101,108,62,10,32,32,32,32,32,32,
60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,98,106,101,99,
116,32,99,108,97,115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,
32,110,97,109,101,61,34,73,68,95,83,65,86,69,95,65,83,95,80,82,79,74,69,
67,84,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,62,83,97,118,
101,32,80,114,111,106,101,99,116,60,47,108,97,98,101,108,62,10,32,32,32,
32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,98,
106,101,99,116,32,99,108,97,115,115,61,34,115,101,112,97,114,97,116,111,
114,34,47,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,
115,115,61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,
61,34,73,68,95,83,65,86,69,95,80,82,79,74,69,67,84,34,62,10,32,32,32,32,
32,32,32,32,60,108,97,98,101,108,62,83,97,118,101,60,47,108,97,98,101,108,
62,10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,
32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,
32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,60,111,98,106,101,
99,116,32,99,108,97,115,115,61,34,115,101,112,97,114,97,116,111,114,34,
47,62,10,32,32,32,32,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,
61,34,119,120,77,101,110,117,73,116,101,109,34,32,110,97,109,101,61,34,
73,68,95,83,65,86,69,95,80,82,79,74,69,67,84,34,62,10,32,32,32,32,32,32,
32,32,60,108,97,98,101,108,62,83,97,118,101,60,47,108,97,98,101,108,62,
10,32,32,32,32,32,32,60,47,111,98,106,101,99,116,62,10,32,32,32,32,32,32,
60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,77,101,110,
117,73,116,101,109,34,32,110,97,109,101,61,34,73,68,95,69,88,80,79,82,84,
95,76,65,89,69,82,34,62,10,32,32,32,32,32,32,32,32,60,108,97,98,101,108,
62,83,97,118,101,32,65,115,60,47,108,97,98,101,108,62,10,32,32,32,32,32,
Expand Down
3 changes: 3 additions & 0 deletions rc/menus.xrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
</object>
<object class="wxMenuItem" name="ID_NEW_PROJ_FROM_SQLITE">
<label>SQLite/SpatialLite (*.sqlite)</label>
</object>
<object class="wxMenuItem" name="ID_NEW_PROJ_FROM_GPKG">
<label>GeoPackage (*.gpkg)</label>
</object>
<object class="wxMenuItem" name="ID_NEW_PROJ_FROM_CSV">
<label>Comma Separated Value (*.csv)</label>
Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ namespace Gda {
const int version_major = 1;
const int version_minor = 8;
const int version_build = 9;
const int version_subbuild = 1;
const int version_subbuild = 3;
const int version_year = 2016;
const int version_month = 7;
const int version_day = 8;
Expand Down

0 comments on commit 26efdf5

Please sign in to comment.