]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
IMP 16551 (show static trihedron)
authorsan <san@opencascade.com>
Thu, 25 Dec 2008 12:16:01 +0000 (12:16 +0000)
committersan <san@opencascade.com>
Thu, 25 Dec 2008 12:16:01 +0000 (12:16 +0000)
src/OCCViewer/Makefile.am
src/OCCViewer/OCCViewer.cxx [deleted file]
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewPort3d.cxx

index 8f9f71a476e3a316306d7220bede09ab90fc7e51..7e77377e21edd18ade767dbbccecd39a8b4bbeda 100755 (executable)
@@ -45,7 +45,6 @@ salomeinclude_HEADERS =                               \
        OCCViewer_Trihedron.h
 
 dist_libOCCViewer_la_SOURCES =                 \
-       OCCViewer.cxx                           \
        OCCViewer_AISSelector.cxx               \
        OCCViewer_ViewManager.cxx               \
        OCCViewer_ViewModel.cxx                 \
@@ -108,5 +107,5 @@ nodist_salomeres_DATA =             \
 libOCCViewer_la_CPPFLAGS = $(QT_INCLUDES) $(OGL_INCLUDES) $(CAS_CPPFLAGS) \
        -I$(srcdir)/../SUIT -I$(srcdir)/../Qtx
 
-libOCCViewer_la_LDFLAGS  = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER) -lTKOpenGl
+libOCCViewer_la_LDFLAGS  = $(OGL_LIBS) $(QT_MT_LIBS) $(CAS_KERNEL) $(CAS_VIEWER)
 libOCCViewer_la_LIBADD   = ../Qtx/libqtx.la ../SUIT/libsuit.la
diff --git a/src/OCCViewer/OCCViewer.cxx b/src/OCCViewer/OCCViewer.cxx
deleted file mode 100644 (file)
index 74d917f..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-//  Copyright (C) 2007-2008  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
-//
-//  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.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "OCCViewer_Trihedron.h"
-
-#include <Graphic3d_CBounds.hxx>
-#include <OpenGl_GraphicDriver.hxx>
-
-void OCCViewer_Init();
-
-extern "C"
-{
-#ifdef WIN32 /* disable MS VC++ warning on C-style function returning C++ object */
-#pragma warning(push)
-#pragma warning(disable:4190)
-#endif
-  Standard_EXPORT Handle( Graphic3d_GraphicDriver ) MetaGraphicDriverFactory( const Standard_CString AShrName )
-  {
-    OCCViewer_Init();
-    Handle( OpenGl_GraphicDriver ) aDriver = new OpenGl_GraphicDriver( AShrName );
-    return aDriver;
-  }
-#ifdef WIN32
-#pragma warning(pop)
-#endif
-
-#include <OpenGl_tgl_all.h>
-#include <OpenGl_tsm.h>
-#include <OpenGl_callback.h>
-#include <OpenGl_telem_highlight.h>
-#include <OpenGl_telem_attri.h>
-
-  TStatus OCCViewer_DisplayTrihedron ( TSM_ELEM_DATA, Tint, cmn_key* );
-  TStatus OCCViewer_AddTrihedron     ( TSM_ELEM_DATA, Tint, cmn_key* );
-  TStatus OCCViewer_DeleteTrihedron  ( TSM_ELEM_DATA, Tint, cmn_key* );
-}
-
-
-TStatus OCCViewer_AddTrihedron( TSM_ELEM_DATA d, Tint n, cmn_key* k )
-{
-  // Retrieve the userdraw structure
-  Graphic3d_CUserDraw *userdraw = ( Graphic3d_CUserDraw* )( k[0]->data.pdata );
-  if ( !userdraw )
-    return TFailure;
-
-  // Retrieve the user structure
-  OCCViewer_Trihedron* userdata = ( OCCViewer_Trihedron* )( userdraw->Data );
-  if ( !userdata )
-    return TFailure;
-
-  ( ( tsm_elem_data )( d.pdata ) )->pdata = ( void* )userdata;
-
-  // Evaluate minmax if needed
-  if( userdraw->Bounds && userdata )
-    userdata->bounds( *( userdraw->Bounds ) );
-
-  return TSuccess;
-}
-
-TStatus OCCViewer_DeleteTrihedron( TSM_ELEM_DATA d, Tint n, cmn_key* k )
-{
-  delete ( OCCViewer_Trihedron* )( d.pdata );
-  return TSuccess;
-}
-
-TStatus OCCViewer_DisplayTrihedron( TSM_ELEM_DATA d, Tint n, cmn_key* k )
-{
-  ( ( OCCViewer_Trihedron* )( d.pdata ) )->display();
-  return TSuccess;
-}
-
-void OCCViewer_Init()
-{
-  //PickTraverse=0
-  //DisplayTraverse=1
-  //Add=2
-  //Delete=3
-  //Print=4
-  //Inquire=5
-  MtblPtr theCallbacks = GetCallbackTable();
-  theCallbacks[DisplayTraverse] = OCCViewer_DisplayTrihedron;
-  theCallbacks[Add] = OCCViewer_AddTrihedron;
-  theCallbacks[Delete] = OCCViewer_DeleteTrihedron;
-}
index b47d3f232d68ee9c58f31432fafc877c00160fed..78b825cb457a000142d963cc95d8af4774e9bb1a 100755 (executable)
@@ -23,7 +23,6 @@
 #include "OCCViewer_ViewWindow.h"
 #include "OCCViewer_VService.h"
 #include "OCCViewer_ViewPort3d.h"
-#include "OCCViewer_Trihedron.h"
 
 #include "SUIT_ViewWindow.h"
 #include "SUIT_ViewManager.h"
@@ -60,7 +59,8 @@
 */
 OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron, bool DisplayStaticTrihedron )
 : SUIT_ViewModel(),
-myBgColor( Qt::black )
+  myBgColor( Qt::black ),
+  myShowStaticTrihedron( DisplayStaticTrihedron )
 {
   // init CasCade viewers
   myV3dViewer = OCCViewer_VService::Viewer3d( "", (short*) "Viewer3d", "", 1000.,
@@ -114,15 +114,6 @@ myBgColor( Qt::black )
     myAISContext->Deactivate(myTrihedron);
   }
 
-  /* create static trihedron (16551: EDF PAL 501) */
-  if( DisplayStaticTrihedron )
-  {
-    Handle(OCCViewer_Trihedron) aTrihedron = new OCCViewer_Trihedron();
-    myAISContext->Display(aTrihedron);
-    myAISContext->Deactivate(aTrihedron);
-    aTrihedron->SetTransformPersistence(Graphic3d_TMF_TriedronPers, gp_Pnt(-1, -1, 200));
-  }
-
   // selection
   mySelectionEnabled = true;
   myMultiSelectionEnabled = true;
index 9d9704f5a7f08949c2c4be1adc3dd3b38b851caa..9e6510f6a743b0864664e76124523c4a639beba0 100755 (executable)
@@ -129,6 +129,7 @@ public:
   bool                            isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
 
   int                             getSelectionCount() const { return (!myAISContext.IsNull())? myAISContext->NbSelected():0; }
+  bool                            isStaticTrihedronDisplayed() { return myShowStaticTrihedron; }
 
   /* Selection management */
   bool    highlight( const Handle(AIS_InteractiveObject)&, bool, bool=true );
@@ -171,6 +172,8 @@ private:
 
   QColor                          myBgColor;
   QPoint                          myStartPnt, myEndPnt;
+
+  bool                            myShowStaticTrihedron;
 };
 
 #ifdef WIN32
index 1710bdcaa0d5d0238ce528e47c90bc7e4abc674a..10e01347e3e4a73deace6d49ab5b2d4d59323c59 100755 (executable)
@@ -23,6 +23,9 @@
 
 #include "OCCViewer_VService.h"
 #include "OCCViewer_ViewWindow.h"
+#include "OCCViewer_ViewModel.h"
+
+#include <SUIT_ViewManager.h>
 
 #include <QColor>
 #include <QRect>
@@ -112,6 +115,16 @@ bool OCCViewer_ViewPort3d::mapView( const Handle(V3d_View)& view )
                if ( view != activeView() )
            view->View()->Deactivate();
        }
+
+  /* create static trihedron (16551: EDF PAL 501) */
+  OCCViewer_ViewWindow* aVW = dynamic_cast<OCCViewer_ViewWindow*>( parentWidget() );
+  if ( aVW ){
+    OCCViewer_Viewer* aViewModel = dynamic_cast<OCCViewer_Viewer*>( aVW->getViewManager()->getViewModel() );
+    if ( aViewModel && aViewModel->isStaticTrihedronDisplayed() ){
+      view->ZBufferTriedronSetup();
+      view->TriedronDisplay( Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.05, V3d_ZBUFFER );
+    }
+  }
   return true;
 }