From 26efdf5a0df3313450e6d03acf94571bf5ab5015 Mon Sep 17 00:00:00 2001 From: Xun Li Date: Wed, 13 Jul 2016 13:57:54 -0700 Subject: [PATCH] update issue #450 --- DialogTools/ExportDataDlg.cpp | 8 ++- GeoDa.cpp | 10 +++ GeoDa.h | 1 + rc/GdaAppResources.cpp | 130 ++++++++++++++++++---------------- rc/menus.xrc | 3 + version.h | 2 +- 6 files changed, 89 insertions(+), 65 deletions(-) diff --git a/DialogTools/ExportDataDlg.cpp b/DialogTools/ExportDataDlg.cpp index 1ef224a3f..7d3fa5592 100644 --- a/DialogTools/ExportDataDlg.cpp +++ b/DialogTools/ExportDataDlg.cpp @@ -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 { @@ -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); diff --git a/GeoDa.cpp b/GeoDa.cpp index 671fdc7a3..c88494ad2 100644 --- a/GeoDa.cpp +++ b/GeoDa.cpp @@ -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) @@ -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); @@ -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"; diff --git a/GeoDa.h b/GeoDa.h index 8c4e4263a..7c4bb94de 100644 --- a/GeoDa.h +++ b/GeoDa.h @@ -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); diff --git a/rc/GdaAppResources.cpp b/rc/GdaAppResources.cpp index 00e39ed1b..29a54fe8a 100644 --- a/rc/GdaAppResources.cpp +++ b/rc/GdaAppResources.cpp @@ -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, @@ -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, diff --git a/rc/menus.xrc b/rc/menus.xrc index 5dbd3276c..14b494982 100644 --- a/rc/menus.xrc +++ b/rc/menus.xrc @@ -10,6 +10,9 @@ + + + diff --git a/version.h b/version.h index 8b0ad9a8f..037865116 100644 --- a/version.h +++ b/version.h @@ -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;