Measuring - Gizmo measure - Commented out hovered feature section from imgui dialog
This commit is contained in:
parent
a0c1648f36
commit
377ff4a519
1 changed files with 95 additions and 95 deletions
|
@ -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 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;
|
||||
bool data_text_set = false;
|
||||
ImGui::Separator();
|
||||
if (feature_type != Measure::SurfaceFeatureType::Undef) {
|
||||
if (m_mode == EMode::BasicSelection) {
|
||||
m_imgui->text(surface_feature_type_as_string(feature_type));
|
||||
data_text_set = true;
|
||||
}
|
||||
else if (m_mode == EMode::ExtendedSelection) {
|
||||
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));
|
||||
data_text_set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!data_text_set)
|
||||
m_imgui->text(_u8L("No feature"));
|
||||
//const Measure::SurfaceFeatureType feature_type = m_curr_feature.has_value() ? m_curr_feature->get_type() : Measure::SurfaceFeatureType::Undef;
|
||||
//bool data_text_set = false;
|
||||
//ImGui::Separator();
|
||||
//if (feature_type != Measure::SurfaceFeatureType::Undef) {
|
||||
// if (m_mode == EMode::BasicSelection) {
|
||||
// m_imgui->text(surface_feature_type_as_string(feature_type));
|
||||
// data_text_set = true;
|
||||
// }
|
||||
// else if (m_mode == EMode::ExtendedSelection) {
|
||||
// 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));
|
||||
// data_text_set = true;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//if (!data_text_set)
|
||||
// m_imgui->text(_u8L("No feature"));
|
||||
|
||||
const unsigned int max_data_row_count = 3;
|
||||
unsigned int data_row_count = 0;
|
||||
if (ImGui::BeginTable("Data", 2)) {
|
||||
if (m_mode == EMode::BasicSelection) {
|
||||
switch (feature_type)
|
||||
{
|
||||
default: { break; }
|
||||
case Measure::SurfaceFeatureType::Point:
|
||||
{
|
||||
Vec3d position = m_volume_matrix * m_curr_feature->get_point();
|
||||
if (use_inches)
|
||||
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));
|
||||
data_row_count = 1;
|
||||
break;
|
||||
}
|
||||
case Measure::SurfaceFeatureType::Edge:
|
||||
{
|
||||
auto [from, to] = m_curr_feature->get_edge();
|
||||
from = m_volume_matrix * from;
|
||||
to = m_volume_matrix * to;
|
||||
if (use_inches) {
|
||||
from = ObjectManipulation::mm_to_in * from;
|
||||
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("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));
|
||||
data_row_count = 3;
|
||||
break;
|
||||
}
|
||||
case Measure::SurfaceFeatureType::Circle:
|
||||
{
|
||||
auto [center, radius, normal] = m_curr_feature->get_circle();
|
||||
// generic point on circle, used to recalculate radius after transformation
|
||||
const Vec3d on_circle = m_volume_matrix * (center + radius * Measure::get_orthogonal(normal, true));
|
||||
center = m_volume_matrix * center;
|
||||
normal = (m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal).normalized();
|
||||
radius = (on_circle - center).norm();
|
||||
if (use_inches) {
|
||||
center = ObjectManipulation::mm_to_in * center;
|
||||
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("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));
|
||||
data_row_count = 3;
|
||||
break;
|
||||
}
|
||||
case Measure::SurfaceFeatureType::Plane:
|
||||
{
|
||||
auto [idx, normal, origin] = m_curr_feature->get_plane();
|
||||
origin = m_volume_matrix * origin;
|
||||
normal = m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal;
|
||||
if (use_inches)
|
||||
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("Normal"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(normal), ImGui::GetStyleColorVec4(ImGuiCol_Text));
|
||||
data_row_count = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_hover_id != -1 && m_curr_point_on_feature_position.has_value()) {
|
||||
Vec3d position = m_volume_matrix * *m_curr_point_on_feature_position;
|
||||
if (use_inches)
|
||||
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));
|
||||
data_row_count = 1;
|
||||
}
|
||||
}
|
||||
//const unsigned int max_data_row_count = 3;
|
||||
//unsigned int data_row_count = 0;
|
||||
//if (ImGui::BeginTable("Data", 2)) {
|
||||
// if (m_mode == EMode::BasicSelection) {
|
||||
// switch (feature_type)
|
||||
// {
|
||||
// default: { break; }
|
||||
// case Measure::SurfaceFeatureType::Point:
|
||||
// {
|
||||
// Vec3d position = m_volume_matrix * m_curr_feature->get_point();
|
||||
// if (use_inches)
|
||||
// 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));
|
||||
// data_row_count = 1;
|
||||
// break;
|
||||
// }
|
||||
// case Measure::SurfaceFeatureType::Edge:
|
||||
// {
|
||||
// auto [from, to] = m_curr_feature->get_edge();
|
||||
// from = m_volume_matrix * from;
|
||||
// to = m_volume_matrix * to;
|
||||
// if (use_inches) {
|
||||
// from = ObjectManipulation::mm_to_in * from;
|
||||
// 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("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));
|
||||
// data_row_count = 3;
|
||||
// break;
|
||||
// }
|
||||
// case Measure::SurfaceFeatureType::Circle:
|
||||
// {
|
||||
// auto [center, radius, normal] = m_curr_feature->get_circle();
|
||||
// // generic point on circle, used to recalculate radius after transformation
|
||||
// const Vec3d on_circle = m_volume_matrix * (center + radius * Measure::get_orthogonal(normal, true));
|
||||
// center = m_volume_matrix * center;
|
||||
// normal = (m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal).normalized();
|
||||
// radius = (on_circle - center).norm();
|
||||
// if (use_inches) {
|
||||
// center = ObjectManipulation::mm_to_in * center;
|
||||
// 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("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));
|
||||
// data_row_count = 3;
|
||||
// break;
|
||||
// }
|
||||
// case Measure::SurfaceFeatureType::Plane:
|
||||
// {
|
||||
// auto [idx, normal, origin] = m_curr_feature->get_plane();
|
||||
// origin = m_volume_matrix * origin;
|
||||
// normal = m_volume_matrix.matrix().block(0, 0, 3, 3).inverse().transpose() * normal;
|
||||
// if (use_inches)
|
||||
// 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("Normal"), ImGuiWrapper::COL_ORANGE_LIGHT, format_vec3(normal), ImGui::GetStyleColorVec4(ImGuiCol_Text));
|
||||
// data_row_count = 2;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// if (m_hover_id != -1 && m_curr_point_on_feature_position.has_value()) {
|
||||
// Vec3d position = m_volume_matrix * *m_curr_point_on_feature_position;
|
||||
// if (use_inches)
|
||||
// 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));
|
||||
// data_row_count = 1;
|
||||
// }
|
||||
// }
|
||||
|
||||
// add dummy rows to keep dialog size fixed
|
||||
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));
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
// // add dummy rows to keep dialog size fixed
|
||||
// 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));
|
||||
// }
|
||||
// ImGui::EndTable();
|
||||
//}
|
||||
|
||||
ImGui::Separator();
|
||||
const ImGuiTableFlags flags = ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersH;
|
||||
|
|
Loading…
Reference in a new issue