Salome HOME
0014047: EDF PAL 334 : Problem to select merged face with Create group window
[modules/geom.git] / src / GEOM / GEOM_Engine.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20
21 #ifndef _GEOM_Engine_HXX_
22 #define _GEOM_Engine_HXX_
23
24 #include "GEOM_Application.hxx"
25 #include "GEOM_Object.hxx"
26 #include "GEOM_DataMapOfAsciiStringTransient.hxx"
27
28 #include <Interface_DataMapOfIntegerTransient.hxx> 
29 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
30 #include <TDocStd_Document.hxx>
31 #include <TColStd_HArray1OfInteger.hxx>
32 #include <TColStd_HSequenceOfAsciiString.hxx>
33 #include <TDF_Label.hxx>
34
35 class GEOM_Engine
36 {
37  public:
38   Standard_EXPORT GEOM_Engine();
39   Standard_EXPORT virtual ~GEOM_Engine();
40
41   //Retuns the engine    
42   Standard_EXPORT static GEOM_Engine* GetEngine();   
43
44   //Returns the OCAF document by its ID, if document doesn't exists it will be created
45   Standard_EXPORT Handle(TDocStd_Document) GetDocument(int theDocID);
46
47   //Returns the ID of the given OCAF document
48   Standard_EXPORT int GetDocID(Handle(TDocStd_Document) theDocument);
49   
50   //Returns the OCAF appliaction
51   Standard_EXPORT Handle(TDocStd_Application) GetApplication() { return _OCAFApp; }
52
53   //Returns a pointer to GEOM_Object defined by a document and the entry
54   Standard_EXPORT Handle(GEOM_Object) GetObject(int theDocID, char* theEntry);
55   
56   //Adds a new object of the type theType in the OCAF document
57   Standard_EXPORT Handle(GEOM_Object) AddObject(int theDocID, int theType);
58
59   //Removes the object from the OCAF document
60   Standard_EXPORT bool RemoveObject(Handle(GEOM_Object) theObject);  
61
62   //Saves the OCAF document with ID = theDocID with file with name theFileName
63   Standard_EXPORT bool Save(int theDocID, char* theFileName);
64   
65   //Loads the OCAF document into the application and assigns to it an ID = theDocID
66   Standard_EXPORT bool Load(int theDocID, char* theFileName);
67
68   //Closes the document with ID =  theDocID
69   Standard_EXPORT void Close(int theDocID);
70
71   //Sets the number of Undos (default value = 10)
72   Standard_EXPORT void SetUndoLimit(int theLimit) { _UndoLimit = theLimit; }
73
74   //Applies an Undo to document with ID = theDocID
75   Standard_EXPORT void Undo(int theDocID);
76
77   //Applies an Redo to document with ID = theDocID
78   Standard_EXPORT void Redo(int theDocID);
79
80   //Adds a new sub shape object of the MainShape object
81   Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, 
82                                   Handle(TColStd_HArray1OfInteger) theIndices,
83                                   bool isStandaloneOperation = false);
84
85   Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, 
86                                      Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
87                                      bool isPublished, 
88                                      bool& aValidScript);
89
90   Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const;
91
92   Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const;
93
94  protected:
95   Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine);       
96
97  private:
98
99   Handle(GEOM_Application)  _OCAFApp;
100   Interface_DataMapOfIntegerTransient _mapIDDocument;
101   int _UndoLimit;
102   GEOM_DataMapOfAsciiStringTransient _objects;
103
104   Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap;
105
106   TDF_Label _lastCleared;
107 };
108
109 #endif