From 3ccd013a70a408dc34c770a99c526094998c0dd7 Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 10 Jun 2016 09:50:28 +0300 Subject: [PATCH] Color correction of conflicting coincidence constraint. Scenario for conflicting coincidence constraint: two parallel lines, distance between a point on 1st line and the 2nd line. Create point, which coincident to both lines. --- src/SketcherPrs/SketcherPrs_Coincident.cpp | 20 ++++---------------- src/SketcherPrs/SketcherPrs_Coincident.h | 1 + 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/src/SketcherPrs/SketcherPrs_Coincident.cpp b/src/SketcherPrs/SketcherPrs_Coincident.cpp index c4539bf63..26a5e682c 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.cpp +++ b/src/SketcherPrs/SketcherPrs_Coincident.cpp @@ -86,7 +86,7 @@ void SketcherPrs_Coincident::Compute(const Handle(PrsMgr_PresentationManager3d)& // The external yellow contour aPtA->SetType(Aspect_TOM_RING3); aPtA->SetScale(2.); - aPtA->SetColor(aValid ? Quantity_NOC_YELLOW : Quantity_NOC_BLACK); + aPtA->SetColor(aValid ? Quantity_NOC_YELLOW : myConflictingColor); Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(thePresentation); aGroup->SetPrimitivesAspect(aPtA); @@ -97,7 +97,7 @@ void SketcherPrs_Coincident::Compute(const Handle(PrsMgr_PresentationManager3d)& // Make a black mid ring aPtA->SetType(Aspect_TOM_RING1); aPtA->SetScale(1.); - aPtA->SetColor(Quantity_NOC_BLACK); + aPtA->SetColor(aValid ? Quantity_NOC_BLACK : myConflictingColor); aGroup->SetPrimitivesAspect(aPtA); aGroup->AddPrimitiveArray (aPntArray); @@ -134,18 +134,6 @@ void SketcherPrs_Coincident::SetConflictingConstraint(const bool& theConflicting const std::vector& theColor) { myIsConflicting = theConflicting; - - /*if (theConflicting) - { - if (!myAspect.IsNull()) - myAspect->SetColor (Quantity_Color (theColor[0] / 255., theColor[1] / 255., theColor[2] / 255., - Quantity_TOC_RGB)); - myIsConflicting = true; - } - else - { - if (!myAspect.IsNull()) - myAspect->SetColor (Quantity_Color (1.0, 1.0, 0.0, Quantity_TOC_RGB)); - myIsConflicting = false; - }*/ + myConflictingColor = Quantity_Color(theColor[0] / 255., theColor[1] / 255., theColor[2] / 255., + Quantity_TOC_RGB); } diff --git a/src/SketcherPrs/SketcherPrs_Coincident.h b/src/SketcherPrs/SketcherPrs_Coincident.h index d041cac9d..9d6d799ad 100644 --- a/src/SketcherPrs/SketcherPrs_Coincident.h +++ b/src/SketcherPrs/SketcherPrs_Coincident.h @@ -72,6 +72,7 @@ private: std::shared_ptr mySketcherPlane; gp_Pnt myPoint; bool myIsConflicting; /// state if the presentation is visualized in error state + Quantity_Color myConflictingColor; /// the color of mid ring if there is a conflict }; -- 2.39.2