| 348 | } |
| 349 | |
| 350 | void ImageViewerHandler::drawMenu() |
| 351 | { |
| 352 | if (ImGui::CollapsingHeader("Image")) |
| 353 | { |
| 354 | if (products->images.size() < 100) |
| 355 | { |
| 356 | if (ImGui::Combo("##imagechannelcombo", &select_image_id, select_image_str.c_str())) |
| 357 | { |
| 358 | if (select_image_id == 0) |
| 359 | active_channel_id = -1; |
| 360 | else |
| 361 | active_channel_id = select_image_id - 1; |
| 362 | asyncUpdate(); |
| 363 | } |
| 364 | } |
| 365 | else |
| 366 | { |
| 367 | if (ImGui::InputInt("##imagechannelint", &select_image_id)) |
| 368 | { |
| 369 | if (select_image_id > (int)products->images.size()) |
| 370 | select_image_id = (int)products->images.size(); |
| 371 | else if (select_image_id < 0) |
| 372 | select_image_id = 0; |
| 373 | |
| 374 | if (select_image_id == 0) |
| 375 | active_channel_id = -1; |
| 376 | else |
| 377 | active_channel_id = select_image_id - 1; |
| 378 | asyncUpdate(); |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | if (ImGui::IsItemHovered() && active_channel_id >= 0) |
| 383 | { |
| 384 | if (products->get_wavenumber(active_channel_id) != -1) |
| 385 | { |
| 386 | ImGui::BeginTooltip(); |
| 387 | ImGui::Text(u8"Wavenumber : %f cm\u207b\u00b9", products->get_wavenumber(active_channel_id)); |
| 388 | double wl_nm = 1e7 / products->get_wavenumber(active_channel_id); |
| 389 | double frequency = 299792458.0 / (wl_nm * 10e-10); |
| 390 | |
| 391 | if (wl_nm < 1e3) |
| 392 | ImGui::Text("Wavelength : %f nm", wl_nm); |
| 393 | else if (wl_nm < 1e6) |
| 394 | ImGui::Text("Wavelength : %f µm", wl_nm / 1e3); |
| 395 | else if (wl_nm < 1e9) |
| 396 | ImGui::Text("Wavelength : %f mm", wl_nm / 1e6); |
| 397 | else |
| 398 | ImGui::Text("Wavelength : %f cm", wl_nm / 1e7); |
| 399 | |
| 400 | if (frequency < 1e3) |
| 401 | ImGui::Text("Frequency : %f Hz", frequency); |
| 402 | else if (frequency < 1e6) |
| 403 | ImGui::Text("Frequency : %f kHz", frequency / 1e3); |
| 404 | else if (frequency < 1e9) |
| 405 | ImGui::Text("Frequency : %f MHz", frequency / 1e6); |
| 406 | else |
| 407 | ImGui::Text("Frequency : %f GHz", frequency / 1e9); |
no test coverage detected