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

Method promptVarSettings

Explore/WebViewExampleWin.cpp:446–551  ·  view source on GitHub ↗

{ "action": "request", "callback_id": "53", "requests" : [ { "interface": "project", "operation": "promptVarSettings", "arity": "bivariate", // also (uni/bi/tri/quad)variate "show_weights": false, // default "title": "Variable Settings" // optional "var1_title": "First Variable (X)" // optional "var2_title": "Second Variable (Y)", // optional "var3_title": "Third Variable (Z)", /

Source from the content-addressed store, hash-verified

444
445 */
446void WebViewExampleDlg::promptVarSettings(const json_spirit::Object& req,
447 json_spirit::Value& response_val)
448{
449 using namespace json_spirit;
450 using namespace GdaJson;
451
452 VariableSettingsDlg::VarType arity = VariableSettingsDlg::univariate;
453 wxString arity_str = getStrValFromObj(req, "arity");
454 if (arity_str == "univariate") {
455 arity = VariableSettingsDlg::univariate;
456 } else if (arity_str == "bivariate") {
457 arity = VariableSettingsDlg::bivariate;
458 } else if (arity_str == "trivariate") {
459 arity = VariableSettingsDlg::trivariate;
460 } else if (arity_str == "quadvariate") {
461 arity = VariableSettingsDlg::quadvariate;
462 } else {
463 throw std::runtime_error("arity missing or invalid");
464 }
465 wxString title = "Variable Settings";
466 wxString var1_title = "First Variable (X)";
467 wxString var2_title = "Second Variable (Y)";
468 wxString var3_title = "Third Variable (Z)";
469 wxString var4_title = "Fourth Variable";
470 if (hasName(req, "var1_title")) {
471 var1_title = getStrValFromObj(req, "var1_title");
472 }
473 if (hasName(req, "var2_title")) {
474 var2_title = getStrValFromObj(req, "var2_title");
475 }
476 if (hasName(req, "var3_title")) {
477 var3_title = getStrValFromObj(req, "var3_title");
478 }
479 if (hasName(req, "var4_title")) {
480 var4_title = getStrValFromObj(req, "var4_title");
481 }
482 bool show_weights = getBoolValFromObj(req, "show_weights");
483
484 VariableSettingsDlg VS(project, arity, show_weights, false, title,
485 var1_title, var2_title, var3_title, var4_title);
486 if (VS.ShowModal() != wxID_OK) {
487 wxString s;
488 s << "{ \"user_cancel\": null}";
489 response_val = Value(s.ToStdString());
490 return;
491 }
492
493 Object response_obj;
494
495 std::vector<std::string> var_nms;
496 var_nms.push_back("var1");
497 var_nms.push_back("var2");
498 var_nms.push_back("var3");
499 var_nms.push_back("var4");
500
501 std::vector<wxString> tm_strs;
502 table_int->GetTimeStrings(tm_strs);
503 Value tm_strs_val;

Callers

nothing calls this directly

Calls 9

GetTimeStringsMethod · 0.80
GetCurrTimeMethod · 0.80
GetColDispDecimalsMethod · 0.80
GetColTypeMethod · 0.80
GetColUndefinedMethod · 0.80
GetColTypesMethod · 0.80
GetSelectedRowsMethod · 0.80
sizeMethod · 0.45
GetColDataMethod · 0.45

Tested by

no test coverage detected