mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 06:55:53 +08:00
New gcode visualization integration - Tool position
This commit is contained in:
parent
ce8da7eccf
commit
735fc6d107
46
resources/icons/horizontal_hide.svg
Normal file
46
resources/icons/horizontal_hide.svg
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.0"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 16 16"
|
||||
enable-background="new 0 0 16 16"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="hide_horizontal.svg"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs945">
|
||||
|
||||
|
||||
|
||||
</defs><sodipodi:namedview
|
||||
id="namedview943"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="50.75"
|
||||
inkscape:cx="7.9901478"
|
||||
inkscape:cy="8.0098522"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1001"
|
||||
inkscape:window-x="3191"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<polygon
|
||||
fill="#ed6b21"
|
||||
points="1,8 1,11 8,16 15,11 15,8 "
|
||||
style="stroke:none;stroke-width:1"
|
||||
id="polygon937"
|
||||
transform="translate(0,-4)" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
46
resources/icons/horizontal_show.svg
Normal file
46
resources/icons/horizontal_show.svg
Normal file
@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.0"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
viewBox="0 0 16 16"
|
||||
enable-background="new 0 0 16 16"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="show_horizontal.svg"
|
||||
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs1127">
|
||||
|
||||
|
||||
|
||||
</defs><sodipodi:namedview
|
||||
id="namedview1125"
|
||||
pagecolor="#505050"
|
||||
bordercolor="#eeeeee"
|
||||
borderopacity="1"
|
||||
inkscape:pageshadow="0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
showgrid="false"
|
||||
inkscape:zoom="50.75"
|
||||
inkscape:cx="7.9901478"
|
||||
inkscape:cy="8.0098522"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1001"
|
||||
inkscape:window-x="3191"
|
||||
inkscape:window-y="-9"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<polygon
|
||||
fill="#ed6b21"
|
||||
points="15,7 15,5 8,0 1,5 1,7 1,8 15,8 "
|
||||
style="stroke:none;stroke-width:1"
|
||||
id="polygon1119"
|
||||
transform="translate(0,4)" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -153,6 +153,10 @@ namespace ImGui
|
||||
const wchar_t PlugMarker = 0x1C;
|
||||
const wchar_t DowelMarker = 0x1D;
|
||||
const wchar_t SnapMarker = 0x1E;
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
const wchar_t HorizontalHide = 0xB0;
|
||||
const wchar_t HorizontalShow = 0xB1;
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
// Do not forget use following letters only in wstring
|
||||
const wchar_t DocumentationButton = 0x2600;
|
||||
const wchar_t DocumentationHoverButton = 0x2601;
|
||||
|
@ -404,35 +404,152 @@ void GCodeViewer::SequentialView::Marker::render()
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
void GCodeViewer::SequentialView::Marker::render_position_window()
|
||||
static std::string to_string(libvgcode::EMoveType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case libvgcode::EMoveType::Noop: { return _u8L("Noop"); }
|
||||
case libvgcode::EMoveType::Retract: { return _u8L("Retract"); }
|
||||
case libvgcode::EMoveType::Unretract: { return _u8L("Unretract"); }
|
||||
case libvgcode::EMoveType::Seam: { return _u8L("Seam"); }
|
||||
case libvgcode::EMoveType::ToolChange: { return _u8L("Tool Change"); }
|
||||
case libvgcode::EMoveType::ColorChange: { return _u8L("Color Change"); }
|
||||
case libvgcode::EMoveType::PausePrint: { return _u8L("Pause Print"); }
|
||||
case libvgcode::EMoveType::CustomGCode: { return _u8L("Custom GCode"); }
|
||||
case libvgcode::EMoveType::Travel: { return _u8L("Travel"); }
|
||||
case libvgcode::EMoveType::Wipe: { return _u8L("Wipe"); }
|
||||
case libvgcode::EMoveType::Extrude: { return _u8L("Extrude"); }
|
||||
default: { return _u8L("Unknown"); }
|
||||
}
|
||||
}
|
||||
|
||||
static std::string to_string(libvgcode::EGCodeExtrusionRole role)
|
||||
{
|
||||
switch (role)
|
||||
{
|
||||
case libvgcode::EGCodeExtrusionRole::None: { return _u8L("Unknown"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Perimeter: { return _u8L("Perimeter"); }
|
||||
case libvgcode::EGCodeExtrusionRole::ExternalPerimeter: { return _u8L("External perimeter"); }
|
||||
case libvgcode::EGCodeExtrusionRole::OverhangPerimeter: { return _u8L("Overhang perimeter"); }
|
||||
case libvgcode::EGCodeExtrusionRole::InternalInfill: { return _u8L("Internal infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SolidInfill: { return _u8L("Solid infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::TopSolidInfill: { return _u8L("Top solid infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Ironing: { return _u8L("Ironing"); }
|
||||
case libvgcode::EGCodeExtrusionRole::BridgeInfill: { return _u8L("Bridge infill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::GapFill: { return _u8L("Gap fill"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Skirt: { return _u8L("Skirt/Brim"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SupportMaterial: { return _u8L("Support material"); }
|
||||
case libvgcode::EGCodeExtrusionRole::SupportMaterialInterface: { return _u8L("Support material interface"); }
|
||||
case libvgcode::EGCodeExtrusionRole::WipeTower: { return _u8L("Wipe tower"); }
|
||||
case libvgcode::EGCodeExtrusionRole::Custom: { return _u8L("Custom"); }
|
||||
default: { return _u8L("Unknown"); }
|
||||
}
|
||||
}
|
||||
|
||||
void GCodeViewer::SequentialView::Marker::render_position_window(const libvgcode::Viewer* viewer)
|
||||
{
|
||||
static float last_window_width = 0.0f;
|
||||
static size_t last_text_length = 0;
|
||||
static bool properties_shown = false;
|
||||
|
||||
if (viewer != nullptr) {
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||
imgui.set_next_window_pos(0.5f * static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 0.5f, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::SetNextWindowBgAlpha(0.25f);
|
||||
imgui.begin(std::string("ToolPosition"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
|
||||
ImGui::AlignTextToFramePadding();
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Position") + ":");
|
||||
ImGui::SameLine();
|
||||
libvgcode::PathVertex vertex = viewer->get_current_vertex();
|
||||
if (vertex.type == libvgcode::EMoveType::Seam)
|
||||
vertex = viewer->get_vertex_at(viewer->get_view_current_range()[1] - 1);
|
||||
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||
imgui.set_next_window_pos(0.5f * static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 0.5f, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::SetNextWindowBgAlpha(0.25f);
|
||||
imgui.begin(std::string("ToolPosition"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Tool position") + ":");
|
||||
ImGui::SameLine();
|
||||
char buf[1024];
|
||||
const Vec3f position = m_world_position + m_world_offset + m_z_offset * Vec3f::UnitZ();
|
||||
sprintf(buf, "X: %.3f, Y: %.3f, Z: %.3f", position.x(), position.y(), position.z());
|
||||
imgui.text(std::string(buf));
|
||||
char buf[1024];
|
||||
sprintf(buf, "X: %.3f, Y: %.3f, Z: %.3f", vertex.position[0], vertex.position[1], vertex.position[2]);
|
||||
imgui.text(std::string(buf));
|
||||
|
||||
// force extra frame to automatically update window size
|
||||
const float width = ImGui::GetWindowWidth();
|
||||
const size_t length = strlen(buf);
|
||||
if (width != last_window_width || length != last_text_length) {
|
||||
last_window_width = width;
|
||||
last_text_length = length;
|
||||
imgui.set_requires_extra_frame();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (imgui.image_button(properties_shown ? ImGui::HorizontalHide : ImGui::HorizontalShow, properties_shown ? _L("Hide properties") : _L("Show properties"))) {
|
||||
properties_shown = !properties_shown;
|
||||
imgui.requires_extra_frame();
|
||||
}
|
||||
|
||||
imgui.end();
|
||||
ImGui::PopStyleVar();
|
||||
if (properties_shown) {
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Type") + ":");
|
||||
ImGui::SameLine();
|
||||
imgui.text(to_string(vertex.type));
|
||||
if (vertex.is_extrusion()) {
|
||||
ImGui::SameLine();
|
||||
imgui.text("(" + to_string(vertex.role) + ")");
|
||||
}
|
||||
const bool imperial_units = wxGetApp().app_config->get_bool("use_inches");
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Width") + ":");
|
||||
if (vertex.is_extrusion()) {
|
||||
sprintf(buf, "%.3f", vertex.width);
|
||||
ImGui::SameLine();
|
||||
imgui.text(std::string(buf));
|
||||
ImGui::SameLine();
|
||||
imgui.text(imperial_units ? _u8L("in") : _u8L("mm"));
|
||||
}
|
||||
else {
|
||||
ImGui::SameLine();
|
||||
imgui.text(_u8L("N/A"));
|
||||
}
|
||||
ImGui::SameLine();
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Height") + ":");
|
||||
if (vertex.is_extrusion()) {
|
||||
sprintf(buf, "%.3f", vertex.height);
|
||||
ImGui::SameLine();
|
||||
imgui.text(std::string(buf));
|
||||
ImGui::SameLine();
|
||||
imgui.text(imperial_units ? _u8L("in") : _u8L("mm"));
|
||||
}
|
||||
else {
|
||||
ImGui::SameLine();
|
||||
imgui.text(_u8L("N/A"));
|
||||
}
|
||||
}
|
||||
|
||||
// force extra frame to automatically update window size
|
||||
const float width = ImGui::GetWindowWidth();
|
||||
const size_t length = strlen(buf);
|
||||
if (width != last_window_width || length != last_text_length) {
|
||||
last_window_width = width;
|
||||
last_text_length = length;
|
||||
imgui.set_requires_extra_frame();
|
||||
}
|
||||
|
||||
imgui.end();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
else {
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
const Size cnv_size = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size();
|
||||
imgui.set_next_window_pos(0.5f * static_cast<float>(cnv_size.get_width()), static_cast<float>(cnv_size.get_height()), ImGuiCond_Always, 0.5f, 1.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::SetNextWindowBgAlpha(0.25f);
|
||||
imgui.begin(std::string("ToolPosition"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove);
|
||||
imgui.text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, _u8L("Tool position") + ":");
|
||||
ImGui::SameLine();
|
||||
char buf[1024];
|
||||
const Vec3f position = m_world_position + m_world_offset + m_z_offset * Vec3f::UnitZ();
|
||||
sprintf(buf, "X: %.3f, Y: %.3f, Z: %.3f", position.x(), position.y(), position.z());
|
||||
imgui.text(std::string(buf));
|
||||
|
||||
// force extra frame to automatically update window size
|
||||
const float width = ImGui::GetWindowWidth();
|
||||
const size_t length = strlen(buf);
|
||||
if (width != last_window_width || length != last_text_length) {
|
||||
last_window_width = width;
|
||||
last_text_length = length;
|
||||
imgui.set_requires_extra_frame();
|
||||
}
|
||||
|
||||
imgui.end();
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
@ -729,9 +846,12 @@ void GCodeViewer::SequentialView::GCodeWindow::render(float top, float bottom, s
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void GCodeViewer::SequentialView::render(float legend_height, bool show_marker)
|
||||
void GCodeViewer::SequentialView::render(float legend_height, const libvgcode::Viewer* viewer)
|
||||
{
|
||||
if (viewer == nullptr)
|
||||
#elif ENABLE_NEW_GCODE_VIEWER
|
||||
void GCodeViewer::SequentialView::render(float legend_height, const libvgcode::Viewer* viewer)
|
||||
{
|
||||
if (show_marker)
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
void GCodeViewer::SequentialView::render(float legend_height)
|
||||
@ -742,7 +862,7 @@ void GCodeViewer::SequentialView::render(float legend_height)
|
||||
marker.render();
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
marker.render_position_window();
|
||||
marker.render_position_window(viewer);
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
float bottom = wxGetApp().plater()->get_current_canvas3D()->get_canvas_size().get_height();
|
||||
@ -1248,7 +1368,9 @@ void GCodeViewer::render()
|
||||
m_sequential_view.marker.set_z_offset(m_z_offset);
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
m_sequential_view.render(legend_height, !m_use_new_viewer);
|
||||
m_sequential_view.render(legend_height, m_use_new_viewer ? &m_new_viewer : nullptr);
|
||||
#elif ENABLE_NEW_GCODE_VIEWER
|
||||
m_sequential_view.render(legend_height, m_use_new_viewer ? &m_new_viewer : nullptr);
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
m_sequential_view.render(legend_height);
|
||||
|
@ -739,7 +739,7 @@ public:
|
||||
void render();
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
void render_position_window();
|
||||
void render_position_window(const libvgcode::Viewer* viewer);
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
};
|
||||
@ -816,7 +816,9 @@ public:
|
||||
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
void render(float legend_height, bool show_marker);
|
||||
void render(float legend_height, const libvgcode::Viewer* viewer);
|
||||
#elif ENABLE_NEW_GCODE_VIEWER
|
||||
void render(float legend_height, const libvgcode::Viewer* viewer);
|
||||
#else
|
||||
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
||||
void render(float legend_height);
|
||||
|
@ -73,6 +73,10 @@ static const std::map<const wchar_t, std::string> font_icons = {
|
||||
{ImGui::PlugMarker , "plug" },
|
||||
{ImGui::DowelMarker , "dowel" },
|
||||
{ImGui::SnapMarker , "snap" },
|
||||
#if ENABLE_NEW_GCODE_VIEWER
|
||||
{ImGui::HorizontalHide , "horizontal_hide" },
|
||||
{ImGui::HorizontalShow , "horizontal_show" },
|
||||
#endif // ENABLE_NEW_GCODE_VIEWER
|
||||
};
|
||||
|
||||
static const std::map<const wchar_t, std::string> font_icons_large = {
|
||||
|
@ -118,6 +118,21 @@ void Viewer::set_view_current_range(uint32_t min, uint32_t max)
|
||||
m_impl.set_view_current_range(min, max);
|
||||
}
|
||||
|
||||
uint32_t Viewer::get_vertices_count() const
|
||||
{
|
||||
return m_impl.get_vertices_count();
|
||||
}
|
||||
|
||||
PathVertex Viewer::get_current_vertex() const
|
||||
{
|
||||
return m_impl.get_current_vertex();
|
||||
}
|
||||
|
||||
PathVertex Viewer::get_vertex_at(uint32_t id) const
|
||||
{
|
||||
return m_impl.get_vertex_at(id);
|
||||
}
|
||||
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
Vec3f Viewer::get_cog_position() const
|
||||
{
|
||||
|
@ -65,6 +65,19 @@ public:
|
||||
//
|
||||
void set_view_current_range(uint32_t min, uint32_t max);
|
||||
|
||||
//
|
||||
// Return the count of vertices used to render the toolpaths
|
||||
//
|
||||
uint32_t get_vertices_count() const;
|
||||
//
|
||||
// Return the vertex pointed by the max value of the view current range
|
||||
//
|
||||
PathVertex get_current_vertex() const;
|
||||
//
|
||||
// Return the vertex at the given index
|
||||
//
|
||||
PathVertex get_vertex_at(uint32_t id) const;
|
||||
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
//
|
||||
// Returns the position of the center of gravity of the toolpaths.
|
||||
|
@ -1040,6 +1040,21 @@ void ViewerImpl::set_view_current_range(uint32_t min, uint32_t max)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ViewerImpl::get_vertices_count() const
|
||||
{
|
||||
return static_cast<uint32_t>(m_vertices.size());
|
||||
}
|
||||
|
||||
PathVertex ViewerImpl::get_current_vertex() const
|
||||
{
|
||||
return m_vertices[m_view_range.get_current_range()[1]];
|
||||
}
|
||||
|
||||
PathVertex ViewerImpl::get_vertex_at(uint32_t id) const
|
||||
{
|
||||
return (id < static_cast<uint32_t>(m_vertices.size())) ? m_vertices[id] : PathVertex();
|
||||
}
|
||||
|
||||
const std::array<std::vector<float>, static_cast<size_t>(ETimeMode::COUNT)>& ViewerImpl::get_layers_times() const
|
||||
{
|
||||
return m_layers_times;
|
||||
|
@ -106,6 +106,9 @@ public:
|
||||
//
|
||||
// Properties getters
|
||||
//
|
||||
uint32_t get_vertices_count() const;
|
||||
PathVertex get_current_vertex() const;
|
||||
PathVertex get_vertex_at(uint32_t id) const;
|
||||
const std::array<std::vector<float>, static_cast<size_t>(ETimeMode::COUNT)>& get_layers_times() const;
|
||||
#if !ENABLE_NEW_GCODE_NO_COG_AND_TOOL_MARKERS
|
||||
Vec3f get_cog_marker_position() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user