Version: 6.3.1

src/PIPELINE/VISU_ScalarBarCtrl.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 //  VISU OBJECT : interactive object for VISU entities implementation
00024 // File:    VISU_ScalarBarCtrl.hxx
00025 // Author:  Peter KURNEV
00026 // Module : VISU
00027 //
00028 #ifndef VISU_ScalarBarCtrl_HeaderFile
00029 #define VISU_ScalarBarCtrl_HeaderFile
00030 
00031 #include "VISUPipeline.hxx"
00032 
00033 #include <vtkObject.h>
00034 
00035 #include "VTKViewer.h"
00036 
00037 class vtkRenderer;
00038 class VISU_LookupTable;
00039 class VISU_ScalarBarActor;
00040 
00041 class VISU_PIPELINE_EXPORT VISU_ScalarBarCtrl :  public vtkObject
00042 {
00043 public:
00044   vtkTypeMacro(VISU_ScalarBarCtrl, vtkObject);
00045   static
00046   VISU_ScalarBarCtrl* 
00047   New();
00048 
00049   enum EMode {eSimple, eGlobal, eLocal};
00050 
00051   // Mode
00052   void
00053   SetMode(EMode theMode);
00054 
00055   EMode 
00056   GetMode() const;
00057 
00058   // Ranges
00059   void
00060   SetRangeGlobal(vtkFloatingPointType theMin,
00061                  vtkFloatingPointType theMax);
00062   void 
00063   SetRangeGlobal(vtkFloatingPointType *theRange);
00064 
00065   void
00066   SetGlobalRangeIsDefined(bool theIsDefined);
00067   
00068   void
00069   SetRangeLocal(vtkFloatingPointType theMin,
00070                 vtkFloatingPointType theMax);
00071   void 
00072   SetRangeLocal(vtkFloatingPointType *theRange);
00073   
00074   // Selectors
00075   VISU_ScalarBarActor* 
00076   GetLocalBar();
00077 
00078   VISU_LookupTable* 
00079   GetLocalTable();
00080 
00081   VISU_ScalarBarActor* 
00082   GetGlobalBar();
00083 
00084   VISU_LookupTable* 
00085   GetGlobalTable();
00086   //
00087   // Renderer
00088   void
00089   AddToRender(vtkRenderer* theRenderer); 
00090 
00091   void
00092   RemoveFromRender(vtkRenderer* theRenderer);
00093   //
00094   // Visibility
00095   void
00096   SetVisibility(int theFlag);
00097 
00098   int
00099   GetVisibility() const;
00100 
00101   // Visibility
00102   void
00103   SetCtrlVisibility(int theFlag);
00104 
00105   int
00106   GetCtrlVisibility() const;
00107 
00108   // Build
00109   void Update();
00110 
00111   // Position
00112   void
00113   SetWidth(const vtkFloatingPointType theWidth);
00114 
00115   vtkFloatingPointType
00116   GetWidth() const;
00117 
00118   void  
00119   SetHeight(const vtkFloatingPointType theHeight);
00120 
00121   vtkFloatingPointType
00122   GetHeight() const;
00123 
00124   void
00125   SetPosition(const vtkFloatingPointType* thePosition);
00126   
00127   const vtkFloatingPointType* 
00128   GetPosition() const;
00129   //
00130   // Spacing
00131   void
00132   SetSpacing(const vtkFloatingPointType theSpacing);
00133 
00134   vtkFloatingPointType
00135   GetSpacing() const;
00136   //
00137   // Rainbow/bicolor
00138   bool
00139   GetBicolor() const;
00140 
00141   void
00142   SetBicolor(const bool theBicolor);
00143   //
00144   // Misc
00145   void  
00146   SetMarkValue(const vtkFloatingPointType theValue);
00147 
00148   vtkFloatingPointType
00149   GetMarkValue() const;
00150 
00151   void
00152   SetIsMarked(const bool theFlag);
00153 
00154   bool
00155   GetIsMarked()const;
00156   //
00157 protected:
00158   VISU_ScalarBarCtrl();
00159 
00160   virtual
00161   ~VISU_ScalarBarCtrl();
00162   
00163   void
00164   UpdateForBicolor();
00165 
00166   void
00167   UpdateForColor();
00168 
00169   void
00170   UpdateMarkValue();
00171 
00172   void
00173   PrepareTables();
00174   
00175   void
00176   PrepareTables(VISU_ScalarBarActor* theScalarBarActor,
00177                 VISU_LookupTable *theLookupTable,
00178                 vtkIdType theId);
00179   
00180 protected:
00181   EMode myMode;
00182   bool myGlobalRangeIsDefined;
00183 
00184   vtkFloatingPointType myDistance;
00185   vtkFloatingPointType myPosition[2];
00186   bool  myBicolor;
00187   int   myCtrlVisibility;
00188 
00189   unsigned char myBlack[3];
00190   unsigned char myGrey[3];
00191   //
00192   bool  myMarked;
00193   vtkFloatingPointType myMarkedValue;
00194   //
00195   VISU_ScalarBarActor *myGlobalScalarBar;
00196   VISU_LookupTable *myGlobalLookupTable; 
00197 
00198   VISU_ScalarBarActor *myLocalScalarBar;
00199   VISU_LookupTable *myLocalLookupTable; 
00200 };
00201 
00202 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS