forked from GeoDaCenter/geoda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConnectivityMapView.cpp
701 lines (601 loc) · 22 KB
/
ConnectivityMapView.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
/**
* GeoDa TM, Copyright (C) 2011-2015 by Luc Anselin - all rights reserved
*
* This file is part of GeoDa.
*
* GeoDa is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GeoDa is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <limits>
#include <vector>
#include <boost/foreach.hpp>
#include <wx/splitter.h>
#include <wx/xrc/xmlres.h>
#include "../DataViewer/TableInterface.h"
#include "../DataViewer/TimeState.h"
#include "../GeneralWxUtils.h"
#include "../GeoDa.h"
#include "../logger.h"
#include "../Project.h"
#include "../VarCalc/WeightsManInterface.h"
#include "ConnectivityMapView.h"
IMPLEMENT_CLASS(ConnectivityMapCanvas, MapCanvas)
BEGIN_EVENT_TABLE(ConnectivityMapCanvas, MapCanvas)
EVT_PAINT(TemplateCanvas::OnPaint)
EVT_ERASE_BACKGROUND(TemplateCanvas::OnEraseBackground)
EVT_MOUSE_EVENTS(TemplateCanvas::OnMouseEvent)
EVT_MOUSE_CAPTURE_LOST(TemplateCanvas::OnMouseCaptureLostEvent)
END_EVENT_TABLE()
ConnectivityMapCanvas::ConnectivityMapCanvas(wxWindow *parent,
TemplateFrame* t_frame,
Project* project,
boost::uuids::uuid weights_id,
const wxPoint& pos,
const wxSize& size)
: MapCanvas(parent, t_frame, project,
std::vector<GdaVarTools::VarInfo>(0), std::vector<int>(0),
CatClassification::no_theme,
no_smoothing, 1, weights_id, pos, size),
w_man_int(project->GetWManInt())
{
SetWeightsId(weights_id);
wxString w_title = project->GetWManInt()->GetShortDispName(GetWeightsId());
cat_classif_def.color_scheme = CatClassification::custom_color_scheme;
CatClassification::ChangeNumCats(1, cat_classif_def);
cat_classif_def.colors[0] = GdaConst::conn_map_default_fill_colour;
cat_data.CreateCategoriesAllCanvasTms(1, 1, num_obs);
cat_data.SetCategoryColor(0 ,0, GdaConst::conn_map_default_fill_colour);
cat_data.SetCategoryLabel(0, 0, "");
cat_data.SetCategoryCount(0, 0, num_obs);
for (int i=0; i<num_obs; i++) cat_data.AppendIdToCategory(0, 0, i);
selectable_fill_color = GdaConst::conn_map_default_fill_colour;
highlight_color = GdaConst::conn_map_default_highlight_colour;
// Will ignore these messages
proj_hs = project->GetHighlightState();
proj_hs->registerObserver(this);
// Used by TemplateCanvas for each instance of ConnectivityMapCanvas
highlight_state->removeObserver(this);
highlight_state = new HighlightState();
highlight_state->SetSize(project->GetNumRecords());
highlight_state->registerObserver(this);
// Used to synchronize core selection amongst all ConnectivityMaps
shared_core_hs = project->GetConMapHlightState();
shared_core_hs->registerObserver(this);
}
ConnectivityMapCanvas::~ConnectivityMapCanvas()
{
proj_hs->removeObserver(this);
highlight_state->removeObserver(this);
// ensure child won't try to removeObserver as well. Since this is
// the only observer, ok to simply set to null since we know it
// was just deleted.
highlight_state = 0;
shared_core_hs->removeObserver(this);
}
void ConnectivityMapCanvas::OnMouseEvent(wxMouseEvent& event)
{
// Capture the mouse when left mouse button is down.
if (event.LeftIsDown() && !HasCapture())
CaptureMouse();
if (event.LeftUp() && HasCapture())
ReleaseMouse();
if (mousemode == select) {
is_showing_brush = true;
if (selectstate == start) {
if (event.LeftDown()) {
prev = GetActualPos(event);
if (sel1.x > 0 && sel1.y > 0 && sel2.x > 0 && sel2.y >0) {
// already has selection then
// detect if click inside brush_shape
GdaShape* brush_shape = NULL;
if (brushtype == rectangle) {
brush_shape = new GdaRectangle(sel1, sel2);
} else if (brushtype == circle) {
brush_shape = new GdaCircle(sel1, sel2);
} else if (brushtype == line) {
brush_shape = new GdaPolyLine(sel1, sel2);
}
if (brush_shape && brush_shape->Contains(prev)) {
// brushing
is_brushing = true;
remember_shiftdown = false; // brush will cancel shift
selectstate = brushing;
} else {
// cancel brushing since click outside, restore leftdown
ResetBrushing();
sel1 = prev;
selectstate = leftdown;
}
delete brush_shape;
} else {
sel1 = prev;
selectstate = leftdown;
}
} else if (event.RightDown()) {
ResetBrushing();
DisplayRightClickMenu(event.GetPosition());
} else {
// hover
if (template_frame && template_frame->IsStatusBarVisible()) {
prev = GetActualPos(event);
DetermineMouseHoverObjects(prev);
UpdateStatusBar();
if (sel1.x > 0 && sel1.y > 0 && sel2.x > 0 && sel2.y >0) {
// already has selection then
return;
}
std::vector<bool>& hs = shared_core_hs->GetHighlight();
for (size_t i=0, sz=hs.size(); i<sz; i++) {
hs[i] = false;
}
if (hover_obs.empty()) {
shared_core_hs->SetEventType(HLStateInt::unhighlight_all);
} else {
hs[ hover_obs[0] ] = true;
shared_core_hs->SetEventType(HLStateInt::delta);
}
shared_core_hs->notifyObservers();
}
}
} else if (selectstate == leftdown) {
if (event.Moving() || event.Dragging()) {
wxPoint act_pos = GetActualPos(event);
if (fabs((double) (sel1.x - act_pos.x)) +
fabs((double) (sel1.y - act_pos.y)) > 2) {
sel2 = GetActualPos(event);
selectstate = dragging;
remember_shiftdown = event.ShiftDown();
UpdateSelection(remember_shiftdown);
//UpdateStatusBar();
//Refresh(false);
}
} else if (event.LeftUp()) {
wxPoint act_pos = GetActualPos(event);
if (act_pos == sel1 ) {
sel2 = sel1;
}
UpdateSelection(event.ShiftDown(), true);
selectstate = start;
ResetBrushing();
} else if (event.RightDown()) {
selectstate = start;
}
} else if (selectstate == dragging) {
if (event.Dragging()) { // mouse moved while buttons still down
sel2 = GetActualPos(event);
UpdateSelection(remember_shiftdown);
//UpdateStatusBar();
//Refresh(false);
} else if (event.LeftUp()) {
sel2 = GetActualPos(event);
UpdateSelection(remember_shiftdown);
remember_shiftdown = false;
selectstate = start;
//Refresh(false);
} else if (event.RightDown()) {
DisplayRightClickMenu(event.GetPosition());
}
} else if (selectstate == brushing) {
if (event.LeftUp()) {
is_brushing = false; // will check again if brushing when mouse down again
selectstate = start;
} else if (event.RightDown()) {
is_brushing = false;
selectstate = start;
Refresh();
} else if (is_brushing && (event.Moving() || event.Dragging())) {
wxPoint cur = GetActualPos(event);
wxPoint diff = cur - prev;
sel1 += diff;
sel2 += diff;
//UpdateStatusBar();
UpdateSelection();
//Refresh(false); // keep painting the select rect
prev = cur;
}
}
} else{
TemplateCanvas::OnMouseEvent(event);
}
}
// The following function assumes that the set of selectable objects
// being selected against are all points. Since all GdaShape objects
// define a center point, this is also the default function for
// all GdaShape selectable objects.
void ConnectivityMapCanvas::UpdateSelection(bool shiftdown, bool pointsel)
{
// notify other windows to update
is_updating = false;
// clean any select_with_neighbor since it's users operation
select_with_neighbor.clear();
size_t sel_shps_sz = selectable_shps.size();
sel_cores.clear();
if (pointsel) { // a point selection
for (int i=0; i<sel_shps_sz; i++) {
if (selectable_shps[i]->pointWithin(sel1)) {
sel_cores.insert(i);
}
}
} else { // determine which obs intersect the selection region.
if (brushtype == rectangle) {
wxRegion rect(wxRect(sel1, sel2));
for (int i=0; i<sel_shps_sz; i++) {
bool contains = (rect.Contains(selectable_shps[i]->center) !=
wxOutRegion);
if (contains) sel_cores.insert(i);
}
} else if (brushtype == circle) {
double radius = GenUtils::distance(sel1, sel2);
// determine if each center is within radius of sel1
for (int i=0; i<sel_shps_sz; i++) {
bool contains = (GenUtils::distance(sel1,
selectable_shps[i]->center)
<= radius);
if (contains) sel_cores.insert(i);
}
} else if (brushtype == line) {
wxRegion rect(wxRect(sel1, sel2));
// determine if each center is within rect and also within distance
// 3.0 of line passing through sel1 and sel2
// Note: we can speed up calculations for GenUtils::pointToLineDist
// by reusing parts of the calculation. See
// GenUtils::pointToLineDist for algorithm that the following
// is based upon.
double p1x = sel1.x;
double p1y = sel1.y;
double p2x = sel2.x;
double p2y = sel2.y;
double p2xMp1x = p2x - p1x;
double p2yMp1y = p2y - p1y;
double dp1p2 = GenUtils::distance(sel1, sel2);
double delta = 3.0 * dp1p2;
for (int i=0; i<sel_shps_sz; i++) {
bool contains = (rect.Contains(selectable_shps[i]->center) !=
wxOutRegion);
if (contains) {
double p0x = selectable_shps[i]->center.x;
double p0y = selectable_shps[i]->center.y;
// determine if selectable_shps[i]->center is within
// distance 3.0 of line passing through sel1 and sel2
if (abs(p2xMp1x * (p1y-p0y) - (p1x-p0x) * p2yMp1y) >
delta ) contains = false;
}
if (contains) sel_cores.insert(i);
}
}
}
// update shared core
std::vector<bool> temp_sel_cores(project->GetNumRecords(), false);
BOOST_FOREACH(long i, sel_cores) {
temp_sel_cores[i] = true;
}
std::vector<bool>& hs = shared_core_hs->GetHighlight();
bool selection_changed = false;
for (size_t i=0, sz=project->GetNumRecords(); i<sz; i++) {
if (!hs[i] && temp_sel_cores[i]) {
hs[i] = true;
selection_changed = true;
} else if (hs[i] && !temp_sel_cores[i]) {
hs[i] = false;
selection_changed = true;
}
}
if (selection_changed) {
shared_core_hs->SetEventType(HLStateInt::delta);
shared_core_hs->notifyObservers();
}
//UpdateFromSharedCore();
UpdateStatusBar();
}
void ConnectivityMapCanvas::UpdateFromSharedCore()
{
sel_cores.clear();
std::vector<bool>& sc_hs = shared_core_hs->GetHighlight();
for (int i=0, sz=sc_hs.size(); i<sz; ++i) {
if (sc_hs[i])
sel_cores.insert(i);
}
std::vector<bool>& hs = highlight_state->GetHighlight();
bool selection_changed = false;
// find set of all neighbors of cores
core_nbrs.clear();
w_man_int->GetNbrsExclCores(weights_id, sel_cores, core_nbrs);
for (size_t i=0, sz=project->GetNumRecords(); i<sz; i++) {
bool is_sel = core_nbrs.find(i) != core_nbrs.end();
if (!hs[i] && is_sel) {
hs[i] = true;
selection_changed = true;
} else if (hs[i] && !is_sel) {
hs[i] = false;
selection_changed = true;
}
}
if ( selection_changed ) {
highlight_state->SetEventType(HLStateInt::delta);
highlight_state->notifyObservers();
}
UpdateStatusBar();
}
/** Don't draw selection outline */
void ConnectivityMapCanvas::PaintSelectionOutline(wxMemoryDC& dc)
{
}
void ConnectivityMapCanvas::DisplayRightClickMenu(const wxPoint& pos)
{
// Workaround for right-click not changing window focus in OSX / wxW 3.0
wxActivateEvent ae(wxEVT_NULL, true, 0, wxActivateEvent::Reason_Mouse);
if (ConnectivityMapFrame* f =
dynamic_cast<ConnectivityMapFrame*>(template_frame)) {
f->OnActivate(ae);
}
wxMenu* optMenu = wxXmlResource::Get()->
LoadMenu("ID_CONNECTIVITY_MAP_VIEW_MENU_OPTIONS");
AddTimeVariantOptionsToMenu(optMenu);
SetCheckMarks(optMenu);
if (template_frame) {
template_frame->UpdateContextMenuItems(optMenu);
template_frame->PopupMenu(optMenu, pos + GetPosition());
template_frame->UpdateOptionMenuItems();
}
}
wxString ConnectivityMapCanvas::GetCanvasTitle()
{
wxString s;
s << _("Connectivity Map - ") << w_man_int->GetLongDispName(weights_id);
return s;
}
wxString ConnectivityMapCanvas::GetVariableNames()
{
wxString s;
s << w_man_int->GetLongDispName(weights_id);
return s;
}
/** This method definition is empty. It is here to override any call
to the parent-class method since smoothing and theme changes are not
supported by connectivity maps */
bool ConnectivityMapCanvas::ChangeMapType(
CatClassification::CatClassifType new_map_theme,
SmoothingType new_map_smoothing)
{
return false;
}
void ConnectivityMapCanvas::SetCheckMarks(wxMenu* menu)
{
// Update the checkmarks and enable/disable state for the
// following menu items if they were specified for this particular
// view in the xrc file. Items that cannot be enable/disabled,
// or are not checkable do not appear.
MapCanvas::SetCheckMarks(menu);
}
/** Time changes have no effect */
void ConnectivityMapCanvas::TimeChange()
{
}
/** Nothing to do */
void ConnectivityMapCanvas::CreateAndUpdateCategories()
{
}
void ConnectivityMapCanvas::ChangeWeights(boost::uuids::uuid new_id)
{
if (new_id == GetWeightsId() || new_id.is_nil()) return;
SetWeightsId(new_id);
int hl_size = highlight_state->GetHighlightSize();
if (hl_size != selectable_shps.size()) return;
std::vector<bool>& hs = highlight_state->GetHighlight();
bool selection_changed = false;
// find set of all neighbors of cores
core_nbrs.clear();
w_man_int->GetNbrsExclCores(GetWeightsId(), sel_cores, core_nbrs);
if (core_nbrs.size() == 1)
int num_obs = project->GetNumRecords();
for (int i=0; i<num_obs; i++) {
bool is_sel = core_nbrs.find(i) != core_nbrs.end();
if (!hs[i] && is_sel) {
hs[i] = true;
selection_changed = true;
} else if (hs[i] && !is_sel) {
hs[i] = false;
selection_changed = true;
}
}
if ( selection_changed ) {
highlight_state->SetEventType(HLStateInt::delta);
highlight_state->notifyObservers();
}
}
void ConnectivityMapCanvas::update(HLStateInt* o)
{
if (o == proj_hs) {
} else if (o == highlight_state) {
//TemplateCanvas::update(o);
if (layer2_bm) {
if (draw_sel_shps_by_z_val) {
// force a full redraw
layer0_valid = false;
return;
}
HLStateInt::EventType type = o->GetEventType();
if (type == HLStateInt::transparency) {
ResetFadedLayer();
}
// re-paint highlight layer (layer1_bm)
layer1_valid = false;
DrawLayers();
Refresh();
UpdateStatusBar();
//ResetBrushing();
}
} else { // o == shared_core_hs
UpdateFromSharedCore();
}
}
void ConnectivityMapCanvas::UpdateStatusBar()
{
wxStatusBar* sb = 0;
if (ConnectivityMapFrame* f =
dynamic_cast<ConnectivityMapFrame*>(template_frame)) {
sb = f->GetStatusBar();
}
if (!sb) return;
wxString s;
if (mousemode == select) {
if (sel_cores.size() == 1) {
long cid = *sel_cores.begin();
s << _("obs ") << w_man_int->RecNumToId(GetWeightsId(), cid);
s << " has " << core_nbrs.size() << " neighbor";
if (core_nbrs.size() != 1) s << "s";
if (core_nbrs.size() > 0) {
s << ": ";
int n_cnt = 0;
for (std::set<long>::const_iterator it = core_nbrs.begin();
it != core_nbrs.end() && n_cnt <= 20; ++it) {
s << w_man_int->RecNumToId(GetWeightsId(), (*it));
if (n_cnt+1 < core_nbrs.size()) s << ", ";
++n_cnt;
}
if (core_nbrs.size() > 20) s << "...";
} else {
s << ".";
}
}
}
sb->SetStatusText(s);
}
IMPLEMENT_CLASS(ConnectivityMapFrame, MapFrame)
BEGIN_EVENT_TABLE(ConnectivityMapFrame, MapFrame)
EVT_ACTIVATE(ConnectivityMapFrame::OnActivate)
END_EVENT_TABLE()
ConnectivityMapFrame::ConnectivityMapFrame(wxFrame *parent, Project* project,
boost::uuids::uuid weights_id_s,
const wxPoint& pos,
const wxSize& size,
const long style)
: MapFrame(parent, project, pos, size, style)
{
wxLogMessage("Open ConnectivityMapFrame");
int width, height;
GetClientSize(&width, &height);
template_legend = 0;
wxPanel* rpanel = new wxPanel(this);
template_canvas = new ConnectivityMapCanvas(rpanel, this, project,
weights_id_s,
wxDefaultPosition,
wxDefaultSize);
template_canvas->SetScrollRate(1,1);
wxBoxSizer* rbox = new wxBoxSizer(wxVERTICAL);
rbox->Add(template_canvas, 1, wxEXPAND);
rpanel->SetSizer(rbox);
wxPanel* toolbar_panel = new wxPanel(this, wxID_ANY, wxDefaultPosition);
wxBoxSizer* toolbar_sizer= new wxBoxSizer(wxVERTICAL);
toolbar = wxXmlResource::Get()->LoadToolBar(toolbar_panel, "ToolBar_MAP");
toolbar->EnableTool(XRCID("ID_SELECT_INVERT"), false);
SetupToolbar();
toolbar_sizer->Add(toolbar, 0, wxEXPAND|wxALL);
toolbar_panel->SetSizerAndFit(toolbar_sizer);
wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->Add(toolbar_panel, 0, wxEXPAND|wxALL);
sizer->Add(rpanel, 1, wxEXPAND|wxALL);
SetSizer(sizer);
SetAutoLayout(true);
DisplayStatusBar(true);
SetTitle(template_canvas->GetCanvasTitle());
Show(true);
}
ConnectivityMapFrame::~ConnectivityMapFrame()
{
}
void ConnectivityMapFrame::OnActivate(wxActivateEvent& event)
{
if (event.GetActive()) {
wxLogMessage("In ConnectivityMapFrame::OnActivate");
RegisterAsActive("ConnectivityMapFrame", GetTitle());
}
if ( event.GetActive() && template_canvas )
template_canvas->SetFocus();
}
void ConnectivityMapFrame::MapMenus()
{
wxMenuBar* mb = GdaFrame::GetGdaFrame()->GetMenuBar();
// Map Options Menus
wxMenu* optMenu = wxXmlResource::Get()->
LoadMenu("ID_CONNECTIVITY_MAP_VIEW_MENU_OPTIONS");
((MapCanvas*) template_canvas)->
AddTimeVariantOptionsToMenu(optMenu);
((MapCanvas*) template_canvas)->SetCheckMarks(optMenu);
GeneralWxUtils::ReplaceMenu(mb, _("Options"), optMenu);
UpdateOptionMenuItems();
}
void ConnectivityMapFrame::UpdateOptionMenuItems()
{
TemplateFrame::UpdateOptionMenuItems(); // set common items first
wxMenuBar* mb = GdaFrame::GetGdaFrame()->GetMenuBar();
int menu = mb->FindMenu(_("Options"));
if (menu == wxNOT_FOUND) {
} else {
((ConnectivityMapCanvas*) template_canvas)->
SetCheckMarks(mb->GetMenu(menu));
}
}
void ConnectivityMapFrame::UpdateContextMenuItems(wxMenu* menu)
{
// Update the checkmarks and enable/disable state for the
// following menu items if they were specified for this particular
// view in the xrc file. Items that cannot be enable/disabled,
// or are not checkable do not appear.
TemplateFrame::UpdateContextMenuItems(menu); // set common items
}
void ConnectivityMapFrame::CoreSelectHelper(const std::vector<bool>& elem)
{
HighlightState* highlight_state = project->GetHighlightState();
std::vector<bool>& hs = highlight_state->GetHighlight();
bool selection_changed = false;
int num_obs = project->GetNumRecords();
for (int i=0; i<num_obs; i++) {
if (!hs[i] && elem[i]) {
hs[i] = true;
selection_changed = true;
} else if (hs[i] && !elem[i]) {
hs[i] = false;
selection_changed = true;
}
}
if (selection_changed) {
highlight_state->SetEventType(HLStateInt::delta);
highlight_state->notifyObservers();
}
}
void ConnectivityMapFrame::OnSelectCores(wxCommandEvent& event)
{
wxLogMessage("Entering ConnectivityMapFrame::OnSelectCores");
std::vector<bool> elem(project->GetNumRecords(), false);
CoreSelectHelper(elem);
}
void ConnectivityMapFrame::OnSelectNeighborsOfCores(wxCommandEvent& event)
{
wxLogMessage("Entering ConnectivityMapFrame::OnSelectNeighborsOfCores");
std::vector<bool> elem(project->GetNumRecords(), false);
CoreSelectHelper(elem);
}
void ConnectivityMapFrame::OnSelectCoresAndNeighbors(wxCommandEvent& event)
{
wxLogMessage("Entering ConnectivityMapFrame::OnSelectCoresAndNeighbors");
std::vector<bool> elem(project->GetNumRecords(), false);
CoreSelectHelper(elem);
}
void ConnectivityMapFrame::ChangeWeights(boost::uuids::uuid new_id)
{
if (new_id == ((MapCanvas*) template_canvas)->GetWeightsId() ||
new_id.is_nil()) return;
((ConnectivityMapCanvas*) template_canvas)->ChangeWeights(new_id);
UpdateTitle();
}