Salome HOME
Merge from BR_Dev_For_4_0 branch (from tag mergeto_BR_QT4_Dev_17Jan08)
[modules/geom.git] / src / GEOMGUI / GEOM_Displayer.h
index 45a1e4f41a3501de9b7eb6db51b446b4a4260cc8..befc7adcdf694a22f1c9b9bdda96bcc5cfa17755 100644 (file)
@@ -1,39 +1,48 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+// GEOM GEOMGUI : GUI for Geometry component
 //
-//  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// Copyright (C) 2003  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.
 //
-//  File   : GEOM_Displayer.h
-//  Author : Vadim SANDLER
-//  Module : GEOM
-//  $Header$
+// 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
+//
+// File   : GEOM_Displayer.h
+// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+//
+
+#ifndef GEOM_DISPLAYER_H
+#define GEOM_DISPLAYER_H
 
-#if !defined (__GEOM_DISPLAYER_H)
-#define __GEOM_DISPLAYER_H
+#include "GEOM_GEOMGUI.hxx"
+
+#include <SALOME_InteractiveObject.hxx>
+
+class SALOME_ListIO;
+class SALOME_View;
+class SALOME_Prs;
+class SALOME_OCCPrs;
+class SALOME_VTKPrs;
+class SALOME_OCCViewType;
 
-#include "SALOME_Prs.h"
-#include "SALOME_InteractiveObject.hxx"
-#include "SALOME_ListIO.hxx"
 #include <TopoDS_Shape.hxx>
 #include <Quantity_Color.hxx>
+#include <LightApp_Displayer.h>
+#include <Aspect_TypeOfMarker.hxx>
+
+#include <QList>
 
 #include <list>
 
 typedef std::list<GEOM::GEOM_Object_ptr> ObjectList;
 
 class TColStd_MapOfInteger;
-class QAD_ViewFrame;
-class SALOME_Selection;
+class LightApp_SelectionMgr;
+class SalomeApp_Study;
+class SalomeApp_Application;
+class SUIT_SelectionFilter;
+//class SALOME_Selection;
 
-class GEOM_Displayer : public SALOME_Displayer
+class GEOMGUI_EXPORT GEOM_Displayer : public LightApp_Displayer
 {
-    
+
 public:
   /* Constructor */
-  GEOM_Displayer();
+  GEOM_Displayer( SalomeApp_Study* app );
   /* Destructor */
   virtual ~GEOM_Displayer();
 
-  /* Display/Erase object methods */
+  virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const;
 
+  /* Display/Erase object methods */
   void          Display   ( const Handle(SALOME_InteractiveObject)& theIO,
                             const bool updateViewer = true,
-                           QAD_ViewFrame* theViewFrame = 0 );
+                           SALOME_View* theViewFrame = 0 );
 
   // This overloaded Display() method can be useful for operations
   // not using dialog boxes.
-  void          Display   ( GEOM::GEOM_Object_ptr theObj, 
+  void          Display   ( GEOM::GEOM_Object_ptr theObj,
                            const bool updateViewer = true );
-                         
+
   void          Redisplay ( const Handle(SALOME_InteractiveObject)& theIO,
                             const bool updateViewer = true );
 
   void          Erase     ( const Handle(SALOME_InteractiveObject)& theIO,
                             const bool forced = false,
                             const bool updateViewer = true,
-                           QAD_ViewFrame* theViewFrame = 0 );
+                           SALOME_View* theViewFrame = 0 );
 
   void          Erase     ( GEOM::GEOM_Object_ptr theObj,
                             const bool forced = false,
-                            const bool updateViewer = true );                            
+                            const bool updateViewer = true );
 
   /* Display/Erase list of objects methods */
-  
+
   void          Display   ( const SALOME_ListIO& theIOList,
                             const bool updateViewer = true );
-                            
+
   void          Erase     ( const SALOME_ListIO& theIOList,
                             const bool forced = false,
                             const bool updateViewer = true );
-                            
+
   void          Redisplay ( const SALOME_ListIO& theIOList,
                             const bool updateViewer = true );
 
-  /* Update current viewer */
-  void          UpdateViewer();
-
   /* build presentation accordint to the current viewer type*/
   SALOME_Prs*   BuildPrs  ( GEOM::GEOM_Object_ptr );
   SALOME_Prs*   BuildPrs  ( const TopoDS_Shape& );
@@ -114,11 +124,16 @@ public:
   void          UnsetWidth();
   double        GetWidth  () const;
   bool          HasWidth  () const;
+  
+  /* Set display mode shape displaying. If it is equal -1 then display mode is used. */
+  int           SetDisplayMode( const int );
+  int           GetDisplayMode() const;
+  int           UnsetDisplayMode();
 
 
   /* Sets name - for temporary objects only */
-  void          SetName( const char* theName ) { myName = theName; }
-  void          UnsetName() { myName = ""; }
+  void          SetName( const char* theName );
+  void          UnsetName();
 
   /* Reimplemented from SALOME_Displayer */
   virtual void  Update( SALOME_OCCPrs* );
@@ -136,38 +151,47 @@ public:
   void         GlobalSelection( const int = GEOM_ALLOBJECTS, const bool = false );
   void         GlobalSelection( const TColStd_MapOfInteger&, const bool = false );
 
-  static QAD_ViewFrame* GetActiveView();
+  SalomeApp_Study* getStudy() const;
+
+  static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
 
 protected:
   /* internal methods */
   /* Builds presentation accordint to the current viewer type */
-  SALOME_Prs* buildPresentation( const Handle(SALOME_InteractiveObject)& theIO,
-                                QAD_ViewFrame* theViewFrame = 0 );
-  
+  virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 );
+
   /* Sets interactive object */
-  void        setIO( const Handle(SALOME_InteractiveObject)& theIO ) { myIO = theIO; }
-  
+  void        setIO( const Handle(SALOME_InteractiveObject)& theIO );
+
   /* Sets shape */
-  void        setShape( const TopoDS_Shape& theShape ) { myShape = theShape; }
-  
+  void        setShape( const TopoDS_Shape& theShape );
+
   /* Resets internal data */
   void        internalReset();
 
-  void        clearTemporary( SALOME_Selection* );
+  void        clearTemporary( LightApp_SelectionMgr* theSelMgr );
+
+  SUIT_SelectionFilter* getFilter( const int theMode );
 
 protected:
   Handle(SALOME_InteractiveObject) myIO;
   TopoDS_Shape                     myShape;
   string                           myName;
   int                              myType;
-  QAD_ViewFrame*                   myViewFrame;
+  SALOME_View*                     myViewFrame;
 
   // Attributes
   Quantity_Color                   myShadingColor;
   int                              myColor;
   double                           myWidth;
   bool                             myToActivate;
+  int                              myDisplayMode;
+  Aspect_TypeOfMarker              myTypeOfMarker;
+  double                           myScaleOfMarker;
+
+private:
+  SalomeApp_Application* myApp;
 };
 
-#endif // __GEOM_DISPLAYER_H
+#endif // GEOM_DISPLAYER_H