Salome HOME
0022353: EDF GEOM: Projection on a edge or a wire
[modules/geom.git] / src / GEOM_I / GEOM_ITransformOperations_i.cc
1 // Copyright (C) 2007-2013  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.
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 GEOM_ITransformOperations_i::OffsetShape
613                                              (GEOM::GEOM_Object_ptr theObject,
614                                               CORBA::Double theOffset)
615 {
616   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
617
618   //Set a not done flag
619   GetOperations()->SetNotDone();
620
621   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
622
623   //check if the object is a sub-shape
624   if (!theObject->IsMainShape()) {
625     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
626     return aGEOMObject._retn();
627   }
628
629   //Get the basic object
630   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
631   if (aBasicObject.IsNull()) return aGEOMObject._retn();
632
633   //Create the offset shape
634   GetOperations()->OffsetShape(aBasicObject, theOffset);
635
636   // Update GUI.
637   UpdateGUIForObject(theObject);
638
639   return aGEOMObject._retn();
640 }
641
642 //=============================================================================
643 /*!
644  *  OffsetShapeCopy
645  */
646 //=============================================================================
647 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
648                                              (GEOM::GEOM_Object_ptr theObject,
649                                               CORBA::Double theOffset)
650 {
651   GEOM::GEOM_Object_var aGEOMObject;
652
653   //Set a not done flag
654   GetOperations()->SetNotDone();
655
656   //Get the basic object
657   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
658   if (aBasicObject.IsNull()) return aGEOMObject._retn();
659
660   //Create the offset shape
661   Handle(GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset);
662   if (!GetOperations()->IsDone() || anObject.IsNull())
663     return aGEOMObject._retn();
664
665   return GetObject(anObject);
666 }
667
668 //=============================================================================
669 /*!
670  *  ProjectShapeCopy
671  */
672 //=============================================================================
673 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ProjectShapeCopy
674                                              (GEOM::GEOM_Object_ptr theSource,
675                                               GEOM::GEOM_Object_ptr theTarget)
676 {
677   GEOM::GEOM_Object_var aGEOMObject;
678
679   //Set a not done flag
680   GetOperations()->SetNotDone();
681
682   //Get the input objects
683   Handle(GEOM_Object) aSource = GetObjectImpl(theSource);
684   Handle(GEOM_Object) aTarget = GetObjectImpl(theTarget);
685   if (aSource.IsNull() || aTarget.IsNull()) return aGEOMObject._retn();
686
687   //Create the projection
688   Handle(GEOM_Object) anObject = GetOperations()->ProjectShapeCopy(aSource, aTarget);
689   if (!GetOperations()->IsDone() || anObject.IsNull())
690     return aGEOMObject._retn();
691
692   return GetObject(anObject);
693 }
694
695 //=============================================================================
696 /*!
697  *  ProjectPointOnWire
698  */
699 //=============================================================================
700 CORBA::Double GEOM_ITransformOperations_i::ProjectPointOnWire
701                                (GEOM::GEOM_Object_ptr thePoint,
702                                 GEOM::GEOM_Object_ptr theWire,
703                                 GEOM::GEOM_Object_out thePointOnEdge,
704                                 CORBA::Long&          theEdgeInWireIndex)
705 {
706   //Set a not done flag
707   GetOperations()->SetNotDone();
708
709   //Get the reference shape
710   Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
711   Handle(GEOM_Object) aWire = GetObjectImpl(theWire);
712
713   if (aPoint.IsNull() || aWire.IsNull()) {
714     return -1.0;
715   }
716
717   Handle(GEOM_Object) aPointOnEdge;
718   CORBA::Double aResult = GetOperations()->ProjectPointOnWire
719     (aPoint, aWire, aPointOnEdge, theEdgeInWireIndex);
720
721   if (!aPointOnEdge.IsNull()) {
722     thePointOnEdge = GetObject(aPointOnEdge);
723   }
724
725   return aResult;
726 }
727
728 //=============================================================================
729 /*!
730  *  ScaleShape
731  */
732 //=============================================================================
733 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
734                                              (GEOM::GEOM_Object_ptr theObject,
735                                               GEOM::GEOM_Object_ptr thePoint,
736                                               CORBA::Double         theFactor)
737 {
738   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
739
740   //Set a not done flag
741   GetOperations()->SetNotDone();
742
743   if (theObject->_is_nil()) return aGEOMObject._retn();
744
745   //check if the object is a sub-shape
746   if (!theObject->IsMainShape()) {
747     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
748     return aGEOMObject._retn();
749   }
750
751   //Get the object itself
752   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
753   if (anObject.IsNull()) return aGEOMObject._retn();
754
755   //Get the point
756   Handle(GEOM_Object) aPoint;
757   if (!thePoint->_is_nil()) {
758     aPoint = GetObjectImpl(thePoint);
759     if (aPoint.IsNull()) return aGEOMObject._retn();
760   }
761
762   //Perform the scale
763   GetOperations()->ScaleShape(anObject, aPoint, theFactor);
764
765   // Update GUI.
766   UpdateGUIForObject(theObject);
767
768   return  aGEOMObject._retn();
769 }
770
771 //=============================================================================
772 /*!
773  *  ScaleShapeCopy
774  */
775 //=============================================================================
776 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
777                                              (GEOM::GEOM_Object_ptr theObject,
778                                               GEOM::GEOM_Object_ptr thePoint,
779                                               CORBA::Double         theFactor)
780 {
781   GEOM::GEOM_Object_var aGEOMObject;
782
783   //Set a not done flag
784   GetOperations()->SetNotDone();
785
786   //Get the basic object
787   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
788   if (aBasicObject.IsNull()) return aGEOMObject._retn();
789
790   //Get the point
791   Handle(GEOM_Object) aPoint;
792   if (!thePoint->_is_nil()) {
793     aPoint = GetObjectImpl(thePoint);
794     if (aPoint.IsNull()) return aGEOMObject._retn();
795   }
796
797   //Perform the scale
798   Handle(GEOM_Object) anObject =
799     GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor);
800   if (!GetOperations()->IsDone() || anObject.IsNull())
801     return aGEOMObject._retn();
802
803   return GetObject(anObject);
804 }
805
806 //=============================================================================
807 /*!
808  *  ScaleShapeAlongAxes
809  */
810 //=============================================================================
811 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes
812                                              (GEOM::GEOM_Object_ptr theObject,
813                                               GEOM::GEOM_Object_ptr thePoint,
814                                               CORBA::Double         theFactorX,
815                                               CORBA::Double         theFactorY,
816                                               CORBA::Double         theFactorZ)
817 {
818   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
819
820   //Set a not done flag
821   GetOperations()->SetNotDone();
822
823   if (theObject->_is_nil()) return aGEOMObject._retn();
824
825   //check if the object is a sub-shape
826   if (!theObject->IsMainShape()) {
827     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
828     return aGEOMObject._retn();
829   }
830
831   //Get the object itself
832   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
833   if (anObject.IsNull()) return aGEOMObject._retn();
834
835   //Get the point
836   Handle(GEOM_Object) aPoint;
837   if (!thePoint->_is_nil()) {
838     aPoint = GetObjectImpl(thePoint);
839     if (aPoint.IsNull()) return aGEOMObject._retn();
840   }
841
842   //Perform the scale
843   GetOperations()->ScaleShapeAlongAxes
844     (anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
845
846   // Update GUI.
847   UpdateGUIForObject(theObject);
848
849   return  aGEOMObject._retn();
850 }
851
852 //=============================================================================
853 /*!
854  *  ScaleShapeAlongAxesCopy
855  */
856 //=============================================================================
857 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy
858                                              (GEOM::GEOM_Object_ptr theObject,
859                                               GEOM::GEOM_Object_ptr thePoint,
860                                               CORBA::Double         theFactorX,
861                                               CORBA::Double         theFactorY,
862                                               CORBA::Double         theFactorZ)
863 {
864   GEOM::GEOM_Object_var aGEOMObject;
865
866   //Set a not done flag
867   GetOperations()->SetNotDone();
868
869   //Get the basic object
870   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
871   if (aBasicObject.IsNull()) return aGEOMObject._retn();
872
873   //Get the point
874   Handle(GEOM_Object) aPoint;
875   if (!thePoint->_is_nil()) {
876     aPoint = GetObjectImpl(thePoint);
877     if (aPoint.IsNull()) return aGEOMObject._retn();
878   }
879
880   //Perform the scale
881   Handle(GEOM_Object) anObject = GetOperations()->ScaleShapeAlongAxes
882     (aBasicObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/true);
883   if (!GetOperations()->IsDone() || anObject.IsNull())
884     return aGEOMObject._retn();
885
886   return GetObject(anObject);
887 }
888
889 //=============================================================================
890 /*!
891  *  PositionShape
892  */
893 //=============================================================================
894 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
895                                              (GEOM::GEOM_Object_ptr theObject,
896                                               GEOM::GEOM_Object_ptr theStartLCS,
897                                               GEOM::GEOM_Object_ptr theEndLCS)
898 {
899   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
900
901   //Set a not done flag
902   GetOperations()->SetNotDone();
903
904   if (CORBA::is_nil(theObject) || CORBA::is_nil(theEndLCS))
905     return aGEOMObject._retn();
906
907   //check if the object is a sub-shape
908   if (!theObject->IsMainShape()) {
909     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
910     return aGEOMObject._retn();
911   }
912
913   //Get the basic object
914   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
915   if (anObject.IsNull()) return aGEOMObject._retn();
916
917   //Get the Start LCS (may be NULL for positioning from global LCS)
918   Handle(GEOM_Object) aStartLCS;
919   if (!CORBA::is_nil(theStartLCS)) {
920     aStartLCS = GetObjectImpl(theStartLCS);
921     if (aStartLCS.IsNull()) return aGEOMObject._retn();
922   }
923
924   //Get the End LCS
925   Handle(GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS);
926   if (aEndLCS.IsNull()) return aGEOMObject._retn();
927
928   //Perform the Position
929   GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
930
931   // Update GUI.
932   UpdateGUIForObject(theObject);
933
934   return  aGEOMObject._retn();
935 }
936
937 //=============================================================================
938 /*!
939  *  PositionShapeCopy
940  */
941 //=============================================================================
942 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
943                                              (GEOM::GEOM_Object_ptr theObject,
944                                               GEOM::GEOM_Object_ptr theStartLCS,
945                                               GEOM::GEOM_Object_ptr theEndLCS)
946 {
947   GEOM::GEOM_Object_var aGEOMObject;
948
949   //Set a not done flag
950   GetOperations()->SetNotDone();
951
952   //Get the basic object
953   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
954   if (aBasicObject.IsNull()) return aGEOMObject._retn();
955
956   //Get the Start LCS (may be NULL for positioning from global LCS)
957   Handle(GEOM_Object) aStartLCS;
958   if (!CORBA::is_nil(theStartLCS)) {
959     aStartLCS = GetObjectImpl(theStartLCS);
960     if (aStartLCS.IsNull()) return aGEOMObject._retn();
961   }
962
963   //Get the End LCS
964   Handle(GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS);
965   if (aEndLCS.IsNull()) return aGEOMObject._retn();
966
967   //Perform the position
968   Handle(GEOM_Object) anObject =
969     GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS);
970   if (!GetOperations()->IsDone() || anObject.IsNull())
971     return aGEOMObject._retn();
972
973   return GetObject(anObject);
974 }
975
976 //=============================================================================
977 /*!
978  *  PositionAlongPath
979  */
980 //=============================================================================
981 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
982                                              (GEOM::GEOM_Object_ptr theObject,
983                                               GEOM::GEOM_Object_ptr thePath,
984                                               CORBA::Double         theDistance,
985                                               CORBA::Boolean        theCopy,
986                                               CORBA::Boolean        theReverse)
987 {
988   GEOM::GEOM_Object_var aGEOMObject;
989
990   //Set a not done flag
991   GetOperations()->SetNotDone();
992
993   //Get the basic object
994   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
995   if (aBasicObject.IsNull()) return aGEOMObject._retn();
996
997   //Get the path object
998   Handle(GEOM_Object) aPathObject = GetObjectImpl(thePath);
999   if (aPathObject.IsNull()) return aGEOMObject._retn();
1000
1001   //Perform the position
1002   Handle(GEOM_Object) anObject =
1003     GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
1004   if (!GetOperations()->IsDone() || anObject.IsNull())
1005     return aGEOMObject._retn();
1006
1007   if (!theCopy) {
1008     // Update GUI.
1009     UpdateGUIForObject(theObject);
1010   }
1011
1012   return GetObject(anObject);
1013 }
1014
1015 //=============================================================================
1016 /*!
1017  *  MultiTranslate1D
1018  */
1019 //=============================================================================
1020 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
1021                            (GEOM::GEOM_Object_ptr theObject,
1022                             GEOM::GEOM_Object_ptr theVector,
1023                             CORBA::Double theStep, CORBA::Long theNbTimes)
1024 {
1025   //Set a not done flag
1026   GetOperations()->SetNotDone();
1027
1028   GEOM::GEOM_Object_var aGEOMObject;
1029
1030   //Get the object itself
1031   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1032   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1033
1034   //Get the vector of translation
1035   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
1036   //if (aVector.IsNull()) return aGEOMObject._retn(); // DX by default
1037
1038   //Perform the translation
1039   Handle(GEOM_Object) anObject =
1040     GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes);
1041   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1042
1043   return GetObject(anObject);
1044 }
1045
1046 //=============================================================================
1047 /*!
1048  *  MultiTranslate2D
1049  */
1050 //=============================================================================
1051 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
1052                                                                      GEOM::GEOM_Object_ptr theVector1,
1053                                                                      CORBA::Double theStep1,
1054                                                                      CORBA::Long theNbTimes1,
1055                                                                      GEOM::GEOM_Object_ptr theVector2,
1056                                                                      CORBA::Double theStep2,
1057                                                                      CORBA::Long theNbTimes2)
1058 {
1059   //Set a not done flag
1060   GetOperations()->SetNotDone();
1061
1062   GEOM::GEOM_Object_var aGEOMObject;
1063
1064   //Get the object itself
1065   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1066   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1067
1068   //Get the vector1 of translation
1069   Handle(GEOM_Object) aVector1 = GetObjectImpl(theVector1);
1070   //if (aVector1.IsNull()) return aGEOMObject._retn(); // DX by default
1071
1072   //Get the vector2 of translation
1073   Handle(GEOM_Object) aVector2 = GetObjectImpl(theVector2);
1074   //if (aVector2.IsNull()) return aGEOMObject._retn(); // DY by default
1075
1076   //Perform the translation
1077   Handle(GEOM_Object) anObject = GetOperations()->Translate2D
1078     (aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2);
1079   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1080
1081   return GetObject(anObject);
1082 }
1083
1084 //=============================================================================
1085 /*!
1086  *  MultiRotate1D
1087  */
1088 //=============================================================================
1089 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
1090                                                                   GEOM::GEOM_Object_ptr theVector,
1091                                                                   CORBA::Long theNbTimes)
1092 {
1093   //Set a not done flag
1094   GetOperations()->SetNotDone();
1095
1096   GEOM::GEOM_Object_var aGEOMObject;
1097
1098   //Get the object itself
1099   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1100   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1101
1102   //Get the a directon of rotation
1103   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
1104   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1105
1106   //Perform the rotation
1107   Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
1108   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1109
1110   return GetObject(anObject);
1111 }
1112
1113 //=============================================================================
1114 /*!
1115  *  MultiRotate1DByStep
1116  */
1117 //=============================================================================
1118 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1DByStep (GEOM::GEOM_Object_ptr theObject,
1119                                                                         GEOM::GEOM_Object_ptr theVector,
1120                                                                         CORBA::Double theAngleStep,
1121                                                                         CORBA::Long theNbSteps)
1122 {
1123   //Set a not done flag
1124   GetOperations()->SetNotDone();
1125
1126   GEOM::GEOM_Object_var aGEOMObject;
1127
1128   //Get the object itself
1129   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1130   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1131
1132   //Get the a directon of rotation
1133   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
1134   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1135
1136   //Perform the rotation
1137   Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theAngleStep, theNbSteps);
1138   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1139
1140   return GetObject(anObject);
1141 }
1142
1143 //=============================================================================
1144 /*!
1145  *  MultiRotate2DNbTimes
1146  */
1147 //=============================================================================
1148 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DNbTimes (GEOM::GEOM_Object_ptr theObject,
1149                                                                          GEOM::GEOM_Object_ptr theVector,
1150                                                                          CORBA::Long theNbObjects,
1151                                                                          CORBA::Double theRadialStep,
1152                                                                          CORBA::Long theNbSteps)
1153 {
1154   //Set a not done flag
1155   GetOperations()->SetNotDone();
1156
1157   GEOM::GEOM_Object_var aGEOMObject;
1158
1159   //Get the object itself
1160   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1161   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1162
1163   //Get the a directon of rotation
1164   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
1165   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1166
1167   //Perform the rotation
1168   Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
1169     (aBasicObject, aVector, theNbObjects, theRadialStep, theNbSteps);
1170   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1171
1172   return GetObject(anObject);
1173 }
1174
1175 //=============================================================================
1176 /*!
1177  *  MultiRotate2DByStep
1178  */
1179 //=============================================================================
1180 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2DByStep (GEOM::GEOM_Object_ptr theObject,
1181                                                                         GEOM::GEOM_Object_ptr theVector,
1182                                                                         CORBA::Double theAngle,
1183                                                                         CORBA::Long theNbTimes1,
1184                                                                         CORBA::Double theStep,
1185                                                                         CORBA::Long theNbTimes2)
1186 {
1187   //Set a not done flag
1188   GetOperations()->SetNotDone();
1189
1190   GEOM::GEOM_Object_var aGEOMObject;
1191
1192   //Get the object itself
1193   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1194   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1195
1196   //Get the a directon of rotation
1197   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
1198   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1199
1200   //Perform the rotation
1201   Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
1202     (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
1203   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1204
1205   return GetObject(anObject);
1206 }
1207
1208 //=============================================================================
1209 /*!
1210  *  MultiRotate2D
1211  */
1212 //=============================================================================
1213 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
1214                                                                   GEOM::GEOM_Object_ptr theVector,
1215                                                                   CORBA::Double theAngle,
1216                                                                   CORBA::Long theNbTimes1,
1217                                                                   CORBA::Double theStep,
1218                                                                   CORBA::Long theNbTimes2)
1219 {
1220   //Set a not done flag
1221   GetOperations()->SetNotDone();
1222
1223   GEOM::GEOM_Object_var aGEOMObject;
1224
1225   //Get the object itself
1226   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1227   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1228
1229   //Get the a directon of rotation
1230   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
1231   //if (aVector.IsNull()) return aGEOMObject._retn(); // DZ by default
1232
1233   double anAngle = M_PI * theAngle / 180.;
1234
1235   //Perform the rotation
1236   Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
1237     (aBasicObject, aVector, anAngle, theNbTimes1, theStep, theNbTimes2);
1238   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
1239
1240   return GetObject(anObject);
1241 }
1242
1243 //=============================================================================
1244 /*!
1245  *  RotateThreePoints
1246  */
1247 //=============================================================================
1248 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints
1249                                              (GEOM::GEOM_Object_ptr theObject,
1250                                               GEOM::GEOM_Object_ptr theCentPoint,
1251                                               GEOM::GEOM_Object_ptr thePoint1,
1252                                               GEOM::GEOM_Object_ptr thePoint2)
1253 {
1254   //Set a not done flag
1255   GetOperations()->SetNotDone();
1256   GEOM::GEOM_Object_var aGEOMObject;
1257
1258   if (CORBA::is_nil(theObject))
1259     return aGEOMObject._retn();
1260
1261   //check if the object is a sub-shape
1262   if (!theObject->IsMainShape()) {
1263     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
1264     return aGEOMObject._retn();
1265   }
1266
1267   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1268
1269   //Get the object itself
1270   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
1271   if (anObject.IsNull()) return aGEOMObject._retn();
1272
1273   //Get the central point of rotation
1274   Handle(GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint);
1275   if (aCentPoint.IsNull()) return aGEOMObject._retn();
1276
1277   //Get the first point
1278   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
1279   if (aPoint1.IsNull()) return aGEOMObject._retn();
1280
1281   //Get the second point
1282   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
1283   if (aPoint2.IsNull()) return aGEOMObject._retn();
1284
1285   //Perform the translation
1286   GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2);
1287
1288   // Update GUI.
1289   UpdateGUIForObject(theObject);
1290
1291   return aGEOMObject._retn();
1292 }
1293
1294 //=============================================================================
1295 /*!
1296  *  RotateThreePointsCopy
1297  */
1298 //=============================================================================
1299 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy
1300                                              (GEOM::GEOM_Object_ptr theObject,
1301                                               GEOM::GEOM_Object_ptr theCentPoint,
1302                                               GEOM::GEOM_Object_ptr thePoint1,
1303                                               GEOM::GEOM_Object_ptr thePoint2)
1304 {
1305   GEOM::GEOM_Object_var aGEOMObject;
1306
1307   //Set a not done flag
1308   GetOperations()->SetNotDone();
1309
1310   //Get the object itself
1311   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1312   if (aBasicObject.IsNull()) return aGEOMObject._retn();
1313
1314   //Get the central point of rotation
1315   Handle(GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint);
1316   if (aCentPoint.IsNull()) return aGEOMObject._retn();
1317
1318   //Get the first point
1319   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
1320   if (aPoint1.IsNull()) return aGEOMObject._retn();
1321
1322   //Get the second point
1323   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
1324   if (aPoint2.IsNull()) return aGEOMObject._retn();
1325
1326   //Perform the rotation
1327   Handle(GEOM_Object) anObject =
1328     GetOperations()->RotateThreePointsCopy(aBasicObject, aCentPoint, aPoint1, aPoint2);
1329   if (!GetOperations()->IsDone() || anObject.IsNull())
1330     return aGEOMObject._retn();
1331
1332   return GetObject(anObject);
1333 }
1334
1335 //=============================================================================
1336 /*!
1337  *  TransformLikeOtherCopy
1338  */
1339 //=============================================================================
1340 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TransformLikeOtherCopy
1341                                              (GEOM::GEOM_Object_ptr theObject,
1342                                               GEOM::GEOM_Object_ptr theSample)
1343 {
1344   GEOM::GEOM_Object_var aGEOMObject;
1345
1346   //Set a not done flag
1347   GetOperations()->SetNotDone();
1348
1349   //Get the object itself
1350   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
1351   if (anObject.IsNull()) return aGEOMObject._retn();
1352
1353   //Get the sample object
1354   Handle(GEOM_Object) aSample = GetObjectImpl(theSample);
1355   if (aSample.IsNull()) return aGEOMObject._retn();
1356
1357   //Perform the transformation
1358   Handle(GEOM_Object) aResObject =
1359     GetOperations()->TransformLikeOtherCopy(anObject, aSample);
1360   if (!GetOperations()->IsDone() || aResObject.IsNull())
1361     return aGEOMObject._retn();
1362
1363   return GetObject(aResObject);
1364 }
1365
1366 //=============================================================================
1367 /*!
1368  *  RecomputeObject
1369  */
1370 //=============================================================================
1371 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RecomputeObject
1372                                              (GEOM::GEOM_Object_ptr theObject)
1373 {
1374   //Set a not done flag
1375   GetOperations()->SetNotDone();
1376   GEOM::GEOM_Object_var aGEOMObject;
1377
1378   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
1379
1380   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1381
1382   //Get the object itself
1383   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
1384   if (anObject.IsNull()) return aGEOMObject._retn();
1385
1386   //Perform the recomputation
1387   Handle(GEOM_Function) aLastFunction = anObject->GetLastFunction();
1388   if (aLastFunction.IsNull()) return aGEOMObject._retn();
1389   GetOperations()->GetSolver()->ComputeFunction(aLastFunction);
1390
1391   return aGEOMObject._retn();
1392 }