00001 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE 00002 // 00003 // This library is free software; you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public 00005 // License as published by the Free Software Foundation; either 00006 // version 2.1 of the License. 00007 // 00008 // This library is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 // Lesser General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU Lesser General Public 00014 // License along with this library; if not, write to the Free Software 00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 // 00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com 00018 // 00019 00020 // VISU VISUGUI : GUI of VISU component 00021 // File : VisuGUI_DeformedShapeAndScalarMapDlg.h 00022 // Author : Eugeny Nikolaev 00023 // Module : VISU 00024 // 00025 #ifndef VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H 00026 #define VISUGUI_DEFORMEDSHAPEANDSCALARMAPDLS_H 00027 00028 #include "VisuGUI_Prs3dDlg.h" 00029 00030 #include "VISUConfig.hh" 00031 00032 #include <QDialog> 00033 00034 #include <set> 00035 #include <vector> 00036 00037 class SalomeApp_Module; 00038 class VisuGUI_InputPane; 00039 class SalomeApp_DoubleSpinBox; 00040 class QComboBox; 00041 class QTabWidget; 00042 00043 namespace VISU 00044 { 00045 class DeformedShapeAndScalarMap_i; 00046 } 00047 00048 class VisuGUI_DeformedShapeAndScalarMapDlg : public VisuGUI_ScalarBarBaseDlg 00049 { 00050 Q_OBJECT 00051 00052 public: 00053 VisuGUI_DeformedShapeAndScalarMapDlg (SalomeApp_Module* theModule); 00054 ~VisuGUI_DeformedShapeAndScalarMapDlg(); 00055 00056 double getFactor() const; 00057 void setFactor(double theFactor); 00058 00059 virtual void initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, 00060 bool theInit ); 00061 00062 virtual int storeToPrsObject(VISU::ColoredPrs3d_i* thePrs); 00063 00064 int getCurrentScalarFieldNamePos(); 00065 QString getCurrentScalarFieldName(); 00066 int getCurrentScalarNbIterations(); 00067 VISU::Entity getCurrentScalarEntity(); 00068 void SetScalarField(int theIter,QString theFieldName=QString(""), const bool = true ); 00069 00070 bool IsScalarFieldValid() const { return myIsScalarFieldValid; } 00071 00072 protected: 00073 virtual QString GetContextHelpFilePath(); 00074 00075 protected slots: 00076 void accept(); 00077 void reject(); 00078 00079 private slots: 00080 void onFieldChanged(int i=0); 00081 void onTimeStampChanged(int i=0); 00082 00083 private: 00084 SalomeApp_DoubleSpinBox* ScalFact; 00085 QTabWidget* myTabBox; 00086 VisuGUI_ScalarBarPane* myScalarPane; 00087 VisuGUI_InputPane* myInputPane; 00088 QComboBox *myFieldsCombo; 00089 QComboBox *myTimeStampsCombo; 00090 QPushButton* myButtonOk; 00091 00092 typedef std::map<int, QString> TTimeStampNumber2Time; // Times map definition (iteration time, real value of time) 00093 typedef std::map<QString, TTimeStampNumber2Time> TFieldName2TimeStamps; // Field name and enity to Times 00094 typedef std::map<VISU::Entity, TFieldName2TimeStamps> TEntity2Fields; // Mesh to fields map 00095 00096 TEntity2Fields myEntity2Fields; 00097 int myCurrScalarIter; 00098 bool myIsAnimation; 00099 bool myUpdateScalars; 00100 std::vector<int> myTimeStampID; 00101 00102 _PTR(SObject) mySelectionObj; 00103 SALOME::GenericObjPtr<VISU::DeformedShapeAndScalarMap_i> myPrsCopy; 00104 SalomeApp_Module* myVisuGUI; 00105 00106 bool myIsScalarFieldValid; 00107 00108 protected: 00109 void UpdateScalarField(); 00110 void SetScalarField( const bool = true ); 00111 void AddAllFieldNames(); 00112 void AddAllTimes(const QString& theFieldName); 00113 QString GetFloatValueOfTimeStamp(VISU::Entity theEntity, 00114 const std::string& theFieldName, 00115 int theTimeStampNumber); 00116 void updateControls(); 00117 }; 00118 00119 #endif // VISUGUI_DEFORMEDSHAPEDLS_H