Back to index

salome-gui  6.5.0
SALOME_Prs.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef SALOME_PRS_H
00024 #define SALOME_PRS_H
00025 
00026 #ifdef WIN32
00027 #if defined PRS_EXPORTS || defined SalomePrs_EXPORTS
00028 #define PRS_EXPORT __declspec(dllexport)
00029 #else
00030 #define PRS_EXPORT __declspec(dllimport)
00031 #endif
00032 #else
00033 #define PRS_EXPORT
00034 #endif
00035 
00036 class SALOME_View;
00037 class SALOME_Displayer;
00038 class SALOME_ListIO;
00039 class Handle_SALOME_InteractiveObject;
00040 
00047 class PRS_EXPORT SALOME_Prs
00048 {
00049 public:
00051   virtual ~SALOME_Prs() {}
00052 
00054   virtual void DisplayIn( SALOME_View* ) const = 0;
00055 
00057   virtual void EraseIn( SALOME_View*, const bool = false ) const = 0;
00058 
00060   virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const = 0;
00061 
00063   virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const = 0;
00064 
00066   virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const = 0;
00067 
00069   virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const = 0;
00070 
00072   virtual void Update( SALOME_Displayer* ) = 0;
00073 
00075   virtual bool IsNull() const = 0;
00076 
00078   virtual void LocalSelectionIn( SALOME_View*, const int ) const = 0;
00079 };
00080 
00087 class PRS_EXPORT SALOME_OCCPrs : public SALOME_Prs
00088 {
00089 public:
00092   virtual void DisplayIn( SALOME_View* ) const;
00093 
00096   virtual void EraseIn( SALOME_View*, const bool = false ) const;
00097 
00100   virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
00101 
00104   virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
00105 
00108   virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
00109 
00112   virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
00113 
00116   virtual void Update( SALOME_Displayer* );
00117 
00119   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
00120 };
00121 
00127 class PRS_EXPORT SALOME_VTKPrs : public SALOME_Prs
00128 {
00129 public:
00132   virtual void DisplayIn( SALOME_View* ) const;
00133 
00136   virtual void EraseIn( SALOME_View*, const bool = false ) const;
00137 
00140   virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
00141 
00144   virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
00145 
00148   virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
00149 
00152   virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
00153 
00156   virtual void Update( SALOME_Displayer* );
00157 
00159   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
00160 };
00161 
00166 class PRS_EXPORT SALOME_Prs2d : public SALOME_Prs
00167 {
00168 public:
00171   virtual void DisplayIn( SALOME_View* ) const;
00172 
00175   virtual void EraseIn( SALOME_View*, const bool = false ) const;
00176 
00179   virtual void BeforeDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
00180 
00183   virtual void AfterDisplayIn( SALOME_Displayer*, SALOME_View* ) const;
00184 
00187   virtual void BeforeEraseIn( SALOME_Displayer*, SALOME_View* ) const;
00188 
00191   virtual void AfterEraseIn( SALOME_Displayer*, SALOME_View* ) const;
00192 
00195   virtual void Update( SALOME_Displayer* );
00196 
00198   virtual void LocalSelectionIn( SALOME_View*, const int ) const;
00199 };
00200 
00208 class PRS_EXPORT SALOME_View
00209 {
00210 public:
00212   virtual ~SALOME_View() {}
00213 
00217   void Display( const SALOME_Prs* );
00218 
00222   void Erase( const SALOME_Prs*, const bool = false );
00223 
00227   void LocalSelection( const SALOME_Prs*, const int );
00228 
00229   // Interface for derived views
00230 
00231   // Display() methods for ALL kinds of presentation should appear here
00232   virtual void Display( const SALOME_OCCPrs* );
00233   virtual void Display( const SALOME_VTKPrs* );
00234   virtual void Display( const SALOME_Prs2d*  );
00235   // Add new Display() methods here...
00236 
00237   // Erase() methods for ALL kinds of presentation should appear here
00238   virtual void Erase( const SALOME_OCCPrs*, const bool = false );
00239   virtual void Erase( const SALOME_VTKPrs*, const bool = false );
00240   virtual void Erase( const SALOME_Prs2d*,  const bool = false );
00241   virtual void EraseAll( const bool = false );
00242   // Add new Erase() methods here...
00243 
00244   // LocalSelection() methods for ALL kinds of presentation should appear here
00245   virtual void LocalSelection( const SALOME_OCCPrs*, const int );
00246   virtual void LocalSelection( const SALOME_VTKPrs*, const int );
00247   virtual void LocalSelection( const SALOME_Prs2d* , const int );
00248 
00250   virtual void GlobalSelection( const bool = false ) const;
00251 
00253   virtual SALOME_Prs* CreatePrs( const char* /*entry*/ = 0 ) { return 0; }
00254 
00255   // Axiluary methods called before and after displaying of objects
00256   virtual void BeforeDisplay( SALOME_Displayer*, const SALOME_Prs* );
00257   virtual void AfterDisplay ( SALOME_Displayer*, const SALOME_Prs* );
00258 
00259   // Axiluary methods called before and after erasing of objects
00260   virtual void BeforeErase( SALOME_Displayer*, const SALOME_Prs* );
00261   virtual void AfterErase ( SALOME_Displayer*, const SALOME_Prs* );
00262 
00263   // New methods (asv)
00265   virtual bool isVisible( const Handle_SALOME_InteractiveObject& ){ return false; }
00266   virtual void Repaint() {} 
00267   virtual void GetVisible( SALOME_ListIO& theList ) {}
00268 };
00269 
00274 class PRS_EXPORT SALOME_Displayer
00275 {
00276 public:
00278   virtual ~SALOME_Displayer() {}
00279 
00283   void UpdatePrs( SALOME_Prs* );
00284 
00285   // Interface for derived displayers
00286 
00287   // Update() methods for ALL kinds of presentation should appear here
00288   virtual void Update( SALOME_OCCPrs* );
00289   virtual void Update( SALOME_VTKPrs* );
00290   virtual void Update( SALOME_Prs2d* );
00291   // Add new Update() methods here...
00292 
00293   // Axiluary methods called before and after displaying of objects
00294   virtual void BeforeDisplay( SALOME_View*, const SALOME_OCCPrs* ) {} 
00295   virtual void AfterDisplay ( SALOME_View*, const SALOME_OCCPrs* ) {} 
00296   virtual void BeforeDisplay( SALOME_View*, const SALOME_VTKPrs* ) {} 
00297   virtual void AfterDisplay ( SALOME_View*, const SALOME_VTKPrs* ) {} 
00298   virtual void BeforeDisplay( SALOME_View*, const SALOME_Prs2d*  ) {} 
00299   virtual void AfterDisplay ( SALOME_View*, const SALOME_Prs2d*  ) {} 
00300 
00301   // Axiluary methods called before and after erasing of objects
00302   virtual void BeforeErase( SALOME_View*, const SALOME_OCCPrs* ) {} 
00303   virtual void AfterErase ( SALOME_View*, const SALOME_OCCPrs* ) {} 
00304   virtual void BeforeErase( SALOME_View*, const SALOME_VTKPrs* ) {} 
00305   virtual void AfterErase ( SALOME_View*, const SALOME_VTKPrs* ) {} 
00306   virtual void BeforeErase( SALOME_View*, const SALOME_Prs2d*  ) {} 
00307   virtual void AfterErase ( SALOME_View*, const SALOME_Prs2d*  ) {} 
00308 
00309 };
00310 
00311 #endif