-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmappingrawdata.cpp
97 lines (74 loc) · 2.36 KB
/
mappingrawdata.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
#include "mappingrawdata.h"
MappingRawData::MappingRawData(QPointF lower_left, QPointF upper_right)
{
this->lower_left=lower_left;
this->upper_right=upper_right;
current_iterator_index = 0;
agentElipseSize = 10; //Default size
//Default colors
emotion_to_color_dictionary.insert("happy",Qt::red);
emotion_to_color_dictionary.insert("unhappy",Qt::blue);
emotion_to_color_dictionary.insert("fear",QColor(122,27,224));
emotion_to_color_dictionary.insert("hope",Qt::green);
emotion_to_color_dictionary.insert("surprise",Qt::yellow);
emotion_to_color_dictionary.insert("disappointed",Qt::cyan);
emotion_to_color_dictionary.insert("relieved",Qt::magenta);
}
void MappingRawData::setAgentElipseSize(qreal size){
agentElipseSize = size;
}
qreal MappingRawData::getAgentElipseSize(){
return agentElipseSize;
}
void MappingRawData::setEmotionColor(QString emotion, QColor color){
if(emotion_to_color_dictionary.contains(emotion))
emotion_to_color_dictionary.remove(emotion);
emotion_to_color_dictionary.insert(emotion,color);
}
QHash<QString, QColor> MappingRawData::getEmotionColorDict(){
return emotion_to_color_dictionary;
}
void MappingRawData::addFrame(Frame* f){
frame_list.append(f);
}
Frame* MappingRawData::getFrame(qreal t){
for(int i=0;i<frame_list.size();i++)
if(frame_list[i] && frame_list[i]->t==t)
return frame_list[i];
return 0;
}
Frame* MappingRawData::getLastFrame(){
return frame_list[frame_list.size()-1];
}
//Iterator for the frames
void MappingRawData::first(){
current_iterator_index = 0;
}
void MappingRawData::last(){
current_iterator_index= frame_list.size()-1;
}
bool MappingRawData::next(){
current_iterator_index++;
return current_iterator_index<frame_list.size();
}
bool MappingRawData::hasNext(){
return current_iterator_index<frame_list.size();
}
Frame* MappingRawData::current(){
return frame_list[current_iterator_index];
}
void MappingRawData::goTo(qreal f){
current_iterator_index = (frame_list.size()-1)*f;
}
QPointF MappingRawData::getLowerLeft(){
return lower_left;
}
QPointF MappingRawData::getUpperRight(){
return upper_right;
}
QString MappingRawData::getBackgroundImagePath(){
return background_image_path;
}
void MappingRawData::setbackgroundImagePath(QString path){
background_image_path = path;
}