Salome HOME
ENV: Windows porting.
[modules/geom.git] / src / GEOM / GEOM_IOperations.cxx
1 #include <Standard_Stream.hxx>
2
3 #include <GEOM_IOperations.hxx>
4
5 #include "utilities.h"
6 #include <OpUtil.hxx>
7 #include <Utils_ExceptHandlers.hxx>
8
9 #include <TDataStd_TreeNode.hxx>
10 #include <TDataStd_ChildNodeIterator.hxx>
11 #include <TDF_TagSource.hxx>
12
13 //=============================================================================
14 /*!
15  *  default constructor:
16  */
17 //=============================================================================
18
19 GEOM_IOperations::GEOM_IOperations(GEOM_Engine* theEngine, int theDocID)
20 : _engine(theEngine), _docID(theDocID)
21 {
22   _solver = new GEOM_Solver(theEngine);
23 }
24
25 //=============================================================================
26 /*!
27  *  destructor
28  */
29 //=============================================================================
30
31 GEOM_IOperations::~GEOM_IOperations()
32 {
33   delete _solver;
34   MESSAGE("GEOM_IOperations::~GEOM_IOperations");
35 }
36
37
38 //=============================================================================
39 /*!
40  *  StartOperation
41  */  
42 //=============================================================================   
43 void GEOM_IOperations::StartOperation()
44 {
45   Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID);
46   if(aDoc->GetUndoLimit() > 0) 
47     aDoc->NewCommand();
48 }
49
50  //=============================================================================
51  /*!
52   *  FinishOperation
53   */
54 //=============================================================================      
55 void GEOM_IOperations::FinishOperation()
56 {
57   Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID);
58   if(aDoc->GetUndoLimit() > 0) 
59     aDoc->CommitCommand();
60 }
61
62 //=============================================================================
63 /*!
64  *  AbortOperation
65  */
66 //=============================================================================   
67 void GEOM_IOperations::AbortOperation()
68 {
69   Handle(TDocStd_Document) aDoc = _engine->GetDocument(_docID);
70   aDoc->AbortCommand();
71 }
72    
73    
74 //=============================================================================
75 /*!
76  *  IsDone
77  */
78 //=============================================================================
79 bool GEOM_IOperations::IsDone()
80 {
81   return (_errorCode == OK);
82 }  
83
84