1 #include <Standard_Stream.hxx>
3 #include "GEOM_ITransformOperations_i.hh"
7 #include "Utils_ExceptHandlers.hxx"
9 #include <TDF_Label.hxx>
10 #include <TDF_Tool.hxx>
11 #include <TCollection_AsciiString.hxx>
12 #include "GEOM_Engine.hxx"
13 #include "GEOM_Object.hxx"
15 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
17 //=============================================================================
21 //=============================================================================
23 GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
24 GEOM::GEOM_Gen_ptr theEngine,
25 ::GEOMImpl_ITransformOperations* theImpl)
26 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
28 MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i");
31 //=============================================================================
35 //=============================================================================
37 GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i()
39 MESSAGE("GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i");
43 //=============================================================================
47 //=============================================================================
48 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints
49 (GEOM::GEOM_Object_ptr theObject,
50 GEOM::GEOM_Object_ptr thePoint1,
51 GEOM::GEOM_Object_ptr thePoint2)
54 GetOperations()->SetNotDone();
55 GEOM::GEOM_Object_var aGEOMObject;
57 if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn();
59 //check if the object is a subshape
60 if(!theObject->IsMainShape()) {
61 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
62 return aGEOMObject._retn();
65 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
67 //Get the object itself
68 Handle(GEOM_Object) anObject =
69 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
70 if (anObject.IsNull()) return aGEOMObject._retn();
72 //Get the first point of translation
73 Handle(GEOM_Object) aPoint1 =
74 GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), thePoint1->GetEntry());
75 if (aPoint1.IsNull()) return aGEOMObject._retn();
77 //Get the second point of translation
78 Handle(GEOM_Object) aPoint2 =
79 GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), thePoint2->GetEntry());
80 if (aPoint2.IsNull()) return aGEOMObject._retn();
82 //Perform the translation
83 GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
85 return aGEOMObject._retn();
88 //=============================================================================
90 * TranslateTwoPointsCopy
92 //=============================================================================
93 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy
94 (GEOM::GEOM_Object_ptr theObject,
95 GEOM::GEOM_Object_ptr thePoint1,
96 GEOM::GEOM_Object_ptr thePoint2)
98 GEOM::GEOM_Object_var aGEOMObject;
100 //Set a not done flag
101 GetOperations()->SetNotDone();
103 if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn();
105 //Get the object itself
106 Handle(GEOM_Object) aBasicObject =
107 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
108 if (aBasicObject.IsNull()) return aGEOMObject._retn();
110 //Get the first point of translation
111 Handle(GEOM_Object) aPoint1 =
112 GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), thePoint1->GetEntry());
113 if (aPoint1.IsNull()) return aGEOMObject._retn();
115 //Get the second point of translation
116 Handle(GEOM_Object) aPoint2 =
117 GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), thePoint2->GetEntry());
118 if (aPoint2.IsNull()) return aGEOMObject._retn();
120 //Create the translated shape
121 Handle(GEOM_Object) anObject =
122 GetOperations()->TranslateTwoPointsCopy(aBasicObject, aPoint1, aPoint2);
123 if (!GetOperations()->IsDone() || anObject.IsNull())
124 return aGEOMObject._retn();
126 return GetObject(anObject);
129 //=============================================================================
133 //=============================================================================
134 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject,
135 CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
137 //Set a not done flag
138 GetOperations()->SetNotDone();
139 GEOM::GEOM_Object_var aGEOMObject ;
141 if (theObject == NULL) return aGEOMObject._retn();
143 //check if the object is a subshape
144 if(!theObject->IsMainShape()) {
145 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
146 return aGEOMObject._retn();
149 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
151 //Get the object itself
152 Handle(GEOM_Object) anObject =
153 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
154 if (anObject.IsNull()) return aGEOMObject._retn();
156 //Perform the translation
157 GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
159 return aGEOMObject._retn();
163 //=============================================================================
165 * TranslateDXDYDZCopy
167 //=============================================================================
168 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy
169 (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
171 GEOM::GEOM_Object_var aGEOMObject;
173 //Set a not done flag
174 GetOperations()->SetNotDone();
176 if (theObject == NULL) return aGEOMObject._retn();
178 //Get the object itself
179 Handle(GEOM_Object) aBasicObject =
180 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
181 if (aBasicObject.IsNull()) return aGEOMObject._retn();
185 //Create the translated shape
186 Handle(GEOM_Object) anObject =
187 GetOperations()->TranslateDXDYDZCopy(aBasicObject, theDX, theDY, theDZ);
188 if (!GetOperations()->IsDone() || anObject.IsNull())
189 return aGEOMObject._retn();
191 return GetObject(anObject);
195 //=============================================================================
199 //=============================================================================
200 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector
201 (GEOM::GEOM_Object_ptr theObject,
202 GEOM::GEOM_Object_ptr theVector)
204 //Set a not done flag
205 GetOperations()->SetNotDone();
206 GEOM::GEOM_Object_var aGEOMObject;
208 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
210 //check if the object is a subshape
211 if(!theObject->IsMainShape()) {
212 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
213 return aGEOMObject._retn();
216 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
218 //Get the object itself
219 Handle(GEOM_Object) anObject =
220 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
221 if (anObject.IsNull()) return aGEOMObject._retn();
223 //Get the vector of translation
224 Handle(GEOM_Object) aVector =
225 GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry());
226 if (aVector.IsNull()) return aGEOMObject._retn();
228 //Perform the translation
229 GetOperations()->TranslateVector(anObject, aVector);
231 return aGEOMObject._retn();
234 //=============================================================================
236 * TranslateVectorCopy
238 //=============================================================================
239 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy
240 (GEOM::GEOM_Object_ptr theObject,
241 GEOM::GEOM_Object_ptr theVector)
243 GEOM::GEOM_Object_var aGEOMObject;
245 //Set a not done flag
246 GetOperations()->SetNotDone();
248 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
250 //Get the object itself
251 Handle(GEOM_Object) aBasicObject =
252 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
253 if (aBasicObject.IsNull()) return aGEOMObject._retn();
255 //Get the vector of translation
256 Handle(GEOM_Object) aVector =
257 GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry());
258 if (aVector.IsNull()) return aGEOMObject._retn();
260 //Perform the translation
261 Handle(GEOM_Object) anObject = GetOperations()->TranslateVectorCopy(aBasicObject, aVector);
262 if (!GetOperations()->IsDone() || anObject.IsNull())
263 return aGEOMObject._retn();
265 return GetObject(anObject);
269 //=============================================================================
273 //=============================================================================
274 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject,
275 GEOM::GEOM_Object_ptr theAxis,
276 CORBA::Double theAngle)
278 //Set a not done flag
279 GetOperations()->SetNotDone();
280 GEOM::GEOM_Object_var aGEOMObject;
282 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
284 //check if the object is a subshape
285 if(!theObject->IsMainShape()) {
286 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
287 return aGEOMObject._retn();
290 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
292 //Get the object itself
293 Handle(GEOM_Object) anObject = GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
294 if (anObject.IsNull()) return aGEOMObject._retn();
296 //Get the axis of revolution
297 Handle(GEOM_Object) anAxis =
298 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
299 if (anAxis.IsNull()) return aGEOMObject._retn();
301 //Perform the rotation
302 GetOperations()->Rotate(anObject, anAxis, theAngle);
304 return aGEOMObject._retn();
307 //=============================================================================
311 //=============================================================================
312 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject,
313 GEOM::GEOM_Object_ptr theAxis,
314 CORBA::Double theAngle)
316 GEOM::GEOM_Object_var aGEOMObject;
318 //Set a not done flag
319 GetOperations()->SetNotDone();
321 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
323 //Get the object itself
324 Handle(GEOM_Object) aBasicObject =
325 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
326 if (aBasicObject.IsNull()) return aGEOMObject._retn();
328 //Get the axis of rotation
329 Handle(GEOM_Object) anAxis =
330 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
331 if (anAxis.IsNull()) return aGEOMObject._retn();
333 //Perform the rotation
334 Handle(GEOM_Object) anObject = GetOperations()->RotateCopy(aBasicObject, anAxis, theAngle);
335 if (!GetOperations()->IsDone() || anObject.IsNull())
336 return aGEOMObject._retn();
338 return GetObject(anObject);
342 //=============================================================================
346 //=============================================================================
347 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane
348 (GEOM::GEOM_Object_ptr theObject,
349 GEOM::GEOM_Object_ptr thePlane)
351 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
353 //Set a not done flag
354 GetOperations()->SetNotDone();
356 if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn();
358 //check if the object is a subshape
359 if(!theObject->IsMainShape()) {
360 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
361 return aGEOMObject._retn();
364 //Get the object itself
365 Handle(GEOM_Object) anObject =
366 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
367 if (anObject.IsNull()) return aGEOMObject._retn();
370 Handle(GEOM_Object) aPlane =
371 GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), thePlane->GetEntry());
372 if (aPlane.IsNull()) return aGEOMObject._retn();
375 GetOperations()->MirrorPlane(anObject, aPlane);
377 return aGEOMObject._retn();
380 //=============================================================================
384 //=============================================================================
385 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy
386 (GEOM::GEOM_Object_ptr theObject,
387 GEOM::GEOM_Object_ptr thePlane)
389 GEOM::GEOM_Object_var aGEOMObject;
391 //Set a not done flag
392 GetOperations()->SetNotDone();
394 if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn();
396 //Get the object itself
397 Handle(GEOM_Object) aBasicObject =
398 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
399 if (aBasicObject.IsNull()) return aGEOMObject._retn();
401 //Get the vector of translation
402 Handle(GEOM_Object) aPlane =
403 GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), thePlane->GetEntry());
404 if (aPlane.IsNull()) return aGEOMObject._retn();
407 Handle(GEOM_Object) anObject = GetOperations()->MirrorPlaneCopy(aBasicObject, aPlane);
408 if (!GetOperations()->IsDone() || anObject.IsNull())
409 return aGEOMObject._retn();
411 return GetObject(anObject);
414 //=============================================================================
418 //=============================================================================
419 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis
420 (GEOM::GEOM_Object_ptr theObject,
421 GEOM::GEOM_Object_ptr theAxis)
423 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
425 //Set a not done flag
426 GetOperations()->SetNotDone();
428 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
430 //check if the object is a subshape
431 if(!theObject->IsMainShape()) {
432 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
433 return aGEOMObject._retn();
436 //Get the object itself
437 Handle(GEOM_Object) anObject =
438 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
439 if (anObject.IsNull()) return aGEOMObject._retn();
442 Handle(GEOM_Object) aAxis =
443 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
444 if (aAxis.IsNull()) return aGEOMObject._retn();
447 GetOperations()->MirrorAxis(anObject, aAxis);
449 return aGEOMObject._retn();
452 //=============================================================================
456 //=============================================================================
457 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy
458 (GEOM::GEOM_Object_ptr theObject,
459 GEOM::GEOM_Object_ptr theAxis)
461 GEOM::GEOM_Object_var aGEOMObject;
463 //Set a not done flag
464 GetOperations()->SetNotDone();
466 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
468 //Get the object itself
469 Handle(GEOM_Object) aBasicObject =
470 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
471 if (aBasicObject.IsNull()) return aGEOMObject._retn();
473 //Get the vector of translation
474 Handle(GEOM_Object) aAxis =
475 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
476 if (aAxis.IsNull()) return aGEOMObject._retn();
479 Handle(GEOM_Object) anObject = GetOperations()->MirrorAxisCopy(aBasicObject, aAxis);
480 if (!GetOperations()->IsDone() || anObject.IsNull())
481 return aGEOMObject._retn();
483 return GetObject(anObject);
486 //=============================================================================
490 //=============================================================================
491 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint
492 (GEOM::GEOM_Object_ptr theObject,
493 GEOM::GEOM_Object_ptr thePoint)
495 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
497 //Set a not done flag
498 GetOperations()->SetNotDone();
500 if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn();
502 //check if the object is a subshape
503 if(!theObject->IsMainShape()) {
504 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
505 return aGEOMObject._retn();
508 //Get the object itself
509 Handle(GEOM_Object) anObject =
510 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
511 if (anObject.IsNull()) return aGEOMObject._retn();
514 Handle(GEOM_Object) aPoint =
515 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
516 if (aPoint.IsNull()) return aGEOMObject._retn();
519 GetOperations()->MirrorPoint(anObject, aPoint);
521 return aGEOMObject._retn();
524 //=============================================================================
528 //=============================================================================
529 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy
530 (GEOM::GEOM_Object_ptr theObject,
531 GEOM::GEOM_Object_ptr thePoint)
533 GEOM::GEOM_Object_var aGEOMObject;
535 //Set a not done flag
536 GetOperations()->SetNotDone();
538 if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn();
540 //Get the object itself
541 Handle(GEOM_Object) aBasicObject =
542 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
543 if (aBasicObject.IsNull()) return aGEOMObject._retn();
545 //Get the vector of translation
546 Handle(GEOM_Object) aPoint =
547 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
548 if (aPoint.IsNull()) return aGEOMObject._retn();
551 Handle(GEOM_Object) anObject = GetOperations()->MirrorPointCopy(aBasicObject, aPoint);
552 if (!GetOperations()->IsDone() || anObject.IsNull())
553 return aGEOMObject._retn();
555 return GetObject(anObject);
559 //=============================================================================
563 //=============================================================================
564 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
565 (GEOM::GEOM_Object_ptr theObject,
566 CORBA::Double theOffset)
568 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
570 //Set a not done flag
571 GetOperations()->SetNotDone();
573 if (theObject == NULL) return aGEOMObject._retn();
575 //check if the object is a subshape
576 if(!theObject->IsMainShape()) {
577 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
578 return aGEOMObject._retn();
582 //Get the basic object
583 Handle(GEOM_Object) aBasicObject =
584 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
585 if (aBasicObject.IsNull()) return aGEOMObject._retn();
587 //Create the offset shape
588 GetOperations()->OffsetShape(aBasicObject, theOffset);
590 return aGEOMObject._retn();
593 //=============================================================================
597 //=============================================================================
598 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
599 (GEOM::GEOM_Object_ptr theObject,
600 CORBA::Double theOffset)
602 GEOM::GEOM_Object_var aGEOMObject;
604 //Set a not done flag
605 GetOperations()->SetNotDone();
607 if (theObject == NULL) return aGEOMObject._retn();
609 //Get the basic object
610 Handle(GEOM_Object) aBasicObject =
611 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
612 if (aBasicObject.IsNull()) return aGEOMObject._retn();
614 //Create the offset shape
615 Handle(GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset);
616 if (!GetOperations()->IsDone() || anObject.IsNull())
617 return aGEOMObject._retn();
619 return GetObject(anObject);
623 //=============================================================================
627 //=============================================================================
628 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
629 (GEOM::GEOM_Object_ptr theObject,
630 GEOM::GEOM_Object_ptr thePoint,
631 CORBA::Double theFactor)
633 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
635 //Set a not done flag
636 GetOperations()->SetNotDone();
638 if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn();
640 //check if the object is a subshape
641 if(!theObject->IsMainShape()) {
642 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
643 return aGEOMObject._retn();
646 //Get the object itself
647 Handle(GEOM_Object) anObject =
648 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
649 if (anObject.IsNull()) return aGEOMObject._retn();
652 Handle(GEOM_Object) aPoint =
653 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
654 if (aPoint.IsNull()) return aGEOMObject._retn();
657 GetOperations()->ScaleShape(anObject, aPoint, theFactor);
659 return aGEOMObject._retn();
662 //=============================================================================
666 //=============================================================================
667 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
668 (GEOM::GEOM_Object_ptr theObject,
669 GEOM::GEOM_Object_ptr thePoint,
670 CORBA::Double theFactor)
672 GEOM::GEOM_Object_var aGEOMObject;
674 //Set a not done flag
675 GetOperations()->SetNotDone();
677 if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn();
679 //Get the basic object
680 Handle(GEOM_Object) aBasicObject =
681 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
682 if (aBasicObject.IsNull()) return aGEOMObject._retn();
685 Handle(GEOM_Object) aPoint =
686 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
687 if (aPoint.IsNull()) return aGEOMObject._retn();
690 Handle(GEOM_Object) anObject =
691 GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor);
692 if (!GetOperations()->IsDone() || anObject.IsNull())
693 return aGEOMObject._retn();
695 return GetObject(anObject);
698 //=============================================================================
702 //=============================================================================
703 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
704 (GEOM::GEOM_Object_ptr theObject,
705 GEOM::GEOM_Object_ptr theStartLCS,
706 GEOM::GEOM_Object_ptr theEndLCS)
708 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
710 //Set a not done flag
711 GetOperations()->SetNotDone();
713 if (theObject == NULL || theStartLCS == NULL || theEndLCS == NULL)
714 return aGEOMObject._retn();
716 //check if the object is a subshape
717 if(!theObject->IsMainShape()) {
718 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
719 return aGEOMObject._retn();
722 //Get the basic object
723 Handle(GEOM_Object) anObject =
724 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
725 if (anObject.IsNull()) return aGEOMObject._retn();
728 Handle(GEOM_Object) aStartLCS =
729 GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), theStartLCS->GetEntry());
730 if (aStartLCS.IsNull()) return aGEOMObject._retn();
733 Handle(GEOM_Object) aEndLCS =
734 GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), theEndLCS->GetEntry());
735 if (aEndLCS.IsNull()) return aGEOMObject._retn();
737 //Perform the Position
738 GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
740 return aGEOMObject._retn();
743 //=============================================================================
747 //=============================================================================
748 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
749 (GEOM::GEOM_Object_ptr theObject,
750 GEOM::GEOM_Object_ptr theStartLCS,
751 GEOM::GEOM_Object_ptr theEndLCS)
753 GEOM::GEOM_Object_var aGEOMObject;
755 //Set a not done flag
756 GetOperations()->SetNotDone();
758 if (theObject == NULL || theStartLCS == NULL || theEndLCS == NULL)
759 return aGEOMObject._retn();
761 //Get the basic object
762 Handle(GEOM_Object) aBasicObject =
763 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
764 if (aBasicObject.IsNull()) return aGEOMObject._retn();
767 Handle(GEOM_Object) aStartLCS =
768 GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), theStartLCS->GetEntry());
769 if (aStartLCS.IsNull()) return aGEOMObject._retn();
772 Handle(GEOM_Object) aEndLCS =
773 GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), theEndLCS->GetEntry());
774 if (aEndLCS.IsNull()) return aGEOMObject._retn();
776 //Perform the position
777 Handle(GEOM_Object) anObject =
778 GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS);
779 if (!GetOperations()->IsDone() || anObject.IsNull())
780 return aGEOMObject._retn();
782 return GetObject(anObject);
785 //=============================================================================
789 //=============================================================================
790 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
791 (GEOM::GEOM_Object_ptr theObject,
792 GEOM::GEOM_Object_ptr theVector,
793 CORBA::Double theStep, CORBA::Long theNbTimes)
795 //Set a not done flag
796 GetOperations()->SetNotDone();
798 GEOM::GEOM_Object_var aGEOMObject;
800 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
802 //Get the object itself
803 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
804 (theObject->GetStudyID(), theObject->GetEntry());
805 if (aBasicObject.IsNull()) return aGEOMObject._retn();
807 //Get the vector of translation
808 Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
809 (theVector->GetStudyID(), theVector->GetEntry());
810 if (aVector.IsNull()) return aGEOMObject._retn();
812 //Perform the translation
813 Handle(GEOM_Object) anObject =
814 GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes);
815 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
817 return GetObject(anObject);
820 //=============================================================================
824 //=============================================================================
825 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
826 GEOM::GEOM_Object_ptr theVector1,
827 CORBA::Double theStep1,
828 CORBA::Long theNbTimes1,
829 GEOM::GEOM_Object_ptr theVector2,
830 CORBA::Double theStep2,
831 CORBA::Long theNbTimes2)
833 //Set a not done flag
834 GetOperations()->SetNotDone();
836 GEOM::GEOM_Object_var aGEOMObject;
838 if (theObject == NULL || theVector1 == NULL || theVector2 == NULL) return aGEOMObject._retn();
840 //Get the object itself
841 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
842 (theObject->GetStudyID(), theObject->GetEntry());
843 if (aBasicObject.IsNull()) return aGEOMObject._retn();
845 //Get the vector1 of translation
846 Handle(GEOM_Object) aVector1 = GetOperations()->GetEngine()->GetObject
847 (theVector1->GetStudyID(), theVector1->GetEntry());
848 if (aVector1.IsNull()) return aGEOMObject._retn();
850 //Get the vector2 of translation
851 Handle(GEOM_Object) aVector2 = GetOperations()->GetEngine()->GetObject
852 (theVector2->GetStudyID(), theVector2->GetEntry());
853 if (aVector2.IsNull()) return aGEOMObject._retn();
855 //Perform the translation
856 Handle(GEOM_Object) anObject = GetOperations()->Translate2D
857 (aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2);
858 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
860 return GetObject(anObject);
863 //=============================================================================
867 //=============================================================================
868 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
869 GEOM::GEOM_Object_ptr theVector,
870 CORBA::Long theNbTimes)
872 //Set a not done flag
873 GetOperations()->SetNotDone();
875 GEOM::GEOM_Object_var aGEOMObject;
877 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
879 //Get the object itself
880 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
881 (theObject->GetStudyID(), theObject->GetEntry());
882 if (aBasicObject.IsNull()) return aGEOMObject._retn();
884 //Get the a directon of rotation
885 Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
886 (theVector->GetStudyID(), theVector->GetEntry());
887 if (aVector.IsNull()) return aGEOMObject._retn();
889 //Perform the rotation
890 Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
891 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
893 return GetObject(anObject);
896 //=============================================================================
900 //=============================================================================
901 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
902 GEOM::GEOM_Object_ptr theVector,
903 CORBA::Double theAngle,
904 CORBA::Long theNbTimes1,
905 CORBA::Double theStep,
906 CORBA::Long theNbTimes2)
908 //Set a not done flag
909 GetOperations()->SetNotDone();
911 GEOM::GEOM_Object_var aGEOMObject;
913 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
915 //Get the object itself
916 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
917 (theObject->GetStudyID(), theObject->GetEntry());
918 if (aBasicObject.IsNull()) return aGEOMObject._retn();
920 //Get the a directon of rotation
921 Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
922 (theVector->GetStudyID(), theVector->GetEntry());
923 if (aVector.IsNull()) return aGEOMObject._retn();
925 //Perform the rotation
926 Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
927 (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
928 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
930 return GetObject(anObject);