| 1063 | } |
| 1064 | |
| 1065 | void RenderingController::HandleGET_stdmultiWindows(const httplib::Request& req, httplib::Response& res) const |
| 1066 | { |
| 1067 | if (m_RenderWindowBridge == nullptr || !m_RenderWindowBridge->HasStdMultiWindowListProvider()) |
| 1068 | { |
| 1069 | const auto error = ErrorResponse::RenderWindowNotAvailable(req.path); |
| 1070 | this->SendErrorResponse(res, 503, error); |
| 1071 | return; |
| 1072 | } |
| 1073 | |
| 1074 | std::vector<WindowInfo> windows; |
| 1075 | try |
| 1076 | { |
| 1077 | windows = m_RenderWindowBridge->ListStdMultiWindows(); |
| 1078 | } |
| 1079 | catch (const std::exception& e) |
| 1080 | { |
| 1081 | const auto [status, payload] = MapBridgeException(e, req.path); |
| 1082 | this->SendErrorResponse(res, status, payload); |
| 1083 | return; |
| 1084 | } |
| 1085 | |
| 1086 | nlohmann::json arr = nlohmann::json::array(); |
| 1087 | for (const auto& w : windows) |
| 1088 | { |
| 1089 | nlohmann::json wj; |
| 1090 | wj["id"] = w.id; |
| 1091 | wj["kind"] = WindowKindToString(w.kind); |
| 1092 | if (w.viewDirection.has_value()) |
| 1093 | wj["view_direction"] = AnatomicalPlaneToV2String(*w.viewDirection); |
| 1094 | arr.push_back(wj); |
| 1095 | } |
| 1096 | |
| 1097 | res.status = 200; |
| 1098 | res.set_content(arr.dump(), "application/json"); |
| 1099 | } |
| 1100 | |
| 1101 | void RenderingController::HandleGET_stdmultiWindow(const httplib::Request& req, httplib::Response& res) const |
| 1102 | { |