Version: 6.3.1

src/VISUGUI/VisuGUI_Prs3dDlg.h

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 VISUGUI : GUI of VISU component
00024 //  File   : VisuGUI_Prs3dDlg.h
00025 //  Author : Laurent CORNABE & Hubert ROLLAND
00026 //  Module : VISU
00027 //
00028 #ifndef VISUGUI_PRS3DDLG_H
00029 #define VISUGUI_PRS3DDLG_H
00030 
00031 #include <QDialog>
00032 
00033 #include "SALOME_GenericObjPointer.hh"
00034 #include "VISU_ColoredPrs3d_i.hh"
00035 
00036 class QButtonGroup;
00037 class QGroupBox;
00038 class QLabel;
00039 class QCheckBox;
00040 class QPushButton;
00041 class QRadioButton;
00042 class QLineEdit;
00043 class QComboBox;
00044 class QToolButton;
00045 class QTabWidget;
00046 
00047 class SalomeApp_DoubleSpinBox;
00048 
00049 class SalomeApp_Module;
00050 class SalomeApp_IntSpinBox;
00051 class SVTK_FontWidget;
00052 class VISU_ScalarMapAct;
00053 class VISU_ScalarMapPL;
00054 
00055 namespace VISU
00056 {
00057   class ColoredPrs3d_i;
00058   class ScalarMap_i;
00059 }
00060 
00061 
00062 //----------------------------------------------------------------------------
00063 class VisuGUI_TextPrefDlg: public QDialog
00064 {
00065   Q_OBJECT;
00066 
00067  public:
00068   VisuGUI_TextPrefDlg (QWidget* parent);
00069   ~VisuGUI_TextPrefDlg() {};
00070 
00071   QString getTitleText();
00072   void setTitleText( const QString& theText);
00073 
00074   void setTitleVisible( bool isVisible );
00075 
00076   void storeBeginValues();
00077 
00078  private:
00079   void keyPressEvent( QKeyEvent* e );
00080 
00081  public:
00082   SVTK_FontWidget* myTitleFont;
00083   SVTK_FontWidget* myLabelFont;
00084 
00085  protected slots:
00086   void accept();
00087   void reject();
00088   void onHelp();
00089 
00090  private:
00091   QLineEdit* myTitleEdt;
00092   QString    myTitle;
00093   QColor     myColors[2];
00094   int        myComboVals[2];
00095   bool       myCheckVals[6];
00096 };
00097 
00098 
00099 //----------------------------------------------------------------------------
00100 class VisuGUI_BarPrefDlg: public QDialog
00101 {
00102   Q_OBJECT;
00103 
00104  public:
00105   VisuGUI_BarPrefDlg (QWidget* parent);
00106   ~VisuGUI_BarPrefDlg() {};
00107 
00108   void setRatios(int titleRatioSize, int labelRatioWidth,
00109                  int barRatioWidth, int barRatioHeight);
00110   void getRatios(int& titleRatioSize, int& labelRatioWidth,
00111                  int& barRatioWidth, int& barRatioHeight);
00112 
00113   void setUnitsVisible(bool isVisible);
00114   bool isUnitsVisible();
00115 
00116   void setLabelsPrecision( const int p );
00117   int getLabelsPrecision() const;
00118 
00119   void setOrientation( const int ori );
00120   int getOrientation() const;
00121 
00122 
00123  private:
00124   void keyPressEvent( QKeyEvent* e );
00125 
00126  signals:
00127   void updatePreview();
00128 
00129  protected slots:
00130   void accept();
00131   void reject();
00132   void onHelp();
00133 
00134  protected:
00135   SalomeApp_IntSpinBox*  myTitleSizeSpin;
00136   SalomeApp_IntSpinBox*  myLabelSizeSpin;
00137   SalomeApp_IntSpinBox*  myBarWidthSpin;
00138   SalomeApp_IntSpinBox*  myBarHeightSpin;
00139   QCheckBox* myUnitsChk;  
00140   SalomeApp_IntSpinBox*  myPrecisionSpin;
00141 
00142   int        myTitleSize;
00143   int        myLabelSize;
00144   int        myBarWidth;
00145   int        myBarHeight;
00146   bool       myUnits;
00147   int        myPrecision;
00148   int        myOrientation;
00149 };
00150 
00151 
00152 //----------------------------------------------------------------------------
00153 class VisuGUI_ScalarBarPane : public QWidget//QVBox
00154 {
00155   Q_OBJECT;
00156 
00157  public:
00158   VisuGUI_ScalarBarPane(QWidget* parent, bool theIsDisplayGaussMetric = false, bool thePreview = FALSE);
00159   ~VisuGUI_ScalarBarPane();
00160 
00161   void    setRange( double imin, double imax, bool sbRange );
00162   void    setDefaultRange(double imin, double imax);
00163   int     getOrientation();
00164   void    setPosAndSize( double x, double y, double w, double h, bool vert );
00165   void    setScalarBarData( int colors, int labels );
00166   bool    isIRange();
00167   double  getMin();
00168   double  getMax();
00169   double  getX();
00170   double  getY();
00171   double  getWidth();
00172   double  getHeight();
00173   int     getNbColors();
00174   int     getNbLabels();
00175   bool    isLogarithmic();
00176   void    setLogarithmic( bool on );
00177   bool    isShowDistribution();
00178   void    setShowDistribution( bool on );
00179   bool    isToSave();
00180 
00181   void storeToResources();
00182   void initFromPrsObject(VISU::ColoredPrs3d_i* thePrs);
00183 
00184   int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs);
00185 
00186   bool check();
00187 
00188  protected:
00189   QButtonGroup*   RangeGroup;
00190   QRadioButton*   RBFrange;
00191   QRadioButton*   RBIrange;
00192   QLineEdit*      MinEdit;
00193   QLineEdit*      MaxEdit;
00194 
00195   QRadioButton*   RBhori;
00196   QRadioButton*   RBvert;
00197 
00198   SalomeApp_DoubleSpinBox*  XSpin;
00199   SalomeApp_DoubleSpinBox*  YSpin;
00200 
00201   SalomeApp_DoubleSpinBox*  WidthSpin;
00202   SalomeApp_DoubleSpinBox*  HeightSpin;
00203 
00204   SalomeApp_IntSpinBox* ColorSpin;
00205   SalomeApp_IntSpinBox* LabelSpin;
00206 
00207   QCheckBox*      CBSave;
00208   QCheckBox*      CBLog;
00209   QCheckBox*      CBDistr;
00210   QCheckBox*      myHideBar;
00211 
00212   QLabel*         myModeLbl;
00213   QComboBox*      myModeCombo;
00214   QLabel*         myGaussMetricLabel;
00215   QComboBox*      myGaussMetric;
00216   QPushButton*    myTextBtn;
00217   QPushButton*    myBarBtn;
00218   VisuGUI_TextPrefDlg* myTextDlg;
00219   VisuGUI_BarPrefDlg* myBarDlg;
00220 
00221   double          myHorX, myHorY, myHorW, myHorH;
00222   double          myVerX, myVerY, myVerW, myVerH;
00223   int             myHorTS, myHorLS, myHorBW, myHorBH;
00224   int             myVerTS, myVerTH, myVerLS, myVerBW, myVerBH;
00225   bool            myIsStoreTextProp;
00226 
00227  private slots:
00228   void changeDefaults( int );
00229  void changeRange( int );
00230  void onFieldRange( bool );
00231  void onImposedRange( bool );
00232   void XYChanged( double );
00233   void changeScalarMode( int );
00234   void changeGaussMetric( int );
00235   void onTextPref();
00236   void onBarPref();
00237   void onPreviewCheck(bool thePreview);
00238   void updatePreview();  
00239   void onShowDistribution(bool);
00240 
00241  private:
00242   void createScalarBar();
00243   void deleteScalarBar();
00244 
00245   QCheckBox*         myPreviewCheck;
00246   VISU_ScalarMapAct* myPreviewActor;
00247   VISU::ScalarMap_i* myScalarMap;
00248   VISU_ScalarMapPL*  myScalarMapPL;
00249   std::string        myTitle;
00250 
00251   bool myBusy;
00252   bool myIsDisplayGaussMetric;
00253 };
00254 
00255 
00256 //----------------------------------------------------------------------------
00257 class VisuGUI_Prs3dDlg : public QDialog
00258 {
00259   Q_OBJECT;
00260 
00261  public:
00262   VisuGUI_Prs3dDlg( SalomeApp_Module* theModule );
00263   ~VisuGUI_Prs3dDlg() {}
00264 
00265   virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
00266                                       bool theInit ) = 0;
00267 
00268   virtual int      storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) = 0;
00269 
00270  protected:
00271   virtual QString  GetContextHelpFilePath() = 0;
00272 
00273  protected slots:
00274   void onHelp();
00275 
00276  private:
00277   void keyPressEvent( QKeyEvent* e );
00278 };
00279 
00280 
00281 //----------------------------------------------------------------------------
00282 class VisuGUI_ScalarBarBaseDlg : public VisuGUI_Prs3dDlg
00283 {
00284   Q_OBJECT;
00285 
00286  public:
00287   VisuGUI_ScalarBarBaseDlg( SalomeApp_Module* theModule, bool theIsDisplayGaussMetric = false, bool thePreview = FALSE );
00288   ~VisuGUI_ScalarBarBaseDlg();
00289 
00290   virtual void     initFromPrsObject( VISU::ColoredPrs3d_i* thePrs,
00291                                       bool theInit );
00292  protected slots:
00293   void accept();
00294   void reject();
00295 
00296  protected:
00297   VisuGUI_ScalarBarPane* GetScalarPane();
00298 
00299  private:
00300   VisuGUI_ScalarBarPane* myScalarPane;
00301 };
00302 
00303 
00304 //----------------------------------------------------------------------------
00305 
00306 #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