-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconceptmapfactory.cpp
More file actions
736 lines (676 loc) · 20.9 KB
/
conceptmapfactory.cpp
File metadata and controls
736 lines (676 loc) · 20.9 KB
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
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/graph/graphviz.hpp>
#include "conceptmapfactory.h"
#include <cassert>
#include <stdexcept>
#include <boost/math/constants/constants.hpp>
#include "add_bundled_edge_between_vertices.h"
#include "conceptmapcenternodefactory.h"
#include "conceptmapconcept.h"
#include "conceptmapconceptfactory.h"
#include "conceptmap.h"
#include "conceptmaphelper.h"
#include "conceptmapexamplefactory.h"
#include "add_bundled_vertex.h"
#include "conceptmapedge.h"
#include "conceptmapedgefactory.h"
#include "conceptmapnode.h"
#include "conceptmapnodefactory.h"
#include "conceptmapregex.h"
#include "set_my_bundled_vertexes.h"
ribi::cmap::ConceptMapFactory::ConceptMapFactory() noexcept
{
}
ribi::cmap::VertexDescriptor ribi::cmap::AddVertex(
const Node& node, ConceptMap& g
) noexcept
{
return add_bundled_vertex(node, g);
}
void ribi::cmap::AddEdge(
const Edge& edge,
const VertexDescriptor& vd_from,
const VertexDescriptor& vd_to,
ConceptMap& g
) noexcept
{
add_bundled_edge_between_vertices(edge, vd_from, vd_to, g);
}
std::vector<ribi::cmap::ConceptMap>
ribi::cmap::ConceptMapFactory::GetNastyTests() const noexcept
{
std::vector<ConceptMap> v{
GetNasty0()
};
return v;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get1() const noexcept
{
ConceptMap g;
AddVertex(CenterNodeFactory().GetTest(0),g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get2() const noexcept
{
ConceptMap g;
AddVertex(CenterNodeFactory().GetTest(1),g);
AddVertex(NodeFactory().GetTest(0), g);
AddVertex(NodeFactory().GetTest(1), g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get3() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().GetTest(2),g);
const auto vd_2 = AddVertex(NodeFactory().GetTest(2), g);
AddEdge(
EdgeFactory().GetTest(1), vd_1, vd_2,g
);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get4() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().GetNastyTest(0), g);
const auto vd_2 = AddVertex(NodeFactory().GetNastyTest(0), g);
const auto vd_3 = AddVertex(NodeFactory().GetNastyTest(1), g);
AddEdge(
EdgeFactory().GetTest(2),
vd_1, vd_2,g
);
AddEdge(
EdgeFactory().GetTest(2),
vd_2, vd_3,g
);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get5() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().GetNastyTest(1), g);
const auto vd_2 = AddVertex(NodeFactory().GetNastyTest(0), g);
const auto vd_3 = AddVertex(NodeFactory().GetNastyTest(2), g);
AddEdge(EdgeFactory().GetNastyTest(0), vd_1, vd_2,g);
AddEdge(EdgeFactory().GetNastyTest(1), vd_2, vd_3,g);
AddEdge(EdgeFactory().GetNastyTest(2), vd_3, vd_1,g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get6() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().GetNastyTest(2), g);
const auto vd_2 = AddVertex(NodeFactory().GetNastyTest(0), g);
const auto vd_3 = AddVertex(NodeFactory().GetNastyTest(1), g);
const auto vd_4 = AddVertex(NodeFactory().GetNastyTest(2), g);
AddEdge(EdgeFactory().GetTest(2), vd_1, vd_2,g);
AddEdge(EdgeFactory().GetNastyTest(0), vd_2, vd_3,g);
AddEdge(EdgeFactory().GetNastyTest(1), vd_3, vd_1,g);
AddEdge(EdgeFactory().GetNastyTest(2), vd_4, vd_1,g);
assert(CountCenterNodes(g) == 1);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::Get11() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().CreateFromStrings("X"), g);
const auto vd_2 = AddVertex(NodeFactory().CreateFromStrings("A"), g);
const auto vd_3 = AddVertex(NodeFactory().GetNasty0(), g);
const auto vd_4 = AddVertex(NodeFactory().GetNasty1(), g);
const auto vd_5 = AddVertex(NodeFactory().GetNasty2(), g);
AddEdge(Edge(NodeFactory().GetNasty0(), false, true), vd_3, vd_2, g);
AddEdge(Edge(NodeFactory().GetNasty1(), false, true), vd_4, vd_3, g);
AddEdge(Edge(NodeFactory().GetNasty2(), false, true), vd_5, vd_4, g);
AddEdge(Edge(NodeFactory().GetNasty0(), false, true), vd_2, vd_5, g);
AddEdge(Edge(NodeFactory().GetNasty1(), false, true), vd_1, vd_2, g);
AddEdge(Edge(NodeFactory().GetNasty2(), false, true), vd_1, vd_3, g);
AddEdge(Edge(NodeFactory().GetNasty0(), false, true), vd_1, vd_4, g);
AddEdge(Edge(NodeFactory().GetNasty1(), false, true), vd_1, vd_5, g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetAllArrowTypes() const noexcept
{
ConceptMap g;
// center --> A <-> B <-- C --- D
const auto vd_1 = AddVertex(Node(Concept("center"), NodeType::center), g);
const auto vd_2 = AddVertex(Node(Concept("A")), g);
const auto vd_3 = AddVertex(Node(Concept("B")), g);
const auto vd_4 = AddVertex(Node(Concept("C")), g);
const auto vd_5 = AddVertex(Node(Concept("D")), g);
AddEdge(Edge(Node(Concept("-->")), true , false), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("<->")), true , true ), vd_2, vd_3, g);
AddEdge(Edge(Node(Concept("<--")), false, true ), vd_3, vd_4, g);
AddEdge(Edge(Node(Concept("---")), false, false), vd_4, vd_5, g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetLevel() const noexcept
{
ConceptMap g;
// Level:
// 2 <- 1 <- 0 -> 1 -> 2
// | |
// v v
// 1 2
// Vertex:
// 3 <- 2 <- 1 -> 5 -> 6
// | |
// v v
// 8 9
const auto vd_1 = boost::add_vertex(Node(Concept("0"), NodeType::center), g);
//Messed up order a bit on purpose: this concept map is used to demonstrate
//GetNodesSortedByLevel
const auto vd_2 = boost::add_vertex(Node(Concept("1"), NodeType::center), g);
const auto vd_3 = boost::add_vertex(Node(Concept("2"), NodeType::center), g);
const auto vd_5 = boost::add_vertex(Node(Concept("1"), NodeType::center), g);
const auto vd_6 = boost::add_vertex(Node(Concept("2"), NodeType::center), g);
const auto vd_8 = boost::add_vertex(Node(Concept("1"), NodeType::center), g);
const auto vd_9 = boost::add_vertex(Node(Concept("2"), NodeType::center), g);
boost::add_edge(vd_1, vd_2, Edge(), g);
boost::add_edge(vd_2, vd_3, Edge(), g);
boost::add_edge(vd_1, vd_5, Edge(), g);
boost::add_edge(vd_5, vd_6, Edge(), g);
boost::add_edge(vd_1, vd_8, Edge(), g);
boost::add_edge(vd_5, vd_9, Edge(), g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetLonelyCenterNode() const noexcept
{
ConceptMap g;
AddVertex(Node(Concept("center"), NodeType::center, 100, 200), g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetLonelyNode() const noexcept
{
ConceptMap g;
AddVertex(Node(Concept("normal"), NodeType::normal, 100, 200), g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetLonelyNodeWithExample() const noexcept
{
ConceptMap g;
AddVertex(
Node(
Concept("normal", Examples( { Example("example") } )),
NodeType::normal, 100, 200
),
g
);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetStarShaped() const noexcept
{
ConceptMap g;
//Not needed to connect to center node
AddVertex(Node(Concept("A star-shaped concept map is ..."), NodeType::center), g);
const auto vd_1 = AddVertex(Node(Concept("A")), g);
const auto vd_2 = AddVertex(Node(Concept("B")), g);
const auto vd_3 = AddVertex(Node(Concept("C")), g);
const auto vd_4 = AddVertex(Node(Concept("D")), g);
AddEdge(Edge(Node(Concept("2")), false, true), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("3")), false, true), vd_1, vd_3, g);
AddEdge(Edge(Node(Concept("4")), false, true), vd_1, vd_4, g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetThreeNodeTwoEdge() const noexcept
{
ConceptMap g;
//These coordinats are tested as such
const auto vd_1 = AddVertex(Node(Concept("center"), NodeType::center, 100, 200), g);
const auto vd_2 = AddVertex(Node(Concept("one"), NodeType::normal, 300, 250), g);
const auto vd_3 = AddVertex(Node(Concept("two"), NodeType::normal, 500, 350), g);
AddEdge(Edge(Node(Concept("first",
Examples( { Example("erster"), Example("premier") } )),
NodeType::normal, 150, 225)), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("second",
Examples( { Example("zweite"), Example("deuxieme") } )),
NodeType::normal, 350, 275)), vd_2, vd_3, g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetThreeNodeTwoEdgeNoCenter() const noexcept
{
ConceptMap g;
//These coordinats are tested as such
const auto vd_1 = AddVertex(
Node(Concept("one", Examples( { Example("unos"), Example("een") } )),
NodeType::normal, 100, 200), g);
const auto vd_2 = AddVertex(
Node(Concept("two", Examples( { Example("Zwei"), Example("twee") } )),
NodeType::normal, 300, 250), g);
const auto vd_3 = AddVertex(
Node(Concept("three", Examples( { Example("drie"), Example("Drei") } )),
NodeType::normal, 500, 350), g);
AddEdge(Edge(Node(Concept("first",
Examples( { Example("erster"), Example("premier") } )),
NodeType::normal, 150, 225)), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("second",
Examples( { Example("zweite"), Example("deuxieme") } )),
NodeType::normal, 350, 275)), vd_2, vd_3, g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetTwoNodeFourEdgesNoCenter() const noexcept
{
ConceptMap g;
//These coordinats are tested as such
const auto vd_1 = AddVertex(Node(Concept("A")), g);
const auto vd_2 = AddVertex(Node(Concept("B")), g);
AddEdge(Edge(Node(Concept("<->")), true, true), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("-->")), true, false), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("<--")), false, true), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("---")), false, false), vd_1, vd_2, g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetTwoNodes() const noexcept
{
ConceptMap g;
AddVertex(Node(Concept("center"), NodeType::center), g);
AddVertex(Node(Concept("one")), g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetTwoNodeOneEdge() const noexcept
{
ConceptMap g;
//These coordinats are tested as such
const auto vd_1 = AddVertex(
Node(Concept("center"), NodeType::center, 100, 200), g);
const auto vd_2 = AddVertex(
Node(Concept("one", Examples( { Example("unos"), Example("een") } )),
NodeType::normal, 300, 250), g);
AddEdge(
Edge(
Node(
Concept( "first"),
NodeType::normal,
150, 225
),
true, //Head arrow
false
), vd_1, vd_2, g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetTwoNodeOneEdgeNoCenter() const noexcept
{
ConceptMap g;
//These coordinats are tested as such
const auto vd_2 = AddVertex(
Node(Concept("one", Examples( { Example("unos"), Example("een") } )),
NodeType::normal, 300, 250), g);
const auto vd_3 = AddVertex(
Node(Concept("two", Examples( { Example("Zwei"), Example("twee") } )),
NodeType::normal, 500, 350), g);
AddEdge(Edge(Node(Concept("second",
Examples( { Example("zweite"), Example("deuxieme") } )),
NodeType::normal, 350, 275)), vd_2, vd_3, g);
return g;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetWithExamplesWithCompetencies(
const std::vector<Competency>& competencies
) const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().CreateFromStrings("A center node is ..."), g);
Node n(Concept("not me"));
std::vector<Example> examples;
{
int i = 0;
for (const auto competency: competencies)
{
const std::string text = "Example " + std::to_string(i);
examples.push_back(
Example(text, competency)
);
++i;
}
}
SetExamples(n, Examples(examples));
const auto vd_2 = AddVertex(n, g);
AddEdge(Edge(), vd_1, vd_2, g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetNasty0() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().GetNastyTest(0), g);
const auto vd_2 = AddVertex(NodeFactory().GetNastyTest(0), g);
const auto vd_3 = AddVertex(NodeFactory().GetNastyTest(1), g);
const auto vd_4 = AddVertex(NodeFactory().GetNastyTest(2), g);
AddEdge(EdgeFactory().GetNastyTest(0), vd_1, vd_2,g);
AddEdge(EdgeFactory().GetNastyTest(1), vd_2, vd_3,g);
AddEdge(EdgeFactory().GetNastyTest(2), vd_3, vd_1,g);
AddEdge(EdgeFactory().GetNastyTest(0), vd_4, vd_1,g);
return g;
}
ribi::cmap::ConceptMap
ribi::cmap::ConceptMapFactory::GetRateConceptTallyDialogExample() const noexcept
{
ConceptMap g;
const Examples examples_1(
{
Example("Always establish order first"),
Example("Punishment"),
}
);
const Examples examples_2(
{
Example("Students teaching each other, get to know each other")
}
);
const Concept concept1("Learning environment");
const Concept concept2("Order");
const Concept concept3("Social safety");
const auto vd_1 = AddVertex(Node(concept1), g);
const auto vd_2 = AddVertex(Node(concept2), g);
const auto vd_3 = AddVertex(Node(concept3), g);
AddEdge(Edge(Node(Concept("prerequisite", examples_1)), true), vd_2, vd_1,g);
AddEdge(Edge(Node(Concept("strengthen", examples_2)), true, true), vd_2, vd_3,g);
return Reposition(g);
}
ribi::cmap::ConceptMap //!OCLINT indeed a long method!
ribi::cmap::ConceptMapFactory
::GetRateConceptTallyDialogExample293() const noexcept
{
// From https://github.com/richelbilderbeek/BrainWeaver/issues/293
// [...] bij 2 complexe relaties en 0 of 1 complexe voorbeelden
// [...] geeft de computer complexiteit 2 en dat moet 1 zijn
ConceptMap g;
const auto vd_1 = AddVertex(
Node(
Concept(
"My focal concept",
Examples(
{
Example(
"My focal concept's single and complex example",
Competency::uninitialized,
true, //Concept is complex
false,
false
)
}
)
)
),
g
);
const auto vd_2 = AddVertex(
Node(
Concept("My first other concept", Examples(), false)
),
g
);
const auto vd_3 = AddVertex(
Node(Concept("My second other concept", Examples(), false)),
g
);
AddEdge(
Edge(
Node(
Concept(
"my first complex relation",
Examples(
{
Example(
"my first relation's example",
Competency::uninitialized,
false,
false,
false
)
}
),
true //Relation is complex
)
)
),
vd_1,
vd_2,
g
);
AddEdge(
Edge(
Node(
Concept(
"my second complex relation",
Examples(
{
Example(
"my second relation's example",
Competency::uninitialized,
false,
false,
false
)
}
),
true //Complex
)
)
),
vd_1,
vd_3,
g
);
return Reposition(g);
}
ribi::cmap::ConceptMap
ribi::cmap::ConceptMapFactory::GetQtRatedConceptDialogExample() const noexcept
{
ConceptMap g;
const Examples examples_node_1(
{
Example("Arduino course"),
Example("Dojo")
}
);
const Examples examples_edge_1(
{
Example("Always establish order first"),
Example("Punishment"),
}
);
const Examples examples_edge_2(
{
Example("Students teaching each other, get to know each other")
}
);
const Concept concept1("Learning environment", examples_node_1);
const Concept concept2("Order");
const Concept concept3("Social safety");
const auto vd_1 = AddVertex(Node(concept1), g);
const auto vd_2 = AddVertex(Node(concept2), g);
const auto vd_3 = AddVertex(Node(concept3), g);
AddEdge(Edge(Node(Concept("prerequisite", examples_edge_1)), true), vd_2, vd_1,g);
AddEdge(Edge(Node(Concept("strengthen", examples_edge_2)), true, true), vd_2, vd_3,g);
return Reposition(g);
}
std::vector<ribi::cmap::ConceptMap >
ribi::cmap::ConceptMapFactory::GetAllTests() const noexcept
{
std::vector<ConceptMap> v{
ConceptMap(),
Get1(),
Get2(),
Get3(),
Get4(),
Get5(),
Get6(),
Get11()
};
return v;
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetRated() const noexcept //!OCLINT Indeed a long function, as the concept map is complex
{
ConceptMap g;
const auto vd_1 = AddVertex(CenterNodeFactory().Create(
Concept(
"As a student teacher of English as a foreign language, "
"I have knowledge of ...")
),
g
);
const auto vd_3 = AddVertex(
Node(
Concept(
"My own professional development",
Examples (
{
Example("Keep your portfolio posted up", Competency::ti_knowledge, false, true, true),
Example("Reflection", Competency::ti_knowledge, true, true, true)
}
),
true,
1,
1,
1
)
),
g
);
const auto vd_4 = AddVertex(
Node(
Concept(
"Myself as a teacher",
Examples(),
false,
0,
0,
0
)
),
g
);
const auto vd_2 = AddVertex(
Node(
Concept(
"Profession in general",
Examples(),
false,
0,
0,
0
)
),
g
);
const auto vd_5 = AddVertex(
Node(
Concept(
"Pupils",
Examples(),
false,
0,
0,
0
)
),
g
);
const auto vd_6 = AddVertex(
Node(
Concept(
"Myself as a person",
Examples(),
false,
0,
0,
0
)
),
g
);
//Connected to center node
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_3, g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_5, g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_6, g);
AddEdge(Edge(Node(Concept("affects")), true, false), vd_2, vd_4, g);
AddEdge(Edge(Node(Concept("is connected with")), true, false), vd_3, vd_4, g);
AddEdge(Edge(Node(Concept("is connected with")), true, false), vd_3, vd_6, g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::ConceptMapFactory::GetUnrated() const noexcept
{
ConceptMap g;
const auto vd_1 = AddVertex(
Node(
Concept(
"As a student teacher of English as a foreign language, "
"I have knowledge of ..."
),
NodeType::center
),
g
);
const auto vd_3 = AddVertex(
Node(
Concept(
"My own professional development",
Examples(
{
Example("Keep your portfolio posted up"),
Example("Reflection")
}
)
)
),
g
);
const auto vd_4 = AddVertex(Node(Concept("Myself as a teacher")), g);
const auto vd_2 = AddVertex(
NodeFactory().CreateFromStrings(
"Profession in general",
{ "An example" }
), g);
const auto vd_5 = AddVertex(NodeFactory().CreateFromStrings("Pupils"), g);
const auto vd_6 = AddVertex(NodeFactory().CreateFromStrings("Myself as a person"), g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_2, g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_3, g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_5, g);
AddEdge(Edge(Node(Concept("")), true, false), vd_1, vd_6, g);
AddEdge(Edge(Node(Concept("affects")), true, false), vd_2, vd_4, g);
AddEdge(Edge(Node(Concept("is connected with")), true, false), vd_3, vd_4, g);
AddEdge(Edge(Node(Concept("is connected with")), true, false), vd_3, vd_6, g);
return Reposition(g);
}
ribi::cmap::ConceptMap ribi::cmap::Reposition(ConceptMap& g)
{
//Reposition the nodes
{
auto nodes = GetNodes(g);
const int n_center{CountCenterNodes(nodes)};
const int n_normal{static_cast<int>(nodes.size()) - n_center};
double delta_angle{
2.0 * boost::math::constants::pi<double>() / static_cast<double>(n_normal)
};
double angle{-delta_angle / 3.0}; //Gives a nice twist to a
for (Node& node: nodes)
{
if (IsCenterNode(node))
{
node.SetPos(0.0, 0.0);
}
else
{
const double r{250.0}; //ray, half of diameter
const double x{ std::sin(angle) * r};
const double y{-std::cos(angle) * r};
node.SetPos(x, y);
angle += delta_angle;
}
}
::set_my_bundled_vertexes(g, nodes);
}
//Reposition edges
{
const auto eip = boost::edges(g);
const auto ei_end = eip.second;
for (auto ei = eip.first; ei != ei_end; ++ei)
{
const EdgeDescriptor ed = *ei;
const Node& from = g[boost::source(ed, g)];
const Node& to = g[boost::target(ed, g)];
Edge& edge = g[ed];
SetX(edge, 0.5 * (from.GetX() + to.GetX()));
SetY(edge, 0.5 * (from.GetY() + to.GetY()));
}
}
return g;
}