- OCCViewer_Viewer* aViewer = getOCCViewer();
- if ( !aViewer )
- return;
- Handle(AIS_InteractiveContext) ic = aViewer->getAISContext();
-
- if ( theOpen ) {
- // Open local context if there is no one
- if ( !ic->HasOpenedContext() ) {
- ic->ClearCurrents( false );
- ic->OpenLocalContext( false/*use displayed objects*/, true/*allow shape decomposition*/ );
- }
- AIS_ListOfInteractive aList;
- ic->DisplayedObjects( aList );
- int aLSize = 0;
- for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() )
- aLSize++;
-
- for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() )
- {
- Handle(AIS_InteractiveObject) anAIS = it.Value();
- if ( !anAIS.IsNull() )
- {
- if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
- {
- ic->Load( anAIS, -1/*selection mode*/, true/*allow decomposition*/ );
- ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)TopAbs_WIRE ) );
- }
- else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
- {
- ic->Load( anAIS, -1/*selection mode*/, false/*allow decomposition*/ );
- ic->Activate( anAIS, TopAbs_VERTEX );
- }
- }
- continue;
- }
- }
- else {
- if ( ic->HasOpenedContext() )
- ic->CloseAllContexts();
- if ( isUpdateTable )
- updateLocalPointView();
- }
-}
-
-void CurveCreator_Widget::addLocalPointToTable( const double theX, const double theY )
-{
- int aRowId = myLocalPointView->rowCount();
- double aCurrentX, aCurrentY;
- for ( int i = 0; i < aRowId; i++ ) {
- aCurrentX = myLocalPointView->item( i, 1 )->data( Qt::UserRole ).toDouble();
- aCurrentY = myLocalPointView->item( i, 2 )->data( Qt::UserRole ).toDouble();
- if ( fabs( aCurrentX - theX ) < LOCAL_SELECTION_TOLERANCE &&
- fabs( aCurrentY - theY ) < LOCAL_SELECTION_TOLERANCE )
- return;
- }
- QTableWidgetItem* anItem;
-
- myLocalPointView->setRowCount( aRowId+1 );
-
- int aPointSection = 0;
- int aPointIndex = findLocalPointIndex( aPointSection, theX, theY );
-
- anItem = new QTableWidgetItem( QString::number( aPointIndex + 1 ) );
- anItem->setFlags( anItem->flags() & ~Qt::ItemIsEnabled );
- myLocalPointView->setItem( aRowId, 0, anItem );
-
- anItem = new QTableWidgetItem( QString::number( theX ) );
- anItem->setData( Qt::UserRole, theX );
- myLocalPointView->setItem( aRowId, 1, anItem );
-
- anItem = new QTableWidgetItem( QString::number( theY ) );
- anItem->setData( Qt::UserRole, theY );
- myLocalPointView->setItem( aRowId, 2, anItem );