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