]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Implementation of the "0021239: EDF 1829 OCC: Bring to front selected objects" issue.
authorrnv <rnv@opencascade.com>
Tue, 13 Mar 2012 08:36:26 +0000 (08:36 +0000)
committerrnv <rnv@opencascade.com>
Tue, 13 Mar 2012 08:36:26 +0000 (08:36 +0000)
src/OBJECT/SALOME_AISShape.hxx
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/SOCC/SOCC_ViewModel.cxx

index cdc8afe2a385023b9bb65b23dfa7e1700c92a396..bcaf862bd90492be88de3896ea896e8e72d11946 100755 (executable)
@@ -80,6 +80,8 @@ public:
 Standard_EXPORT SALOME_AISShape(const TopoDS_Shape& shape);
 Standard_EXPORT virtual  Handle_SALOME_InteractiveObject getIO() = 0;
 Standard_EXPORT virtual  Standard_Boolean hasIO() = 0;
+Standard_EXPORT virtual  Standard_Boolean isTopLevel() = 0;
+Standard_EXPORT virtual  void setTopLevel(Standard_Boolean) = 0;
 Standard_EXPORT virtual  Standard_CString getName() = 0;
 Standard_EXPORT virtual  void setName(const Standard_CString aName) = 0;
 Standard_EXPORT virtual  void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) = 0;
@@ -111,7 +113,7 @@ private:
 
  // Fields PRIVATE
  //
-
+  
 
 };
 
index 9196394dcbb9dd7e60b0d47c4c02cc896a9a1058..8bd978269fff186d38c1960fa805476cb9c6d2bf 100755 (executable)
@@ -61,6 +61,8 @@
 
 #include <Visual3d_View.hxx>
 
+#include <Basics_OCCTVersion.hxx>
+
 /*!
   Get data for supported background modes: gradient types, identifiers and supported image formats
 */
@@ -85,6 +87,7 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron)
 : SUIT_ViewModel(),
   myBackgrounds(4, Qtx::BackgroundData( Qt::black )),
   myIsRelative(true),
+  myTopLayerId( 0 ),
   myTrihedronSize(100)
 {
   // init CasCade viewers
@@ -359,6 +362,16 @@ void OCCViewer_Viewer::onKeyPress(SUIT_ViewWindow* theWindow, QKeyEvent* theEven
   emit selectionChanged();
 }
 
+int OCCViewer_Viewer::getTopLayerId()
+{
+#if OCC_VERSION_LARGE > 0x06050200
+  if ( myTopLayerId == 0 && !myAISContext->CurrentViewer().IsNull() )    
+    myAISContext->CurrentViewer()->AddZLayer( myTopLayerId );
+#endif
+
+  return myTopLayerId;
+}
+
 /*!
   \return interaction style
 */
index bda8ce7827a065a3b3b7eb8767970a766354bca8..b55e9d77f13d31678e91840bd85e8ccf897839bc 100755 (executable)
@@ -121,6 +121,8 @@ public:
   Handle(AIS_InteractiveContext)  getAISContext()  const { return myAISContext; }
   Handle(AIS_Trihedron)           getTrihedron()   const { return myTrihedron; }
 
+  int                             getTopLayerId();
+
   int                             interactionStyle() const;
   void                            setInteractionStyle( const int );
 
@@ -170,7 +172,7 @@ protected:
   Handle(V3d_Viewer)              myV3dCollector;
 
   Handle(AIS_Trihedron)           myTrihedron;
-  Handle(AIS_InteractiveContext)  myAISContext;
+  Handle(AIS_InteractiveContext)  myAISContext;  
 
   int                             myInteractionStyle;
   int                             myZoomingStyle;
@@ -179,6 +181,8 @@ protected:
   bool                            myMultiSelectionEnabled;
   bool                            myIsRelative;
 
+  int                             myTopLayerId;
+
   //QColor                          myBgColor;
   QPoint                          myStartPnt, myEndPnt;
 
index aa23946aca8c8bb00beb4d7ad355d94cdcc67419..630e919de7d5e3d6eaee45a3c522fb1ffeb10899 100755 (executable)
@@ -57,6 +57,7 @@
 
 //#include "SALOMEDSClient.hxx"
 //#include "SALOMEDS_StudyManager.hxx"
+#include <Basics_OCCTVersion.hxx>
 
 #include <AIS_TypeOfIso.hxx>
 #include <Precision.hxx>
@@ -390,7 +391,13 @@ void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
       }
 
       ic->Display( anAIS, false );
-
+      
+#if OCC_VERSION_LARGE > 0x06050200 
+      Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(anAIS);
+      if ( !aSh.IsNull() ) {
+       ic->SetZLayer( aSh, aSh->isTopLevel() ? getTopLayerId() : 0 );
+      }
+#endif
       //Register anAIS (if it has an entry) in entry2aisobjects map
       Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
       if ( !anObj.IsNull() && anObj->hasEntry())