Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/geom.git] / src / GEOMBase / GEOM_Operation.cxx
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 // GEOM GEOMGUI : GUI for Geometry component
23 // File   : GEOM_Operation.cxx
24 // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
25 //
26 #include "GEOM_Operation.h"
27
28 #include <SUIT_Application.h>
29 #include <SalomeApp_Tools.h>
30
31
32 //================================================================
33 // Function : GEOM_Operation
34 // Purpose  : 
35 //================================================================
36 GEOM_Operation::GEOM_Operation( SUIT_Application* app, GEOM::GEOM_IOperations_ptr oper )
37 : SUIT_Operation( app )
38 {
39   myIOperation = GEOM::GEOM_IOperations::_narrow( oper );
40 }
41
42 //================================================================
43 // Function : ~GEOM_Operation
44 // Purpose  : 
45 //================================================================
46 GEOM_Operation::~GEOM_Operation()
47 {
48 }
49
50 //================================================================
51 // Function : onStartOperation()
52 // Purpose  : Opens an internal transaction in GEOM engine
53 //================================================================
54 void GEOM_Operation::startOperation()
55 {
56   SUIT_Operation::startOperation();
57
58   if ( !myIOperation->_is_nil() ) {
59     try {
60       myIOperation->StartOperation();
61     }
62     catch ( const SALOME::SALOME_Exception& e ) {
63       SalomeApp_Tools:: QtCatchCorbaException( e );
64     }
65   }
66 }
67
68 //================================================================
69 // Function : onFinishOperation
70 // Purpose  : Commits an internal transaction in GEOM engine
71 //================================================================
72 void GEOM_Operation::commitOperation()
73 {
74   SUIT_Operation::commitOperation();
75
76   if ( !myIOperation->_is_nil() ) {
77     try {
78       myIOperation->FinishOperation();
79     }
80     catch ( const SALOME::SALOME_Exception& e ) {
81       SalomeApp_Tools:: QtCatchCorbaException( e );
82     }
83   }
84 }
85
86 //================================================================
87 // Function : onSuspendOperation
88 // Purpose  : 
89 //================================================================
90 void GEOM_Operation::suspendOperation()
91 {
92   SUIT_Operation::suspendOperation();
93 }
94
95 //================================================================
96 // Function : onResumeOperation
97 // Purpose  : 
98 //================================================================
99 void GEOM_Operation::resumeOperation()
100 {
101   SUIT_Operation::resumeOperation();
102 }
103
104 //================================================================
105 // Function : onAbortOperation
106 // Purpose  : Aborts an internal transaction in GEOM engine
107 //================================================================
108 void GEOM_Operation::abortOperation()
109 {
110   SUIT_Operation::abortOperation();
111
112   if ( !myIOperation->_is_nil() ) {
113     try {
114       myIOperation->AbortOperation();
115     }
116     catch ( const SALOME::SALOME_Exception& e ) {
117       SalomeApp_Tools::QtCatchCorbaException( e );
118     }
119   }
120 }
121