| 3595 | } |
| 3596 | |
| 3597 | void MapFrame::OnMapAddLayer(wxCommandEvent& e) |
| 3598 | { |
| 3599 | wxLogMessage("In MapFrame::OnMapAddLayer()"); |
| 3600 | bool show_csv_config = true; |
| 3601 | ConnectDatasourceDlg connect_dlg(this, wxDefaultPosition, wxDefaultSize, |
| 3602 | show_csv_config); |
| 3603 | if (connect_dlg.ShowModal() != wxID_OK) { |
| 3604 | return; |
| 3605 | } |
| 3606 | wxString proj_title = connect_dlg.GetProjectTitle(); |
| 3607 | wxString layer_name = connect_dlg.GetLayerName(); |
| 3608 | IDataSource* datasource = connect_dlg.GetDataSource(); |
| 3609 | wxString datasource_name = datasource->GetOGRConnectStr(); |
| 3610 | GdaConst::DataSourceType ds_type = datasource->GetType(); |
| 3611 | |
| 3612 | BackgroundMapLayer* map_layer = project->AddMapLayer(datasource_name, |
| 3613 | ds_type, layer_name); |
| 3614 | if (map_layer == NULL) { |
| 3615 | wxMessageDialog dlg (this, _("GeoDa could not load this layer. Please check if the datasource is valid and not table only."), _("Load Layer Failed."), wxOK | wxICON_ERROR); |
| 3616 | dlg.ShowModal(); |
| 3617 | } else { |
| 3618 | MapCanvas* m = (MapCanvas*) template_canvas; |
| 3619 | m->AddMapLayer(layer_name, map_layer->Clone(), false); |
| 3620 | toolbar->EnableTool(XRCID("ID_EDIT_LAYER"), true); |
| 3621 | OnMapEditLayer(e); |
| 3622 | } |
| 3623 | } |
| 3624 | |
| 3625 | void MapFrame::OnMapEditLayer(wxCommandEvent& e) |
| 3626 | { |
nothing calls this directly
no test coverage detected