Skip to content

Commit

Permalink
Merge pull request #3 from lixun910/dev1.9
Browse files Browse the repository at this point in the history
Dev1.9 patch for 1.8.4
  • Loading branch information
lixun910 committed May 2, 2016
2 parents 9d46975 + 8b926ab commit 84b2fe8
Show file tree
Hide file tree
Showing 11 changed files with 267 additions and 161 deletions.
29 changes: 22 additions & 7 deletions DialogTools/CreatingWeightDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,15 +389,23 @@ void CreatingWeightDlg::OnCreateClick( wxCommandEvent& event )
}
gal = PolysToContigWeights(project->main_data, !is_rook, precision_threshold);
}

if (!gal) {

bool empty_w = true;
bool has_island = false;

for (size_t i=0; i<m_num_obs; ++i) {
if (gal[i].Size() >0) {
empty_w = false;
} else {
has_island = true;
}
}

if (empty_w) {
// could be an empty weights file, and should prompt user
// to setup Precision Threshold
wxString msg("GeoDa can't find weights information from "
"shapes. You can try to set a precision "
"threshold value to find neighbor shapes "
"using a fuzzy matching approach.");
wxMessageDialog dlg(NULL, msg, "Empty Contiguity Weights Created", wxOK | wxICON_WARNING);
wxString msg("None of your observations have neighbors. This could be related to digitizing problems, which can be fixed by adjusting the precision threshold.");
wxMessageDialog dlg(NULL, msg, "Empty Contiguity Weights", wxOK | wxICON_WARNING);
dlg.ShowModal();

m_cbx_precision_threshold->SetValue(true);
Expand All @@ -420,6 +428,13 @@ void CreatingWeightDlg::OnCreateClick( wxCommandEvent& event )
m_txt_precision_threshold->SetValue(tmpTxt);
break;
}
if (has_island) {
wxString msg("There is at least one neighborless observation. Check the weights histogram and linked map to see if the islands are real or not. If not, adjust the distance threshold (points) or the precision threshold (polygons).");
wxMessageDialog dlg(NULL, msg, "Neighborless Observation", wxOK | wxICON_WARNING);
dlg.ShowModal();
}


if (m_ooC > 1) {
Gda::MakeHigherOrdContiguity(m_ooC, m_num_obs, gal, m_check1);
WriteWeightFile(gal, 0, project->GetProjectTitle(), outputfile, id, wmi);
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/ExportCsvDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void ExportCsvDlg::OnOkClick( wxCommandEvent& event )
// Prompt for overwrite permission
if (wxFileExists(new_csv)) {
wxString msg;
msg << new_csv << " already exists. Ok to overwrite?";
msg << new_csv << " already exists. OK to overwrite?";
wxMessageDialog dlg (this, msg, "Overwrite?",
wxYES_NO | wxCANCEL | wxNO_DEFAULT);
if (dlg.ShowModal() != wxID_YES) return;
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/RegressionDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ void RegressionDlg::OnSaveToTxtFileClick( wxCommandEvent& event )
// Prompt for overwrite permission
if (wxFileExists(new_txt)) {
wxString msg;
msg << new_txt << " already exists. Ok to overwrite?";
msg << new_txt << " already exists. OK to overwrite?";
wxMessageDialog dlg (this, msg, "Overwrite?",
wxYES_NO | wxCANCEL | wxNO_DEFAULT);
if (dlg.ShowModal() != wxID_YES) return;
Expand Down
14 changes: 12 additions & 2 deletions DialogTools/RegressionReportDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ void RegressionReportDlg::CreateControls()

vbox->Add(m_textbox, 1, wxEXPAND|wxALL|wxALIGN_CENTRE);
panel->SetSizer(vbox);


//wxBitmap edit = wxArtProvider::GetBitmap(wxART_PRINT);
//wxBitmap save = wxArtProvider::GetBitmap(wxART_FILE_SAVE);
//wxToolBar *toolbar = CreateToolBar();
//toolbar->AddTool(wxID_EDIT, "Change Font", edit);
//toolbar->AddTool(wxID_SAVE, "Save Regression Results", save);
//toolbar->Realize();
//Connect(wxID_EDIT, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(RegressionReportDlg::OnFontChanged));
//Connect(wxID_SAVE, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(RegressionReportDlg::OnFontChanged));

Center();
}
Expand All @@ -105,7 +115,7 @@ void RegressionReportDlg::SetReport(const wxString report)

void RegressionReportDlg::OnMouseEvent(wxMouseEvent& event)
{
if (event.RightUp())
if (event.RightDown())
PopupMenu(wxXmlResource::Get()->
LoadMenu("ID_REPORT_VIEW_MENU_CONTEXT"),
event.GetPosition().x, event.GetPosition().y);
Expand All @@ -114,7 +124,7 @@ void RegressionReportDlg::OnMouseEvent(wxMouseEvent& event)
void RegressionReportDlg::OnFontChanged(wxCommandEvent& event)
{
wxFontData data;
wxFontDialog dlg(this, data);
wxFontDialog dlg(NULL, data);
wxTextAttr attr;

if (dlg.ShowModal() == wxID_OK)
Expand Down
4 changes: 2 additions & 2 deletions DialogTools/SelectWeightsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ w_man_int(project->GetWManInt()), w_list(0), ok_btn(0), cancel_btn(0)
void SelectWeightsDlg::InitNoWeights()
{
panel = new wxPanel(this);
ok_btn = new wxButton(panel, XRCID("wxID_OK"), "Ok",
ok_btn = new wxButton(panel, XRCID("wxID_OK"), "OK",
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
Connect(XRCID("wxID_OK"), wxEVT_BUTTON,
wxCommandEventHandler(SelectWeightsDlg::OnOkClick));
Expand Down Expand Up @@ -86,7 +86,7 @@ void SelectWeightsDlg::InitNormal()
panel->SetBackgroundColour(*wxWHITE);
SetBackgroundColour(*wxWHITE);

ok_btn = new wxButton(panel, XRCID("wxID_OK"), "Ok",
ok_btn = new wxButton(panel, XRCID("wxID_OK"), "OK",
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
cancel_btn = new wxButton(panel, XRCID("wxID_CANCEL"), "Cancel",
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/VariableSettingsDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void DiffMoranVarSettingDlg::CreateControls()

panel->SetSizer(vbox);

wxButton *okButton = new wxButton(this, wxID_OK, wxT("Ok"), wxDefaultPosition, wxSize(70, 30));
wxButton *okButton = new wxButton(this, wxID_OK, wxT("OK"), wxDefaultPosition, wxSize(70, 30));
wxButton *closeButton = new wxButton(this, wxID_EXIT, wxT("Close"), wxDefaultPosition, wxSize(70, 30));

hbox2->Add(okButton, 1);
Expand Down
2 changes: 1 addition & 1 deletion DialogTools/WeightsManDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ void WeightsManFrame::OnRemoveBtn(wxCommandEvent& ev)
msg << " other " << (nb==1 ? "view" : "views");
msg << " open that depend" << (nb==1 ? "s" : "");
msg << " on this matrix. ";
msg << "Ok to close " << (nb==1 ? "this view" : "these views");
msg << "OK to close " << (nb==1 ? "this view" : "these views");
msg << " and remove?";
wxMessageDialog dlg(this, msg, "Notice",
wxYES_NO | wxNO_DEFAULT | wxICON_QUESTION);
Expand Down
Loading

0 comments on commit 84b2fe8

Please sign in to comment.