| 460 | } |
| 461 | |
| 462 | fg_surface ForgeManager::getSurface(fg_chart chart, int nX, int nY, |
| 463 | fg_dtype type) { |
| 464 | unsigned long long surfaceSize = nX * static_cast<unsigned long long>(nY); |
| 465 | assert(surfaceSize <= 2ULL << 48ULL); |
| 466 | unsigned long long key = ((surfaceSize & _48BIT) << 16U) | (type & _16BIT); |
| 467 | |
| 468 | ChartKey keypair = make_pair(key, chart); |
| 469 | auto iter = mSfcMap.find(keypair); |
| 470 | |
| 471 | if (iter == mSfcMap.end()) { |
| 472 | fg_chart_type chart_type; |
| 473 | FG_CHECK(mPlugin->fg_get_chart_type(&chart_type, chart)); |
| 474 | if (chart_type != FG_CHART_3D) { |
| 475 | AF_ERROR("Surface can only be added to chart of type FG_CHART_3D", |
| 476 | AF_ERR_TYPE); |
| 477 | } |
| 478 | fg_surface surf = nullptr; |
| 479 | FG_CHECK(mPlugin->fg_create_surface(&surf, nX, nY, type, |
| 480 | FG_PLOT_SURFACE, FG_MARKER_NONE)); |
| 481 | FG_CHECK(mPlugin->fg_append_surface_to_chart(chart, surf)); |
| 482 | mSfcMap[keypair] = SurfacePtr(new Surface({surf})); |
| 483 | } |
| 484 | return mSfcMap[keypair]->handle; |
| 485 | } |
| 486 | |
| 487 | fg_vector_field ForgeManager::getVectorField(fg_chart chart, int nPoints, |
| 488 | fg_dtype type) { |