Salome HOME
Modified a method createAndDisplayGO
[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 "GEOM_Object.hxx"
7 #include "GEOM_DataMapOfAsciiStringTransient.hxx"
8
9 #include <Interface_DataMapOfIntegerTransient.hxx> 
10 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
11 #include <TDocStd_Document.hxx>
12 #include <TColStd_HArray1OfInteger.hxx>
13 #include <TColStd_HSequenceOfAsciiString.hxx>
14
15 class GEOM_Engine
16 {
17  public:
18   Standard_EXPORT GEOM_Engine();
19   Standard_EXPORT ~GEOM_Engine() { _mapIDDocument.Clear(); _objects.Clear(); }
20
21   //Retuns the engine    
22   Standard_EXPORT static GEOM_Engine* GetEngine();   
23
24   //Returns the OCAF document by its ID, if document doesn't exists it will be created
25   Standard_EXPORT Handle(TDocStd_Document) GetDocument(int theDocID);
26
27   //Returns the ID of the given OCAF document
28   Standard_EXPORT int GetDocID(Handle(TDocStd_Document) theDocument);
29   
30   //Returns the OCAF appliaction
31   Standard_EXPORT Handle(TDocStd_Application) GetApplication() { return _OCAFApp; }
32
33   //Returns a pointer to GEOM_Object defined by a document and the entry
34   Standard_EXPORT Handle(GEOM_Object) GetObject(int theDocID, char* theEntry);
35   
36   //Adds a new object of the type theType in the OCAF document
37   Standard_EXPORT Handle(GEOM_Object) AddObject(int theDocID, int theType);
38
39   //Removes the object from the OCAF document
40   Standard_EXPORT bool RemoveObject(Handle(GEOM_Object) theObject);  
41
42   //Saves the OCAF document with ID = theDocID with file with name theFileName
43   Standard_EXPORT bool Save(int theDocID, char* theFileName);
44   
45   //Loads the OCAF document into the application and assigns to it an ID = theDocID
46   Standard_EXPORT bool Load(int theDocID, char* theFileName);
47
48   //Closes the document with ID =  theDocID
49   Standard_EXPORT void Close(int theDocID);
50
51   //Sets the number of Undos (default value = 10)
52   Standard_EXPORT void SetUndoLimit(int theLimit) { _UndoLimit = theLimit; }
53
54   //Applies an Undo to document with ID = theDocID
55   Standard_EXPORT void Undo(int theDocID);
56
57   //Applies an Redo to document with ID = theDocID
58   Standard_EXPORT void Redo(int theDocID);
59
60   //Adds a new sub shape object of the MainShape object
61   Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, 
62                                   Handle(TColStd_HArray1OfInteger) theIndices,
63                                   bool isStandaloneOperation = false);
64
65   Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, 
66                                      Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
67                                      bool isPublished, 
68                                      bool& aValidScript);
69
70   Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const;
71
72   Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const;
73
74  protected:
75   Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine);       
76
77  private:
78
79   Handle(GEOM_Application)  _OCAFApp;
80   Interface_DataMapOfIntegerTransient _mapIDDocument;
81   int _UndoLimit;
82   GEOM_DataMapOfAsciiStringTransient _objects;
83
84   Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap;
85 };
86
87 #endif