]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
OCC functionality moving out from the widget
authornds <nds@opencascade.com>
Tue, 3 Dec 2013 08:41:44 +0000 (08:41 +0000)
committernds <nds@opencascade.com>
Tue, 3 Dec 2013 08:41:44 +0000 (08:41 +0000)
src/HYDROCurveCreator/CurveCreator_Utils.cxx

index 15396cdc6626a8105e7884dc537285d32efc324a..1775167850ea90c1f35e20cca96947adf9fc4922 100644 (file)
@@ -42,6 +42,7 @@
 #include <TopExp_Explorer.hxx>
 #include <BRep_Tool.hxx>
 #include <GeomAPI_ProjectPointOnCurve.hxx>
+#include <SelectMgr_EntityOwner.hxx>
 
 #include <ProjLib.hxx>
 #include <ElSLib.hxx>
@@ -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,