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

Method OnDocumentLoaded

Explore/WebViewExampleWin.cpp:553–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

551}
552
553void WebViewExampleDlg::OnDocumentLoaded(wxWebViewEvent& ev)
554{
555 LOG_MSG("Entering WebViewExampleDlg::OnDocumentLoaded");
556 //Only notify if the document is the main frame, not a subframe
557 if (ev.GetURL() == web_view->GetCurrentURL()) {
558 wxString s;
559 s << "url: " << ev.GetURL();
560 LOG_MSG(s);
561
562 if (load_url_called) {
563 web_view->RunScript("gda.readyToInit();");
564
565 load_url_called = false;
566 }
567
568 //web_view->RunScript("document.body.style.background = 'orange';");
569 //web_view->RunScript("AppendP(\"It Works!\");");
570
571 /*
572 if (load_url_called) {
573 // call various JS functions to initialize.
574 // initFromDataset expects the following init_obj JSON message:
575 // {
576 // var1_title: "title",
577 // var2_title: "title2",
578 // var1_data: [ 1, 2, 3, 4 ],
579 // var2_data: [ 1.1, 2.2, 3.3, 4.4 ],
580 // selected: [ 3, 12, 23, 33 ]
581 // }
582
583 using namespace json_spirit;
584 Object o;
585
586 o.push_back(Pair("var1_title", var_info[0].name.ToStdString()));
587 o.push_back(Pair("var2_title", var_info[1].name.ToStdString()));
588
589 std::vector<double> v1;
590 std::vector<double> v2;
591 table_int->GetColData(col_ids[0], var_info[0].time, v1);
592 table_int->GetColData(col_ids[1], var_info[1].time, v2);
593 Array v1_array;
594 Array v2_array;
595 for (size_t i=0, sz=v1.size(); i<sz; ++i) {
596 v1_array.push_back(Value(v1[i]));
597 v2_array.push_back(Value(v2[i]));
598 }
599 o.push_back(Pair("var1_data", v1_array));
600 o.push_back(Pair("var2_data", v2_array));
601
602 Array init_sel;
603 std::vector<bool>& hs = highlight_state->GetHighlight();
604 for (size_t i=0, sz=hs.size(); i<sz; ++i) {
605 if (hs[i]) init_sel.push_back((int) i);
606 }
607 o.push_back(Pair("selected", init_sel));
608
609 std::string json_str = write(o);
610 wxString js_call;

Callers

nothing calls this directly

Calls 1

GetURLMethod · 0.80

Tested by

no test coverage detected