-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,
bool hilight, bool upd )
{
- bool isInLocal = getAISContext()->HasOpenedContext();
- //SUIT_Study* ActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
- //SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
-
AIS_ListOfInteractive List;
getAISContext()->DisplayedObjects(List);
if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
{
- if ( !isInLocal )
- OCCViewer_Viewer::highlight( ite.Value(), hilight, false );
+ OCCViewer_Viewer::highlight( ite.Value(), hilight, false );
// highlight sub-shapes only when local selection is active
- else
- {
- /*if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )
- {
- Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );
- TColStd_IndexedMapOfInteger MapIndex;
- Sel->GetIndex( IObject, MapIndex );
- aSh->highlightSubShapes( MapIndex, highlight );
- }*/
- }
break;
}
}
\param onlyInViewer - search object only in viewer (so object must be displayed)
*/
bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj,
- bool onlyInViewer )
+ bool /*onlyInViewer*/ )
{
AIS_ListOfInteractive List;
getAISContext()->DisplayedObjects(List);
\param prs - presentation
\param forced - removes object from context
*/
-void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
+void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool /*forced*/ )
{
// try do downcast object
const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
Handle(AIS_InteractiveContext) ic = getAISContext();
// check if trihedron is displayed
- Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() );
+ Standard_Boolean isTrihedronDisplayed = isTrihedronVisible();
+ Standard_Boolean isViewCubeDisplayed = isViewCubeVisible();
// get objects to be erased (all currently displayed objects)
AIS_ListOfInteractive aList;
ic->DisplayedObjects( aList );
AIS_ListIteratorOfListOfInteractive anIter( aList );
for ( ; anIter.More(); anIter.Next() ) {
- if ( (isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) ) )
+ if ( isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron ) )
+ continue;
+ if ( isViewCubeDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_ViewCube ) )
continue;
// erase an object
// Open local context if there is no one
bool allObjects = thePrs == 0 || thePrs->IsNull();
- if ( !ic->HasOpenedContext() ) {
- ic->ClearCurrents( false );
- ic->OpenLocalContext( Standard_False, Standard_True, Standard_True );
- }
+ ic->Deactivate();
AIS_ListOfInteractive anObjs;
// Get objects to be activated
std::list<int>::const_iterator it;
if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
{
- ic->Load( anAIS, -1, false );
+ ic->Load( anAIS, -1 );
for( it = sel_modes.begin(); it != sel_modes.end(); ++it )
ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)*it ) );
}
+ else if ( anAIS->DynamicType() == STANDARD_TYPE(AIS_ViewCube) )
+ {
+ ic->Activate( anAIS, 0 );
+ }
else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
{
- ic->Load( anAIS, -1, false );
+ ic->Load( anAIS, -1 );
for( it = sel_modes.begin(); it != sel_modes.end(); ++it )
ic->Activate( anAIS, *it );
}
Handle(AIS_InteractiveContext) ic = getAISContext();
if ( !ic.IsNull() )
{
- ic->CloseAllContexts( false );
+ ic->Deactivate();
+ ic->Activate( 0 );
if ( update )
ic->CurrentViewer()->Redraw();
}