Salome HOME
5f5f63288e306b4ea7b64d0e790495f1c5105347
[modules/geom.git] / src / GEOM_I / GEOM_ITransformOperations_i.cc
1 // Copyright (C) 2007-2023  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, or (at your option) any later version.
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
23 #include <Standard_Stream.hxx>
24
25 #include "GEOM_ITransformOperations_i.hh"
26
27 #include "utilities.h"
28 #include "OpUtil.hxx"
29 #include "Utils_ExceptHandlers.hxx"
30
31 #include <TDF_Label.hxx>
32 #include <TDF_Tool.hxx>
33 #include <TCollection_AsciiString.hxx>
34 #include "GEOM_Engine.hxx"
35 #include "GEOM_Object.hxx"
36
37 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
38
39 //=============================================================================
40 /*!
41  *   constructor:
42  */
43 //=============================================================================
44
45 GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
46                                                           GEOM::GEOM_Gen_ptr theEngine,
47                                                           ::GEOMImpl_ITransformOperations* theImpl)
48      :GEOM_IOperations_i(thePOA, theEngine, theImpl)
49 {
50   MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i");
51 }
52
53 //=============================================================================
54 /*!
55  *  destructor
56  */
57 //=============================================================================
58
59 GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i()
60 {
61   MESSAGE("GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i");
62 }
63
64
65 //=============================================================================
66 /*!
67  *  TranslateTwoPoints
68  */
69 //=============================================================================
70 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints
71                                              (GEOM::GEOM_Object_ptr theObject,
72                                               GEOM::GEOM_Object_ptr thePoint1,
73                                               GEOM::GEOM_Object_ptr thePoint2)
74 {
75   //Set a not done flag
76   GetOperations()->SetNotDone();
77   GEOM::GEOM_Object_var aGEOMObject;
78
79   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
80
81   //check if the object is a sub-shape
82   if (!theObject->IsMainShape()) {
83     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
84     return aGEOMObject._retn();
85   }
86
87   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
88
89   //Get the object itself
90   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
91   if (anObject.IsNull()) return aGEOMObject._retn();
92
93   //Get the first point of translation
94   Handle(::GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
95   if (aPoint1.IsNull()) return aGEOMObject._retn();
96
97   //Get the second point of translation
98   Handle(::GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
99   if (aPoint2.IsNull()) return aGEOMObject._retn();
100
101   //Perform the translation
102   GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
103
104   // Update GUI.
105   UpdateGUIForObject(theObject);
106
107   return aGEOMObject._retn();
108 }
109
110 //=============================================================================
111 /*!
112  *  TranslateTwoPointsCopy
113  */
114 //=============================================================================
115 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy
116                                              (GEOM::GEOM_Object_ptr theObject,
117                                               GEOM::GEOM_Object_ptr thePoint1,
118                                               GEOM::GEOM_Object_ptr thePoint2)
119 {
120   GEOM::GEOM_Object_var aGEOMObject;
121
122   //Set a not done flag
123   GetOperations()->SetNotDone();
124
125   //Get the object itself
126   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
127   if (aBasicObject.IsNull()) return aGEOMObject._retn();
128
129   //Get the first point of translation
130   Handle(::GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
131   if (aPoint1.IsNull()) return aGEOMObject._retn();
132
133   //Get the second point of translation
134   Handle(::GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
135   if (aPoint2.IsNull()) return aGEOMObject._retn();
136
137   //Create the translated shape
138   Handle(::GEOM_Object) anObject =
139     GetOperations()->TranslateTwoPointsCopy(aBasicObject, aPoint1, aPoint2);
140   if (!GetOperations()->IsDone() || anObject.IsNull())
141     return aGEOMObject._retn();
142
143   return GetObject(anObject);
144 }
145
146 //=============================================================================
147 /*!
148  *  TranslateDXDYDZ
149  */
150 //=============================================================================
151 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ
152                       (GEOM::GEOM_Object_ptr theObject,
153                        CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
154 {
155   //Set a not done flag
156   GetOperations()->SetNotDone();
157   GEOM::GEOM_Object_var aGEOMObject;
158
159   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
160
161   //check if the object is a sub-shape
162   if (!theObject->IsMainShape()) {
163     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
164     return aGEOMObject._retn();
165   }
166
167   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
168
169   //Get the object itself
170   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
171   if (anObject.IsNull()) return aGEOMObject._retn();
172
173   //Perform the translation
174   GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
175
176   // Update GUI.
177   UpdateGUIForObject(theObject);
178
179   return aGEOMObject._retn();
180 }
181
182 //=============================================================================
183 /*!
184  *  TranslateDXDYDZCopy
185  */
186 //=============================================================================
187 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy
188                                              (GEOM::GEOM_Object_ptr theObject,
189                                               CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
190 {
191   GEOM::GEOM_Object_var aGEOMObject;
192
193   //Set a not done flag
194   GetOperations()->SetNotDone();
195
196   //Get the object itself
197   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
198   if (aBasicObject.IsNull()) return aGEOMObject._retn();
199
200   //Create the translated shape
201   Handle(::GEOM_Object) anObject =
202     GetOperations()->TranslateDXDYDZCopy(aBasicObject, theDX, theDY, theDZ);
203   if (!GetOperations()->IsDone() || anObject.IsNull())
204     return aGEOMObject._retn();
205
206   return GetObject(anObject);
207 }
208
209 //=============================================================================
210 /*!
211  *  TranslateVector
212  */
213 //=============================================================================
214 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector
215                                             (GEOM::GEOM_Object_ptr theObject,
216                                              GEOM::GEOM_Object_ptr theVector)
217 {
218   //Set a not done flag
219   GetOperations()->SetNotDone();
220   GEOM::GEOM_Object_var aGEOMObject;
221
222   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
223
224   //check if the object is a sub-shape
225   if (!theObject->IsMainShape()) {
226     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
227     return aGEOMObject._retn();
228   }
229
230   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
231
232   //Get the object itself
233   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
234   if (anObject.IsNull()) return aGEOMObject._retn();
235
236   //Get the vector of translation
237   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
238   if (aVector.IsNull()) return aGEOMObject._retn();
239
240   //Perform the translation
241   GetOperations()->TranslateVector(anObject, aVector);
242
243   // Update GUI.
244   UpdateGUIForObject(theObject);
245
246   return aGEOMObject._retn();
247 }
248
249 //=============================================================================
250 /*!
251  *  TranslateVectorCopy
252  */
253 //=============================================================================
254 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy
255                                             (GEOM::GEOM_Object_ptr theObject,
256                                              GEOM::GEOM_Object_ptr theVector)
257 {
258   GEOM::GEOM_Object_var aGEOMObject;
259
260   //Set a not done flag
261   GetOperations()->SetNotDone();
262
263   //Get the object itself
264   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
265   if (aBasicObject.IsNull()) return aGEOMObject._retn();
266
267   //Get the vector of translation
268   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
269   if (aVector.IsNull()) return aGEOMObject._retn();
270
271   //Perform the translation
272   Handle(::GEOM_Object) anObject = GetOperations()->TranslateVectorCopy(aBasicObject, aVector);
273   if (!GetOperations()->IsDone() || anObject.IsNull())
274     return aGEOMObject._retn();
275
276   return GetObject(anObject);
277 }
278
279 //=============================================================================
280 /*!
281  *  TranslateVectorDistance
282  */
283 //=============================================================================
284 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance
285                                             (GEOM::GEOM_Object_ptr theObject,
286                                              GEOM::GEOM_Object_ptr theVector,
287                                              CORBA::Double theDistance,
288                                              CORBA::Boolean theCopy)
289 {
290   GEOM::GEOM_Object_var aGEOMObject;
291   GetOperations()->SetNotDone(); //Set a not done flag
292
293   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
294
295   //check if the object is a sub-shape
296   if (!theCopy && !theObject->IsMainShape()) {
297     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
298     return aGEOMObject._retn();
299   }
300
301   if (!theCopy)
302     aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
303
304   //Get the object itself
305   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
306   if (aBasicObject.IsNull()) return aGEOMObject._retn();
307
308   //Get the vector of translation
309   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
310   if (aVector.IsNull()) return aGEOMObject._retn();
311
312   //Perform the translation
313   if (theCopy) {
314     Handle(::GEOM_Object) anObject = GetOperations()->
315       TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
316     if (!GetOperations()->IsDone() || anObject.IsNull())
317       return aGEOMObject._retn();
318
319     return GetObject(anObject);
320   }
321
322   GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
323
324   // Update GUI.
325   UpdateGUIForObject(theObject);
326
327   return aGEOMObject._retn();
328 }
329
330 //=============================================================================
331 /*!
332  *  Rotate
333  */
334 //=============================================================================
335 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject,
336                                                            GEOM::GEOM_Object_ptr theAxis,
337                                                            CORBA::Double theAngle)
338 {
339   //Set a not done flag
340   GetOperations()->SetNotDone();
341   GEOM::GEOM_Object_var aGEOMObject;
342
343   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
344
345   //check if the object is a sub-shape
346   if (!theObject->IsMainShape()) {
347     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
348     return aGEOMObject._retn();
349   }
350
351   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
352
353   //Get the object itself
354   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
355   if (anObject.IsNull()) return aGEOMObject._retn();
356
357   //Get the axis of revolution
358   Handle(::GEOM_Object) anAxis = GetObjectImpl(theAxis);
359   if (anAxis.IsNull()) return aGEOMObject._retn();
360
361   //Perform the rotation
362   GetOperations()->Rotate(anObject, anAxis, theAngle);
363
364   // Update GUI.
365   UpdateGUIForObject(theObject);
366
367   return aGEOMObject._retn();
368 }
369
370 //=============================================================================
371 /*!
372  *  RotateCopy
373  */
374 //=============================================================================
375 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject,
376                                                                GEOM::GEOM_Object_ptr theAxis,
377                                                                CORBA::Double theAngle)
378 {
379   GEOM::GEOM_Object_var aGEOMObject;
380
381   //Set a not done flag
382   GetOperations()->SetNotDone();
383
384   //Get the object itself
385   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
386   if (aBasicObject.IsNull()) return aGEOMObject._retn();
387
388   //Get the axis of rotation
389   Handle(::GEOM_Object) anAxis = GetObjectImpl(theAxis);
390   if (anAxis.IsNull()) return aGEOMObject._retn();
391
392   //Perform the rotation
393   Handle(::GEOM_Object) anObject = GetOperations()->RotateCopy(aBasicObject, anAxis, theAngle);
394   if (!GetOperations()->IsDone() || anObject.IsNull())
395     return aGEOMObject._retn();
396
397   return GetObject(anObject);
398 }
399
400 //=============================================================================
401 /*!
402  *  MirrorPlane
403  */
404 //=============================================================================
405 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane
406                                             (GEOM::GEOM_Object_ptr theObject,
407                                              GEOM::GEOM_Object_ptr thePlane)
408 {
409   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
410
411   //Set a not done flag
412   GetOperations()->SetNotDone();
413
414   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
415
416   //check if the object is a sub-shape
417   if (!theObject->IsMainShape()) {
418     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
419     return aGEOMObject._retn();
420   }
421
422   //Get the object itself
423   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
424   if (anObject.IsNull()) return aGEOMObject._retn();
425
426   //Get the plane
427   Handle(::GEOM_Object) aPlane = GetObjectImpl(thePlane);
428   if (aPlane.IsNull()) return aGEOMObject._retn();
429
430   //Perform the mirror
431   GetOperations()->MirrorPlane(anObject, aPlane);
432
433   // Update GUI.
434   UpdateGUIForObject(theObject);
435
436   return aGEOMObject._retn();
437 }
438
439 //=============================================================================
440 /*!
441  *  MirrorPlaneCopy
442  */
443 //=============================================================================
444 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy
445                                             (GEOM::GEOM_Object_ptr theObject,
446                                              GEOM::GEOM_Object_ptr thePlane)
447 {
448   GEOM::GEOM_Object_var aGEOMObject;
449
450   //Set a not done flag
451   GetOperations()->SetNotDone();
452
453   //Get the object itself
454   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
455   if (aBasicObject.IsNull()) return aGEOMObject._retn();
456
457   //Get the vector of translation
458   Handle(::GEOM_Object) aPlane = GetObjectImpl(thePlane);
459   if (aPlane.IsNull()) return aGEOMObject._retn();
460
461   //Perform the mirror
462   Handle(::GEOM_Object) anObject = GetOperations()->MirrorPlaneCopy(aBasicObject, aPlane);
463   if (!GetOperations()->IsDone() || anObject.IsNull())
464     return aGEOMObject._retn();
465
466   return GetObject(anObject);
467 }
468
469 //=============================================================================
470 /*!
471  *  MirrorAxis
472  */
473 //=============================================================================
474 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis
475                                             (GEOM::GEOM_Object_ptr theObject,
476                                              GEOM::GEOM_Object_ptr theAxis)
477 {
478   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
479
480   //Set a not done flag
481   GetOperations()->SetNotDone();
482
483   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
484
485   //check if the object is a sub-shape
486   if (!theObject->IsMainShape()) {
487     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
488     return aGEOMObject._retn();
489   }
490
491   //Get the object itself
492   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
493   if (anObject.IsNull()) return aGEOMObject._retn();
494
495   //Get the axis
496   Handle(::GEOM_Object) aAxis = GetObjectImpl(theAxis);
497   if (aAxis.IsNull()) return aGEOMObject._retn();
498
499   //Perform the mirror
500   GetOperations()->MirrorAxis(anObject, aAxis);
501
502   // Update GUI.
503   UpdateGUIForObject(theObject);
504
505   return aGEOMObject._retn();
506 }
507
508 //=============================================================================
509 /*!
510  *  MirrorAxisCopy
511  */
512 //=============================================================================
513 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy
514                                             (GEOM::GEOM_Object_ptr theObject,
515                                              GEOM::GEOM_Object_ptr theAxis)
516 {
517   GEOM::GEOM_Object_var aGEOMObject;
518
519   //Set a not done flag
520   GetOperations()->SetNotDone();
521
522   //Get the object itself
523   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
524   if (aBasicObject.IsNull()) return aGEOMObject._retn();
525
526   //Get the vector of translation
527   Handle(::GEOM_Object) aAxis = GetObjectImpl(theAxis);
528   if (aAxis.IsNull()) return aGEOMObject._retn();
529
530   //Perform the mirror
531   Handle(::GEOM_Object) anObject = GetOperations()->MirrorAxisCopy(aBasicObject, aAxis);
532   if (!GetOperations()->IsDone() || anObject.IsNull())
533     return aGEOMObject._retn();
534
535   return GetObject(anObject);
536 }
537
538 //=============================================================================
539 /*!
540  *  MirrorPoint
541  */
542 //=============================================================================
543 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint
544                                             (GEOM::GEOM_Object_ptr theObject,
545                                              GEOM::GEOM_Object_ptr thePoint)
546 {
547   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
548
549   //Set a not done flag
550   GetOperations()->SetNotDone();
551
552   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
553
554   //check if the object is a sub-shape
555   if (!theObject->IsMainShape()) {
556     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
557     return aGEOMObject._retn();
558   }
559
560   //Get the object itself
561   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
562   if (anObject.IsNull()) return aGEOMObject._retn();
563
564   //Get the point
565   Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
566   if (aPoint.IsNull()) return aGEOMObject._retn();
567
568   //Perform the mirror
569   GetOperations()->MirrorPoint(anObject, aPoint);
570
571   // Update GUI.
572   UpdateGUIForObject(theObject);
573
574   return aGEOMObject._retn();
575 }
576
577 //=============================================================================
578 /*!
579  *  MirrorPointCopy
580  */
581 //=============================================================================
582 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy
583                                             (GEOM::GEOM_Object_ptr theObject,
584                                              GEOM::GEOM_Object_ptr thePoint)
585 {
586   GEOM::GEOM_Object_var aGEOMObject;
587
588   //Set a not done flag
589   GetOperations()->SetNotDone();
590
591   //Get the object itself
592   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
593   if (aBasicObject.IsNull()) return aGEOMObject._retn();
594
595   //Get the vector of translation
596   Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
597   if (aPoint.IsNull()) return aGEOMObject._retn();
598
599   //Perform the mirror
600   Handle(::GEOM_Object) anObject = GetOperations()->MirrorPointCopy(aBasicObject, aPoint);
601   if (!GetOperations()->IsDone() || anObject.IsNull())
602     return aGEOMObject._retn();
603
604   return GetObject(anObject);
605 }
606
607 //=============================================================================
608 /*!
609  *  OffsetShape
610  */
611 //=============================================================================
612 GEOM::GEOM_Object_ptr
613 GEOM_ITransformOperations_i::OffsetShape (GEOM::GEOM_Object_ptr theObject,
614                                           CORBA::Double         theOffset,
615                                           CORBA::Boolean        theJoinByPipes)
616 {
617   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
618
619   //Set a not done flag
620   GetOperations()->SetNotDone();
621
622   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
623
624   //check if the object is a sub-shape
625   if (!theObject->IsMainShape()) {
626     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
627     return aGEOMObject._retn();
628   }
629
630   //Get the basic object
631   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
632   if (aBasicObject.IsNull()) return aGEOMObject._retn();
633
634   //Create the offset shape
635   GetOperations()->OffsetShape( aBasicObject, theOffset, theJoinByPipes );
636
637   // Update GUI.
638   UpdateGUIForObject(theObject);
639
640   return aGEOMObject._retn();
641 }
642
643 //=============================================================================
644 /*!
645  *  OffsetShapeCopy
646  */
647 //=============================================================================
648 GEOM::GEOM_Object_ptr
649 GEOM_ITransformOperations_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject,
650                                               CORBA::Double         theOffset,
651                                               CORBA::Boolean        theJoinByPipes)
652 {
653   GEOM::GEOM_Object_var aGEOMObject;
654
655   //Set a not done flag
656   GetOperations()->SetNotDone();
657
658   //Get the basic object
659   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
660   if (aBasicObject.IsNull()) return aGEOMObject._retn();
661
662   //Create the offset shape
663   Handle(::GEOM_Object) anObject =
664     GetOperations()->OffsetShapeCopy(aBasicObject, theOffset, theJoinByPipes);
665   if (!GetOperations()->IsDone() || anObject.IsNull())
666     return aGEOMObject._retn();
667
668   return GetObject(anObject);
669 }
670
671 //=============================================================================
672 /*!
673  *  ProjectShapeCopy
674  */
675 //=============================================================================
676 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ProjectShapeCopy
677                                              (GEOM::GEOM_Object_ptr theSource,
678                                               GEOM::GEOM_Object_ptr theTarget)
679 {
680   GEOM::GEOM_Object_var aGEOMObject;
681
682   //Set a not done flag
683   GetOperations()->SetNotDone();
684
685   //Get the input objects
686   Handle(::GEOM_Object) aSource = GetObjectImpl(theSource);
687   Handle(::GEOM_Object) aTarget = GetObjectImpl(theTarget);
688   if (aSource.IsNull() || aTarget.IsNull()) return aGEOMObject._retn();
689
690   //Create the projection
691   Handle(::GEOM_Object) anObject = GetOperations()->ProjectShapeCopy(aSource, aTarget);
692   if (!GetOperations()->IsDone() || anObject.IsNull())
693     return aGEOMObject._retn();
694
695   return GetObject(anObject);
696 }
697
698 //=============================================================================
699 /*!
700  *  ProjectPointOnWire
701  */
702 //=============================================================================
703 CORBA::Double GEOM_ITransformOperations_i::ProjectPointOnWire
704                                (GEOM::GEOM_Object_ptr thePoint,
705                                 GEOM::GEOM_Object_ptr theWire,
706                                 GEOM::GEOM_Object_out thePointOnEdge,
707                                 CORBA::Long&          theEdgeInWireIndex)
708 {
709   //Set a not done flag
710   GetOperations()->SetNotDone();
711
712   //Get the reference shape
713   Handle(::GEOM_Object) aPoint = GetObjectImpl(thePoint);
714   Handle(::GEOM_Object) aWire = GetObjectImpl(theWire);
715
716   if (aPoint.IsNull() || aWire.IsNull()) {
717     return -1.0;
718   }
719
720   Handle(::GEOM_Object) aPointOnEdge;
721   Standard_Integer anEdgeIndex;
722   CORBA::Double aResult = GetOperations()->ProjectPointOnWire
723     (aPoint, aWire, aPointOnEdge, anEdgeIndex);
724
725   if (!aPointOnEdge.IsNull()) {
726     thePointOnEdge = GetObject(aPointOnEdge);
727     theEdgeInWireIndex = anEdgeIndex;
728   }
729
730   return aResult;
731 }
732
733 //=============================================================================
734 /*!
735  *  ScaleShape
736  */
737 //=============================================================================
738 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
739                                              (GEOM::GEOM_Object_ptr theObject,
740                                               GEOM::GEOM_Object_ptr thePoint,
741                                               CORBA::Double         theFactor)
742 {
743   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
744
745   //Set a not done flag
746   GetOperations()->SetNotDone();
747
748   if (theObject->_is_nil()) return aGEOMObject._retn();
749
750   //check if the object is a sub-shape
751   if (!theObject->IsMainShape()) {
752     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
753     return aGEOMObject._retn();
754   }
755
756   //Get the object itself
757   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
758   if (anObject.IsNull()) return aGEOMObject._retn();
759
760   //Get the point
761   Handle(::GEOM_Object) aPoint;
762   if (!thePoint->_is_nil()) {
763     aPoint = GetObjectImpl(thePoint);
764     if (aPoint.IsNull()) return aGEOMObject._retn();
765   }
766
767   //Perform the scale
768   GetOperations()->ScaleShape(anObject, aPoint, theFactor);
769
770   // Update GUI.
771   UpdateGUIForObject(theObject);
772
773   return  aGEOMObject._retn();
774 }
775
776 //=============================================================================
777 /*!
778  *  ScaleShapeCopy
779  */
780 //=============================================================================
781 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
782                                              (GEOM::GEOM_Object_ptr theObject,
783                                               GEOM::GEOM_Object_ptr thePoint,
784                                               CORBA::Double         theFactor)
785 {
786   GEOM::GEOM_Object_var aGEOMObject;
787
788   //Set a not done flag
789   GetOperations()->SetNotDone();
790
791   //Get the basic object
792   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
793   if (aBasicObject.IsNull()) return aGEOMObject._retn();
794
795   //Get the point
796   Handle(::GEOM_Object) aPoint;
797   if (!thePoint->_is_nil()) {
798     aPoint = GetObjectImpl(thePoint);
799     if (aPoint.IsNull()) return aGEOMObject._retn();
800   }
801
802   //Perform the scale
803   Handle(::GEOM_Object) anObject =
804     GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor);
805   if (!GetOperations()->IsDone() || anObject.IsNull())
806     return aGEOMObject._retn();
807
808   return GetObject(anObject);
809 }
810
811 //=============================================================================
812 /*!
813  *  ScaleShapeAlongAxes
814  */
815 //=============================================================================
816 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes
817                                              (GEOM::GEOM_Object_ptr theObject,
818                                               GEOM::GEOM_Object_ptr thePoint,
819                                               CORBA::Double         theFactorX,
820                                               CORBA::Double         theFactorY,
821                                               CORBA::Double         theFactorZ)
822 {
823   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
824
825   //Set a not done flag
826   GetOperations()->SetNotDone();
827
828   if (theObject->_is_nil()) return aGEOMObject._retn();
829
830   //check if the object is a sub-shape
831   if (!theObject->IsMainShape()) {
832     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
833     return aGEOMObject._retn();
834   }
835
836   //Get the object itself
837   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
838   if (anObject.IsNull()) return aGEOMObject._retn();
839
840   //Get the point
841   Handle(::GEOM_Object) aPoint;
842   if (!thePoint->_is_nil()) {
843     aPoint = GetObjectImpl(thePoint);
844     if (aPoint.IsNull()) return aGEOMObject._retn();
845   }
846
847   //Perform the scale
848   GetOperations()->ScaleShapeAlongAxes
849     (anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
850
851   // Update GUI.
852   UpdateGUIForObject(theObject);
853
854   return  aGEOMObject._retn();
855 }
856
857 //=============================================================================
858 /*!
859  *  ScaleShapeAlongAxesCopy
860  */
861 //=============================================================================
862 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy
863                                              (GEOM::GEOM_Object_ptr theObject,
864                                               GEOM::GEOM_Object_ptr thePoint,
865                                               CORBA::Double         theFactorX,
866                                               CORBA::Double         theFactorY,
867                                               CORBA::Double         theFactorZ)
868 {
869   GEOM::GEOM_Object_var aGEOMObject;
870
871   //Set a not done flag
872   GetOperations()->SetNotDone();
873
874   //Get the basic object
875   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
876   if (aBasicObject.IsNull()) return aGEOMObject._retn();
877
878   //Get the point
879   Handle(::GEOM_Object) aPoint;
880   if (!thePoint->_is_nil()) {
881     aPoint = GetObjectImpl(thePoint);
882     if (aPoint.IsNull()) return aGEOMObject._retn();
883   }
884
885   //Perform the scale
886   Handle(::GEOM_Object) anObject = GetOperations()->ScaleShapeAlongAxes
887     (aBasicObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/true);
888   if (!GetOperations()->IsDone() || anObject.IsNull())
889     return aGEOMObject._retn();
890
891   return GetObject(anObject);
892 }
893
894 //=============================================================================
895 /*!
896  *  PositionShape
897  */
898 //=============================================================================
899 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
900                                              (GEOM::GEOM_Object_ptr theObject,
901                                               GEOM::GEOM_Object_ptr theStartLCS,
902                                               GEOM::GEOM_Object_ptr theEndLCS)
903 {
904   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
905
906   //Set a not done flag
907   GetOperations()->SetNotDone();
908
909   if (CORBA::is_nil(theObject) || CORBA::is_nil(theEndLCS))
910     return aGEOMObject._retn();
911
912   //check if the object is a sub-shape
913   if (!theObject->IsMainShape()) {
914     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
915     return aGEOMObject._retn();
916   }
917
918   //Get the basic object
919   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
920   if (anObject.IsNull()) return aGEOMObject._retn();
921
922   //Get the Start LCS (may be NULL for positioning from global LCS)
923   Handle(::GEOM_Object) aStartLCS;
924   if (!CORBA::is_nil(theStartLCS)) {
925     aStartLCS = GetObjectImpl(theStartLCS);
926     if (aStartLCS.IsNull()) return aGEOMObject._retn();
927   }
928
929   //Get the End LCS
930   Handle(::GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS);
931   if (aEndLCS.IsNull()) return aGEOMObject._retn();
932
933   //Perform the Position
934   GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
935
936   // Update GUI.
937   UpdateGUIForObject(theObject);
938
939   return  aGEOMObject._retn();
940 }
941
942 //=============================================================================
943 /*!
944  *  PositionShapeCopy
945  */
946 //=============================================================================
947 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
948                                              (GEOM::GEOM_Object_ptr theObject,
949                                               GEOM::GEOM_Object_ptr theStartLCS,
950                                               GEOM::GEOM_Object_ptr theEndLCS)
951 {
952   GEOM::GEOM_Object_var aGEOMObject;
953
954   //Set a not done flag
955   GetOperations()->SetNotDone();
956
957   //Get the basic object
958   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
959   if (aBasicObject.IsNull()) return aGEOMObject._retn();
960
961   //Get the Start LCS (may be NULL for positioning from global LCS)
962   Handle(::GEOM_Object) aStartLCS;
963   if (!CORBA::is_nil(theStartLCS)) {
964     aStartLCS = GetObjectImpl(theStartLCS);
965     if (aStartLCS.IsNull()) return aGEOMObject._retn();
966   }
967
968   //Get the End LCS
969   Handle(::GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS);
970   if (aEndLCS.IsNull()) return aGEOMObject._retn();
971
972   //Perform the position
973   Handle(::GEOM_Object) anObject =
974     GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS);
975   if (!GetOperations()->IsDone() || anObject.IsNull())
976     return aGEOMObject._retn();
977
978   return GetObject(anObject);
979 }
980
981 //=============================================================================
982 /*!
983  *  PositionAlongPath
984  */
985 //=============================================================================
986 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
987                                              (GEOM::GEOM_Object_ptr theObject,
988                                               GEOM::GEOM_Object_ptr thePath,
989                                               CORBA::Double         theDistance,
990                                               CORBA::Boolean        theCopy,
991                                               CORBA::Boolean        theReverse)
992 {
993   GEOM::GEOM_Object_var aGEOMObject;
994
995   //Set a not done flag
996   GetOperations()->SetNotDone();
997
998   //Get the basic object
999   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1000   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1001
1002   //Get the path object
1003   Handle(::GEOM_Object) aPathObject = GetObjectImpl(thePath);
1004   if (aPathObject.IsNull()) return aGEOMObject._retn();
1005
1006   //Perform the position
1007   Handle(::GEOM_Object) anObject =
1008     GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
1009   if (!GetOperations()->IsDone() || anObject.IsNull())
1010     return aGEOMObject._retn();
1011
1012   if (!theCopy) {
1013     // Update GUI.
1014     UpdateGUIForObject(theObject);
1015   }
1016
1017   return GetObject(anObject);
1018 }
1019
1020 //=============================================================================
1021 /*!
1022  *  MultiTranslate1D
1023  */
1024 //=============================================================================
1025 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
1026                            (GEOM::GEOM_Object_ptr theObject,
1027                             GEOM::GEOM_Object_ptr theVector,
1028                             CORBA::Double theStep, CORBA::Long theNbTimes)
1029 {
1030   //Set a not done flag
1031   GetOperations()->SetNotDone();
1032
1033   GEOM::GEOM_Object_var aGEOMObject;
1034
1035   //Get the object itself
1036   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1037   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1038
1039   //Get the vector of translation
1040   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
1041   //if (aVector.IsNull()) return aGEOMObject._retn(); // DX by default
1042
1043   //Perform the translation
1044   Handle(::GEOM_Object) anObject =
1045     GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes);
1046   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1047
1048   return GetObject(anObject);
1049 }
1050
1051 //=============================================================================
1052 /*!
1053  *  MultiTranslate2D
1054  */
1055 //=============================================================================
1056 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
1057                                                                      GEOM::GEOM_Object_ptr theVector1,
1058                                                                      CORBA::Double theStep1,
1059                                                                      CORBA::Long theNbTimes1,
1060                                                                      GEOM::GEOM_Object_ptr theVector2,
1061                                                                      CORBA::Double theStep2,
1062                                                                      CORBA::Long theNbTimes2)
1063 {
1064   //Set a not done flag
1065   GetOperations()->SetNotDone();
1066
1067   GEOM::GEOM_Object_var aGEOMObject;
1068
1069   //Get the object itself
1070   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1071   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1072
1073   //Get the vector1 of translation
1074   Handle(::GEOM_Object) aVector1 = GetObjectImpl(theVector1);
1075   //if (aVector1.IsNull()) return aGEOMObject._retn(); // DX by default
1076
1077   //Get the vector2 of translation
1078   Handle(::GEOM_Object) aVector2 = GetObjectImpl(theVector2);
1079   //if (aVector2.IsNull()) return aGEOMObject._retn(); // DY by default
1080
1081   //Perform the translation
1082   Handle(::GEOM_Object) anObject = GetOperations()->Translate2D
1083     (aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2);
1084   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1085
1086   return GetObject(anObject);
1087 }
1088
1089 //=============================================================================
1090 /*!
1091  *  MultiRotate1D
1092  */
1093 //=============================================================================
1094 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
1095                                                                   GEOM::GEOM_Object_ptr theVector,
1096                                                                   CORBA::Long theNbTimes)
1097 {
1098   //Set a not done flag
1099   GetOperations()->SetNotDone();
1100
1101   GEOM::GEOM_Object_var aGEOMObject;
1102
1103   //Get the object itself
1104   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1105   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1106
1107   //Get the a directon of rotation
1108   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
1109   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1110
1111   //Perform the rotation
1112   Handle(::GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
1113   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1114
1115   return GetObject(anObject);
1116 }
1117
1118 //=============================================================================
1119 /*!
1120  *  MultiRotate1DByStep
1121  */
1122 //=============================================================================
1123 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1DByStep (GEOM::GEOM_Object_ptr theObject,
1124                                                                         GEOM::GEOM_Object_ptr theVector,
1125                                                                         CORBA::Double theAngleStep,
1126                                                                         CORBA::Long theNbSteps)
1127 {
1128   //Set a not done flag
1129   GetOperations()->SetNotDone();
1130
1131   GEOM::GEOM_Object_var aGEOMObject;
1132
1133   //Get the object itself
1134   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1135   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1136
1137   //Get the a directon of rotation
1138   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
1139   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1140
1141   //Perform the rotation
1142   Handle(::GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theAngleStep, theNbSteps);
1143   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1144
1145   return GetObject(anObject);
1146 }
1147
1148 //=============================================================================
1149 /*!
1150  *  MultiRotate2DNbTimes
1151  */
1152 //=============================================================================
1153 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DNbTimes (GEOM::GEOM_Object_ptr theObject,
1154                                                                          GEOM::GEOM_Object_ptr theVector,
1155                                                                          CORBA::Long theNbObjects,
1156                                                                          CORBA::Double theRadialStep,
1157                                                                          CORBA::Long theNbSteps)
1158 {
1159   //Set a not done flag
1160   GetOperations()->SetNotDone();
1161
1162   GEOM::GEOM_Object_var aGEOMObject;
1163
1164   //Get the object itself
1165   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1166   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1167
1168   //Get the a directon of rotation
1169   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
1170   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1171
1172   //Perform the rotation
1173   Handle(::GEOM_Object) anObject = GetOperations()->Rotate2D
1174     (aBasicObject, aVector, theNbObjects, theRadialStep, theNbSteps);
1175   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1176
1177   return GetObject(anObject);
1178 }
1179
1180 //=============================================================================
1181 /*!
1182  *  MultiRotate2DByStep
1183  */
1184 //=============================================================================
1185 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DByStep (GEOM::GEOM_Object_ptr theObject,
1186                                                                         GEOM::GEOM_Object_ptr theVector,
1187                                                                         CORBA::Double theAngle,
1188                                                                         CORBA::Long theNbTimes1,
1189                                                                         CORBA::Double theStep,
1190                                                                         CORBA::Long theNbTimes2)
1191 {
1192   //Set a not done flag
1193   GetOperations()->SetNotDone();
1194
1195   GEOM::GEOM_Object_var aGEOMObject;
1196
1197   //Get the object itself
1198   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1199   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1200
1201   //Get the a directon of rotation
1202   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
1203   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1204
1205   //Perform the rotation
1206   Handle(::GEOM_Object) anObject = GetOperations()->Rotate2D
1207     (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
1208   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1209
1210   return GetObject(anObject);
1211 }
1212
1213 //=============================================================================
1214 /*!
1215  *  MultiRotate2D
1216  */
1217 //=============================================================================
1218 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
1219                                                                   GEOM::GEOM_Object_ptr theVector,
1220                                                                   CORBA::Double theAngle,
1221                                                                   CORBA::Long theNbTimes1,
1222                                                                   CORBA::Double theStep,
1223                                                                   CORBA::Long theNbTimes2)
1224 {
1225   //Set a not done flag
1226   GetOperations()->SetNotDone();
1227
1228   GEOM::GEOM_Object_var aGEOMObject;
1229
1230   //Get the object itself
1231   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1232   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1233
1234   //Get the a directon of rotation
1235   Handle(::GEOM_Object) aVector = GetObjectImpl(theVector);
1236   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1237
1238   double anAngle = M_PI * theAngle / 180.;
1239
1240   //Perform the rotation
1241   Handle(::GEOM_Object) anObject = GetOperations()->Rotate2D
1242     (aBasicObject, aVector, anAngle, theNbTimes1, theStep, theNbTimes2);
1243   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1244
1245   return GetObject(anObject);
1246 }
1247
1248 //=============================================================================
1249 /*!
1250  *  RotateThreePoints
1251  */
1252 //=============================================================================
1253 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints
1254                                              (GEOM::GEOM_Object_ptr theObject,
1255                                               GEOM::GEOM_Object_ptr theCentPoint,
1256                                               GEOM::GEOM_Object_ptr thePoint1,
1257                                               GEOM::GEOM_Object_ptr thePoint2)
1258 {
1259   //Set a not done flag
1260   GetOperations()->SetNotDone();
1261   GEOM::GEOM_Object_var aGEOMObject;
1262
1263   if (CORBA::is_nil(theObject))
1264     return aGEOMObject._retn();
1265
1266   //check if the object is a sub-shape
1267   if (!theObject->IsMainShape()) {
1268     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
1269     return aGEOMObject._retn();
1270   }
1271
1272   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1273
1274   //Get the object itself
1275   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
1276   if (anObject.IsNull()) return aGEOMObject._retn();
1277
1278   //Get the central point of rotation
1279   Handle(::GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint);
1280   if (aCentPoint.IsNull()) return aGEOMObject._retn();
1281
1282   //Get the first point
1283   Handle(::GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
1284   if (aPoint1.IsNull()) return aGEOMObject._retn();
1285
1286   //Get the second point
1287   Handle(::GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
1288   if (aPoint2.IsNull()) return aGEOMObject._retn();
1289
1290   //Perform the translation
1291   GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2);
1292
1293   // Update GUI.
1294   UpdateGUIForObject(theObject);
1295
1296   return aGEOMObject._retn();
1297 }
1298
1299 //=============================================================================
1300 /*!
1301  *  RotateThreePointsCopy
1302  */
1303 //=============================================================================
1304 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy
1305                                              (GEOM::GEOM_Object_ptr theObject,
1306                                               GEOM::GEOM_Object_ptr theCentPoint,
1307                                               GEOM::GEOM_Object_ptr thePoint1,
1308                                               GEOM::GEOM_Object_ptr thePoint2)
1309 {
1310   GEOM::GEOM_Object_var aGEOMObject;
1311
1312   //Set a not done flag
1313   GetOperations()->SetNotDone();
1314
1315   //Get the object itself
1316   Handle(::GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1317   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1318
1319   //Get the central point of rotation
1320   Handle(::GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint);
1321   if (aCentPoint.IsNull()) return aGEOMObject._retn();
1322
1323   //Get the first point
1324   Handle(::GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
1325   if (aPoint1.IsNull()) return aGEOMObject._retn();
1326
1327   //Get the second point
1328   Handle(::GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
1329   if (aPoint2.IsNull()) return aGEOMObject._retn();
1330
1331   //Perform the rotation
1332   Handle(::GEOM_Object) anObject =
1333     GetOperations()->RotateThreePointsCopy(aBasicObject, aCentPoint, aPoint1, aPoint2);
1334   if (!GetOperations()->IsDone() || anObject.IsNull())
1335     return aGEOMObject._retn();
1336
1337   return GetObject(anObject);
1338 }
1339
1340 //=============================================================================
1341 /*!
1342  *  TransformLikeOtherCopy
1343  */
1344 //=============================================================================
1345 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TransformLikeOtherCopy
1346                                              (GEOM::GEOM_Object_ptr theObject,
1347                                               GEOM::GEOM_Object_ptr theSample)
1348 {
1349   GEOM::GEOM_Object_var aGEOMObject;
1350
1351   //Set a not done flag
1352   GetOperations()->SetNotDone();
1353
1354   //Get the object itself
1355   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
1356   if (anObject.IsNull()) return aGEOMObject._retn();
1357
1358   //Get the sample object
1359   Handle(::GEOM_Object) aSample = GetObjectImpl(theSample);
1360   if (aSample.IsNull()) return aGEOMObject._retn();
1361
1362   //Perform the transformation
1363   Handle(::GEOM_Object) aResObject =
1364     GetOperations()->TransformLikeOtherCopy(anObject, aSample);
1365   if (!GetOperations()->IsDone() || aResObject.IsNull())
1366     return aGEOMObject._retn();
1367
1368   return GetObject(aResObject);
1369 }
1370
1371 //=============================================================================
1372 /*!
1373  *  RecomputeObject
1374  */
1375 //=============================================================================
1376 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RecomputeObject
1377                                              (GEOM::GEOM_Object_ptr theObject)
1378 {
1379   //Set a not done flag
1380   GetOperations()->SetNotDone();
1381   GEOM::GEOM_Object_var aGEOMObject;
1382
1383   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
1384
1385   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1386
1387   //Get the object itself
1388   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
1389   if (anObject.IsNull()) return aGEOMObject._retn();
1390
1391   //Perform the recomputation
1392   Handle(::GEOM_Function) aLastFunction = anObject->GetLastFunction();
1393   if (aLastFunction.IsNull()) return aGEOMObject._retn();
1394   GetOperations()->GetSolver()->ComputeFunction(aLastFunction);
1395
1396   return aGEOMObject._retn();
1397 }
1398
1399 //=============================================================================
1400 /*!
1401  *  MakeProjectionOnCylinder
1402  */
1403 //=============================================================================
1404 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MakeProjectionOnCylinder
1405                                    (GEOM::GEOM_Object_ptr theObject,
1406                                     CORBA::Double         theRadius,
1407                                     CORBA::Double         theStartAngle,
1408                                     CORBA::Double         theAngleLength,
1409                                     CORBA::Double         theAngleRotation)
1410 {
1411   GEOM::GEOM_Object_var aGEOMObject;
1412
1413   //Set a not done flag
1414   GetOperations()->SetNotDone();
1415
1416   //Get the object
1417   Handle(::GEOM_Object) anObject = GetObjectImpl(theObject);
1418
1419   if (anObject.IsNull()) {
1420     return aGEOMObject._retn();
1421   }
1422
1423   //Perform the transformation
1424   Handle(::GEOM_Object) aResObject = GetOperations()->MakeProjectionOnCylinder
1425     (anObject, theRadius, theStartAngle, theAngleLength, theAngleRotation);
1426
1427   if (!GetOperations()->IsDone() || aResObject.IsNull()) {
1428     return aGEOMObject._retn();
1429   }
1430
1431   return GetObject(aResObject);
1432 }