1 #include <Standard_Stream.hxx>
3 #include "GEOM_ILocalOperations_i.hh"
7 #include "Utils_ExceptHandlers.hxx"
9 #include "GEOM_Engine.hxx"
10 #include "GEOM_Object.hxx"
12 //=============================================================================
16 //=============================================================================
17 GEOM_ILocalOperations_i::GEOM_ILocalOperations_i (PortableServer::POA_ptr thePOA,
18 GEOM::GEOM_Gen_ptr theEngine,
19 ::GEOMImpl_ILocalOperations* theImpl)
20 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
22 MESSAGE("GEOM_ILocalOperations_i::GEOM_ILocalOperations_i");
25 //=============================================================================
29 //=============================================================================
30 GEOM_ILocalOperations_i::~GEOM_ILocalOperations_i()
32 MESSAGE("GEOM_ILocalOperations_i::~GEOM_ILocalOperations_i");
36 //=============================================================================
40 //=============================================================================
41 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletAll
42 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR)
44 GEOM::GEOM_Object_var aGEOMObject;
46 if (theShape == NULL) return aGEOMObject._retn();
48 //Get the reference shape
49 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
50 (theShape->GetStudyID(), theShape->GetEntry());
52 if (aShapeRef.IsNull()) return aGEOMObject._retn();
55 Handle(GEOM_Object) anObject =
56 GetOperations()->MakeFilletAll(aShapeRef, theR);
57 if (!GetOperations()->IsDone() || anObject.IsNull())
58 return aGEOMObject._retn();
60 return GetObject(anObject);
63 //=============================================================================
67 //=============================================================================
68 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletEdges
69 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
70 const GEOM::ListOfLong& theEdges)
72 GEOM::GEOM_Object_var aGEOMObject;
74 if (theShape == NULL) return aGEOMObject._retn();
76 //Get the reference shape
77 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
78 (theShape->GetStudyID(), theShape->GetEntry());
79 if (aShapeRef.IsNull()) return aGEOMObject._retn();
81 //Get the reference edges
83 int aLen = theEdges.length();
85 for (; ind < aLen; ind++) {
86 anEdges.push_back(theEdges[ind]);
90 Handle(GEOM_Object) anObject =
91 GetOperations()->MakeFilletEdges(aShapeRef, theR, anEdges);
92 if (!GetOperations()->IsDone() || anObject.IsNull())
93 return aGEOMObject._retn();
95 return GetObject(anObject);
98 //=============================================================================
102 //=============================================================================
103 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFaces
104 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
105 const GEOM::ListOfLong& theFaces)
107 GEOM::GEOM_Object_var aGEOMObject;
109 if (theShape == NULL) return aGEOMObject._retn();
111 //Get the reference shape
112 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
113 (theShape->GetStudyID(), theShape->GetEntry());
114 if (aShapeRef.IsNull()) return aGEOMObject._retn();
116 //Get the reference faces
118 int aLen = theFaces.length();
120 for (; ind < aLen; ind++) {
121 aFaces.push_back(theFaces[ind]);
125 Handle(GEOM_Object) anObject =
126 GetOperations()->MakeFilletFaces(aShapeRef, theR, aFaces);
127 if (!GetOperations()->IsDone() || anObject.IsNull())
128 return aGEOMObject._retn();
130 return GetObject(anObject);
133 //=============================================================================
137 //=============================================================================
138 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferAll
139 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD)
141 GEOM::GEOM_Object_var aGEOMObject;
143 if (theShape == NULL) return aGEOMObject._retn();
145 //Get the reference shape
146 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
147 (theShape->GetStudyID(), theShape->GetEntry());
149 if (aShapeRef.IsNull()) return aGEOMObject._retn();
152 Handle(GEOM_Object) anObject =
153 GetOperations()->MakeChamferAll(aShapeRef, theD);
154 if (!GetOperations()->IsDone() || anObject.IsNull())
155 return aGEOMObject._retn();
157 return GetObject(anObject);
160 //=============================================================================
164 //=============================================================================
165 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferEdge
166 (GEOM::GEOM_Object_ptr theShape,
167 CORBA::Double theD1, CORBA::Double theD2,
168 CORBA::Long theFace1, CORBA::Long theFace2)
170 GEOM::GEOM_Object_var aGEOMObject;
172 if (theShape == NULL) return aGEOMObject._retn();
174 //Get the reference shape
175 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
176 (theShape->GetStudyID(), theShape->GetEntry());
177 if (aShapeRef.IsNull()) return aGEOMObject._retn();
180 Handle(GEOM_Object) anObject =
181 GetOperations()->MakeChamferEdge(aShapeRef, theD1, theD2, theFace1, theFace2);
182 if (!GetOperations()->IsDone() || anObject.IsNull())
183 return aGEOMObject._retn();
185 return GetObject(anObject);
188 //=============================================================================
192 //=============================================================================
193 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeChamferFaces
194 (GEOM::GEOM_Object_ptr theShape,
195 CORBA::Double theD1, CORBA::Double theD2,
196 const GEOM::ListOfLong& theFaces)
198 GEOM::GEOM_Object_var aGEOMObject;
200 if (theShape == NULL) return aGEOMObject._retn();
202 //Get the reference shape
203 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
204 (theShape->GetStudyID(), theShape->GetEntry());
205 if (aShapeRef.IsNull()) return aGEOMObject._retn();
207 //Get the reference faces
209 int aLen = theFaces.length();
211 for (; ind < aLen; ind++) {
212 aFaces.push_back(theFaces[ind]);
216 Handle(GEOM_Object) anObject =
217 GetOperations()->MakeChamferFaces(aShapeRef, theD1, theD2, aFaces);
218 if (!GetOperations()->IsDone() || anObject.IsNull())
219 return aGEOMObject._retn();
221 return GetObject(anObject);
224 //=============================================================================
228 //=============================================================================
229 GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeArchimede (GEOM::GEOM_Object_ptr theShape,
230 CORBA::Double theWeight,
231 CORBA::Double theWaterDensity,
232 CORBA::Double theMeshingDeflection)
234 GEOM::GEOM_Object_var aGEOMObject;
236 if (theShape == NULL) return aGEOMObject._retn();
238 //Get the reference shape
239 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
240 (theShape->GetStudyID(), theShape->GetEntry());
241 if (aShapeRef.IsNull()) return aGEOMObject._retn();
243 //Create the Archimede
244 Handle(GEOM_Object) anObject = GetOperations()->MakeArchimede
245 (aShapeRef, theWeight, theWaterDensity, theMeshingDeflection);
246 if (!GetOperations()->IsDone() || anObject.IsNull())
247 return aGEOMObject._retn();
249 return GetObject(anObject);
252 //=============================================================================
256 //=============================================================================
257 CORBA::Long GEOM_ILocalOperations_i::GetSubShapeIndex
258 (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theSubShape)
260 if (theShape == NULL || theSubShape == NULL) return -1;
262 //Get the reference shapes
263 Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
264 (theShape->GetStudyID(), theShape->GetEntry());
265 Handle(GEOM_Object) aSubShapeRef = GetOperations()->GetEngine()->GetObject
266 (theSubShape->GetStudyID(), theSubShape->GetEntry());
267 if (aShapeRef.IsNull() || aSubShapeRef.IsNull()) return -1;
269 //Get the unique ID of <theSubShape> inside <theShape>
270 CORBA::Long anID = GetOperations()->GetSubShapeIndex(aShapeRef, aSubShapeRef);
271 if (!GetOperations()->IsDone())