Version: 9.12.0
SMESH_NoteBook.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2023 CEA, EDF, 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, or (at your option) any later version.
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 
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;
62 };
63 
65 {
66 public:
67  typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
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 
81 };
82 
83 
85 {
86 public:
87 
90  void ReplaceVariables();
91 
92  void AddCommand(const TCollection_AsciiString& theString);
93  TCollection_AsciiString GetResultScript() const;
94  void GetResultLines(std::list< TCollection_AsciiString >& lines) const;
95 
96 private:
97 
98  void InitObjectMap();
100 
101  bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
102 
103 private:
104 
105  typedef std::map<TCollection_AsciiString,SMESH_ObjectStates*> TVariablesMap;
106  typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
107  typedef std::map<TCollection_AsciiString,std::vector< std::string > > TEntry2VarVecMap;
108 
109  TVariablesMap _objectMap; // old approach - full states are kept
110  TEntry2VarVecMap _entry2VarsMap; // new approach - only var names are kept
111  std::vector<Handle(_pyCommand)> _commands;
113 };
114 
115 #endif //SMESH_NoteBook_HeaderFile
Handle(SALOME_InteractiveObject) GeomSelectionTools
Return the first selected Salome Interactive Object (Handle(Salome_InteractiveObject))
Definition: GeomSelectionTools.cxx:97
std::vector< TCollection_AsciiString > TState
Definition: SMESH_NoteBook.hxx:33
TCollection_AsciiString _pyID
Definition: SMESH_NoteBook.hxx:40
std::vector< TState > TAllStates
Definition: SMESH_NoteBook.hxx:39
Definition: SMESH_NoteBook.hxx:65
void AddDistribution(const TCollection_AsciiString &theDistribution)
AddDistribution.
Definition: SMESH_NoteBook.cxx:158
TDistributionMap _distributions
Definition: SMESH_NoteBook.hxx:80
virtual ~LayerDistributionStates()
Destructor.
Definition: SMESH_NoteBook.cxx:148
TCollection_AsciiString GetDistributionType(const TCollection_AsciiString &theDistribution) const
GetDistributionType.
Definition: SMESH_NoteBook.cxx:194
bool SetDistributionType(const TCollection_AsciiString &theDistribution, const TCollection_AsciiString &theType)
SetDistributionType.
Definition: SMESH_NoteBook.cxx:178
std::map< TCollection_AsciiString, TCollection_AsciiString > TDistributionMap
Definition: SMESH_NoteBook.hxx:67
LayerDistributionStates()
Constructor.
Definition: SMESH_NoteBook.cxx:139
bool HasDistribution(const TCollection_AsciiString &theDistribution) const
HasDistribution.
Definition: SMESH_NoteBook.cxx:168
Definition: SMESH_NoteBook.hxx:85
std::map< TCollection_AsciiString, TCollection_AsciiString > TMeshEditorMap
Definition: SMESH_NoteBook.hxx:106
void InitObjectMap()
Private method.
Definition: SMESH_NoteBook.cxx:735
TMeshEditorMap _meshEditors
Definition: SMESH_NoteBook.hxx:112
std::map< TCollection_AsciiString, SMESH_ObjectStates * > TVariablesMap
Definition: SMESH_NoteBook.hxx:105
TVariablesMap _objectMap
Definition: SMESH_NoteBook.hxx:109
void ProcessLayerDistribution()
Definition: SMESH_NoteBook.cxx:839
bool GetReal(const TCollection_AsciiString &theVarName, double &theValue)
Return value of the variable.
Definition: SMESH_NoteBook.cxx:946
TCollection_AsciiString GetResultScript() const
Return result script.
Definition: SMESH_NoteBook.cxx:922
~SMESH_NoteBook()
Destructor.
Definition: SMESH_NoteBook.cxx:215
void GetResultLines(std::list< TCollection_AsciiString > &lines) const
Return lines of the result script.
Definition: SMESH_NoteBook.cxx:935
TEntry2VarVecMap _entry2VarsMap
Definition: SMESH_NoteBook.hxx:110
void AddCommand(const TCollection_AsciiString &theString)
Definition: SMESH_NoteBook.cxx:821
SMESH_NoteBook()
Constructor.
Definition: SMESH_NoteBook.cxx:205
std::map< TCollection_AsciiString, std::vector< std::string > > TEntry2VarVecMap
Definition: SMESH_NoteBook.hxx:107
std::vector< Handle(_pyCommand)> _commands
Definition: SMESH_NoteBook.hxx:111
void ReplaceVariables()
Replace parameters of the functions on the Salome NoteBook Variables.
Definition: SMESH_NoteBook.cxx:231
Definition: SMESH_NoteBook.hxx:42
TCollection_AsciiString _type
Definition: SMESH_NoteBook.hxx:59
TCollection_AsciiString GetObjectType() const
Definition: SMESH_NoteBook.cxx:129
void IncrementState()
Definition: SMESH_NoteBook.cxx:119
int _dumpstate
Definition: SMESH_NoteBook.hxx:61
TAllStates GetAllStates() const
Definition: SMESH_NoteBook.cxx:109
virtual ~SMESH_ObjectStates()
Destructor.
Definition: SMESH_NoteBook.cxx:74
TState GetCurrectState() const
Return current object state \retval state - Object state (vector of notebook variable)
Definition: SMESH_NoteBook.cxx:95
TAllStates _states
Definition: SMESH_NoteBook.hxx:60
void AddState(const TState &theState)
Add new object state.
Definition: SMESH_NoteBook.cxx:84
SMESH_ObjectStates(TCollection_AsciiString theType)
Constructor.
Definition: SMESH_NoteBook.cxx:63
Class operating on a command string looking like ResultValue = Object.Method( Arg1,...
Definition: SMESH_2smeshpy.hxx:99