// License: Apache 2.0. See LICENSE file in root directory. // Copyright(c) 2017 Intel Corporation. All Rights Reserved. #pragma once #include #include "rendering.h" #include "ux-window.h" #include "parser.hpp" #include "rs-config.h" #define GLFW_INCLUDE_GLU #include #include "opengl3.h" #include #include #include #include #include #include #include "objects-in-frame.h" #include "processing-block-model.h" #include "realsense-ui-advanced-mode.h" #include "fw-update-helper.h" #include "updates-model.h" #include "calibration-model.h" #include #include "option-model.h" namespace rs2 { void prepare_config_file(); bool frame_metadata_to_csv( const std::string & filename, rs2::frame frame ); bool motion_data_to_csv( const std::string & filename, rs2::frame frame ); bool pose_data_to_csv( const std::string & filename, rs2::frame frame ); void open_issue(std::string body); class option_model; void hyperlink(ux_window& window, const char* title, const char* link); static const float FEET_TO_METER = 0.3048f; rs2_sensor_mode resolution_from_width_height(int width, int height); template void sort_together(std::vector& vec, std::vector& names) { std::vector> pairs(vec.size()); for (size_t i = 0; i < vec.size(); i++) pairs[i] = std::make_pair(vec[i], names[i]); std::sort(begin(pairs), end(pairs), [](const std::pair& lhs, const std::pair& rhs) { return lhs.first < rhs.first; }); for (size_t i = 0; i < vec.size(); i++) { vec[i] = pairs[i].first; names[i] = pairs[i].second; } } template void push_back_if_not_exists(std::vector& vec, T value) { auto it = std::find(vec.begin(), vec.end(), value); if (it == vec.end()) vec.push_back(value); } struct notification_model; typedef std::map streams_layout; std::vector get_device_info(const device& dev, bool include_location = true); using color = std::array; using face = std::array; using colored_cube = std::array, 6>; using tracked_point = std::pair; // translation and confidence class press_button_model { public: press_button_model(const char* icon_default, const char* icon_pressed, std::string tooltip_default, std::string tooltip_pressed, bool init_pressed) { state_pressed = init_pressed; tooltip[unpressed] = tooltip_default; tooltip[pressed] = tooltip_pressed; icon[unpressed] = icon_default; icon[pressed] = icon_pressed; } void toggle_button() { state_pressed = !state_pressed; } void set_button_pressed(bool p) { state_pressed = p; } bool is_pressed() { return state_pressed; } std::string get_tooltip() { return(state_pressed ? tooltip[pressed] : tooltip[unpressed]); } std::string get_icon() { return(state_pressed ? icon[pressed] : icon[unpressed]); } private: enum button_state { unpressed, //default pressed }; bool state_pressed = false; std::string tooltip[2]; std::string icon[2]; }; bool yes_no_dialog(const std::string& title, const std::string& message_text, bool& approved, ux_window& window, const std::string& error_message, bool disabled = false, const std::string& disabled_reason = ""); bool status_dialog(const std::string& title, const std::string& process_topic_text, const std::string& process_status_text, bool enable_close, ux_window& window); struct notifications_model; void export_frame(const std::string& fname, std::unique_ptr exporter, notifications_model& ns, rs2::frame data, bool notify = true); // Auxillary function to save stream data in its internal (raw) format bool save_frame_raw_data(const std::string& filename, rs2::frame frame); }