@@ -165,10 +165,10 @@ ItemLoadingState StatisticsData::needsLoading(int frameIndex) const
165
165
{
166
166
// If the statistics for this frame index were not loaded yet but will be rendered, load them
167
167
// now.
168
- if (it->render && this ->frameCache .count (it->typeID ) == 0 )
168
+ if (it->render && this ->frameCache .count (it->getTypeID () ) == 0 )
169
169
{
170
170
// Return that loading is needed before we can render the statitics.
171
- DEBUG_STATDATA (" StatisticsData::needsLoading type " << it->typeID << " LoadingNeeded" );
171
+ DEBUG_STATDATA (" StatisticsData::needsLoading type " << it->getTypeID () << " LoadingNeeded" );
172
172
return ItemLoadingState::LoadingNeeded;
173
173
}
174
174
}
@@ -184,8 +184,8 @@ std::vector<int> StatisticsData::getTypesThatNeedLoading(int frameIndex) const
184
184
auto loadAll = this ->frameIdx != frameIndex;
185
185
for (const auto &statsType : this ->statsTypes )
186
186
{
187
- if (statsType.render && (loadAll || this ->frameCache .count (statsType.typeID ) == 0 ))
188
- typesToLoad.push_back (statsType.typeID );
187
+ if (statsType.render && (loadAll || this ->frameCache .count (statsType.getTypeID () ) == 0 ))
188
+ typesToLoad.push_back (statsType.getTypeID () );
189
189
}
190
190
191
191
DEBUG_STATDATA (" StatisticsData::getTypesThatNeedLoading "
@@ -204,13 +204,13 @@ QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const
204
204
205
205
for (auto it = this ->statsTypes .rbegin (); it != this ->statsTypes .rend (); it++)
206
206
{
207
- if (it->typeID == INT_INVALID || this ->frameCache .count (it->typeID ) == 0 )
207
+ if (it->getTypeID () == INT_INVALID || this ->frameCache .count (it->getTypeID () ) == 0 )
208
208
// no active statistics data
209
209
continue ;
210
210
211
211
// Get all value data entries
212
212
bool foundStats = false ;
213
- for (const auto &valueItem : this ->frameCache .at (it->typeID ).valueData )
213
+ for (const auto &valueItem : this ->frameCache .at (it->getTypeID () ).valueData )
214
214
{
215
215
auto rect = QRect (valueItem.pos [0 ], valueItem.pos [1 ], valueItem.size [0 ], valueItem.size [1 ]);
216
216
if (rect.contains (pos))
@@ -221,12 +221,12 @@ QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const
221
221
valTxt = std::to_string (float (value) / (valueItem.size [0 ] * valueItem.size [1 ]));
222
222
223
223
valueList.append (
224
- QStringPair (QString::fromStdString (it->typeName ), QString::fromStdString (valTxt)));
224
+ QStringPair (QString::fromStdString (it->getTypeName () ), QString::fromStdString (valTxt)));
225
225
foundStats = true ;
226
226
}
227
227
}
228
228
229
- for (const auto &vectorItem : this ->frameCache .at (it->typeID ).vectorData )
229
+ for (const auto &vectorItem : this ->frameCache .at (it->getTypeID () ).vectorData )
230
230
{
231
231
auto rect =
232
232
QRect (vectorItem.pos [0 ], vectorItem.pos [1 ], vectorItem.size [0 ], vectorItem.size [1 ]);
@@ -245,13 +245,13 @@ QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const
245
245
x = double (vectorItem.point [0 ].x ) / scale;
246
246
y = double (vectorItem.point [0 ].y ) / scale;
247
247
}
248
- valueList.append (QStringPair (QString (" %1" ).arg (QString::fromStdString (it->typeName )),
248
+ valueList.append (QStringPair (QString (" %1" ).arg (QString::fromStdString (it->getTypeName () )),
249
249
QString (" (%1,%2)" ).arg (x).arg (y)));
250
250
foundStats = true ;
251
251
}
252
252
}
253
253
254
- for (const auto &affineTFItem : this ->frameCache .at (it->typeID ).affineTFData )
254
+ for (const auto &affineTFItem : this ->frameCache .at (it->getTypeID () ).affineTFData )
255
255
{
256
256
const auto rect = QRect (
257
257
affineTFItem.pos [0 ], affineTFItem.pos [1 ], affineTFItem.size [0 ], affineTFItem.size [1 ]);
@@ -263,17 +263,17 @@ QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const
263
263
auto xScaled = float (affineTFItem.point [i].x / scale);
264
264
auto yScaled = float (affineTFItem.point [i].y / scale);
265
265
valueList.append (
266
- QStringPair (QString (" %1_%2[x]" ).arg (QString::fromStdString (it->typeName )).arg (i),
266
+ QStringPair (QString (" %1_%2[x]" ).arg (QString::fromStdString (it->getTypeName () )).arg (i),
267
267
QString::number (xScaled)));
268
268
valueList.append (
269
- QStringPair (QString (" %1_%2[y]" ).arg (QString::fromStdString (it->typeName )).arg (i),
269
+ QStringPair (QString (" %1_%2[y]" ).arg (QString::fromStdString (it->getTypeName () )).arg (i),
270
270
QString::number (yScaled)));
271
271
}
272
272
foundStats = true ;
273
273
}
274
274
}
275
275
276
- for (const auto &valueItem : this ->frameCache .at (it->typeID ).polygonValueData )
276
+ for (const auto &valueItem : this ->frameCache .at (it->getTypeID () ).polygonValueData )
277
277
{
278
278
if (valueItem.corners .size () < 3 )
279
279
continue ; // need at least triangle -- or more corners
@@ -282,12 +282,12 @@ QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const
282
282
int value = valueItem.value ;
283
283
auto valTxt = it->getValueText (value);
284
284
valueList.append (
285
- QStringPair (QString::fromStdString (it->typeName ), QString::fromStdString (valTxt)));
285
+ QStringPair (QString::fromStdString (it->getTypeName () ), QString::fromStdString (valTxt)));
286
286
foundStats = true ;
287
287
}
288
288
}
289
289
290
- for (const auto &polygonVectorItem : this ->frameCache .at (it->typeID ).polygonVectorData )
290
+ for (const auto &polygonVectorItem : this ->frameCache .at (it->getTypeID () ).polygonVectorData )
291
291
{
292
292
if (polygonVectorItem.corners .size () < 3 )
293
293
continue ; // need at least triangle -- or more corners
@@ -299,17 +299,19 @@ QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const
299
299
const auto scale = it->vectorDataOptions ->scale ;
300
300
auto xScaled = (float )polygonVectorItem.point .x / scale;
301
301
auto yScaled = (float )polygonVectorItem.point .y / scale;
302
- valueList.append (QStringPair (QString (" %1[x]" ).arg (QString::fromStdString (it->typeName )),
303
- QString::number (xScaled)));
304
- valueList.append (QStringPair (QString (" %1[y]" ).arg (QString::fromStdString (it->typeName )),
305
- QString::number (yScaled)));
302
+ valueList.append (
303
+ QStringPair (QString (" %1[x]" ).arg (QString::fromStdString (it->getTypeName ())),
304
+ QString::number (xScaled)));
305
+ valueList.append (
306
+ QStringPair (QString (" %1[y]" ).arg (QString::fromStdString (it->getTypeName ())),
307
+ QString::number (yScaled)));
306
308
foundStats = true ;
307
309
}
308
310
}
309
311
}
310
312
311
313
if (!foundStats)
312
- valueList.append (QStringPair (QString::fromStdString (it->typeName ), " -" ));
314
+ valueList.append (QStringPair (QString::fromStdString (it->getTypeName () ), " -" ));
313
315
}
314
316
315
317
return valueList;
@@ -337,25 +339,7 @@ void StatisticsData::setFrameIndex(int frameIndex)
337
339
338
340
void StatisticsData::addStatType (const StatisticsType &type)
339
341
{
340
- if (type.typeID == -1 )
341
- {
342
- // stat source does not have type ids. need to auto assign an id for this type
343
- // check if type not already in list
344
- int maxTypeID = 0 ;
345
- for (auto it = this ->statsTypes .begin (); it != this ->statsTypes .end (); it++)
346
- {
347
- if (it->typeName == type.typeName )
348
- return ;
349
- if (it->typeID > maxTypeID)
350
- maxTypeID = it->typeID ;
351
- }
352
-
353
- auto newType = type;
354
- newType.typeID = maxTypeID + 1 ;
355
- this ->statsTypes .push_back (newType);
356
- }
357
- else
358
- this ->statsTypes .push_back (type);
342
+ this ->statsTypes .push_back (type);
359
343
}
360
344
361
345
void StatisticsData::savePlaylist (YUViewDomElement &root) const
0 commit comments