From 1c14457122ecd6d826df184d5ec0f3e030e6b8ba Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 3 Dec 2013 08:41:44 +0000 Subject: [PATCH] OCC functionality moving out from the widget --- src/HYDROCurveCreator/CurveCreator_Utils.cxx | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/HYDROCurveCreator/CurveCreator_Utils.cxx b/src/HYDROCurveCreator/CurveCreator_Utils.cxx index 15396cdc..17751678 100644 --- a/src/HYDROCurveCreator/CurveCreator_Utils.cxx +++ b/src/HYDROCurveCreator/CurveCreator_Utils.cxx @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -139,6 +140,35 @@ void CurveCreator_Utils::setLocalPointContext( } } +bool CurveCreator_Utils::getNeighbourPoints( Handle(AIS_InteractiveContext) theContext, + Handle(V3d_View) theView, + const int theX, const int theY, + gp_Pnt& thePoint, gp_Pnt& thePoint1, + gp_Pnt& thePoint2 ) +{ + bool isFoundPoint = false; + if ( theContext.IsNull() ) + return isFoundPoint; + + for ( theContext->InitSelected(); theContext->MoreSelected() && !isFoundPoint; + theContext->NextSelected() ) { + TopoDS_Shape aTShape = theContext->SelectedShape(); + if ( !aTShape.IsNull() && aTShape.ShapeType() == TopAbs_VERTEX ) + continue; + else { + Handle(SelectMgr_EntityOwner) anOwner = theContext->SelectedOwner(); + if ( anOwner.IsNull() ) + continue; + const TopLoc_Location& aLocation = anOwner->Location(); + Handle(AIS_InteractiveObject) anAIS = + Handle(AIS_InteractiveObject)::DownCast( anOwner->Selectable() ); + isFoundPoint = CurveCreator_Utils::pointOnObject( theView, anAIS, theX, theY, thePoint, + thePoint1, thePoint2 ); + } + } + return isFoundPoint; +} + bool CurveCreator_Utils::pointOnObject( Handle(V3d_View) theView, Handle(AIS_InteractiveObject) theObject, const int theX, const int theY, -- 2.39.2