1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <Standard_Stream.hxx>
22 #include "GEOM_ITransformOperations_i.hh"
24 #include "utilities.h"
26 #include "Utils_ExceptHandlers.hxx"
28 #include <TDF_Label.hxx>
29 #include <TDF_Tool.hxx>
30 #include <TCollection_AsciiString.hxx>
31 #include "GEOM_Engine.hxx"
32 #include "GEOM_Object.hxx"
34 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
36 //=============================================================================
40 //=============================================================================
42 GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
43 GEOM::GEOM_Gen_ptr theEngine,
44 ::GEOMImpl_ITransformOperations* theImpl)
45 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
47 MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i");
50 //=============================================================================
54 //=============================================================================
56 GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i()
58 MESSAGE("GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i");
62 //=============================================================================
66 //=============================================================================
67 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints
68 (GEOM::GEOM_Object_ptr theObject,
69 GEOM::GEOM_Object_ptr thePoint1,
70 GEOM::GEOM_Object_ptr thePoint2)
73 GetOperations()->SetNotDone();
74 GEOM::GEOM_Object_var aGEOMObject;
76 if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn();
78 //check if the object is a subshape
79 if(!theObject->IsMainShape()) {
80 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
81 return aGEOMObject._retn();
84 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
86 //Get the object itself
87 Handle(GEOM_Object) anObject =
88 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
89 if (anObject.IsNull()) return aGEOMObject._retn();
91 //Get the first point of translation
92 Handle(GEOM_Object) aPoint1 =
93 GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), thePoint1->GetEntry());
94 if (aPoint1.IsNull()) return aGEOMObject._retn();
96 //Get the second point of translation
97 Handle(GEOM_Object) aPoint2 =
98 GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), thePoint2->GetEntry());
99 if (aPoint2.IsNull()) return aGEOMObject._retn();
101 //Perform the translation
102 GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
104 return aGEOMObject._retn();
107 //=============================================================================
109 * TranslateTwoPointsCopy
111 //=============================================================================
112 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy
113 (GEOM::GEOM_Object_ptr theObject,
114 GEOM::GEOM_Object_ptr thePoint1,
115 GEOM::GEOM_Object_ptr thePoint2)
117 GEOM::GEOM_Object_var aGEOMObject;
119 //Set a not done flag
120 GetOperations()->SetNotDone();
122 if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn();
124 //Get the object itself
125 Handle(GEOM_Object) aBasicObject =
126 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
127 if (aBasicObject.IsNull()) return aGEOMObject._retn();
129 //Get the first point of translation
130 Handle(GEOM_Object) aPoint1 =
131 GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), thePoint1->GetEntry());
132 if (aPoint1.IsNull()) return aGEOMObject._retn();
134 //Get the second point of translation
135 Handle(GEOM_Object) aPoint2 =
136 GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), thePoint2->GetEntry());
137 if (aPoint2.IsNull()) return aGEOMObject._retn();
139 //Create the translated shape
140 Handle(GEOM_Object) anObject =
141 GetOperations()->TranslateTwoPointsCopy(aBasicObject, aPoint1, aPoint2);
142 if (!GetOperations()->IsDone() || anObject.IsNull())
143 return aGEOMObject._retn();
145 return GetObject(anObject);
148 //=============================================================================
152 //=============================================================================
153 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ (GEOM::GEOM_Object_ptr theObject,
154 CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
156 //Set a not done flag
157 GetOperations()->SetNotDone();
158 GEOM::GEOM_Object_var aGEOMObject ;
160 if (theObject == NULL) return aGEOMObject._retn();
162 //check if the object is a subshape
163 if(!theObject->IsMainShape()) {
164 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
165 return aGEOMObject._retn();
168 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
170 //Get the object itself
171 Handle(GEOM_Object) anObject =
172 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
173 if (anObject.IsNull()) return aGEOMObject._retn();
175 //Perform the translation
176 GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
178 return aGEOMObject._retn();
182 //=============================================================================
184 * TranslateDXDYDZCopy
186 //=============================================================================
187 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy
188 (GEOM::GEOM_Object_ptr theObject, CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
190 GEOM::GEOM_Object_var aGEOMObject;
192 //Set a not done flag
193 GetOperations()->SetNotDone();
195 if (theObject == NULL) return aGEOMObject._retn();
197 //Get the object itself
198 Handle(GEOM_Object) aBasicObject =
199 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
200 if (aBasicObject.IsNull()) return aGEOMObject._retn();
204 //Create the translated shape
205 Handle(GEOM_Object) anObject =
206 GetOperations()->TranslateDXDYDZCopy(aBasicObject, theDX, theDY, theDZ);
207 if (!GetOperations()->IsDone() || anObject.IsNull())
208 return aGEOMObject._retn();
210 return GetObject(anObject);
214 //=============================================================================
218 //=============================================================================
219 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector
220 (GEOM::GEOM_Object_ptr theObject,
221 GEOM::GEOM_Object_ptr theVector)
223 //Set a not done flag
224 GetOperations()->SetNotDone();
225 GEOM::GEOM_Object_var aGEOMObject;
227 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
229 //check if the object is a subshape
230 if(!theObject->IsMainShape()) {
231 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
232 return aGEOMObject._retn();
235 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
237 //Get the object itself
238 Handle(GEOM_Object) anObject =
239 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
240 if (anObject.IsNull()) return aGEOMObject._retn();
242 //Get the vector of translation
243 Handle(GEOM_Object) aVector =
244 GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry());
245 if (aVector.IsNull()) return aGEOMObject._retn();
247 //Perform the translation
248 GetOperations()->TranslateVector(anObject, aVector);
250 return aGEOMObject._retn();
253 //=============================================================================
255 * TranslateVectorCopy
257 //=============================================================================
258 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy
259 (GEOM::GEOM_Object_ptr theObject,
260 GEOM::GEOM_Object_ptr theVector)
262 GEOM::GEOM_Object_var aGEOMObject;
264 //Set a not done flag
265 GetOperations()->SetNotDone();
267 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
269 //Get the object itself
270 Handle(GEOM_Object) aBasicObject =
271 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
272 if (aBasicObject.IsNull()) return aGEOMObject._retn();
274 //Get the vector of translation
275 Handle(GEOM_Object) aVector =
276 GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), theVector->GetEntry());
277 if (aVector.IsNull()) return aGEOMObject._retn();
279 //Perform the translation
280 Handle(GEOM_Object) anObject = GetOperations()->TranslateVectorCopy(aBasicObject, aVector);
281 if (!GetOperations()->IsDone() || anObject.IsNull())
282 return aGEOMObject._retn();
284 return GetObject(anObject);
288 //=============================================================================
292 //=============================================================================
293 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject,
294 GEOM::GEOM_Object_ptr theAxis,
295 CORBA::Double theAngle)
297 //Set a not done flag
298 GetOperations()->SetNotDone();
299 GEOM::GEOM_Object_var aGEOMObject;
301 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
303 //check if the object is a subshape
304 if(!theObject->IsMainShape()) {
305 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
306 return aGEOMObject._retn();
309 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
311 //Get the object itself
312 Handle(GEOM_Object) anObject = GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
313 if (anObject.IsNull()) return aGEOMObject._retn();
315 //Get the axis of revolution
316 Handle(GEOM_Object) anAxis =
317 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
318 if (anAxis.IsNull()) return aGEOMObject._retn();
320 //Perform the rotation
321 GetOperations()->Rotate(anObject, anAxis, theAngle);
323 return aGEOMObject._retn();
326 //=============================================================================
330 //=============================================================================
331 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject,
332 GEOM::GEOM_Object_ptr theAxis,
333 CORBA::Double theAngle)
335 GEOM::GEOM_Object_var aGEOMObject;
337 //Set a not done flag
338 GetOperations()->SetNotDone();
340 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
342 //Get the object itself
343 Handle(GEOM_Object) aBasicObject =
344 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
345 if (aBasicObject.IsNull()) return aGEOMObject._retn();
347 //Get the axis of rotation
348 Handle(GEOM_Object) anAxis =
349 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
350 if (anAxis.IsNull()) return aGEOMObject._retn();
352 //Perform the rotation
353 Handle(GEOM_Object) anObject = GetOperations()->RotateCopy(aBasicObject, anAxis, theAngle);
354 if (!GetOperations()->IsDone() || anObject.IsNull())
355 return aGEOMObject._retn();
357 return GetObject(anObject);
361 //=============================================================================
365 //=============================================================================
366 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane
367 (GEOM::GEOM_Object_ptr theObject,
368 GEOM::GEOM_Object_ptr thePlane)
370 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
372 //Set a not done flag
373 GetOperations()->SetNotDone();
375 if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn();
377 //check if the object is a subshape
378 if(!theObject->IsMainShape()) {
379 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
380 return aGEOMObject._retn();
383 //Get the object itself
384 Handle(GEOM_Object) anObject =
385 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
386 if (anObject.IsNull()) return aGEOMObject._retn();
389 Handle(GEOM_Object) aPlane =
390 GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), thePlane->GetEntry());
391 if (aPlane.IsNull()) return aGEOMObject._retn();
394 GetOperations()->MirrorPlane(anObject, aPlane);
396 return aGEOMObject._retn();
399 //=============================================================================
403 //=============================================================================
404 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy
405 (GEOM::GEOM_Object_ptr theObject,
406 GEOM::GEOM_Object_ptr thePlane)
408 GEOM::GEOM_Object_var aGEOMObject;
410 //Set a not done flag
411 GetOperations()->SetNotDone();
413 if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn();
415 //Get the object itself
416 Handle(GEOM_Object) aBasicObject =
417 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
418 if (aBasicObject.IsNull()) return aGEOMObject._retn();
420 //Get the vector of translation
421 Handle(GEOM_Object) aPlane =
422 GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), thePlane->GetEntry());
423 if (aPlane.IsNull()) return aGEOMObject._retn();
426 Handle(GEOM_Object) anObject = GetOperations()->MirrorPlaneCopy(aBasicObject, aPlane);
427 if (!GetOperations()->IsDone() || anObject.IsNull())
428 return aGEOMObject._retn();
430 return GetObject(anObject);
433 //=============================================================================
437 //=============================================================================
438 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis
439 (GEOM::GEOM_Object_ptr theObject,
440 GEOM::GEOM_Object_ptr theAxis)
442 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
444 //Set a not done flag
445 GetOperations()->SetNotDone();
447 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
449 //check if the object is a subshape
450 if(!theObject->IsMainShape()) {
451 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
452 return aGEOMObject._retn();
455 //Get the object itself
456 Handle(GEOM_Object) anObject =
457 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
458 if (anObject.IsNull()) return aGEOMObject._retn();
461 Handle(GEOM_Object) aAxis =
462 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
463 if (aAxis.IsNull()) return aGEOMObject._retn();
466 GetOperations()->MirrorAxis(anObject, aAxis);
468 return aGEOMObject._retn();
471 //=============================================================================
475 //=============================================================================
476 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy
477 (GEOM::GEOM_Object_ptr theObject,
478 GEOM::GEOM_Object_ptr theAxis)
480 GEOM::GEOM_Object_var aGEOMObject;
482 //Set a not done flag
483 GetOperations()->SetNotDone();
485 if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
487 //Get the object itself
488 Handle(GEOM_Object) aBasicObject =
489 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
490 if (aBasicObject.IsNull()) return aGEOMObject._retn();
492 //Get the vector of translation
493 Handle(GEOM_Object) aAxis =
494 GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), theAxis->GetEntry());
495 if (aAxis.IsNull()) return aGEOMObject._retn();
498 Handle(GEOM_Object) anObject = GetOperations()->MirrorAxisCopy(aBasicObject, aAxis);
499 if (!GetOperations()->IsDone() || anObject.IsNull())
500 return aGEOMObject._retn();
502 return GetObject(anObject);
505 //=============================================================================
509 //=============================================================================
510 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint
511 (GEOM::GEOM_Object_ptr theObject,
512 GEOM::GEOM_Object_ptr thePoint)
514 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
516 //Set a not done flag
517 GetOperations()->SetNotDone();
519 if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn();
521 //check if the object is a subshape
522 if(!theObject->IsMainShape()) {
523 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
524 return aGEOMObject._retn();
527 //Get the object itself
528 Handle(GEOM_Object) anObject =
529 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
530 if (anObject.IsNull()) return aGEOMObject._retn();
533 Handle(GEOM_Object) aPoint =
534 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
535 if (aPoint.IsNull()) return aGEOMObject._retn();
538 GetOperations()->MirrorPoint(anObject, aPoint);
540 return aGEOMObject._retn();
543 //=============================================================================
547 //=============================================================================
548 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy
549 (GEOM::GEOM_Object_ptr theObject,
550 GEOM::GEOM_Object_ptr thePoint)
552 GEOM::GEOM_Object_var aGEOMObject;
554 //Set a not done flag
555 GetOperations()->SetNotDone();
557 if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn();
559 //Get the object itself
560 Handle(GEOM_Object) aBasicObject =
561 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
562 if (aBasicObject.IsNull()) return aGEOMObject._retn();
564 //Get the vector of translation
565 Handle(GEOM_Object) aPoint =
566 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
567 if (aPoint.IsNull()) return aGEOMObject._retn();
570 Handle(GEOM_Object) anObject = GetOperations()->MirrorPointCopy(aBasicObject, aPoint);
571 if (!GetOperations()->IsDone() || anObject.IsNull())
572 return aGEOMObject._retn();
574 return GetObject(anObject);
578 //=============================================================================
582 //=============================================================================
583 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
584 (GEOM::GEOM_Object_ptr theObject,
585 CORBA::Double theOffset)
587 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
589 //Set a not done flag
590 GetOperations()->SetNotDone();
592 if (theObject == NULL) return aGEOMObject._retn();
594 //check if the object is a subshape
595 if(!theObject->IsMainShape()) {
596 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
597 return aGEOMObject._retn();
601 //Get the basic object
602 Handle(GEOM_Object) aBasicObject =
603 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
604 if (aBasicObject.IsNull()) return aGEOMObject._retn();
606 //Create the offset shape
607 GetOperations()->OffsetShape(aBasicObject, theOffset);
609 return aGEOMObject._retn();
612 //=============================================================================
616 //=============================================================================
617 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
618 (GEOM::GEOM_Object_ptr theObject,
619 CORBA::Double theOffset)
621 GEOM::GEOM_Object_var aGEOMObject;
623 //Set a not done flag
624 GetOperations()->SetNotDone();
626 if (theObject == NULL) return aGEOMObject._retn();
628 //Get the basic object
629 Handle(GEOM_Object) aBasicObject =
630 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
631 if (aBasicObject.IsNull()) return aGEOMObject._retn();
633 //Create the offset shape
634 Handle(GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset);
635 if (!GetOperations()->IsDone() || anObject.IsNull())
636 return aGEOMObject._retn();
638 return GetObject(anObject);
642 //=============================================================================
646 //=============================================================================
647 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
648 (GEOM::GEOM_Object_ptr theObject,
649 GEOM::GEOM_Object_ptr thePoint,
650 CORBA::Double theFactor)
652 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
654 //Set a not done flag
655 GetOperations()->SetNotDone();
657 if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn();
659 //check if the object is a subshape
660 if(!theObject->IsMainShape()) {
661 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
662 return aGEOMObject._retn();
665 //Get the object itself
666 Handle(GEOM_Object) anObject =
667 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
668 if (anObject.IsNull()) return aGEOMObject._retn();
671 Handle(GEOM_Object) aPoint =
672 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
673 if (aPoint.IsNull()) return aGEOMObject._retn();
676 GetOperations()->ScaleShape(anObject, aPoint, theFactor);
678 return aGEOMObject._retn();
681 //=============================================================================
685 //=============================================================================
686 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
687 (GEOM::GEOM_Object_ptr theObject,
688 GEOM::GEOM_Object_ptr thePoint,
689 CORBA::Double theFactor)
691 GEOM::GEOM_Object_var aGEOMObject;
693 //Set a not done flag
694 GetOperations()->SetNotDone();
696 if (thePoint == NULL || theObject == NULL) return aGEOMObject._retn();
698 //Get the basic object
699 Handle(GEOM_Object) aBasicObject =
700 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
701 if (aBasicObject.IsNull()) return aGEOMObject._retn();
704 Handle(GEOM_Object) aPoint =
705 GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), thePoint->GetEntry());
706 if (aPoint.IsNull()) return aGEOMObject._retn();
709 Handle(GEOM_Object) anObject =
710 GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor);
711 if (!GetOperations()->IsDone() || anObject.IsNull())
712 return aGEOMObject._retn();
714 return GetObject(anObject);
717 //=============================================================================
721 //=============================================================================
722 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
723 (GEOM::GEOM_Object_ptr theObject,
724 GEOM::GEOM_Object_ptr theStartLCS,
725 GEOM::GEOM_Object_ptr theEndLCS)
727 GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
729 //Set a not done flag
730 GetOperations()->SetNotDone();
732 if (theObject == NULL || theStartLCS == NULL || theEndLCS == NULL)
733 return aGEOMObject._retn();
735 //check if the object is a subshape
736 if(!theObject->IsMainShape()) {
737 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
738 return aGEOMObject._retn();
741 //Get the basic object
742 Handle(GEOM_Object) anObject =
743 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
744 if (anObject.IsNull()) return aGEOMObject._retn();
747 Handle(GEOM_Object) aStartLCS =
748 GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), theStartLCS->GetEntry());
749 if (aStartLCS.IsNull()) return aGEOMObject._retn();
752 Handle(GEOM_Object) aEndLCS =
753 GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), theEndLCS->GetEntry());
754 if (aEndLCS.IsNull()) return aGEOMObject._retn();
756 //Perform the Position
757 GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
759 return aGEOMObject._retn();
762 //=============================================================================
766 //=============================================================================
767 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
768 (GEOM::GEOM_Object_ptr theObject,
769 GEOM::GEOM_Object_ptr theStartLCS,
770 GEOM::GEOM_Object_ptr theEndLCS)
772 GEOM::GEOM_Object_var aGEOMObject;
774 //Set a not done flag
775 GetOperations()->SetNotDone();
777 if (theObject == NULL || theStartLCS == NULL || theEndLCS == NULL)
778 return aGEOMObject._retn();
780 //Get the basic object
781 Handle(GEOM_Object) aBasicObject =
782 GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
783 if (aBasicObject.IsNull()) return aGEOMObject._retn();
786 Handle(GEOM_Object) aStartLCS =
787 GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), theStartLCS->GetEntry());
788 if (aStartLCS.IsNull()) return aGEOMObject._retn();
791 Handle(GEOM_Object) aEndLCS =
792 GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), theEndLCS->GetEntry());
793 if (aEndLCS.IsNull()) return aGEOMObject._retn();
795 //Perform the position
796 Handle(GEOM_Object) anObject =
797 GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS);
798 if (!GetOperations()->IsDone() || anObject.IsNull())
799 return aGEOMObject._retn();
801 return GetObject(anObject);
804 //=============================================================================
808 //=============================================================================
809 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
810 (GEOM::GEOM_Object_ptr theObject,
811 GEOM::GEOM_Object_ptr theVector,
812 CORBA::Double theStep, CORBA::Long theNbTimes)
814 //Set a not done flag
815 GetOperations()->SetNotDone();
817 GEOM::GEOM_Object_var aGEOMObject;
819 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
821 //Get the object itself
822 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
823 (theObject->GetStudyID(), theObject->GetEntry());
824 if (aBasicObject.IsNull()) return aGEOMObject._retn();
826 //Get the vector of translation
827 Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
828 (theVector->GetStudyID(), theVector->GetEntry());
829 if (aVector.IsNull()) return aGEOMObject._retn();
831 //Perform the translation
832 Handle(GEOM_Object) anObject =
833 GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes);
834 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
836 return GetObject(anObject);
839 //=============================================================================
843 //=============================================================================
844 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
845 GEOM::GEOM_Object_ptr theVector1,
846 CORBA::Double theStep1,
847 CORBA::Long theNbTimes1,
848 GEOM::GEOM_Object_ptr theVector2,
849 CORBA::Double theStep2,
850 CORBA::Long theNbTimes2)
852 //Set a not done flag
853 GetOperations()->SetNotDone();
855 GEOM::GEOM_Object_var aGEOMObject;
857 if (theObject == NULL || theVector1 == NULL || theVector2 == NULL) return aGEOMObject._retn();
859 //Get the object itself
860 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
861 (theObject->GetStudyID(), theObject->GetEntry());
862 if (aBasicObject.IsNull()) return aGEOMObject._retn();
864 //Get the vector1 of translation
865 Handle(GEOM_Object) aVector1 = GetOperations()->GetEngine()->GetObject
866 (theVector1->GetStudyID(), theVector1->GetEntry());
867 if (aVector1.IsNull()) return aGEOMObject._retn();
869 //Get the vector2 of translation
870 Handle(GEOM_Object) aVector2 = GetOperations()->GetEngine()->GetObject
871 (theVector2->GetStudyID(), theVector2->GetEntry());
872 if (aVector2.IsNull()) return aGEOMObject._retn();
874 //Perform the translation
875 Handle(GEOM_Object) anObject = GetOperations()->Translate2D
876 (aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2);
877 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
879 return GetObject(anObject);
882 //=============================================================================
886 //=============================================================================
887 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
888 GEOM::GEOM_Object_ptr theVector,
889 CORBA::Long theNbTimes)
891 //Set a not done flag
892 GetOperations()->SetNotDone();
894 GEOM::GEOM_Object_var aGEOMObject;
896 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
898 //Get the object itself
899 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
900 (theObject->GetStudyID(), theObject->GetEntry());
901 if (aBasicObject.IsNull()) return aGEOMObject._retn();
903 //Get the a directon of rotation
904 Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
905 (theVector->GetStudyID(), theVector->GetEntry());
906 if (aVector.IsNull()) return aGEOMObject._retn();
908 //Perform the rotation
909 Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
910 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
912 return GetObject(anObject);
915 //=============================================================================
919 //=============================================================================
920 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
921 GEOM::GEOM_Object_ptr theVector,
922 CORBA::Double theAngle,
923 CORBA::Long theNbTimes1,
924 CORBA::Double theStep,
925 CORBA::Long theNbTimes2)
927 //Set a not done flag
928 GetOperations()->SetNotDone();
930 GEOM::GEOM_Object_var aGEOMObject;
932 if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
934 //Get the object itself
935 Handle(GEOM_Object) aBasicObject = GetOperations()->GetEngine()->GetObject
936 (theObject->GetStudyID(), theObject->GetEntry());
937 if (aBasicObject.IsNull()) return aGEOMObject._retn();
939 //Get the a directon of rotation
940 Handle(GEOM_Object) aVector = GetOperations()->GetEngine()->GetObject
941 (theVector->GetStudyID(), theVector->GetEntry());
942 if (aVector.IsNull()) return aGEOMObject._retn();
944 //Perform the rotation
945 Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
946 (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
947 if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
949 return GetObject(anObject);