]> SALOME platform Git repositories - modules/shaper_study.git/blob - src/StudyData/StudyData_XAO.h
Salome HOME
8b4e98952d647e964e15c5607178fdf5663fa383
[modules/shaper_study.git] / src / StudyData / StudyData_XAO.h
1 // Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef StudyData_Object_H
24
25 #include "StudyData.h"
26 #include <XAO_Xao.hxx>
27 #include <XAO_Step.hxx>
28 #include <XAO_Field.hxx>
29
30 #include <list>
31 #include <map>
32
33 class TopoDS_Shape;
34
35 class StudyData_XAO
36 {
37   TopoDS_Shape* myShape; ///< the shape, part of XAO
38   XAO::Xao* myExport; ///< the XAO instance for export
39   XAO::Xao* myImport; ///< the XAO instance for export
40   std::map<int, XAO::Group*> myGroups; ///< id of group to the group structure
41   std::map<int, XAO::Field*> myFields; ///< id of field to the field structure
42   std::map<int, std::map<int, XAO::Step*> > mySteps; ///< id of field to the field structure
43   int myCurrentElementID; ///< to add elements of step one by one
44   XAO::stepIterator myStepIterator; ///< contains a current steps iterator (on import)
45
46 public:
47   StudyData_EXPORT StudyData_XAO();
48
49   // defines the shape for XAO export
50   StudyData_EXPORT void SetShape(const long long theShapePtr);
51
52   // add a new group for export to XAO; returns id of this group
53   StudyData_EXPORT int AddGroup(const int theSelType, const std::string theGroupName);
54   // sets the selection for an already added group
55   StudyData_EXPORT void AddGroupSelection(const int theGroupID, const int theSelection);
56
57   // add a new field for export to XAO; returns id of this field
58   StudyData_EXPORT int AddField(const int theValType, const int theSelType,
59                                 const int theCompsNum, const std::string theFieldName);
60   // set the component name for the exported field
61   StudyData_EXPORT void SetFieldComponent(const int theFieldID, const int theCompIndex,
62                                           const std::string theCompName);
63   // adds a step to the exported field
64   StudyData_EXPORT void AddStep(const int theFieldID, const int theStepID, const int theStampID);
65   // adds the value to the step of the exported field. values must come one by one (row by row)
66   StudyData_EXPORT void AddStepValue(
67     const int theFieldID, const int theStepID, std::string theValue);
68
69   // performs the export to XAO
70   StudyData_EXPORT void Export(const std::string theFileName);
71
72   // Imports the XAO data, returns the error string or empty one if it is ok.
73   StudyData_EXPORT std::string Import(const std::string theFileName);
74
75   // Returns a pointer to the shape from XAO after import
76   StudyData_EXPORT long long GetShape();
77
78   // Returns a selection type of the group
79   StudyData_EXPORT int GetGroupDimension(const int theGroupID);
80
81   // Returns a selection list of indices of the group
82   StudyData_EXPORT std::list<long> GetGroupSelection(const int theGroupID);
83
84   // Returns a value type of the imported field
85   StudyData_EXPORT int GetValuesType(const int theFieldID);
86   // Returns a selection type of the imported field
87   StudyData_EXPORT int GetSelectionType(const int theFieldID);
88   // Returns components names of the imported field
89   StudyData_EXPORT std::list<std::string> GetComponents(const int theFieldID);
90   // Starts iteration of steps
91   StudyData_EXPORT void BeginSteps(const int theFieldID);
92   // Returns true if steps iteration contains a current step
93   StudyData_EXPORT bool More(const int theFieldID);
94   // Iterates the step iterator contains a current step
95   StudyData_EXPORT void Next();
96   // Returns a stamp ID of the imported field step
97   StudyData_EXPORT int GetStamp();
98   // Returns a step ID of the imported field step
99   StudyData_EXPORT int GetStepIndex();
100   // Returns string values of the imported field step
101   StudyData_EXPORT std::list<std::string> GetValues();
102 };
103
104 #endif // !StudyData_XAO_H