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