Skip to content

Commit

Permalink
#584 add conditional map to local cluster maps
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Feb 6, 2017
1 parent b387f37 commit 89c27f4
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 81 deletions.
9 changes: 5 additions & 4 deletions BuildTools/macosx/build-express.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ fi
#########################################################################
# install wxWidgets library
#########################################################################
LIB_NAME=wxWidgets-3.0.2
LIB_URL=https://dl.dropboxusercontent.com/u/145979/geoda_libraries/wxWidgets-3.0.2.tar.bz2
LIB_NAME=wxWidgets-3.1.0
LIB_URL=https://dl.dropboxusercontent.com/u/145979/geoda_libraries/wxWidgets-3.1.0.tar.bz2
LIB_FILENAME=$(basename "$LIB_URL" ".tar")
LIB_CHECKER=libwx_baseu-3.0.a
LIB_CHECKER=libwx_baseu-3.1.a
echo $LIB_FILENAME

cd $DOWNLOAD_HOME
Expand All @@ -144,7 +144,8 @@ if ! [ -f "$PREFIX/lib/$LIB_CHECKER" ] ; then
cd $LIB_NAME
cp -rf $GEODA_HOME/dep/$LIB_NAME/* .
make clean
./configure --with-cocoa --disable-shared --enable-mediactrl=no --disable-monolithic --with-opengl --enable-postscript --enable-textfile --without-liblzma --enable-webview --enable-compat28 --disable-mediactrl --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk --prefix=$PREFIX
./configure --with-cocoa --disable-shared --enable-mediactrl=no --disable-monolithic --with-opengl --enable-postscript --enable-textfile --without-liblzma --enable-webview --enable-compat28 --disable-mediactrl -prefix=$PREFIX
#./configure CFLAGS="$GDA_CFLAGS" CXXFLAGS="$GDA_CXXFLAGS" LDFLAGS="$GDA_LDFLAGS" OBJCFLAGS="-arch x86_64" OBJCXXFLAGS="-arch x86_64" --with-cocoa --disable-shared --disable-monolithic --with-opengl --enable-postscript --enable-textfile --without-liblzma --enable-webview --enable-compat28 --prefix=$PREFIX
$MAKER
make install
cd ..
Expand Down
4 changes: 3 additions & 1 deletion DialogTools/ConnectDatasourceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,16 @@ BEGIN_EVENT_TABLE( ConnectDatasourceDlg, wxFrame )
//EVT_BUTTON(XRCID("ID_BTN_LOOKUP_WSLAYER"), ConnectDatasourceDlg::OnLookupWSLayerBtn)
EVT_BUTTON(wxID_OK, ConnectDatasourceDlg::OnOkClick )
EVT_BUTTON(wxID_CANCEL, ConnectDatasourceDlg::OnCancelClick )
EVT_BUTTON(wxID_EXIT, ConnectDatasourceDlg::OnCancelClick )
EVT_MENU(wxID_EXIT, ConnectDatasourceDlg::OnCancelClick )
END_EVENT_TABLE()


ConnectDatasourceDlg::ConnectDatasourceDlg(wxWindow* parent, const wxPoint& pos,
const wxSize& size,
bool showCsvConfigure_,
bool showRecentPanel_)
:datasource(0), scrl(0), recent_panel(0), showCsvConfigure(showCsvConfigure_),
:DatasourceDlg(), datasource(0), scrl(0), recent_panel(0), showCsvConfigure(showCsvConfigure_),
showRecentPanel(showRecentPanel_)
{
base_xrcid_recent_thumb = 7000;
Expand Down
10 changes: 9 additions & 1 deletion DialogTools/DatasourceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ using namespace std;
DatasourceDlg::DatasourceDlg()
: is_ok_clicked(false), eventLoop(NULL)
{
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler(DatasourceDlg::OnExit) );
}

DatasourceDlg::~DatasourceDlg()
Expand All @@ -71,6 +71,9 @@ int DatasourceDlg::ShowModal()

// mow to stop execution start a event loop
eventLoop = new wxEventLoop;
if (eventLoop == NULL)
return wxID_CANCEL;

eventLoop->Run();

if (is_ok_clicked)
Expand All @@ -90,6 +93,11 @@ void DatasourceDlg::OnCancelClick( wxCommandEvent& event )
EndDialog();
}

void DatasourceDlg::OnExit(wxCloseEvent& e)
{
EndDialog();
}

void DatasourceDlg::Init()
{
m_ds_menu = NULL;
Expand Down
4 changes: 3 additions & 1 deletion DialogTools/DatasourceDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ class DatasourceDlg : public wxFrame
DatasourceDlg();
virtual ~DatasourceDlg();
virtual void OnOkClick( wxCommandEvent& event ) = 0;


void OnExit(wxCloseEvent& e);

wxFileName ds_file_path;

protected:
Expand Down
104 changes: 47 additions & 57 deletions Explore/ConditionalClusterMapView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,16 @@ ConditionalClusterMapCanvas(wxWindow *parent,
Project* project_s,
const vector<GdaVarTools::VarInfo>& v_info,
const vector<int>& col_ids,
const wxString& ttl,
const wxPoint& pos, const wxSize& size)
: ConditionalNewCanvas(parent, t_frame, project_s, v_info, col_ids,
true, true, pos, size),
num_categories(1),bin_bm(0),
bin_bg_map_pen(wxColor(200,200,200)),
bin_bg_map_brush(wxColor(200,200,200)),
cc_state_map(0),
full_map_redraw_needed(true)
full_map_redraw_needed(true),
title(ttl)
{

}
Expand Down Expand Up @@ -117,7 +119,10 @@ void ConditionalClusterMapCanvas::DisplayRightClickMenu(const wxPoint& pos)

wxMenu* optMenu = wxXmlResource::Get()->
LoadMenu("ID_COND_MAP_VIEW_MENU_OPTIONS");


wxMenuItem* first_map_menu_item = optMenu->FindItemByPosition(0);
optMenu->Delete(first_map_menu_item);

AddTimeVariantOptionsToMenu(optMenu);
TemplateCanvas::AppendCustomCategories(optMenu,
project->GetCatClassifManager());
Expand All @@ -136,6 +141,21 @@ void ConditionalClusterMapCanvas::OnScrollChanged(wxScrollWinEvent& event)
event.Skip();
}

wxString ConditionalClusterMapCanvas::GetCategoriesTitle()
{
return title;
}

wxString ConditionalClusterMapCanvas::GetCanvasTitle()
{
wxString v;
v << "Conditional Map - ";
v << "x: " << GetNameWithTime(HOR_VAR);
v << ", y: " << GetNameWithTime(VERT_VAR);
v << ", " << title;
return v;
}


void ConditionalClusterMapCanvas::SetCheckMarks(wxMenu* menu)
{
Expand Down Expand Up @@ -746,8 +766,7 @@ ConditionalClusterMapFrame(wxFrame *parent, Project* project,
LisaCoordinator* lisa_coord,
const wxString& title, const wxPoint& pos,
const wxSize& size, const long style)
: ConditionalNewFrame(parent, project, var_info, col_ids, title, pos,
size, style)
: ConditionalNewFrame(parent, project, var_info, col_ids, title, pos,size, style)
{

wxLogMessage("Open ConditionalNewFrame -- LISA.");
Expand All @@ -762,10 +781,11 @@ ConditionalClusterMapFrame(wxFrame *parent, Project* project,

wxPanel* rpanel = new wxPanel(splitter_win);
template_canvas = new ConditionalLISAClusterMapCanvas(rpanel, this, project,
var_info, col_ids,
lisa_coord,
wxDefaultPosition,
wxDefaultSize);
var_info, col_ids,
lisa_coord,
title,
wxDefaultPosition,
wxDefaultSize);
SetTitle(template_canvas->GetCanvasTitle());
template_canvas->SetScrollRate(1,1);
wxBoxSizer* rbox = new wxBoxSizer(wxVERTICAL);
Expand Down Expand Up @@ -796,6 +816,7 @@ ConditionalClusterMapFrame(wxFrame *parent, Project* project,
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
GStatCoordinator* g_coord,
bool is_gi, bool is_perm,
const wxString& title, const wxPoint& pos,
const wxSize& size, const long style)
: ConditionalNewFrame(parent, project, var_info, col_ids, title, pos,
Expand All @@ -814,10 +835,11 @@ ConditionalClusterMapFrame(wxFrame *parent, Project* project,

wxPanel* rpanel = new wxPanel(splitter_win);
template_canvas = new ConditionalGClusterMapCanvas(rpanel, this, project,
var_info, col_ids,
g_coord,
wxDefaultPosition,
wxDefaultSize);
var_info, col_ids,
g_coord, is_gi, is_perm,
title,
wxDefaultPosition,
wxDefaultSize);
SetTitle(template_canvas->GetCanvasTitle());
template_canvas->SetScrollRate(1,1);
wxBoxSizer* rbox = new wxBoxSizer(wxVERTICAL);
Expand Down Expand Up @@ -864,10 +886,12 @@ void ConditionalClusterMapFrame::MapMenus()
// Map Options Menus
wxMenu* optMenu = wxXmlResource::Get()->
LoadMenu("ID_COND_MAP_VIEW_MENU_OPTIONS");
((ConditionalClusterMapCanvas*) template_canvas)->
AddTimeVariantOptionsToMenu(optMenu);
TemplateCanvas::AppendCustomCategories(optMenu,
project->GetCatClassifManager());

wxMenuItem* first_map_menu_item = optMenu->FindItemByPosition(0);
optMenu->Delete(first_map_menu_item);

((ConditionalClusterMapCanvas*) template_canvas)->AddTimeVariantOptionsToMenu(optMenu);
TemplateCanvas::AppendCustomCategories(optMenu, project->GetCatClassifManager());
((ConditionalClusterMapCanvas*) template_canvas)->SetCheckMarks(optMenu);
GeneralWxUtils::ReplaceMenu(mb, "Options", optMenu);
UpdateOptionMenuItems();
Expand Down Expand Up @@ -988,9 +1012,10 @@ ConditionalLISAClusterMapCanvas(wxWindow *parent, TemplateFrame* t_frame,
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
LisaCoordinator* lisa_coordinator,
const wxString& title,
const wxPoint& pos,
const wxSize& size)
: ConditionalClusterMapCanvas(parent, t_frame, project, var_info, col_ids, pos, size),
: ConditionalClusterMapCanvas(parent, t_frame, project, var_info, col_ids, title, pos, size),
lisa_coord(lisa_coordinator)
{
Init(size);
Expand All @@ -1001,23 +1026,6 @@ ConditionalLISAClusterMapCanvas::~ConditionalLISAClusterMapCanvas()

}

wxString ConditionalLISAClusterMapCanvas::GetCategoriesTitle()
{
wxString v;
v << "LISA Cluster Map: " << lisa_coord->var_info[0].name;
return v;
}

wxString ConditionalLISAClusterMapCanvas::GetCanvasTitle()
{
wxString v;
v << "Conditional Map - ";
v << "x: " << GetNameWithTime(HOR_VAR);
v << ", y: " << GetNameWithTime(VERT_VAR);
v << ", LISA:" << lisa_coord->var_info[0].name;
return v;
}

void ConditionalLISAClusterMapCanvas::CreateAndUpdateCategories()
{
cat_var_sorted.clear();
Expand Down Expand Up @@ -1218,10 +1226,13 @@ ConditionalGClusterMapCanvas(wxWindow *parent, TemplateFrame* t_frame,
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
GStatCoordinator* g_coordinator,
bool is_gi_,
bool is_perm_,
const wxString& title,
const wxPoint& pos,
const wxSize& size)
: ConditionalClusterMapCanvas(parent, t_frame, project, var_info, col_ids, pos, size),
g_coord(g_coordinator)
: ConditionalClusterMapCanvas(parent, t_frame, project, var_info, col_ids, title, pos, size),
g_coord(g_coordinator), is_gi(is_gi_), is_perm(is_perm_)
{
Init(size);
}
Expand All @@ -1231,23 +1242,6 @@ ConditionalGClusterMapCanvas::~ConditionalGClusterMapCanvas()

}

wxString ConditionalGClusterMapCanvas::GetCategoriesTitle()
{
wxString v;
v << "LISA Cluster Map: " << g_coord->var_info[0].name;
return v;
}

wxString ConditionalGClusterMapCanvas::GetCanvasTitle()
{
wxString v;
v << "Conditional Map - ";
v << "x: " << GetNameWithTime(HOR_VAR);
v << ", y: " << GetNameWithTime(VERT_VAR);
v << ", LISA:" << g_coord->var_info[0].name;
return v;
}

void ConditionalGClusterMapCanvas::CreateAndUpdateCategories()
{
cat_var_sorted.clear();
Expand All @@ -1271,8 +1265,6 @@ void ConditionalGClusterMapCanvas::CreateAndUpdateCategories()
cat_var_sorted[t].resize(num_obs);
cat_var_undef[t].resize(num_obs);
vector<wxInt64> cluster;
bool is_gi = false;
bool is_perm = false;
g_coord->FillClusterCats(t, is_gi, is_perm, cluster);

for (int i=0; i<num_obs; i++) {
Expand Down Expand Up @@ -1353,8 +1345,6 @@ void ConditionalGClusterMapCanvas::CreateAndUpdateCategories()
}

vector<wxInt64> cluster;
bool is_gi = false;
bool is_perm = false;
g_coord->FillClusterCats(t, is_gi, is_perm, cluster);

for (int i=0, iend=g_coord->num_obs; i<iend; i++) {
Expand Down
33 changes: 19 additions & 14 deletions Explore/ConditionalClusterMapView.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,17 @@ class ConditionalClusterMapCanvas : public ConditionalNewCanvas {
Project* project,
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);

virtual ~ConditionalClusterMapCanvas();


virtual wxString GetCategoriesTitle() = 0;
virtual wxString GetCanvasTitle() = 0;
virtual void CreateAndUpdateCategories() = 0;
virtual void TimeSyncVariableToggle(int var_index) = 0;

virtual wxString GetCategoriesTitle();
virtual wxString GetCanvasTitle();

void Init(const wxSize& size);
virtual void DisplayRightClickMenu(const wxPoint& pos);
Expand Down Expand Up @@ -84,6 +85,7 @@ class ConditionalClusterMapCanvas : public ConditionalNewCanvas {
virtual void UpdateStatusBar() = 0;
virtual void PopulateCanvas();

wxString title;
CatClassifState* cc_state_map;
int num_categories; // current number of categories
vector<Gda::dbl_int_pair_vec_type> cat_var_sorted;
Expand Down Expand Up @@ -127,6 +129,7 @@ class ConditionalClusterMapFrame : public ConditionalNewFrame {
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
GStatCoordinator* g_coord,
bool is_gi, bool is_perm,
const wxString& title = _("Conditional GetisOrd Map"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
Expand Down Expand Up @@ -159,7 +162,7 @@ class ConditionalClusterMapFrame : public ConditionalNewFrame {
CatClassification::CatClassifType new_cat_theme,
int num_categories,
const wxString& custom_classif_title = wxEmptyString);
DECLARE_EVENT_TABLE()
};

Expand All @@ -178,13 +181,12 @@ class ConditionalLISAClusterMapCanvas : public ConditionalClusterMapCanvas {
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
LisaCoordinator* lisa_coordinator,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);

virtual ~ConditionalLISAClusterMapCanvas();

virtual wxString GetCategoriesTitle();
virtual wxString GetCanvasTitle();
virtual void CreateAndUpdateCategories();
virtual void TimeSyncVariableToggle(int var_index);

Expand All @@ -203,20 +205,23 @@ class ConditionalGClusterMapCanvas : public ConditionalClusterMapCanvas {
public:

ConditionalGClusterMapCanvas(wxWindow *parent, TemplateFrame* t_frame,
Project* project,
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
GStatCoordinator* g_coordinator,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);
Project* project,
const vector<GdaVarTools::VarInfo>& var_info,
const vector<int>& col_ids,
GStatCoordinator* g_coordinator,
bool is_gi,
bool is_perm,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize);

virtual ~ConditionalGClusterMapCanvas();

virtual wxString GetCategoriesTitle();
virtual wxString GetCanvasTitle();
virtual void CreateAndUpdateCategories();
virtual void TimeSyncVariableToggle(int var_index);
protected:
bool is_perm;
bool is_gi;
GStatCoordinator* g_coord;
virtual void UpdateStatusBar();
};
Expand Down
Loading

0 comments on commit 89c27f4

Please sign in to comment.