- bool isFound = false;
-
- OCCViewer_Viewer* aViewer = getOCCViewer();
- if ( theObject.IsNull() || !aViewer )
- return isFound;
-
- OCCViewer_ViewWindow* aWindow =
- (OCCViewer_ViewWindow*)aViewer->getViewManager()->getActiveView();
- thePoint = GEOMUtils::ConvertClickToPoint( theX, theY,
- aWindow->getViewPort()->getView() );
-
- Handle(AIS_Line) aLine = Handle(AIS_Line)::DownCast( theObject );
- if ( !aLine.IsNull() ) {
- Handle(Geom_Point) aPStart;
- Handle(Geom_Point) aPEnd;
- aLine->Points( aPStart, aPEnd );
-
- Standard_Real aStartX = aPStart->X(),
- aStartY = aPStart->Y(),
- aStartZ = aPStart->Z();
- Standard_Real anEndX = aPEnd->X(),
- anEndY = aPEnd->Y(),
- anEndZ = aPEnd->Z();
- // TODO: check whether the point belong to the selected line
- gp_Lin aLin( gp_Pnt( aPStart->X(), aPStart->Y(), aPStart->Z() ),
- gp_Dir( gp_Vec( gp_Pnt( aPStart->X(), aPStart->Y(), aPStart->Z() ),
- gp_Pnt( aPEnd->X(), aPEnd->Y(), aPEnd->Z() ) ) ) );
- double aDistance = aLin.Distance( thePoint );
-
-
- if ( aLin.Contains( thePoint, LOCAL_SELECTION_TOLERANCE ) ) {
- // find the neighbour points
- thePoint1 = findLocalPointIndex( 0, aPStart->X(), aPStart->Y() );
- thePoint2 = findLocalPointIndex( 0, aPEnd->X(), aPEnd->Y() );
-
- isFound = thePoint1 >= 0 && thePoint2 >= 0;
- }
- }
- else {
- Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast( theObject );
- if ( !aShape.IsNull() ) {
- // find the neighbour points
- }
- }
- return isFound;