Skip to content

Commit 6cf40f6

Browse files
committed
restore join count ratio summary in unique value map
1 parent 94224b8 commit 6cf40f6

File tree

4 files changed

+132
-10
lines changed

4 files changed

+132
-10
lines changed

GeneralWxUtils.cpp

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,3 +821,77 @@ void SummaryDialog::OnClose( wxCloseEvent& event )
821821
Destroy();
822822
event.Skip();
823823
}
824+
825+
826+
BEGIN_EVENT_TABLE( ValidationSummaryDialog, wxFrame)
827+
EVT_CLOSE( ValidationSummaryDialog::OnClose )
828+
END_EVENT_TABLE()
829+
830+
ValidationSummaryDialog::~ValidationSummaryDialog( )
831+
{
832+
frames_manager->removeObserver(this);
833+
}
834+
835+
ValidationSummaryDialog::ValidationSummaryDialog( wxWindow* parent, Project* project,
836+
wxString showText,
837+
wxWindowID id,
838+
const wxString& caption,
839+
const wxPoint& pos,
840+
const wxSize& size, long style )
841+
:wxFrame(parent, id, caption, pos, size, style)
842+
{
843+
wxLogMessage("Open ValidationSummaryDialog.");
844+
SetParent(parent);
845+
frames_manager = project->GetFramesManager();
846+
847+
results = showText;
848+
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
849+
CreateControls();
850+
Centre();
851+
m_textbox->AppendText(results);
852+
853+
frames_manager->registerObserver(this);
854+
}
855+
856+
void ValidationSummaryDialog::update(FramesManager* o)
857+
{
858+
}
859+
860+
void ValidationSummaryDialog::CreateControls()
861+
{
862+
wxPanel *panel = new wxPanel(this, -1);
863+
wxBoxSizer *vbox = new wxBoxSizer(wxVERTICAL);
864+
m_textbox = new SimpleReportTextCtrl(panel, XRCID("ID_TEXTCTRL"), "", wxDefaultPosition, wxSize(620,560));
865+
866+
if (GeneralWxUtils::isWindows()) {
867+
wxFont font(8,wxFONTFAMILY_TELETYPE,wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
868+
m_textbox->SetFont(font);
869+
} else {
870+
wxFont font(12,wxFONTFAMILY_TELETYPE,wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
871+
m_textbox->SetFont(font);
872+
873+
}
874+
vbox->Add(m_textbox, 1, wxEXPAND|wxALL);
875+
panel->SetSizer(vbox);
876+
877+
Center();
878+
}
879+
880+
void ValidationSummaryDialog::AddNewReport(const wxString report)
881+
{
882+
results = report + results;
883+
m_textbox->SetValue(results);
884+
}
885+
886+
void ValidationSummaryDialog::SetReport(const wxString report)
887+
{
888+
results = report;
889+
m_textbox->SetValue(results);
890+
}
891+
892+
void ValidationSummaryDialog::OnClose( wxCloseEvent& event )
893+
{
894+
wxLogMessage("In ValidationSummaryDialog::OnClose()");
895+
Destroy();
896+
event.Skip();
897+
}

GeneralWxUtils.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,37 @@ class SummaryDialog : public wxFrame, public FramesManagerObserver
117117
FramesManager* frames_manager;
118118
};
119119

120+
class ValidationSummaryDialog : public wxFrame, public FramesManagerObserver
121+
{
122+
DECLARE_EVENT_TABLE()
123+
124+
public:
125+
ValidationSummaryDialog() {}
126+
ValidationSummaryDialog(wxWindow* parent, Project* project, wxString showText,
127+
wxWindowID id = wxID_ANY,
128+
const wxString& caption = _("Spatial Validation Summary"),
129+
const wxPoint& pos = wxDefaultPosition,
130+
const wxSize& size = wxSize(680, 480),
131+
long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX);
132+
virtual ~ValidationSummaryDialog();
133+
134+
/** Implementation of FramesManagerObserver interface */
135+
virtual void update(FramesManager* o);
136+
137+
void CreateControls();
138+
void OnClose(wxCloseEvent& event);
139+
void AddNewReport(const wxString report);
140+
void SetReport(const wxString report);
141+
142+
SimpleReportTextCtrl* m_textbox;
143+
wxString results;
144+
145+
private:
146+
FramesManager* frames_manager;
147+
};
148+
149+
150+
120151
class ScrolledDetailMsgDialog : public wxDialog
121152
{
122153
public:

GeoDa.cpp

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5108,12 +5108,29 @@ void GdaFrame::ChangeToEqualIntervals(int num_cats)
51085108
void GdaFrame::OnOpenUniqueValues(wxCommandEvent& event)
51095109
{
51105110
wxLogMessage("In GdaFrame::OnOpenUniqueValues()");
5111-
bool show_str_var = true;
5112-
VariableSettingsDlg dlg(project_p, VariableSettingsDlg::univariate,
5113-
// default values
5114-
false, false, _("Variable Settings"), "", "","","",false, false, false,
5115-
show_str_var);
5111+
UniqueValuesSettingDlg dlg(project_p);
51165112
if (dlg.ShowModal() != wxID_OK) return;
5113+
5114+
wxString joincountSummary = dlg.GetSummary();
5115+
if (!joincountSummary.IsEmpty()) {
5116+
FramesManager* fm = project_p->GetFramesManager();
5117+
std::list<FramesManagerObserver*> observers(fm->getCopyObservers());
5118+
std::list<FramesManagerObserver*>::iterator it;
5119+
for (it=observers.begin(); it != observers.end(); ++it) {
5120+
if (SummaryDialog* w = dynamic_cast<SummaryDialog*>(*it)) {
5121+
w->AddNewReport(joincountSummary);
5122+
w->m_textbox->SetSelection(0, 0);
5123+
w->Show(true);
5124+
w->Raise();
5125+
return;
5126+
}
5127+
}
5128+
5129+
SummaryDialog* summaryDlg = new SummaryDialog(this, project_p, joincountSummary, wxID_ANY, _("Join Count Ratio Summary"));
5130+
summaryDlg->Show(true);
5131+
summaryDlg->m_textbox->SetSelection(0, 0);
5132+
}
5133+
51175134
MapFrame* nf = new MapFrame(GdaFrame::gda_frame, project_p,
51185135
dlg.var_info, dlg.col_ids,
51195136
CatClassification::unique_values,
@@ -5174,7 +5191,7 @@ void GdaFrame::OnOpenClusterValidation(wxCommandEvent& event)
51745191
std::list<FramesManagerObserver*> observers(fm->getCopyObservers());
51755192
std::list<FramesManagerObserver*>::iterator it;
51765193
for (it=observers.begin(); it != observers.end(); ++it) {
5177-
if (SummaryDialog* w = dynamic_cast<SummaryDialog*>(*it)) {
5194+
if (ValidationSummaryDialog* w = dynamic_cast<ValidationSummaryDialog*>(*it)) {
51785195
w->AddNewReport(validationSummary);
51795196
w->m_textbox->SetSelection(0, 0);
51805197
w->Show(true);
@@ -5183,9 +5200,9 @@ void GdaFrame::OnOpenClusterValidation(wxCommandEvent& event)
51835200
}
51845201
}
51855202

5186-
SummaryDialog* summaryDlg = new SummaryDialog(this, project_p,
5203+
ValidationSummaryDialog* summaryDlg = new ValidationSummaryDialog(this, project_p,
51875204
validationSummary, wxID_ANY,
5188-
_("Validation Summary"));
5205+
_("Spatial Validation Summary"));
51895206
summaryDlg->Show(true);
51905207
summaryDlg->m_textbox->SetSelection(0, 0);
51915208
}

version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ namespace Gda {
22
const int version_major = 1;
33
const int version_minor = 18;
44
const int version_build = 0;
5-
const int version_subbuild = 32;
5+
const int version_subbuild = 34;
66
const int version_year = 2021;
77
const int version_month = 8;
8-
const int version_day = 22;
8+
const int version_day = 23;
99
const int version_night = 0;
1010
const int version_type = 2; // 0: alpha, 1: beta, 2: release
1111
}

0 commit comments

Comments
 (0)