Salome HOME
Include utilities.h when needed.
[modules/geom.git] / src / RepairGUI / RepairGUI_FreeFacesDlg.cxx
index 75501bb939e98223612056ab76a66448398271b3..8fe66a4bdab3586484ae59a2b7f2448d3ed7214a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2014  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
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include <LightApp_SelectionMgr.h>
 #include <SalomeApp_Application.h>
 #include <SalomeApp_Tools.h>
+#include <SalomeApp_Study.h>
 
 #include <SUIT_MessageBox.h>
 #include <SUIT_Session.h>
 #include <SUIT_OverrideCursor.h>
 #include <SUIT_Desktop.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_ViewWindow.h>
+#include <SUIT_ViewManager.h>
 
 #include <GEOMImpl_Types.hxx>
+#include <GEOM_Constants.h>
 
 #include <TopTools_IndexedMapOfShape.hxx>
 #include <TColStd_MapOfInteger.hxx>
@@ -120,7 +124,7 @@ RepairGUI_FreeFacesDlg::RepairGUI_FreeFacesDlg( GeometryGUI* GUI, QWidget* paren
   aLay->addStretch();
   aLay->addWidget( aFrame );
 
-  myHelpFileName = "using_measurement_tools_page.html#faces_anchor";
+  myHelpFileName = "free_faces_page.html";
 
   connect( aCloseBtn, SIGNAL( clicked() ), SLOT( onClose() ) );
   connect( aHelpBtn,  SIGNAL( clicked() ), SLOT( onHelp() ) );
@@ -325,11 +329,33 @@ bool RepairGUI_FreeFacesDlg::execute( ObjectList& objects )
     TopExp::MapShapes( aSelShape, anIndices);
     SALOME_Prs* aPrs = 0;
     
+    //Get object trancparency and set it to preview
+    SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+    double transparency = 1.0;
+    if( app ) {
+      SUIT_ViewWindow* window = app->desktop( )->activeWindow( );
+      if( window && window->getViewManager() ) {
+       if ( app ) {
+         SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+         if( aStudy ) {
+           int aMgrId = window->getViewManager()->getGlobalId();
+           CORBA::String_var aMainEntry = myObj->GetStudyEntry();
+           QString anEntry = aMainEntry.in();
+           QVariant v = aStudy->getObjectProperty( aMgrId , anEntry , GEOM::propertyName( GEOM::Transparency ) , transparency );
+           if( v.canConvert( QVariant::Double ) ) {
+             transparency = v.toDouble();
+           }
+         }
+       }
+      }
+    }
+    
     for ( int i = 0, n = aFaceLst->length(); i < n; i++ ) {
       aFace = anIndices.FindKey( aFaceLst[i] );
       try {
         getDisplayer()->SetColor( Quantity_NOC_RED );
         getDisplayer()->SetToActivate( false );
+       getDisplayer()->SetTransparency( transparency );
         aPrs = !aFace.IsNull() ? getDisplayer()->BuildPrs( aFace ) : 0;
         if ( aPrs )
           displayPreview( aPrs, true );