X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketcherPrs%2FSketcherPrs_Tangent.cpp;h=88dcd35c3fd45b27b56196ccb1e4f7ad9daef8a6;hb=7f873aed4bae5a98dca078209699b54276b46fce;hp=4d13a6535cc7fe824dd9c231f758c0437bff7d98;hpb=4ec2f8898777f6c71fcf6818b4e0fc340d057bde;p=modules%2Fshaper.git diff --git a/src/SketcherPrs/SketcherPrs_Tangent.cpp b/src/SketcherPrs/SketcherPrs_Tangent.cpp index 4d13a6535..88dcd35c3 100644 --- a/src/SketcherPrs/SketcherPrs_Tangent.cpp +++ b/src/SketcherPrs/SketcherPrs_Tangent.cpp @@ -8,29 +8,14 @@ #include "SketcherPrs_Tools.h" #include "SketcherPrs_PositionMgr.h" -#include +#include #include -#include -#include - -#include +#include #include -#include - -#include -#include #include -#include - -#include -#include - -#include -#include -#include - +#include IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Tangent, SketcherPrs_SymbolPrs); @@ -82,7 +67,31 @@ void SketcherPrs_Tangent::drawLines(const Handle(Prs3d_Presentation)& thePrs, Qu Handle(Graphic3d_AspectLine3d) aLineAspect = new Graphic3d_AspectLine3d(theColor, Aspect_TOL_SOLID, 2); aGroup->SetPrimitivesAspect(aLineAspect); - addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); - addLine(aGroup, SketchPlugin_Constraint::ENTITY_B()); + ObjectPtr aObj1 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_A()); + ObjectPtr aObj2 = SketcherPrs_Tools::getResult(myConstraint, SketchPlugin_Constraint::ENTITY_B()); + + std::shared_ptr aShape1 = SketcherPrs_Tools::getShape(aObj1); + std::shared_ptr aShape2 = SketcherPrs_Tools::getShape(aObj2); + + if ((aShape1.get() == NULL) || (aShape2.get() == NULL)) + return; + + std::shared_ptr aCurve1 = std::shared_ptr(new GeomAPI_Curve(aShape1)); + std::shared_ptr aCurve2 = std::shared_ptr(new GeomAPI_Curve(aShape2)); + if (aCurve1->isCircle() && aCurve2->isLine()) { + addLine(aGroup, SketchPlugin_Constraint::ENTITY_B()); + GeomAdaptor_Curve aAdaptor(aCurve1->impl(), aCurve1->startParam(), aCurve1->endParam()); + StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer); + } else if (aCurve1->isLine() && aCurve2->isCircle()) { + addLine(aGroup, SketchPlugin_Constraint::ENTITY_A()); + GeomAdaptor_Curve aAdaptor(aCurve2->impl(), aCurve2->startParam(), aCurve2->endParam()); + StdPrs_DeflectionCurve::Add(thePrs,aAdaptor,myDrawer); + } else { + // Both curves are arcs + GeomAdaptor_Curve aAdaptor1(aCurve1->impl(), aCurve1->startParam(), aCurve1->endParam()); + StdPrs_DeflectionCurve::Add(thePrs, aAdaptor1, myDrawer); + GeomAdaptor_Curve aAdaptor2(aCurve2->impl(), aCurve2->startParam(), aCurve2->endParam()); + StdPrs_DeflectionCurve::Add(thePrs, aAdaptor2, myDrawer); + } }