From: vsv Date: Fri, 11 Sep 2015 09:44:26 +0000 (+0300) Subject: Simplified calculation of fly out distance and creation of constraints limited only... X-Git-Tag: V_1.4.0_beta4~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=64fc7e4fdd63997ec7a502b233ef5f88186d5bbb;p=modules%2Fshaper.git Simplified calculation of fly out distance and creation of constraints limited only by Line, Point, Arc, Circle --- diff --git a/src/PartSet/PartSet_WidgetPoint2d.cpp b/src/PartSet/PartSet_WidgetPoint2d.cpp index 61749d78f..60e826b42 100644 --- a/src/PartSet/PartSet_WidgetPoint2d.cpp +++ b/src/PartSet/PartSet_WidgetPoint2d.cpp @@ -29,6 +29,10 @@ #include #include +#include +#include +#include +#include #include #include @@ -46,6 +50,7 @@ const double MaxCoordinate = 1e12; +static QStringList MyFeaturesForCoincedence; PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, @@ -53,6 +58,12 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent, const std::string& theParentId) : ModuleBase_ModelWidget(theParent, theData, theParentId), myWorkshop(theWorkshop) { + if (MyFeaturesForCoincedence.isEmpty()) { + MyFeaturesForCoincedence << SketchPlugin_Line::ID().c_str() + << SketchPlugin_Arc::ID().c_str() + << SketchPlugin_Point::ID().c_str() + << SketchPlugin_Circle::ID().c_str(); + } myLockApplyMgr = new PartSet_LockApplyMgr(theParent, myWorkshop); // the control should accept the focus, so the boolen flag is corrected to be true @@ -348,9 +359,10 @@ void PartSet_WidgetPoint2D::onMouseRelease(ModuleBase_IViewWindow* theWnd, QMous // the same constraints for the same points, oterwise the result line has zero length. if (getPoint2d(aView, aShape, aX, aY)) PartSet_Tools::setConstraints(mySketch, feature(), attributeID(), aX, aY); - else if (aShape.ShapeType() == TopAbs_EDGE) - setConstraintWith(aObject); - + else if (aShape.ShapeType() == TopAbs_EDGE) { + if (MyFeaturesForCoincedence.contains(myFeature->getKind().c_str())) + setConstraintWith(aObject); + } // it is important to perform updateObject() in order to the current value is // processed by Sketch Solver. Test case: line is created from a previous point // to some distance, but in the area of the highlighting of the point. Constraint diff --git a/src/SketcherPrs/SketcherPrs_Angle.cpp b/src/SketcherPrs/SketcherPrs_Angle.cpp index 8603dd444..40133d9cb 100644 --- a/src/SketcherPrs/SketcherPrs_Angle.cpp +++ b/src/SketcherPrs/SketcherPrs_Angle.cpp @@ -82,21 +82,7 @@ void SketcherPrs_Angle::Compute(const Handle(PrsMgr_PresentationManager3d)& theP TopoDS_Edge aEdge2 = TopoDS::Edge(aTEdge2); SetMeasuredGeometry(aEdge1, aEdge2); - // Compute intersection point - TopoDS_Vertex aV1, aV2; - TopExp::Vertices(aEdge1, aV1, aV2); - gp_Pnt aPnt1 = BRep_Tool::Pnt(aV1); - gp_Pnt aPnt2 = BRep_Tool::Pnt(aV2); - std::shared_ptr aL1(new GeomAPI_Lin(aPnt1.X(), aPnt1.Y(), aPnt1.Z(), - aPnt2.X(), aPnt2.Y(), aPnt2.Z())); - TopExp::Vertices(aEdge2, aV1, aV2); - aPnt1 = BRep_Tool::Pnt(aV1); - aPnt2 = BRep_Tool::Pnt(aV2); - std::shared_ptr aL2(new GeomAPI_Lin(aPnt1.X(), aPnt1.Y(), aPnt1.Z(), - aPnt2.X(), aPnt2.Y(), aPnt2.Z())); - - std::shared_ptr aInter = aL1->intersect(aL2); - gp_Pnt aCenter = aInter->impl(); + gp_Pnt aCenter = CenterPoint(); gp_Pnt aFLyPnt(aFlyoutPnt->x(), aFlyoutPnt->y(), aFlyoutPnt->z()); double aDist = aCenter.Distance(aFLyPnt);