X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMGUI%2FGEOMGUI_Selection.cxx;h=2b11f63fe45d3b8a79362297d92d95920854aa63;hb=b6f0965afb72083a5234f9b4fb0b233adaaf8d9d;hp=351bb017ea9cd83a6ae08e8febf2a1adaa07c33c;hpb=5e7cf6df5a668d1e1608ba946c59ba34234d8942;p=modules%2Fgeom.git diff --git a/src/GEOMGUI/GEOMGUI_Selection.cxx b/src/GEOMGUI/GEOMGUI_Selection.cxx index 351bb017e..2b11f63fe 100644 --- a/src/GEOMGUI/GEOMGUI_Selection.cxx +++ b/src/GEOMGUI/GEOMGUI_Selection.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2022 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 @@ -132,7 +132,7 @@ void GEOMGUI_Selection::init( const QString& context, LightApp_SelectionMgr* sel QString anEntry = entry( idx ); if ( study && !anEntry.isEmpty() ) { _PTR(SObject) aSO( study->FindObjectID( anEntry.toStdString() ) ); - if ( aSO ) { + if ( GeometryGUI::IsInGeomComponent( aSO )) { CORBA::Object_var varObj = GeometryGUI::ClientSObjectToObject( aSO ); myObjects[idx] = GEOM::GEOM_BaseObject::_narrow( varObj ); } @@ -206,6 +206,8 @@ QVariant GEOMGUI_Selection::parameter( const int idx, const QString& p ) const v = hasHiddenAnnotations(idx); else if ( p == "hasVisibleAnnotations" ) v = hasVisibleAnnotations(idx); + else if ( p == "matMenu" ) + v = SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "predef_materials", false ); else v = LightApp_Selection::parameter( idx, p ); @@ -269,7 +271,7 @@ bool GEOMGUI_Selection::isVisible( const int index ) const GEOM::GEOM_Object_var obj = getObject( index ); SALOME_View* view = GEOM_Displayer::GetActiveView(); if ( !CORBA::is_nil( obj ) && view ) { - Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toLatin1().constData(), "GEOM", "TEMP_IO" ); + Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( entry( index ).toUtf8().constData(), "GEOM", "TEMP_IO" ); res = view->isVisible( io ); } @@ -286,10 +288,28 @@ bool GEOMGUI_Selection::isAutoColor( const int index ) const bool GEOMGUI_Selection::isImported( const int index ) const { + bool result = false; GEOM::GEOM_Object_var obj = getObject( index ); - if ( !CORBA::is_nil( obj ) ) - return obj->GetType() == GEOM_IMPORT; - return false; + if ( !CORBA::is_nil( obj ) && obj->GetType() == GEOM_IMPORT ) + { + QString fileName; + GEOM::CreationInformationSeq_var info = obj->GetCreationInformation(); + if ( info->length() > 0 ) + { + for ( uint i = 0, nb = info->length(); i < nb; ++i ) + { + GEOM::CreationInformation iInfo = info[i]; + for ( uint j = 0; j < iInfo.params.length(); ++j ) + { + QString param = (char*)(CORBA::String_var)(iInfo.params[j].name); + if ( param == "File name" ) + fileName = (char*)(CORBA::String_var)(iInfo.params[j].value); + } + } + } + result = !fileName.isEmpty() && !fileName.toLower().endsWith(".xao"); + } + return result; } bool GEOMGUI_Selection::hasImported() const @@ -342,7 +362,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const SALOME_View* view = GEOM_Displayer::GetActiveView(); if ( view /*fix for 9320==>*/&& ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { - SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() ); if ( prs ) { if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs; @@ -392,7 +412,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const bool GEOMGUI_Selection::autoBringToFront( const int /*index*/ ) const { - return SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", "false" ); + return SUIT_Session::session()->resourceMgr()->booleanValue( "Geometry", "auto_bring_to_front", false ); } bool GEOMGUI_Selection::isVectorsMode( const int index ) const @@ -408,7 +428,7 @@ bool GEOMGUI_Selection::isVectorsMode( const int index ) const SALOME_View* view = GEOM_Displayer::GetActiveView(); QString viewType = activeViewType(); if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { - SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() ); if ( prs ) { if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs; @@ -455,7 +475,7 @@ bool GEOMGUI_Selection::isVerticesMode( const int index ) const SALOME_View* view = GEOM_Displayer::GetActiveView(); QString viewType = activeViewType(); if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { - SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() ); if ( prs ) { if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs; @@ -502,7 +522,7 @@ bool GEOMGUI_Selection::isNameMode( const int index ) const SALOME_View* view = GEOM_Displayer::GetActiveView(); QString viewType = activeViewType(); if ( view && ( viewType == OCCViewer_Viewer::Type() || viewType == SVTK_Viewer::Type() ) ) { - SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() ); if ( prs ) { if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs; @@ -716,7 +736,7 @@ bool GEOMGUI_Selection::topLevel( const int index ) const SALOME_View* view = GEOM_Displayer::GetActiveView(); QString viewType = activeViewType(); if ( view && viewType == OCCViewer_Viewer::Type() ) { - SALOME_Prs* prs = view->CreatePrs( entry( index ).toLatin1().constData() ); + SALOME_Prs* prs = view->CreatePrs( entry( index ).toUtf8().constData() ); if ( prs ) { if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs; @@ -752,7 +772,7 @@ bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const SALOME_View* view = GEOM_Displayer::GetActiveView(); QString viewType = activeViewType(); if ( view ) { - SALOME_Prs* prs = view->CreatePrs( entry( idx ).toLatin1().constData() ); + SALOME_Prs* prs = view->CreatePrs( entry( idx ).toUtf8().constData() ); if ( prs ) { if ( viewType == OCCViewer_Viewer::Type() ) { // assuming OCC SOCC_Prs* occPrs = (SOCC_Prs*) prs;