MCPcopy Create free account
hub / github.com/GeoDaCenter/geoda / OnMapAddLayer

Method OnMapAddLayer

Explore/MapNewView.cpp:3597–3623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3595}
3596
3597void 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
3625void MapFrame::OnMapEditLayer(wxCommandEvent& e)
3626{

Callers

nothing calls this directly

Calls 8

GetProjectTitleMethod · 0.45
GetLayerNameMethod · 0.45
GetDataSourceMethod · 0.45
GetOGRConnectStrMethod · 0.45
GetTypeMethod · 0.45
AddMapLayerMethod · 0.45
CloneMethod · 0.45
EnableToolMethod · 0.45

Tested by

no test coverage detected