]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM/GEOM_Engine.hxx
Salome HOME
Update copyright information
[modules/geom.git] / src / GEOM / GEOM_Engine.hxx
1 //  Copyright (C) 2007-2008  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.
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 #ifndef _GEOM_Engine_HXX_
23 #define _GEOM_Engine_HXX_
24
25 #include "GEOM_Application.hxx"
26 #include "GEOM_Object.hxx"
27 #include "GEOM_DataMapOfAsciiStringTransient.hxx"
28
29 #include <Interface_DataMapOfIntegerTransient.hxx> 
30 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
31 #include <TDocStd_Document.hxx>
32 #include <TColStd_HArray1OfInteger.hxx>
33 #include <TColStd_HSequenceOfAsciiString.hxx>
34 #include <TDF_Label.hxx>
35
36 class GEOM_Engine
37 {
38  public:
39   Standard_EXPORT GEOM_Engine();
40   Standard_EXPORT virtual ~GEOM_Engine();
41
42   //Retuns the engine    
43   Standard_EXPORT static GEOM_Engine* GetEngine();   
44
45   //Returns the OCAF document by its ID, if document doesn't exists it will be created
46   Standard_EXPORT Handle(TDocStd_Document) GetDocument(int theDocID);
47
48   //Returns the ID of the given OCAF document
49   Standard_EXPORT int GetDocID(Handle(TDocStd_Document) theDocument);
50   
51   //Returns the OCAF appliaction
52   Standard_EXPORT Handle(TDocStd_Application) GetApplication() { return _OCAFApp; }
53
54   //Returns a pointer to GEOM_Object defined by a document and the entry
55   Standard_EXPORT Handle(GEOM_Object) GetObject(int theDocID, char* theEntry);
56   
57   //Adds a new object of the type theType in the OCAF document
58   Standard_EXPORT Handle(GEOM_Object) AddObject(int theDocID, int theType);
59
60   //Removes the object from the OCAF document
61   Standard_EXPORT bool RemoveObject(Handle(GEOM_Object) theObject);  
62
63   //Saves the OCAF document with ID = theDocID with file with name theFileName
64   Standard_EXPORT bool Save(int theDocID, char* theFileName);
65   
66   //Loads the OCAF document into the application and assigns to it an ID = theDocID
67   Standard_EXPORT bool Load(int theDocID, char* theFileName);
68
69   //Closes the document with ID =  theDocID
70   Standard_EXPORT void Close(int theDocID);
71
72   //Sets the number of Undos (default value = 10)
73   Standard_EXPORT void SetUndoLimit(int theLimit) { _UndoLimit = theLimit; }
74
75   //Applies an Undo to document with ID = theDocID
76   Standard_EXPORT void Undo(int theDocID);
77
78   //Applies an Redo to document with ID = theDocID
79   Standard_EXPORT void Redo(int theDocID);
80
81   //Adds a new sub shape object of the MainShape object
82   Standard_EXPORT Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, 
83                                   Handle(TColStd_HArray1OfInteger) theIndices,
84                                   bool isStandaloneOperation = false);
85
86   Standard_EXPORT TCollection_AsciiString DumpPython(int theDocID, 
87                                      Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
88                                      bool isPublished, 
89                                      bool& aValidScript);
90
91   Standard_EXPORT const char* GetDumpName (const char* theStudyEntry) const;
92
93   Standard_EXPORT Handle(TColStd_HSequenceOfAsciiString) GetAllDumpNames() const;
94
95  protected:
96   Standard_EXPORT static void SetEngine(GEOM_Engine* theEngine);       
97
98  private:
99
100   Handle(GEOM_Application)  _OCAFApp;
101   Interface_DataMapOfIntegerTransient _mapIDDocument;
102   int _UndoLimit;
103   GEOM_DataMapOfAsciiStringTransient _objects;
104
105   Resource_DataMapOfAsciiStringAsciiString _studyEntry2NameMap;
106
107   TDF_Label _lastCleared;
108 };
109
110 #endif