diff --git a/src/AIAC/Feedback/CutChainSawFeedback.h b/src/AIAC/Feedback/CutChainSawFeedback.h index fc460a2d0..feb6421f6 100644 --- a/src/AIAC/Feedback/CutChainSawFeedback.h +++ b/src/AIAC/Feedback/CutChainSawFeedback.h @@ -72,7 +72,11 @@ namespace AIAC { void Deactivate() override; // FIXME: maybe we can have a "CutFeedback" class for such fuctions - inline void EnableCutPlane(bool enable) { m_ToShowCutPlane = enable; } + inline void EnableCutPlane(bool enable) { + m_ToShowCutPlane = enable; + if(enable) m_CutPlaneVisualizer.Activate(); + else m_CutPlaneVisualizer.Deactivate(); + } private: void updateCutPlane(); diff --git a/src/AIAC/Feedback/CutCircularSawFeedback.h b/src/AIAC/Feedback/CutCircularSawFeedback.h index 81cf7aea3..172d5baa3 100644 --- a/src/AIAC/Feedback/CutCircularSawFeedback.h +++ b/src/AIAC/Feedback/CutCircularSawFeedback.h @@ -44,7 +44,11 @@ namespace AIAC{ void Activate() override; void Deactivate() override; - inline void EnableCutPlane(bool enable) { m_ToShowCutPlane = enable; }; + inline void EnableCutPlane(bool enable) { + m_ToShowCutPlane = enable; + if(enable) m_CutPlaneVisualizer.Activate(); + else m_CutPlaneVisualizer.Deactivate(); + }; private: // data diff --git a/src/AIAC/Feedback/CutPlaneVisualizer.cpp b/src/AIAC/Feedback/CutPlaneVisualizer.cpp index b04d4c905..407e68133 100644 --- a/src/AIAC/Feedback/CutPlaneVisualizer.cpp +++ b/src/AIAC/Feedback/CutPlaneVisualizer.cpp @@ -9,14 +9,14 @@ CutPlaneVisualizer::DistanceVisualizer::DistanceVisualizer(){ auto line = GOLine::Add(); line->SetColor(glm::vec4(1.0f, 1.0f, 1.0f, 1.0f)); line->SetWeight(2.0f); - m_Lines.push_back(line); - m_AllPrimitives.push_back(line); + m_AllPrimitives.emplace_back(line); + m_Lines.emplace_back(line); - auto text = GOText::Add("Dist", GOPoint(0.0f, 0.0f, 0.0f)); + auto text = GOText::Add("", GOPoint(0.0f, 0.0f, 0.0f)); text->SetColor(GOColor::WHITE); text->SetWeight(GOWeight::BoldThick); - m_Texts.push_back(text); - m_AllPrimitives.push_back(text); + m_AllPrimitives.emplace_back(text); + m_Texts.emplace_back(text); } Deactivate(); @@ -48,7 +48,7 @@ void CutPlaneVisualizer::CutPlaneVisualizer::Deactivate(){ m_DistanceVisualizer.Deactivate(); } -std::vector CutPlaneVisualizer:: Update(glm::vec3 faceNorm, glm::vec3 facePt){ +std::vector CutPlaneVisualizer::Update(glm::vec3 faceNorm, glm::vec3 facePt){ auto bbox = AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().GetBoundingBox(); auto bboxIndices = AIAC_APP.GetLayer()->GetACInfoModel().GetTimberInfo().GetBboxEdgesIndices(); @@ -111,7 +111,7 @@ std::vector CutPlaneVisualizer:: Update(glm::vec3 faceNorm, glm::vec3 minDistPt = corner; } } - + // update the line & text line->SetPts(pt, minDistPt); text->SetAnchor(pt); @@ -122,7 +122,6 @@ std::vector CutPlaneVisualizer:: Update(glm::vec3 faceNorm, glm::vec3 text->SetColor(GOColor::WHITE); } } - } else { m_DistanceVisualizer.Deactivate(); }