Salome HOME
IMPs 19766 (Wire from unconnected edges) and 20004 (NumberOfSolids)
[modules/geom.git] / src / GEOM_I / GEOM_IOperations_i.cc
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 #include "GEOM_IOperations_i.hh"
23
24 #include "GEOM_Engine.hxx"
25
26 #include "utilities.h"
27 #include "OpUtil.hxx"
28 #include "Utils_ExceptHandlers.hxx"
29
30 #include <Standard_Stream.hxx>
31 #include <TCollection_AsciiString.hxx>
32 #include <TDF_Tool.hxx>
33
34 //=============================================================================
35 /*!
36  *  default constructor:
37  */
38 //=============================================================================
39
40 GEOM_IOperations_i::GEOM_IOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOM_IOperations* theImpl)
41 :SALOME::GenericObj_i( thePOA ), _impl(theImpl), _engine(theEngine)
42 {
43 }
44
45 //=============================================================================
46 /*!
47  *  destructor
48  */
49 //=============================================================================
50
51 GEOM_IOperations_i::~GEOM_IOperations_i()
52 {}
53
54
55 //=============================================================================
56 /*!
57  *  IsDone
58  */
59 //=============================================================================
60 CORBA::Boolean GEOM_IOperations_i::IsDone()
61 {
62   return _impl->IsDone();
63 }
64
65
66 //=============================================================================
67 /*!
68  *  SetErrorCode
69  */
70 //=============================================================================
71 void GEOM_IOperations_i::SetErrorCode(const char* theErrorCode)
72 {
73   _impl->SetErrorCode((char*)theErrorCode);
74 }
75
76 //=============================================================================
77 /*!
78  *  GetErrorCode
79  */
80 //=============================================================================
81 char* GEOM_IOperations_i::GetErrorCode()
82 {
83   return CORBA::string_dup(_impl->GetErrorCode());
84 }
85
86 //=============================================================================
87 /*!
88  *  GetStudyID
89  */
90 //=============================================================================
91 CORBA::Long GEOM_IOperations_i::GetStudyID()
92 {
93   return _impl->GetDocID();
94 }
95
96 //=============================================================================
97 /*!
98  *  StartOperation
99  */
100 //=============================================================================
101 void GEOM_IOperations_i::StartOperation()
102 {
103   _impl->StartOperation();
104 }
105
106 //=============================================================================
107 /*!
108  *  FinishOperation
109  */
110 //=============================================================================
111 void GEOM_IOperations_i::FinishOperation()
112 {
113   _impl->FinishOperation();
114 }
115
116
117 //=============================================================================
118 /*!
119  *  AbortOperation
120  */
121 //=============================================================================
122 void GEOM_IOperations_i::AbortOperation()
123 {
124   _impl->AbortOperation();
125 }
126
127 //=============================================================================
128 /*!
129  *  GetObject
130  */
131 //=============================================================================
132 GEOM::GEOM_Object_ptr GEOM_IOperations_i::GetObject(Handle(GEOM_Object) theObject)
133 {
134   GEOM::GEOM_Object_var GO;
135   if (theObject.IsNull()) return GO._retn();
136   TCollection_AsciiString anEntry;
137   TDF_Tool::Entry(theObject->GetEntry(), anEntry);
138   GO = _engine->GetObject(theObject->GetDocID(), anEntry.ToCString());
139   return GO._retn();
140 }
141
142 //=============================================================================
143 /*!
144  *  GetObjectImpl
145  */
146 //=============================================================================
147 Handle(GEOM_Object) GEOM_IOperations_i::GetObjectImpl(GEOM::GEOM_Object_ptr theObject)
148 {
149   Handle(GEOM_Object) anImpl;
150   if (!CORBA::is_nil(theObject)) {
151     CORBA::String_var anEntry = theObject->GetEntry();
152     anImpl = GetImpl()->GetEngine()->GetObject
153       (theObject->GetStudyID(), anEntry);
154   }
155   return anImpl;
156 }