| 329 | } |
| 330 | |
| 331 | fg_chart ForgeManager::getChart(const fg_window window, const int r, |
| 332 | const int c, const fg_chart_type ctype) { |
| 333 | auto gIter = mWndGridMap.find(window); |
| 334 | |
| 335 | int rows = std::get<0>(gIter->second); |
| 336 | int cols = std::get<1>(gIter->second); |
| 337 | |
| 338 | if (c >= cols || r >= rows) { |
| 339 | AF_ERROR("Window Grid points are out of bounds", AF_ERR_TYPE); |
| 340 | } |
| 341 | |
| 342 | // upgrade to exclusive access to make changes |
| 343 | auto chart_iter = mChartMap.find(window); |
| 344 | ChartPtr& chart = (chart_iter->second)[c * rows + r]; |
| 345 | |
| 346 | if (!chart) { |
| 347 | fg_chart temp = NULL; |
| 348 | FG_CHECK(mPlugin->fg_create_chart(&temp, ctype)); |
| 349 | chart.reset(new Chart({temp})); |
| 350 | mChartAxesOverrideMap[chart->handle] = false; |
| 351 | } else { |
| 352 | fg_chart_type chart_type; |
| 353 | FG_CHECK(mPlugin->fg_get_chart_type(&chart_type, chart->handle)); |
| 354 | if (chart_type != ctype) { |
| 355 | // Existing chart is of incompatible type |
| 356 | mChartAxesOverrideMap.erase(chart->handle); |
| 357 | fg_chart temp = 0; |
| 358 | FG_CHECK(mPlugin->fg_create_chart(&temp, ctype)); |
| 359 | chart.reset(new Chart({temp})); |
| 360 | mChartAxesOverrideMap[chart->handle] = false; |
| 361 | } |
| 362 | } |
| 363 | return chart->handle; |
| 364 | } |
| 365 | |
| 366 | unsigned long long ForgeManager::genImageKey(unsigned w, unsigned h, |
| 367 | fg_channel_format mode, |
no test coverage detected