1 #include <Standard_Stream.hxx>
3 #include "GEOM_I3DPrimOperations_i.hh"
7 #include "Utils_ExceptHandlers.hxx"
9 #include "GEOM_Engine.hxx"
10 #include "GEOM_Object.hxx"
12 //=============================================================================
16 //=============================================================================
17 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
18 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
20 MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
23 //=============================================================================
27 //=============================================================================
28 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
30 MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
34 //=============================================================================
38 //=============================================================================
39 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
43 GEOM::GEOM_Object_var aGEOMObject;
46 GetOperations()->SetNotDone();
49 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
50 if (!GetOperations()->IsDone() || anObject.IsNull())
51 return aGEOMObject._retn();
53 return GetObject(anObject);
56 //=============================================================================
60 //=============================================================================
61 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
62 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
64 GEOM::GEOM_Object_var aGEOMObject;
67 GetOperations()->SetNotDone();
69 if (thePnt1 == NULL || thePnt2 == NULL) return aGEOMObject._retn();
71 //Get the reference points
72 Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
73 (thePnt1->GetStudyID(), thePnt1->GetEntry());
74 Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
75 (thePnt2->GetStudyID(), thePnt2->GetEntry());
77 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
80 Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
81 if (!GetOperations()->IsDone() || anObject.IsNull())
82 return aGEOMObject._retn();
84 return GetObject(anObject);
87 //=============================================================================
91 //=============================================================================
92 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
95 GEOM::GEOM_Object_var aGEOMObject;
98 GetOperations()->SetNotDone();
100 //Create the Cylinder
101 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
102 if (!GetOperations()->IsDone() || anObject.IsNull())
103 return aGEOMObject._retn();
105 return GetObject(anObject);
108 //=============================================================================
110 * MakeCylinderPntVecRH
112 //=============================================================================
113 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
114 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
115 CORBA::Double theR, CORBA::Double theH)
117 GEOM::GEOM_Object_var aGEOMObject;
119 //Set a not done flag
120 GetOperations()->SetNotDone();
122 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
124 //Get the reference points
125 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
126 (thePnt->GetStudyID(), thePnt->GetEntry());
127 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
128 (theVec->GetStudyID(), theVec->GetEntry());
130 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
132 //Create the Cylinder
133 Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
134 if (!GetOperations()->IsDone() || anObject.IsNull())
135 return aGEOMObject._retn();
137 return GetObject(anObject);
140 //=============================================================================
144 //=============================================================================
145 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
149 GEOM::GEOM_Object_var aGEOMObject;
151 //Set a not done flag
152 GetOperations()->SetNotDone();
155 Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
156 if (!GetOperations()->IsDone() || anObject.IsNull())
157 return aGEOMObject._retn();
159 return GetObject(anObject);
162 //=============================================================================
164 * MakeConePntVecR1R2H
166 //=============================================================================
167 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
168 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
169 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
171 GEOM::GEOM_Object_var aGEOMObject;
173 //Set a not done flag
174 GetOperations()->SetNotDone();
176 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
178 //Get the reference points
179 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
180 (thePnt->GetStudyID(), thePnt->GetEntry());
181 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
182 (theVec->GetStudyID(), theVec->GetEntry());
184 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
187 Handle(GEOM_Object) anObject =
188 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
189 if (!GetOperations()->IsDone() || anObject.IsNull())
190 return aGEOMObject._retn();
192 return GetObject(anObject);
195 //=============================================================================
199 //=============================================================================
200 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
202 GEOM::GEOM_Object_var aGEOMObject;
204 //Set a not done flag
205 GetOperations()->SetNotDone();
208 Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
209 if (!GetOperations()->IsDone() || anObject.IsNull())
210 return aGEOMObject._retn();
212 return GetObject(anObject);
215 //=============================================================================
219 //=============================================================================
220 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
221 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
223 GEOM::GEOM_Object_var aGEOMObject;
225 //Set a not done flag
226 GetOperations()->SetNotDone();
228 if (thePnt == NULL) return aGEOMObject._retn();
230 //Get the reference point
231 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
232 (thePnt->GetStudyID(), thePnt->GetEntry());
234 if (aPnt.IsNull()) return aGEOMObject._retn();
237 Handle(GEOM_Object) anObject =
238 GetOperations()->MakeSpherePntR(aPnt, theR);
239 if (!GetOperations()->IsDone() || anObject.IsNull())
240 return aGEOMObject._retn();
242 return GetObject(anObject);
245 //=============================================================================
249 //=============================================================================
250 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
251 (CORBA::Double theRMajor, CORBA::Double theRMinor)
253 GEOM::GEOM_Object_var aGEOMObject;
255 //Set a not done flag
256 GetOperations()->SetNotDone();
259 Handle(GEOM_Object) anObject =
260 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
261 if (!GetOperations()->IsDone() || anObject.IsNull())
262 return aGEOMObject._retn();
264 return GetObject(anObject);
267 //=============================================================================
271 //=============================================================================
272 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
273 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
274 CORBA::Double theRMajor, CORBA::Double theRMinor)
276 GEOM::GEOM_Object_var aGEOMObject;
278 //Set a not done flag
279 GetOperations()->SetNotDone();
281 if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
283 //Get the reference points
284 Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
285 (thePnt->GetStudyID(), thePnt->GetEntry());
286 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
287 (theVec->GetStudyID(), theVec->GetEntry());
289 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
292 Handle(GEOM_Object) anObject =
293 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
294 if (!GetOperations()->IsDone() || anObject.IsNull())
295 return aGEOMObject._retn();
297 return GetObject(anObject);
300 //=============================================================================
304 //=============================================================================
305 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
306 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
309 GEOM::GEOM_Object_var aGEOMObject;
311 //Set a not done flag
312 GetOperations()->SetNotDone();
314 if (theBase == NULL || theVec == NULL) return aGEOMObject._retn();
316 //Get the reference objects
317 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
318 (theBase->GetStudyID(), theBase->GetEntry());
319 Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
320 (theVec->GetStudyID(), theVec->GetEntry());
322 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
325 Handle(GEOM_Object) anObject =
326 GetOperations()->MakePrismVecH(aBase, aVec, theH);
327 if (!GetOperations()->IsDone() || anObject.IsNull())
328 return aGEOMObject._retn();
330 return GetObject(anObject);
333 //=============================================================================
337 //=============================================================================
338 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
339 (GEOM::GEOM_Object_ptr theBase,
340 GEOM::GEOM_Object_ptr thePoint1,
341 GEOM::GEOM_Object_ptr thePoint2)
343 GEOM::GEOM_Object_var aGEOMObject;
345 //Set a not done flag
346 GetOperations()->SetNotDone();
348 if (theBase == NULL || thePoint1 == NULL || thePoint2 == NULL)
349 return aGEOMObject._retn();
351 //Get the reference objects
352 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
353 (theBase->GetStudyID(), theBase->GetEntry());
354 Handle(GEOM_Object) aPoint1 = GetOperations()->GetEngine()->GetObject
355 (thePoint1->GetStudyID(), thePoint1->GetEntry());
356 Handle(GEOM_Object) aPoint2 = GetOperations()->GetEngine()->GetObject
357 (thePoint2->GetStudyID(), thePoint2->GetEntry());
359 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
360 return aGEOMObject._retn();
363 Handle(GEOM_Object) anObject =
364 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
365 if (!GetOperations()->IsDone() || anObject.IsNull())
366 return aGEOMObject._retn();
368 return GetObject(anObject);
371 //=============================================================================
375 //=============================================================================
376 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
377 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
379 GEOM::GEOM_Object_var aGEOMObject;
381 //Set a not done flag
382 GetOperations()->SetNotDone();
384 if (theBase == NULL || thePath == NULL) return aGEOMObject._retn();
386 //Get the reference objects
387 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
388 (theBase->GetStudyID(), theBase->GetEntry());
389 Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
390 (thePath->GetStudyID(), thePath->GetEntry());
392 if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
395 Handle(GEOM_Object) anObject =
396 GetOperations()->MakePipe(aBase, aPath);
397 if (!GetOperations()->IsDone() || anObject.IsNull())
398 return aGEOMObject._retn();
400 return GetObject(anObject);
403 //=============================================================================
405 * MakeRevolutionAxisAngle
407 //=============================================================================
408 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
409 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
410 CORBA::Double theAngle)
412 GEOM::GEOM_Object_var aGEOMObject;
414 //Set a not done flag
415 GetOperations()->SetNotDone();
417 if (theBase == NULL || theAxis == NULL) return aGEOMObject._retn();
419 //Get the reference objects
420 Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->GetObject
421 (theBase->GetStudyID(), theBase->GetEntry());
422 Handle(GEOM_Object) anAxis = GetOperations()->GetEngine()->GetObject
423 (theAxis->GetStudyID(), theAxis->GetEntry());
425 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
427 //Create the Revolution
428 Handle(GEOM_Object) anObject =
429 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
430 if (!GetOperations()->IsDone() || anObject.IsNull())
431 return aGEOMObject._retn();
433 return GetObject(anObject);
436 //=============================================================================
440 //=============================================================================
441 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
442 CORBA::Long theMinDeg,
443 CORBA::Long theMaxDeg,
444 CORBA::Double theTol2D,
445 CORBA::Double theTol3D,
446 CORBA::Long theNbIter)
448 GEOM::GEOM_Object_var aGEOMObject;
450 //Set a not done flag
451 GetOperations()->SetNotDone();
453 if (theShape == NULL) return aGEOMObject._retn();
455 //Get the reference objects
456 Handle(GEOM_Object) aShape = GetOperations()->GetEngine()->GetObject
457 (theShape->GetStudyID(), theShape->GetEntry());
459 if (aShape.IsNull()) return aGEOMObject._retn();
462 Handle(GEOM_Object) anObject = GetOperations()->MakeFilling(aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter);
463 if (!GetOperations()->IsDone() || anObject.IsNull())
464 return aGEOMObject._retn();
466 return GetObject(anObject);