Measuring - Gizmo measure - Commented out hovered feature section from imgui dialog

This commit is contained in:
enricoturri1966 2022-10-25 14:50:54 +02:00
parent a0c1648f36
commit 377ff4a519

View File

@ -1479,103 +1479,103 @@ void GLGizmoMeasure::on_render_input_window(float x, float y, float bottom_limit
const bool use_inches = wxGetApp().app_config->get("use_inches") == "1"; const bool use_inches = wxGetApp().app_config->get("use_inches") == "1";
const std::string units = use_inches ? " " + _u8L("in") : " " + _u8L("mm"); const std::string units = use_inches ? " " + _u8L("in") : " " + _u8L("mm");
const Measure::SurfaceFeatureType feature_type = m_curr_feature.has_value() ? m_curr_feature->get_type() : Measure::SurfaceFeatureType::Undef; //const Measure::SurfaceFeatureType feature_type = m_curr_feature.has_value() ? m_curr_feature->get_type() : Measure::SurfaceFeatureType::Undef;
bool data_text_set = false; //bool data_text_set = false;
ImGui::Separator(); //ImGui::Separator();
if (feature_type != Measure::SurfaceFeatureType::Undef) { //if (feature_type != Measure::SurfaceFeatureType::Undef) {
if (m_mode == EMode::BasicSelection) { // if (m_mode == EMode::BasicSelection) {
m_imgui->text(surface_feature_type_as_string(feature_type)); // m_imgui->text(surface_feature_type_as_string(feature_type));
data_text_set = true; // data_text_set = true;
} // }
else if (m_mode == EMode::ExtendedSelection) { // else if (m_mode == EMode::ExtendedSelection) {
if (m_hover_id != -1 && m_curr_point_on_feature_position.has_value()) { // if (m_hover_id != -1 && m_curr_point_on_feature_position.has_value()) {
m_imgui->text(point_on_feature_type_as_string(feature_type, m_hover_id)); // m_imgui->text(point_on_feature_type_as_string(feature_type, m_hover_id));
data_text_set = true; // data_text_set = true;
} // }
} // }
} //}
if (!data_text_set) //if (!data_text_set)
m_imgui->text(_u8L("No feature")); // m_imgui->text(_u8L("No feature"));
const unsigned int max_data_row_count = 3; //const unsigned int max_data_row_count = 3;
unsigned int data_row_count = 0; //unsigned int data_row_count = 0;
if (ImGui::BeginTable("Data", 2)) { //if (ImGui::BeginTable("Data", 2)) {
if (m_mode == EMode::BasicSelection) { // if (m_mode == EMode::BasicSelection) {
switch (feature_type) // switch (feature_type)
{ // {
default: { break; } // default: { break; }
case Measure::SurfaceFeatureType::Point: // case Measure::SurfaceFeatureType::Point:
{ // {
Vec3d position = m_volume_matrix * m_curr_feature->get_point(); // Vec3d position = m_volume_matrix * m_curr_feature->get_point();
if (use_inches) // if (use_inches)
position = ObjectManipulation::mm_to_in * position; // position = ObjectManipulation::mm_to_in * position;
add_strings_row_to_table(*m_imgui, _u8L("Position"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(position), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Position"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(position), ImGui::GetStyleColorVec4(ImGuiCol_Text));
data_row_count = 1; // data_row_count = 1;
break; // break;
} // }
case Measure::SurfaceFeatureType::Edge: // case Measure::SurfaceFeatureType::Edge:
{ // {
auto [from, to] = m_curr_feature->get_edge(); // auto [from, to] = m_curr_feature->get_edge();
from = m_volume_matrix * from; // from = m_volume_matrix * from;
to = m_volume_matrix * to; // to = m_volume_matrix * to;
if (use_inches) { // if (use_inches) {
from = ObjectManipulation::mm_to_in * from; // from = ObjectManipulation::mm_to_in * from;
to = ObjectManipulation::mm_to_in * to; // to = ObjectManipulation::mm_to_in * to;
} // }
add_strings_row_to_table(*m_imgui, _u8L("From"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(from), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("From"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(from), ImGui::GetStyleColorVec4(ImGuiCol_Text));
add_strings_row_to_table(*m_imgui, _u8L("To"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(to), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("To"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(to), ImGui::GetStyleColorVec4(ImGuiCol_Text));
add_strings_row_to_table(*m_imgui, _u8L("Length"), ImGuiWrapper::COL_ORANGE_LIGHT, format_double((to - from).norm()) + units, ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Length"), ImGuiWrapper::COL_ORANGE_LIGHT, format_double((to - from).norm()) + units, ImGui::GetStyleColorVec4(ImGuiCol_Text));
data_row_count = 3; // data_row_count = 3;
break; // break;
} // }
case Measure::SurfaceFeatureType::Circle: // case Measure::SurfaceFeatureType::Circle:
{ // {
auto [center, radius, normal] = m_curr_feature->get_circle(); // auto [center, radius, normal] = m_curr_feature->get_circle();
// generic point on circle, used to recalculate radius after transformation // // generic point on circle, used to recalculate radius after transformation
const Vec3d on_circle = m_volume_matrix * (center + radius * Measure::get_orthogonal(normal, true)); // const Vec3d on_circle = m_volume_matrix * (center + radius * Measure::get_orthogonal(normal, true));
center = m_volume_matrix * center; // center = m_volume_matrix * center;
normal = (m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal).normalized(); // normal = (m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal).normalized();
radius = (on_circle - center).norm(); // radius = (on_circle - center).norm();
if (use_inches) { // if (use_inches) {
center = ObjectManipulation::mm_to_in * center; // center = ObjectManipulation::mm_to_in * center;
radius = ObjectManipulation::mm_to_in * radius; // radius = ObjectManipulation::mm_to_in * radius;
} // }
add_strings_row_to_table(*m_imgui, _u8L("Center"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(center), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Center"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(center), ImGui::GetStyleColorVec4(ImGuiCol_Text));
add_strings_row_to_table(*m_imgui, _u8L("Radius"), ImGuiWrapper::COL_ORANGE_LIGHT, format_double(radius) + units, ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Radius"), ImGuiWrapper::COL_ORANGE_LIGHT, format_double(radius) + units, ImGui::GetStyleColorVec4(ImGuiCol_Text));
add_strings_row_to_table(*m_imgui, _u8L("Normal"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(normal), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Normal"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(normal), ImGui::GetStyleColorVec4(ImGuiCol_Text));
data_row_count = 3; // data_row_count = 3;
break; // break;
} // }
case Measure::SurfaceFeatureType::Plane: // case Measure::SurfaceFeatureType::Plane:
{ // {
auto [idx, normal, origin] = m_curr_feature->get_plane(); // auto [idx, normal, origin] = m_curr_feature->get_plane();
origin = m_volume_matrix * origin; // origin = m_volume_matrix * origin;
normal = m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal; // normal = m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal;
if (use_inches) // if (use_inches)
origin = ObjectManipulation::mm_to_in * origin; // origin = ObjectManipulation::mm_to_in * origin;
add_strings_row_to_table(*m_imgui, _u8L("Origin"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(origin), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Origin"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(origin), ImGui::GetStyleColorVec4(ImGuiCol_Text));
add_strings_row_to_table(*m_imgui, _u8L("Normal"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(normal), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Normal"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(normal), ImGui::GetStyleColorVec4(ImGuiCol_Text));
data_row_count = 2; // data_row_count = 2;
break; // break;
} // }
} // }
} // }
else { // else {
if (m_hover_id != -1 && m_curr_point_on_feature_position.has_value()) { // if (m_hover_id != -1 && m_curr_point_on_feature_position.has_value()) {
Vec3d position = m_volume_matrix * *m_curr_point_on_feature_position; // Vec3d position = m_volume_matrix * *m_curr_point_on_feature_position;
if (use_inches) // if (use_inches)
position = ObjectManipulation::mm_to_in * position; // position = ObjectManipulation::mm_to_in * position;
add_strings_row_to_table(*m_imgui, _u8L("Position"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(position), ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, _u8L("Position"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(position), ImGui::GetStyleColorVec4(ImGuiCol_Text));
data_row_count = 1; // data_row_count = 1;
} // }
} // }
// add dummy rows to keep dialog size fixed // // add dummy rows to keep dialog size fixed
for (unsigned int i = data_row_count; i < max_data_row_count; ++i) { // for (unsigned int i = data_row_count; i < max_data_row_count; ++i) {
add_strings_row_to_table(*m_imgui, " ", ImGuiWrapper::COL_ORANGE_LIGHT, " ", ImGui::GetStyleColorVec4(ImGuiCol_Text)); // add_strings_row_to_table(*m_imgui, " ", ImGuiWrapper::COL_ORANGE_LIGHT, " ", ImGui::GetStyleColorVec4(ImGuiCol_Text));
} // }
ImGui::EndTable(); // ImGui::EndTable();
} //}
ImGui::Separator(); ImGui::Separator();
const ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersH; const ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersH;