return raw(!) value of front-most, active statistic item at given position Info is always read from the current buffer. So these values are only valid if a draw event occurred first.
| 195 | // Info is always read from the current buffer. So these values are only valid if a draw event |
| 196 | // occurred first. |
| 197 | QStringPairList StatisticsData::getValuesAt(const QPoint &pos) const |
| 198 | { |
| 199 | QStringPairList valueList; |
| 200 | |
| 201 | std::unique_lock<std::mutex> lock(this->accessMutex); |
| 202 | |
| 203 | for (auto it = this->statsTypes.rbegin(); it != this->statsTypes.rend(); it++) |
| 204 | { |
| 205 | if (!it->renderGrid) |
| 206 | continue; |
| 207 | |
| 208 | if (it->typeID == INT_INVALID || this->frameCache.count(it->typeID) == 0) |
| 209 | // no active statistics data |
| 210 | continue; |
| 211 | |
| 212 | // Get all value data entries |
| 213 | bool foundStats = false; |
| 214 | for (const auto &valueItem : this->frameCache.at(it->typeID).valueData) |
| 215 | { |
| 216 | auto rect = QRect(valueItem.pos[0], valueItem.pos[1], valueItem.size[0], valueItem.size[1]); |
| 217 | if (rect.contains(pos)) |
| 218 | { |
| 219 | int value = valueItem.value; |
| 220 | auto valTxt = it->getValueTxt(value); |
| 221 | if (valTxt.isEmpty() && it->scaleValueToBlockSize) |
| 222 | valTxt = QString("%1").arg(float(value) / (valueItem.size[0] * valueItem.size[1])); |
| 223 | |
| 224 | valueList.append(QStringPair(it->typeName, valTxt)); |
| 225 | foundStats = true; |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | for (const auto &vectorItem : this->frameCache.at(it->typeID).vectorData) |
| 230 | { |
| 231 | auto rect = |
| 232 | QRect(vectorItem.pos[0], vectorItem.pos[1], vectorItem.size[0], vectorItem.size[1]); |
| 233 | if (rect.contains(pos)) |
| 234 | { |
| 235 | double x{}; |
| 236 | double y{}; |
| 237 | if (vectorItem.isLine) |
| 238 | { |
| 239 | x = double(vectorItem.point[1].x - vectorItem.point[0].x) / it->vectorScale; |
| 240 | y = double(vectorItem.point[1].y - vectorItem.point[0].y) / it->vectorScale; |
| 241 | } |
| 242 | else |
| 243 | { |
| 244 | x = double(vectorItem.point[0].x) / it->vectorScale; |
| 245 | y = double(vectorItem.point[0].y) / it->vectorScale; |
| 246 | } |
| 247 | valueList.append( |
| 248 | QStringPair(QString("%1").arg(it->typeName), QString("(%1,%2)").arg(x).arg(y))); |
| 249 | foundStats = true; |
| 250 | } |
| 251 | } |
| 252 | |
| 253 | for (const auto &affineTFItem : this->frameCache.at(it->typeID).affineTFData) |
| 254 | { |