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