Salome HOME
Implementation of python dump of SHAPER STUDY for results and groups using XAO file...
[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
28 #include <list>
29 #include <map>
30
31 class TopoDS_Shape;
32
33 class StudyData_XAO
34 {
35   TopoDS_Shape* myShape; ///< the shape, part of XAO
36   XAO::Xao* myExport; ///< the XAO instance for export
37   XAO::Xao* myImport; ///< the XAO instance for export
38   std::map<int, XAO::Group*> myGroups; ///< id of group to the group structure
39
40 public:
41   StudyData_EXPORT StudyData_XAO();
42
43   // defines the shape for XAO export
44   StudyData_EXPORT void SetShape(const long long theShapePtr);
45
46   // add a new group for export to XAO; returns id of this group
47   StudyData_EXPORT int AddGroup(const int theSelType, const std::string theGroupName);
48   // sets the selection for an already added group
49   StudyData_EXPORT void AddGroupSelection(const int theGroupID, const int theSelection);
50
51   // performs the export to XAO
52   StudyData_EXPORT void Export(const std::string theFileName);
53
54   // Imports the XAO data, returns the error string or empty one if it is ok.
55   StudyData_EXPORT std::string Import(const std::string theFileName);
56
57   // Returns a pointer to the shape from XAO after import
58   StudyData_EXPORT long long GetShape();
59
60   // Returns a selection type of the group
61   StudyData_EXPORT int GetGroupDimension(const int theGroupID);
62
63   // Returns a selection list of indices of the group
64   StudyData_EXPORT std::list<long> GetGroupSelection(const int theGroupID);
65 };
66
67 #endif // !StudyData_XAO_H