Salome HOME
Merge from V6_main_20120808 08Aug12
[modules/smesh.git] / src / SMESH_I / SMESH_NoteBook.hxx
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File      : SMESH_NoteBook.hxx
21 // Author    : Roman NIKOLAEV ()
22 //
23 #ifndef SMESH_NoteBook_HeaderFile
24 #define SMESH_NoteBook_HeaderFile
25
26 // All this stuff is obsolete since issue 0021308:
27 // "Remove hard-coded dependency of the external mesh plugins from the SMESH module"
28 // is implemented (Mar 2012). It is kept for backward compatibility only.
29
30 #include <TCollection_AsciiString.hxx>
31 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
32  
33 class _pyCommand;
34
35 #include <vector>
36 #include <string>
37
38 typedef std::vector<TCollection_AsciiString>  TState;
39 typedef std::vector<TState>                   TAllStates;
40 typedef TCollection_AsciiString               _pyID;
41
42 class SMESH_ObjectStates{
43   
44 public:
45   
46   SMESH_ObjectStates(TCollection_AsciiString theType);
47   virtual ~SMESH_ObjectStates();
48
49   void AddState(const TState &theState);
50
51   TState GetCurrectState() const;
52   TAllStates GetAllStates() const;
53   void IncrementState();
54   TCollection_AsciiString GetObjectType() const;
55
56   
57
58 private:
59   TCollection_AsciiString                   _type;
60   TAllStates                                _states;
61   int                                       _dumpstate;
62 };
63
64 class LayerDistributionStates : public SMESH_ObjectStates
65 {
66 public:
67   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
68   LayerDistributionStates();
69   virtual ~LayerDistributionStates();
70
71   void AddDistribution(const TCollection_AsciiString& theDistribution);
72   bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
73
74   bool SetDistributionType(const TCollection_AsciiString& theDistribution,
75                            const TCollection_AsciiString& theType);
76   TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
77   
78 private:
79   
80   TDistributionMap _distributions;
81 };
82
83
84 class SMESH_NoteBook
85 {
86 public:
87   typedef std::map<TCollection_AsciiString,SMESH_ObjectStates*> TVariablesMap;
88   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
89   SMESH_NoteBook();
90   ~SMESH_NoteBook();
91   void ReplaceVariables();
92   
93   void AddCommand(const TCollection_AsciiString& theString);
94   TCollection_AsciiString GetResultScript() const;
95
96 private:
97   void InitObjectMap();
98   void ProcessLayerDistribution();
99
100   bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
101   
102 private:
103   
104   TVariablesMap _objectMap;
105   std::vector<Handle(_pyCommand)> _commands;
106   TMeshEditorMap myMeshEditors;
107 };
108
109 #endif //SMESH_NoteBook_HeaderFile