-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMappingManager_8cpp_source.html
258 lines (258 loc) · 39.3 KB
/
MappingManager_8cpp_source.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.8"/>
<title>MapMap: MappingManager.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">MapMap
 <span id="projectnumber">0.3.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.8 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>File Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">MappingManager.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="MappingManager_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment"> * MappingManager.cpp</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment"> * (c) 2013 Sofian Audry -- info(@)sofianaudry(.)com</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="comment"> * (c) 2013 Alexandre Quessy -- alexandre(@)quessy(.)net</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="comment"> * This program is free software: you can redistribute it and/or modify</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment"> * it under the terms of the GNU General Public License as published by</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="comment"> * the Free Software Foundation, either version 3 of the License, or</span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="comment"> * (at your option) any later version.</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="comment"> * This program is distributed in the hope that it will be useful,</span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span> <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span> <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="comment"> * GNU General Public License for more details.</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span> <span class="comment"> *</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span> <span class="comment"> * You should have received a copy of the GNU General Public License</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="comment"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span> <span class="comment"> */</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span> </div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include "<a class="code" href="MappingManager_8h.html">MappingManager.h</a>"</span></div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span> <span class="preprocessor">#include <iostream></span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span> </div>
<div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="classMappingManager.html#a47d00fe9ba37fa5f60d97629c78a0a23"> 24</a></span> <a class="code" href="classMappingManager.html#a47d00fe9ba37fa5f60d97629c78a0a23">MappingManager::MappingManager</a>()</div>
<div class="line"><a name="l00025"></a><span class="lineno"> 25</span> {</div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>  <span class="comment">// TODO Auto-generated constructor stub</span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span> </div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span> }</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span> </div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="classMappingManager.html#af0a563739508271ea96b8233ea1ce498"> 30</a></span> QMap<uid, Mapping::ptr> <a class="code" href="classMappingManager.html#af0a563739508271ea96b8233ea1ce498">MappingManager::getPaintMappings</a>(<span class="keyword">const</span> <a class="code" href="classPaint.html#ae6959dfc98bed1fd7015a0dddba43e5e">Paint::ptr</a> paint)<span class="keyword"> const</span></div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  QMap<uid, Mapping::ptr> paintMappings;</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">for</span> (QVector<Mapping::ptr>::const_iterator it = <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.begin(); it != <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.end(); ++it)</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  {</div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">if</span> ((*it)->getPaint() == paint)</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  paintMappings[(*it)->getId()] = *it;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  }</div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>  <span class="keywordflow">return</span> paintMappings;</div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> }</div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span> </div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classMappingManager.html#a2c5592ce7b633f5526649b0ccfe81d99"> 41</a></span> QMap<uid, Mapping::ptr> <a class="code" href="classMappingManager.html#a2c5592ce7b633f5526649b0ccfe81d99">MappingManager::getPaintMappingsById</a>(<a class="code" href="UidAllocator_8h.html#ac83b9ada9e7333675745ef795a057883">uid</a> paintId)<span class="keyword"> const</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <span class="keywordflow">return</span> <a class="code" href="classMappingManager.html#af0a563739508271ea96b8233ea1ce498">getPaintMappings</a>( <a class="code" href="classMappingManager.html#a72c46b5c7f46f28eb5e946356106c210">paintMap</a>[paintId] );</div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span> }</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span> </div>
<div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="classMappingManager.html#a654e0527c33034cd725a7de17f9fe780"> 46</a></span> <a class="code" href="UidAllocator_8h.html#ac83b9ada9e7333675745ef795a057883">uid</a> <a class="code" href="classMappingManager.html#a654e0527c33034cd725a7de17f9fe780">MappingManager::addPaint</a>(<a class="code" href="classPaint.html#ae6959dfc98bed1fd7015a0dddba43e5e">Paint::ptr</a> paint )</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span> {</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <a class="code" href="classMappingManager.html#a650172eeed6c7c3f49ff8170e9766498">paintVector</a>.push_back(paint);</div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <a class="code" href="classMappingManager.html#a72c46b5c7f46f28eb5e946356106c210">paintMap</a>[paint->getId()] = paint;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordflow">return</span> paint->getId();</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span> }</div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classMappingManager.html#af215b03c0d00e14589744ae9b99fae3d"> 53</a></span> <span class="keywordtype">bool</span> <a class="code" href="classMappingManager.html#af215b03c0d00e14589744ae9b99fae3d">MappingManager::removePaint</a>(<a class="code" href="UidAllocator_8h.html#ac83b9ada9e7333675745ef795a057883">uid</a> paintId)</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span> {</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <span class="comment">// Make sure the paint to which this paint refers to exists in the manager.</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <a class="code" href="classPaint.html#ae6959dfc98bed1fd7015a0dddba43e5e">Paint::ptr</a> paint = <a class="code" href="classMappingManager.html#a7c9b912e3c84f7d7ab3b2d604986d73a">getPaintById</a>(paintId);</div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keywordflow">if</span> (paint)</div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  {</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="comment">// Remove all mappings associated with paint.</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  QMap<uid, Mapping::ptr> paintMappings = <a class="code" href="classMappingManager.html#af0a563739508271ea96b8233ea1ce498">getPaintMappings</a>(paint);</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  <span class="keywordflow">for</span> (QMap<uid, Mapping::ptr>::const_iterator it = paintMappings.constBegin();</div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  it != paintMappings.constEnd(); ++it)</div>
<div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <a class="code" href="classMappingManager.html#a636c3bc97e492fdbf6305cd3e36ccf96">removeMapping</a>(it.key());</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// Remove paint.</span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="keywordtype">int</span> idx = <a class="code" href="classMappingManager.html#a650172eeed6c7c3f49ff8170e9766498">paintVector</a>.lastIndexOf(paint);</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  Q_ASSERT( idx != -1 ); <span class="comment">// Q_ASSERT(mappingVector.contains(mapping));</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="classMappingManager.html#a650172eeed6c7c3f49ff8170e9766498">paintVector</a>.remove(idx);</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <a class="code" href="classMappingManager.html#a72c46b5c7f46f28eb5e946356106c210">paintMap</a>.remove(paintId);</div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  }</div>
<div class="line"><a name="l00073"></a><span class="lineno"> 73</span> </div>
<div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span> }</div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classMappingManager.html#a36ac6121cad890e15e5913a73524a99a"> 77</a></span> <span class="keywordtype">bool</span> <a class="code" href="classMappingManager.html#a36ac6121cad890e15e5913a73524a99a">MappingManager::replacePaintMappings</a>(<a class="code" href="classPaint.html#ae6959dfc98bed1fd7015a0dddba43e5e">Paint::ptr</a> oldpaint, <a class="code" href="classPaint.html#ae6959dfc98bed1fd7015a0dddba43e5e">Paint::ptr</a> newpaint)</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span> {</div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="comment">// Make sure the paint to which this paint refers to exists in the manager.</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  <span class="keywordflow">if</span> (oldpaint && newpaint)</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  {</div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  QMap<uid, Mapping::ptr> paintMappings = <a class="code" href="classMappingManager.html#af0a563739508271ea96b8233ea1ce498">getPaintMappings</a>(oldpaint);</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <span class="keywordflow">for</span> (QMap<uid, Mapping::ptr>::const_iterator it = paintMappings.constBegin();</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  it != paintMappings.constEnd(); ++it) {</div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <a class="code" href="classMapping.html#ae79d6c9d0e86634b92c955962aaeabdc">Mapping::ptr</a> mapping = it.value();</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  mapping->setPaint(newpaint);</div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  }</div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  }</div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span> }</div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="line" href="classMappingManager.html#a8520f36639420ee5ea6df9ae80dc0e33"> 94</a></span> <a class="code" href="UidAllocator_8h.html#ac83b9ada9e7333675745ef795a057883">uid</a> <a class="code" href="classMappingManager.html#a8520f36639420ee5ea6df9ae80dc0e33">MappingManager::addMapping</a>(<a class="code" href="classMapping.html#ae79d6c9d0e86634b92c955962aaeabdc">Mapping::ptr</a> mapping)</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span> {</div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="comment">// Make sure the paint to which this mapping refers to exists in the manager.</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  Q_ASSERT ( <a class="code" href="classMappingManager.html#a650172eeed6c7c3f49ff8170e9766498">paintVector</a>.contains(mapping->getPaint()) );</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span> </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.push_back(mapping);</div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <a class="code" href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">mappingMap</a>[mapping->getId()] = mapping;</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keywordflow">return</span> mapping->getId();</div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span> }</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span> </div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="line" href="classMappingManager.html#a636c3bc97e492fdbf6305cd3e36ccf96"> 105</a></span> <span class="keywordtype">bool</span> <a class="code" href="classMappingManager.html#a636c3bc97e492fdbf6305cd3e36ccf96">MappingManager::removeMapping</a>(<a class="code" href="UidAllocator_8h.html#ac83b9ada9e7333675745ef795a057883">uid</a> mappingId)</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span> {</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="comment">// Make sure the paint to which this mapping refers to exists in the manager.</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <a class="code" href="classMapping.html#ae79d6c9d0e86634b92c955962aaeabdc">Mapping::ptr</a> mapping = <a class="code" href="classMappingManager.html#a5f725de7227d100962da39ad646e9a03">getMappingById</a>(mappingId);</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordflow">if</span> (mapping)</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  {</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordtype">int</span> idx = <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.lastIndexOf(mapping);</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  Q_ASSERT( idx != -1 ); <span class="comment">// Q_ASSERT(mappingVector.contains(mapping));</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.remove(idx);</div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <a class="code" href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">mappingMap</a>.remove(mappingId);</div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span> </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span> }</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span> </div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="classMappingManager.html#a0d427b746cf6aa1326ca67d4a9f88ab0"> 122</a></span> QVector<Mapping::ptr> <a class="code" href="classMappingManager.html#a0d427b746cf6aa1326ca67d4a9f88ab0">MappingManager::getVisibleMappings</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span> <span class="keyword"></span>{</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  QVector<Mapping::ptr> visible;</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span> </div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">// First pass: check if one of the mappings is in solo mode.</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordtype">bool</span> hasSolo = <span class="keyword">false</span>;</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  <span class="keywordflow">for</span> (QVector<Mapping::ptr>::const_iterator it = <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.begin(); it != <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.end(); ++it)</div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  {</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordflow">if</span> ((*it)->isSolo())</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  {</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  hasSolo = <span class="keyword">true</span>;</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordflow">break</span>;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  }</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  }</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span> </div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  <span class="comment">// Second pass: fill the visible vector.</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  <span class="keywordflow">for</span> (QVector<Mapping::ptr>::const_iterator it = <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.begin(); it != <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.end(); ++it)</div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  {</div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  <span class="comment">// Solo has priority over invisible (mute)</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordflow">if</span> ( (hasSolo && (*it)->isSolo() && (*it)->isVisible()) || (!hasSolo && (*it)->isVisible()) )</div>
<div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  visible.push_back(*it);</div>
<div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  }</div>
<div class="line"><a name="l00144"></a><span class="lineno"> 144</span> </div>
<div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <span class="keywordflow">return</span> visible;</div>
<div class="line"><a name="l00146"></a><span class="lineno"> 146</span> }</div>
<div class="line"><a name="l00147"></a><span class="lineno"> 147</span> </div>
<div class="line"><a name="l00148"></a><span class="lineno"><a class="line" href="classMappingManager.html#a7bb2d9d9f7c8b2b8f6ef7d45bdf313a9"> 148</a></span> <span class="keywordtype">void</span> <a class="code" href="classMappingManager.html#a7bb2d9d9f7c8b2b8f6ef7d45bdf313a9">MappingManager::reorderMappings</a>(QVector<uid> mappingIds)</div>
<div class="line"><a name="l00149"></a><span class="lineno"> 149</span> {</div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  <span class="comment">// Both vector needs to have the same size.</span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  Q_ASSERT( mappingIds.size() == <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.size() );</div>
<div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.clear();</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="keywordtype">int</span> depth = 0;</div>
<div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <span class="keywordflow">for</span> (QVector<uid>::iterator it = mappingIds.begin(); it != mappingIds.end(); ++it)</div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  {</div>
<div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <span class="comment">// Uid should be a key of the mappingMap.</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  Q_ASSERT( <a class="code" href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">mappingMap</a>.contains(*it) );</div>
<div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <span class="comment">// Makes sure the uids are not repeated.</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  Q_ASSERT( !<a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.contains(<a class="code" href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">mappingMap</a>[*it]) );</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="comment">// Adds the mapping at the right place in the vector.</span></div>
<div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <a class="code" href="classMapping.html#ae79d6c9d0e86634b92c955962aaeabdc">Mapping::ptr</a> mapping = <a class="code" href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">mappingMap</a>[*it];</div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  mapping->setDepth(depth);</div>
<div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.push_back( mapping );</div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span> </div>
<div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  depth++;</div>
<div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  }</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span> }</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span> </div>
<div class="line"><a name="l00169"></a><span class="lineno"> 169</span> <span class="comment">//bool MappingManager::removeMapping(Mapping::ptr mapping)</span></div>
<div class="line"><a name="l00170"></a><span class="lineno"> 170</span> <span class="comment">//{</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span> <span class="comment">//}</span></div>
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span> </div>
<div class="line"><a name="l00173"></a><span class="lineno"><a class="line" href="classMappingManager.html#a2182e7e79053192e651218750c609092"> 173</a></span> <span class="keywordtype">void</span> <a class="code" href="classMappingManager.html#a2182e7e79053192e651218750c609092">MappingManager::clearAll</a>()</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span> {</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  <a class="code" href="classMappingManager.html#a650172eeed6c7c3f49ff8170e9766498">paintVector</a>.clear();</div>
<div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  <a class="code" href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">mappingVector</a>.clear();</div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  <a class="code" href="classMappingManager.html#a72c46b5c7f46f28eb5e946356106c210">paintMap</a>.clear();</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>  <a class="code" href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">mappingMap</a>.clear();</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span> }</div>
<div class="ttc" id="classMappingManager_html_a650172eeed6c7c3f49ff8170e9766498"><div class="ttname"><a href="classMappingManager.html#a650172eeed6c7c3f49ff8170e9766498">MappingManager::paintVector</a></div><div class="ttdeci">QVector< Paint::ptr > paintVector</div><div class="ttdoc">Container for all paints. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8h_source.html#l00043">MappingManager.h:43</a></div></div>
<div class="ttc" id="classMappingManager_html_af0a563739508271ea96b8233ea1ce498"><div class="ttname"><a href="classMappingManager.html#af0a563739508271ea96b8233ea1ce498">MappingManager::getPaintMappings</a></div><div class="ttdeci">QMap< uid, Mapping::ptr > getPaintMappings(const Paint::ptr paint) const </div><div class="ttdoc">Returns the list of mappings associated with given paint. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00030">MappingManager.cpp:30</a></div></div>
<div class="ttc" id="classMappingManager_html_a7c9b912e3c84f7d7ab3b2d604986d73a"><div class="ttname"><a href="classMappingManager.html#a7c9b912e3c84f7d7ab3b2d604986d73a">MappingManager::getPaintById</a></div><div class="ttdeci">Paint::ptr getPaintById(uid id)</div><div class="ttdoc">Returns paint with given uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8h_source.html#l00080">MappingManager.h:80</a></div></div>
<div class="ttc" id="classMappingManager_html_af215b03c0d00e14589744ae9b99fae3d"><div class="ttname"><a href="classMappingManager.html#af215b03c0d00e14589744ae9b99fae3d">MappingManager::removePaint</a></div><div class="ttdeci">bool removePaint(uid paintId)</div><div class="ttdoc">Removes a paint of given uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00053">MappingManager.cpp:53</a></div></div>
<div class="ttc" id="UidAllocator_8h_html_ac83b9ada9e7333675745ef795a057883"><div class="ttname"><a href="UidAllocator_8h.html#ac83b9ada9e7333675745ef795a057883">uid</a></div><div class="ttdeci">int uid</div><div class="ttdoc">The UidAllocator class. </div><div class="ttdef"><b>Definition:</b> <a href="UidAllocator_8h_source.html#l00033">UidAllocator.h:33</a></div></div>
<div class="ttc" id="classMappingManager_html_a431d2cc375bf250d8a3dd71e3421fe3f"><div class="ttname"><a href="classMappingManager.html#a431d2cc375bf250d8a3dd71e3421fe3f">MappingManager::mappingVector</a></div><div class="ttdeci">QVector< Mapping::ptr > mappingVector</div><div class="ttdoc">Container for all mappings (ordered from bottom layer to top layer). </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8h_source.html#l00049">MappingManager.h:49</a></div></div>
<div class="ttc" id="classMappingManager_html_a47d00fe9ba37fa5f60d97629c78a0a23"><div class="ttname"><a href="classMappingManager.html#a47d00fe9ba37fa5f60d97629c78a0a23">MappingManager::MappingManager</a></div><div class="ttdeci">MappingManager()</div><div class="ttdoc">Constructor. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00024">MappingManager.cpp:24</a></div></div>
<div class="ttc" id="classMappingManager_html_a36ac6121cad890e15e5913a73524a99a"><div class="ttname"><a href="classMappingManager.html#a36ac6121cad890e15e5913a73524a99a">MappingManager::replacePaintMappings</a></div><div class="ttdeci">bool replacePaintMappings(Paint::ptr oldpaint, Paint::ptr newpaint)</div><div class="ttdoc">DEPRECATED. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00077">MappingManager.cpp:77</a></div></div>
<div class="ttc" id="classMappingManager_html_a636c3bc97e492fdbf6305cd3e36ccf96"><div class="ttname"><a href="classMappingManager.html#a636c3bc97e492fdbf6305cd3e36ccf96">MappingManager::removeMapping</a></div><div class="ttdeci">bool removeMapping(uid mappingId)</div><div class="ttdoc">Removes a mapping of given uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00105">MappingManager.cpp:105</a></div></div>
<div class="ttc" id="classMappingManager_html_a0d427b746cf6aa1326ca67d4a9f88ab0"><div class="ttname"><a href="classMappingManager.html#a0d427b746cf6aa1326ca67d4a9f88ab0">MappingManager::getVisibleMappings</a></div><div class="ttdeci">QVector< Mapping::ptr > getVisibleMappings() const </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00122">MappingManager.cpp:122</a></div></div>
<div class="ttc" id="classMappingManager_html_a5f725de7227d100962da39ad646e9a03"><div class="ttname"><a href="classMappingManager.html#a5f725de7227d100962da39ad646e9a03">MappingManager::getMappingById</a></div><div class="ttdeci">Mapping::ptr getMappingById(uid id)</div><div class="ttdoc">Returns mapping with given uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8h_source.html#l00098">MappingManager.h:98</a></div></div>
<div class="ttc" id="classMappingManager_html_a72c46b5c7f46f28eb5e946356106c210"><div class="ttname"><a href="classMappingManager.html#a72c46b5c7f46f28eb5e946356106c210">MappingManager::paintMap</a></div><div class="ttdeci">QMap< uid, Paint::ptr > paintMap</div><div class="ttdoc">Maps from uids to paints. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8h_source.html#l00046">MappingManager.h:46</a></div></div>
<div class="ttc" id="classMapping_html_ae79d6c9d0e86634b92c955962aaeabdc"><div class="ttname"><a href="classMapping.html#ae79d6c9d0e86634b92c955962aaeabdc">Mapping::ptr</a></div><div class="ttdeci">QSharedPointer< Mapping > ptr</div><div class="ttdef"><b>Definition:</b> <a href="Mapping_8h_source.html#l00070">Mapping.h:70</a></div></div>
<div class="ttc" id="classMappingManager_html_a8520f36639420ee5ea6df9ae80dc0e33"><div class="ttname"><a href="classMappingManager.html#a8520f36639420ee5ea6df9ae80dc0e33">MappingManager::addMapping</a></div><div class="ttdeci">uid addMapping(Mapping::ptr mapping)</div><div class="ttdoc">Adds a mapping and returns its uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00094">MappingManager.cpp:94</a></div></div>
<div class="ttc" id="classPaint_html_ae6959dfc98bed1fd7015a0dddba43e5e"><div class="ttname"><a href="classPaint.html#ae6959dfc98bed1fd7015a0dddba43e5e">Paint::ptr</a></div><div class="ttdeci">QSharedPointer< Paint > ptr</div><div class="ttdef"><b>Definition:</b> <a href="Paint_8h_source.html#l00057">Paint.h:57</a></div></div>
<div class="ttc" id="classMappingManager_html_a654e0527c33034cd725a7de17f9fe780"><div class="ttname"><a href="classMappingManager.html#a654e0527c33034cd725a7de17f9fe780">MappingManager::addPaint</a></div><div class="ttdeci">uid addPaint(Paint::ptr paint)</div><div class="ttdoc">Adds a paint and returns its uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00046">MappingManager.cpp:46</a></div></div>
<div class="ttc" id="classMappingManager_html_a2182e7e79053192e651218750c609092"><div class="ttname"><a href="classMappingManager.html#a2182e7e79053192e651218750c609092">MappingManager::clearAll</a></div><div class="ttdeci">void clearAll()</div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00173">MappingManager.cpp:173</a></div></div>
<div class="ttc" id="classMappingManager_html_a09e2ed5ee3f05b92b7278aeb9f947b05"><div class="ttname"><a href="classMappingManager.html#a09e2ed5ee3f05b92b7278aeb9f947b05">MappingManager::mappingMap</a></div><div class="ttdeci">QMap< uid, Mapping::ptr > mappingMap</div><div class="ttdoc">Maps from uids to mappings. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8h_source.html#l00052">MappingManager.h:52</a></div></div>
<div class="ttc" id="classMappingManager_html_a7bb2d9d9f7c8b2b8f6ef7d45bdf313a9"><div class="ttname"><a href="classMappingManager.html#a7bb2d9d9f7c8b2b8f6ef7d45bdf313a9">MappingManager::reorderMappings</a></div><div class="ttdeci">void reorderMappings(QVector< uid > mappingIds)</div><div class="ttdoc">Reorders the mappings according to given list of uids. QVector needs to. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00148">MappingManager.cpp:148</a></div></div>
<div class="ttc" id="classMappingManager_html_a2c5592ce7b633f5526649b0ccfe81d99"><div class="ttname"><a href="classMappingManager.html#a2c5592ce7b633f5526649b0ccfe81d99">MappingManager::getPaintMappingsById</a></div><div class="ttdeci">QMap< uid, Mapping::ptr > getPaintMappingsById(uid paintId) const </div><div class="ttdoc">Returns the list of mappings associated with given paint uid. </div><div class="ttdef"><b>Definition:</b> <a href="MappingManager_8cpp_source.html#l00041">MappingManager.cpp:41</a></div></div>
<div class="ttc" id="MappingManager_8h_html"><div class="ttname"><a href="MappingManager_8h.html">MappingManager.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Jan 8 2016 09:37:01 for MapMap by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.8
</small></address>
</body>
</html>