]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM/GEOM_Engine.hxx
Salome HOME
3db976f6e43694451f91d24c66f089b926933492
[modules/geom.git] / src / GEOM / GEOM_Engine.hxx
1
2 #ifndef _GEOM_Engine_HXX_
3 #define _GEOM_Engine_HXX_
4
5 #include "GEOM_Application.hxx"
6 #include <Interface_DataMapOfIntegerTransient.hxx> 
7 #include <TDF_Label.hxx>
8 #include <TDocStd_Document.hxx>
9 #include "GEOM_Object.hxx"
10 #include <TColStd_HArray1OfInteger.hxx>
11 #include <TopAbs.hxx>
12
13 #include "GEOM_DataMapOfAsciiStringTransient.hxx"
14
15 class GEOM_Engine
16 {
17  public:
18   GEOM_Engine();
19   ~GEOM_Engine() { _mapIDDocument.Clear(); _objects.Clear(); }
20
21   //Retuns the engine    
22   static GEOM_Engine* GetEngine();   
23
24   //Returns the OCAF document by its ID, if document doesn't exists it will be created
25   Handle(TDocStd_Document) GetDocument(int theDocID);
26
27   //Returns the ID of the given OCAF document
28   int GetDocID(Handle(TDocStd_Document) theDocument);
29   
30   //Returns the OCAF appliaction
31   Handle(TDocStd_Application) GetApplication() { return _OCAFApp; }
32
33   //Returns a pointer to GEOM_Object defined by a document and the entry
34   Handle(GEOM_Object) GetObject(int theDocID, char* theEntry);
35   
36   //Adds a new object of the type theType in the OCAF document
37   Handle(GEOM_Object) AddObject(int theDocID, int theType);
38
39   //Removes the object from the OCAF document
40   bool RemoveObject(Handle(GEOM_Object) theObject);  
41
42   //Saves the OCAF document with ID = theDocID with file with name theFileName
43   bool Save(int theDocID, char* theFileName);
44   
45   //Loads the OCAF document into the application and assigns to it an ID = theDocID
46   bool Load(int theDocID, char* theFileName);
47
48   //Closes the document with ID =  theDocID
49   void Close(int theDocID);
50
51   //Sets the number of Undos (default value = 10)
52   void SetUndoLimit(int theLimit) { _UndoLimit = theLimit; }
53
54   //Applies an Undo to document with ID = theDocID
55   void Undo(int theDocID);
56
57   //Applies an Redo to document with ID = theDocID
58   void Redo(int theDocID);
59
60   //Adds a new sub shape object of the MainShape object
61   Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices);
62
63  protected:
64   static void SetEngine(GEOM_Engine* theEngine);       
65
66  private:
67
68   Handle(GEOM_Application)  _OCAFApp;
69   Interface_DataMapOfIntegerTransient _mapIDDocument;
70   int _UndoLimit;
71   GEOM_DataMapOfAsciiStringTransient _objects;
72 };
73
74 #endif