1 // Created on: 1993-03-05
2 // Created by: Philippe DAUTRY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <MgtGeom.ixx>
19 #include <Standard_Type.hxx>
21 #include <PColStd_HArray1OfInteger.hxx>
22 #include <PColStd_HArray2OfInteger.hxx>
23 #include <PColStd_HArray1OfReal.hxx>
24 #include <PColStd_HArray2OfReal.hxx>
26 #include <TColStd_Array1OfInteger.hxx>
27 #include <TColStd_Array2OfInteger.hxx>
28 #include <TColStd_HArray1OfInteger.hxx>
30 #include <TColStd_Array1OfReal.hxx>
31 #include <TColStd_Array2OfReal.hxx>
32 #include <TColStd_HArray1OfReal.hxx>
33 #include <TColStd_HArray2OfReal.hxx>
35 #include <TColgp_Array1OfPnt.hxx>
36 #include <TColgp_Array2OfPnt.hxx>
37 #include <TColgp_HArray1OfPnt.hxx>
38 #include <TColgp_HArray2OfPnt.hxx>
40 #include <PColgp_HArray1OfPnt.hxx>
41 #include <PColgp_HArray2OfPnt.hxx>
44 #include <gp_Circ.hxx>
48 #include <Standard_NullObject.hxx>
52 // *******************************************************************
53 // The following methods are subroutines used to copy elements
54 // from structures to other structures, as array1 or array2.
55 // *******************************************************************
57 // *******************************************************************
58 // Structures from TCollection to structures from PCollection.
59 // *******************************************************************
61 //=======================================================================
62 //function : ArrayCopy
63 //purpose : Copy the gp_Pnt
64 // from an Array1 from TColgp (TCollection)
65 // to an HArray1 from PColgp (PCollection)
66 //=======================================================================
68 static Handle(PColgp_HArray1OfPnt) ArrayCopy
69 (const TColgp_Array1OfPnt& TArray)
71 Standard_Integer Lower = TArray.Lower();
72 Standard_Integer Upper = TArray.Upper();
73 Standard_Integer Index;
74 Handle(PColgp_HArray1OfPnt) PArray = new PColgp_HArray1OfPnt(Lower, Upper);
75 for (Index = Lower; Index <= Upper; Index++) {
76 PArray->SetValue(Index, TArray(Index));
81 //=======================================================================
82 //function : ArrayCopy
83 //purpose : Copy the gp_Pnt
84 // from an Array2 from TColgp (TCollection)
85 // to an HArray2 from PColgp (PCollection)
86 //=======================================================================
88 static Handle(PColgp_HArray2OfPnt) ArrayCopy
89 (const TColgp_Array2OfPnt& TArray)
91 Standard_Integer LowerRow = TArray.LowerRow();
92 Standard_Integer UpperRow = TArray.UpperRow();
93 Standard_Integer LowerCol = TArray.LowerCol();
94 Standard_Integer UpperCol = TArray.UpperCol();
95 Standard_Integer IndexRow, IndexCol;
96 Handle(PColgp_HArray2OfPnt) PArray =
97 new PColgp_HArray2OfPnt(LowerRow, UpperRow, LowerCol, UpperCol);
98 for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
99 for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
100 PArray->SetValue(IndexRow, IndexCol, TArray(IndexRow, IndexCol));
106 //=======================================================================
107 //function : ArrayCopy
108 //purpose : Copy the Standard_Real
109 // from an Array1 from TColStd (TCollection)
110 // to an SingleArray from PCollection
111 //=======================================================================
113 static Handle(PColStd_HArray1OfReal) ArrayCopy
114 (const TColStd_Array1OfReal& TArray)
116 Standard_Integer Lower = TArray.Lower();
117 Standard_Integer Upper = TArray.Upper();
118 Standard_Integer Index;
119 Handle(PColStd_HArray1OfReal) PArray =
120 new PColStd_HArray1OfReal(Lower, Upper);
121 for (Index = Lower; Index <= Upper; Index++) {
122 PArray->SetValue(Index, TArray(Index));
127 //=======================================================================
128 //function : ArrayCopy
129 //purpose : Copy the Standard_Real
130 // from an Array2 from TColStd (TCollection)
131 // to an DoubleArray from PCollection
132 //=======================================================================
134 static Handle(PColStd_HArray2OfReal) ArrayCopy
135 (const TColStd_Array2OfReal& TArray)
137 Standard_Integer LowerRow = TArray.LowerRow();
138 Standard_Integer UpperRow = TArray.UpperRow();
139 Standard_Integer LowerCol = TArray.LowerCol();
140 Standard_Integer UpperCol = TArray.UpperCol();
141 Standard_Integer IndexRow, IndexCol;
142 Handle(PColStd_HArray2OfReal) PArray =
143 new PColStd_HArray2OfReal(LowerRow, UpperRow, LowerCol, UpperCol);
144 for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
145 for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
146 PArray->SetValue(IndexRow, IndexCol, TArray(IndexRow, IndexCol));
152 //=======================================================================
153 //function : ArrayCopy
154 //purpose : Copy the Standard_Integer
155 // from an Array1 from TColStd (TCollection)
156 // to an SingleArray from PCollection
157 //=======================================================================
159 static Handle(PColStd_HArray1OfInteger) ArrayCopy
160 (const TColStd_Array1OfInteger& TArray)
162 Standard_Integer Lower = TArray.Lower();
163 Standard_Integer Upper = TArray.Upper();
164 Standard_Integer Index;
165 Handle(PColStd_HArray1OfInteger) PArray =
166 new PColStd_HArray1OfInteger(Lower, Upper);
167 for (Index = Lower; Index <= Upper; Index++) {
168 PArray->SetValue(Index, TArray(Index));
173 // *******************************************************************
174 // Structures from PCollection to structures from TCollection.
175 // *******************************************************************
177 //=======================================================================
178 //function : ArrayCopy
179 //purpose : Copy the gp_Pnt
180 // from an HArray1 from PColgp (PCollection)
181 // to an Array1 from TColgp (TCollection)
182 //=======================================================================
184 static void ArrayCopy
185 (const Handle(PColgp_HArray1OfPnt)& PArray,
186 TColgp_Array1OfPnt& TArray)
188 Standard_Integer Lower = PArray->Lower();
189 Standard_Integer Upper = PArray->Upper();
190 Standard_Integer Index;
191 for (Index = Lower; Index <= Upper; Index++) {
192 TArray(Index) = PArray->Value(Index);
196 //=======================================================================
197 //function : ArrayCopy
198 //purpose : Copy the gp_Pnt
199 // from an HArray2 from PColgp (PCollection)
200 // to an Array2 from TColgp (TCollection)
201 //=======================================================================
203 static void ArrayCopy
204 (const Handle(PColgp_HArray2OfPnt)& PArray,
205 TColgp_Array2OfPnt& TArray)
207 Standard_Integer LowerRow = TArray.LowerRow();
208 Standard_Integer UpperRow = TArray.UpperRow();
209 Standard_Integer LowerCol = TArray.LowerCol();
210 Standard_Integer UpperCol = TArray.UpperCol();
211 Standard_Integer IndexRow, IndexCol;
212 for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
213 for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
214 TArray(IndexRow, IndexCol) = PArray->Value(IndexRow, IndexCol);
219 //=======================================================================
220 //function : ArrayCopy
221 //purpose : Copy the Standard_Real
222 // from an SingleArray from PCollection
223 // to an Array1 from TColStd (TCollection)
224 //=======================================================================
226 static void ArrayCopy
227 (const Handle(PColStd_HArray1OfReal)& PArray,
228 TColStd_Array1OfReal& TArray)
230 Standard_Integer Lower = PArray->Lower();
231 Standard_Integer Upper = PArray->Upper();
232 Standard_Integer Index;
233 for (Index = Lower; Index <= Upper; Index++) {
234 TArray(Index) = PArray->Value(Index);
238 //=======================================================================
239 //function : ArrayCopy
240 //purpose : Copy the Standard_Real
241 // from an DoubleArray from PCollection
242 // to an Array2 from TColStd (TCollection)
243 //=======================================================================
245 static void ArrayCopy
246 (const Handle(PColStd_HArray2OfReal)& PArray,
247 TColStd_Array2OfReal& TArray)
249 Standard_Integer LowerRow = TArray.LowerRow();
250 Standard_Integer UpperRow = TArray.UpperRow();
251 Standard_Integer LowerCol = TArray.LowerCol();
252 Standard_Integer UpperCol = TArray.UpperCol();
253 Standard_Integer IndexRow, IndexCol;
254 for (IndexRow = LowerRow; IndexRow <= UpperRow; IndexRow++) {
255 for (IndexCol = LowerCol; IndexCol <= UpperCol; IndexCol++) {
256 TArray(IndexRow, IndexCol) = PArray->Value(IndexRow, IndexCol);
261 //=======================================================================
262 //function : ArrayCopy
263 //purpose : Copy the Standard_Integer
264 // from an SingleArray from PCollection
265 // to an Array1 from TColStd (TCollection)
266 //=======================================================================
268 static void ArrayCopy
269 (const Handle(PColStd_HArray1OfInteger)& PArray,
270 TColStd_Array1OfInteger& TArray)
272 Standard_Integer Lower = PArray->Lower();
273 Standard_Integer Upper = PArray->Upper();
274 Standard_Integer Index;
275 for (Index = Lower; Index <= Upper; Index++) {
276 TArray(Index) = PArray->Value(Index);
282 // *******************************************************************
283 // Here is the implementation of the package methods.
284 // *******************************************************************
287 //=======================================================================
288 //function : Translate
289 //purpose : Translates a PGeom_Axis1Placement to a Geom_Axis1Placement.
290 //=======================================================================
292 Handle(Geom_Axis1Placement) MgtGeom::Translate
293 (const Handle(PGeom_Axis1Placement)& PObj)
295 return new Geom_Axis1Placement(PObj->Axis());
299 //=======================================================================
300 //function : Translate
301 //purpose : Translates a Geom_Axis1Placement to a PGeom_Axis1Placement.
302 //=======================================================================
304 Handle(PGeom_Axis1Placement) MgtGeom::Translate
305 (const Handle(Geom_Axis1Placement)& TObj)
307 return new PGeom_Axis1Placement(TObj->Axis());
311 //=======================================================================
312 //function : Translate
313 //purpose : Translates a PGeom_Axis2Placement to a Geom_Axis2Placement.
314 //=======================================================================
316 Handle(Geom_Axis2Placement) MgtGeom::Translate
317 (const Handle(PGeom_Axis2Placement)& PObj)
319 return new Geom_Axis2Placement(PObj->Axis().Location(),
320 PObj->Axis().Direction(),
325 //=======================================================================
326 //function : Translate
327 //purpose : Translates a Geom_Axis2Placement to a PGeom_Axis2Placement.
328 //=======================================================================
330 Handle(PGeom_Axis2Placement) MgtGeom::Translate
331 (const Handle(Geom_Axis2Placement)& TObj)
333 return new PGeom_Axis2Placement(TObj->Axis(),
338 //=======================================================================
339 //function : Translate
340 //purpose : Translates a PGeom_BSplineCurve to a Geom_BSplineCurve.
341 //=======================================================================
343 Handle(Geom_BSplineCurve) MgtGeom::Translate
344 (const Handle(PGeom_BSplineCurve)& PObj)
346 Handle(Geom_BSplineCurve) TBSplC;
348 Handle(PColgp_HArray1OfPnt) oldPoles = PObj->Poles();
349 TColgp_Array1OfPnt newPoles (oldPoles->Lower(),oldPoles->Upper());
350 ArrayCopy(oldPoles,newPoles);
352 Handle(PColStd_HArray1OfInteger) oldMult = PObj->Multiplicities();
353 TColStd_Array1OfInteger newMultiplicities(oldMult->Lower(),oldMult->Upper());
354 ArrayCopy(oldMult,newMultiplicities);
356 Handle(PColStd_HArray1OfReal) oldKnots = PObj->Knots();
357 TColStd_Array1OfReal newKnots (oldKnots->Lower(),oldKnots->Upper());
358 ArrayCopy(oldKnots,newKnots);
360 if (PObj->Rational()) {
361 Handle(PColStd_HArray1OfReal) oldWeights = PObj->Weights();
362 TColStd_Array1OfReal newWeights (oldWeights->Lower(),oldWeights->Upper());
363 ArrayCopy(oldWeights,newWeights);
364 TBSplC = new Geom_BSplineCurve
365 (newPoles, newWeights, newKnots, newMultiplicities, PObj->SpineDegree(),PObj->Periodic());
368 TBSplC = new Geom_BSplineCurve
369 (newPoles, newKnots, newMultiplicities, PObj->SpineDegree(),PObj->Periodic());
371 // if (PObj->Periodic()) TBSplC->SetPeriodic();
376 //=======================================================================
377 //function : Translate
378 //purpose : Translates a Geom_BSplineCurve to a PGeom_BSplineCurve.
379 //=======================================================================
381 Handle(PGeom_BSplineCurve) MgtGeom::Translate
382 (const Handle(Geom_BSplineCurve)& TObj)
384 Standard_Integer Upper;
386 Upper = TObj->NbPoles();
388 TColgp_Array1OfPnt oldPoles(1, Upper);
389 TObj->Poles(oldPoles);
390 Handle(PColgp_HArray1OfPnt) newPPoles = ArrayCopy(oldPoles);
392 Handle(PColStd_HArray1OfReal) newPWeights;
393 if (TObj->IsRational()) {
394 TColStd_Array1OfReal oldWeights(1, Upper);
395 TObj->Weights(oldWeights);
396 newPWeights = ArrayCopy(oldWeights);
399 Upper = TObj->NbKnots();
401 TColStd_Array1OfReal oldKnots(1, Upper);
402 TObj->Knots(oldKnots);
403 Handle(PColStd_HArray1OfReal) newPKnots = ArrayCopy(oldKnots);
405 TColStd_Array1OfInteger oldMultiplicities(1, Upper);
406 TObj->Multiplicities(oldMultiplicities);
407 Handle(PColStd_HArray1OfInteger) newPMultiplicities =
408 ArrayCopy(oldMultiplicities);
410 return new PGeom_BSplineCurve(TObj->IsRational(),
420 //=======================================================================
421 //function : Translate
422 //purpose : Translates a PGeom_BSplineSurface to a Geom_BSplineSurface.
423 //=======================================================================
425 Handle(Geom_BSplineSurface) MgtGeom::Translate
426 (const Handle(PGeom_BSplineSurface)& PObj)
428 Handle(Geom_BSplineSurface) TBSplS;
430 Handle(PColgp_HArray2OfPnt) oldPoles = PObj->Poles();
431 TColgp_Array2OfPnt newPoles (oldPoles->LowerRow(),oldPoles->UpperRow(),
432 oldPoles->LowerCol(),oldPoles->UpperCol());
433 ArrayCopy(oldPoles,newPoles);
435 Handle(PColStd_HArray1OfInteger) oldUMult = PObj->UMultiplicities();
436 TColStd_Array1OfInteger
437 newUMultiplicities (oldUMult->Lower(),oldUMult->Upper());
438 ArrayCopy(oldUMult,newUMultiplicities);
440 Handle(PColStd_HArray1OfInteger) oldVMult = PObj->VMultiplicities();
441 TColStd_Array1OfInteger
442 newVMultiplicities (oldVMult->Lower(),oldVMult->Upper());
443 ArrayCopy(oldVMult,newVMultiplicities);
445 Handle(PColStd_HArray1OfReal) oldUKnots = PObj->UKnots();
446 TColStd_Array1OfReal newUKnots (oldUKnots->Lower(),oldUKnots->Upper());
447 ArrayCopy(oldUKnots,newUKnots);
449 Handle(PColStd_HArray1OfReal) oldVKnots = PObj->VKnots();
450 TColStd_Array1OfReal newVKnots (oldVKnots->Lower(),oldVKnots->Upper());
451 ArrayCopy(oldVKnots,newVKnots);
453 if (!PObj->URational() && !PObj->VRational()) {
454 TBSplS = new Geom_BSplineSurface
456 newUKnots, newVKnots,
457 newUMultiplicities,newVMultiplicities,
458 PObj->USpineDegree(),
459 PObj->VSpineDegree(),
464 Handle(PColStd_HArray2OfReal) oldWeights = PObj->Weights();
466 newWeights (oldWeights->LowerRow(),oldWeights->UpperRow(),
467 oldWeights->LowerCol(),oldWeights->UpperCol());
468 ArrayCopy(oldWeights,newWeights);
469 TBSplS = new Geom_BSplineSurface
472 newUKnots, newVKnots,
473 newUMultiplicities,newVMultiplicities,
474 PObj->USpineDegree(),
475 PObj->VSpineDegree(),
479 // if (PObj->UPeriodic()) TBSplS->SetUPeriodic();
480 // if (PObj->VPeriodic()) TBSplS->SetVPeriodic();
485 //=======================================================================
486 //function : Translate
487 //purpose : Translates a Geom_BSplineSurface to a PGeom_BSplineSurface.
488 //=======================================================================
490 Handle(PGeom_BSplineSurface) MgtGeom::Translate
491 (const Handle(Geom_BSplineSurface)& TObj)
493 Standard_Integer UpperU, UpperV;
495 UpperU = TObj->NbUPoles();
496 UpperV = TObj->NbVPoles();
498 TColgp_Array2OfPnt oldPoles(1, UpperU, 1, UpperV);
499 TObj->Poles(oldPoles);
500 Handle(PColgp_HArray2OfPnt) newPPoles =
503 Handle(PColStd_HArray2OfReal) newPWeights;
504 if (TObj->IsURational() || TObj->IsVRational()) {
505 TColStd_Array2OfReal oldWeights(1, UpperU, 1, UpperV);
506 TObj->Weights(oldWeights);
507 newPWeights = ArrayCopy(oldWeights);
510 UpperU = TObj->NbUKnots();
512 TColStd_Array1OfReal oldUKnots(1, UpperU);
513 TObj->UKnots(oldUKnots);
514 Handle(PColStd_HArray1OfReal) newPUKnots =
515 ArrayCopy(oldUKnots);
517 TColStd_Array1OfInteger oldUMultiplicities(1, UpperU);
518 TObj->UMultiplicities(oldUMultiplicities);
519 Handle(PColStd_HArray1OfInteger) newPUMultiplicities =
520 ArrayCopy(oldUMultiplicities);
522 UpperV = TObj->NbVKnots();
524 TColStd_Array1OfReal oldVKnots(1, UpperV);
525 TObj->VKnots(oldVKnots);
526 Handle(PColStd_HArray1OfReal) newPVKnots =
527 ArrayCopy(oldVKnots);
529 TColStd_Array1OfInteger oldVMultiplicities(1, UpperV);
530 TObj->VMultiplicities(oldVMultiplicities);
531 Handle(PColStd_HArray1OfInteger) newPVMultiplicities =
532 ArrayCopy(oldVMultiplicities);
534 return new PGeom_BSplineSurface(TObj->IsURational(),
545 newPVMultiplicities);
549 //=======================================================================
550 //function : Translate
551 //purpose : Translates a PGeom_BezierCurve to a Geom_BezierCurve.
552 //=======================================================================
554 Handle(Geom_BezierCurve) MgtGeom::Translate
555 (const Handle(PGeom_BezierCurve)& PObj)
557 Handle(Geom_BezierCurve) TBzC;
559 Handle(PColgp_HArray1OfPnt) oldPoles = PObj->Poles();
560 TColgp_Array1OfPnt newPoles (oldPoles->Lower(),oldPoles->Upper());
561 ArrayCopy(oldPoles,newPoles);
563 if (PObj->Rational()) {
564 Handle(PColStd_HArray1OfReal) oldWeights = PObj->Weights();
565 TColStd_Array1OfReal newWeights (oldWeights->Lower(),oldWeights->Upper());
566 ArrayCopy(oldWeights,newWeights);
567 TBzC = new Geom_BezierCurve(newPoles, newWeights);
570 TBzC = new Geom_BezierCurve(newPoles);
576 //=======================================================================
577 //function : Translate
578 //purpose : Translates a Geom_BezierCurve to a PGeom_BezierCurve.
579 //=======================================================================
581 Handle(PGeom_BezierCurve) MgtGeom::Translate
582 (const Handle(Geom_BezierCurve)& TObj)
584 Standard_Integer Upper;
586 Upper = TObj->NbPoles();
588 TColgp_Array1OfPnt oldPoles(1, Upper);
589 TObj->Poles(oldPoles);
590 Handle(PColgp_HArray1OfPnt) newPPoles = ArrayCopy(oldPoles);
592 Handle(PColStd_HArray1OfReal) newPWeights;
593 if (TObj->IsRational()) {
594 TColStd_Array1OfReal oldWeights(1, Upper);
595 TObj->Weights(oldWeights);
596 newPWeights = ArrayCopy(oldWeights);
599 return new PGeom_BezierCurve(newPPoles,
605 //=======================================================================
606 //function : Translate
607 //purpose : Translates a PGeom_BezierSurface to a Geom_BezierSurface.
608 //=======================================================================
610 Handle(Geom_BezierSurface) MgtGeom::Translate
611 (const Handle(PGeom_BezierSurface)& PObj)
613 Handle(Geom_BezierSurface) TBzS;
615 Handle(PColgp_HArray2OfPnt) oldPoles = PObj->Poles();
616 TColgp_Array2OfPnt newPoles (oldPoles->LowerRow(),oldPoles->UpperRow(),
617 oldPoles->LowerCol(),oldPoles->UpperCol());
618 ArrayCopy(oldPoles,newPoles);
620 if (!PObj->URational() && !PObj->VRational()) {
621 TBzS = new Geom_BezierSurface(newPoles);
624 Handle(PColStd_HArray2OfReal) oldWeights = PObj->Weights();
626 newWeights (oldWeights->LowerRow(),oldWeights->UpperRow(),
627 oldWeights->LowerCol(),oldWeights->UpperCol());
628 ArrayCopy(oldWeights,newWeights);
630 TBzS = new Geom_BezierSurface(newPoles, newWeights);
636 //=======================================================================
637 //function : Translate
638 //purpose : Translates a Geom_BezierSurface to a PGeom_BezierSurface.
639 //=======================================================================
641 Handle(PGeom_BezierSurface) MgtGeom::Translate(const Handle(Geom_BezierSurface)& TObj)
643 Standard_Integer UpperU, UpperV;
645 UpperU = TObj->NbUPoles();
646 UpperV = TObj->NbVPoles();
648 TColgp_Array2OfPnt oldPoles(1, UpperU, 1, UpperV);
649 TObj->Poles(oldPoles);
650 Handle(PColgp_HArray2OfPnt) newPPoles =
653 Handle(PColStd_HArray2OfReal) newPWeights;
654 if (TObj->IsURational() || TObj->IsVRational()) {
655 TColStd_Array2OfReal oldWeights(1, UpperU, 1, UpperV);
656 TObj->Weights(oldWeights);
657 newPWeights = ArrayCopy(oldWeights);
660 return new PGeom_BezierSurface(TObj->IsURational(),
667 //=======================================================================
668 //function : Translate
669 //purpose : Translates a PGeom_CartesianPoint to a Geom_CartesianPoint.
670 //=======================================================================
672 Handle(Geom_CartesianPoint) MgtGeom::Translate
673 (const Handle(PGeom_CartesianPoint)& PObj)
674 { return new Geom_CartesianPoint(PObj->Pnt()); }
677 //=======================================================================
678 //function : Translate
679 //purpose : Translates a Geom_CartesianPoint to a PGeom_CartesianPoint.
680 //=======================================================================
682 Handle(PGeom_CartesianPoint) MgtGeom::Translate
683 (const Handle(Geom_CartesianPoint)& TObj)
684 { return new PGeom_CartesianPoint(TObj->Pnt()); }
687 //=======================================================================
688 //function : Translate
689 //purpose : Translates a PGeom_Circle to a Geom_Circle.
690 //=======================================================================
692 Handle(Geom_Circle) MgtGeom::Translate(const Handle(PGeom_Circle)& PObj)
694 return new Geom_Circle(PObj->Position(),
699 //=======================================================================
700 //function : Translate
701 //purpose : Translates a Geom_Circle to a PGeom_Circle.
702 //=======================================================================
704 Handle(PGeom_Circle) MgtGeom::Translate(const Handle(Geom_Circle)& TObj)
706 gp_Circ cir = TObj->Circ();
707 return new PGeom_Circle(cir.Position(),cir.Radius());
711 //=======================================================================
712 //function : Translate
713 //purpose : Translates a PGeom_ConicalSurface to a Geom_ConicalSurface.
714 //=======================================================================
716 Handle(Geom_ConicalSurface) MgtGeom::Translate
717 (const Handle(PGeom_ConicalSurface)& PObj)
719 return new Geom_ConicalSurface(PObj->Position(),
725 //=======================================================================
726 //function : Translate
727 //purpose : Translates a Geom_ConicalSurface to a PGeom_ConicalSurface.
728 //=======================================================================
730 Handle(PGeom_ConicalSurface) MgtGeom::Translate
731 (const Handle(Geom_ConicalSurface)& TObj)
733 return new PGeom_ConicalSurface(TObj->Position(),
739 //=======================================================================
740 //function : Translate
741 //purpose : Translates a PGeom_Curve to a Geom_Curve.
742 //=======================================================================
744 Handle(Geom_Curve) MgtGeom::Translate(const Handle(PGeom_Curve)& PObj)
746 Handle(Standard_Type) CurveType = PObj->DynamicType();
748 if (CurveType == STANDARD_TYPE(PGeom_Line)) {
749 Handle(PGeom_Line)& TLine =
750 (Handle(PGeom_Line)&) PObj;
751 return MgtGeom::Translate(TLine);
753 else if (CurveType == STANDARD_TYPE(PGeom_Circle)) {
754 Handle(PGeom_Circle)& TCircle =
755 (Handle(PGeom_Circle)&) PObj;
756 return MgtGeom::Translate(TCircle);
758 else if (CurveType == STANDARD_TYPE(PGeom_Ellipse)) {
759 Handle(PGeom_Ellipse)& TEllipse =
760 (Handle(PGeom_Ellipse)&) PObj;
761 return MgtGeom::Translate(TEllipse);
763 else if (CurveType == STANDARD_TYPE(PGeom_Hyperbola)) {
764 Handle(PGeom_Hyperbola)& THyperbola =
765 (Handle(PGeom_Hyperbola)&) PObj;
766 return MgtGeom::Translate(THyperbola);
768 else if (CurveType == STANDARD_TYPE(PGeom_Parabola)) {
769 Handle(PGeom_Parabola)& TParabola =
770 (Handle(PGeom_Parabola)&) PObj;
771 return MgtGeom::Translate(TParabola);
773 else if (CurveType == STANDARD_TYPE(PGeom_BezierCurve)) {
774 Handle(PGeom_BezierCurve)& TBezierCurve =
775 (Handle(PGeom_BezierCurve)&) PObj;
776 return MgtGeom::Translate(TBezierCurve);
778 else if (CurveType == STANDARD_TYPE(PGeom_BSplineCurve)) {
779 Handle(PGeom_BSplineCurve)& TBSplineCurve =
780 (Handle(PGeom_BSplineCurve)&) PObj;
781 return MgtGeom::Translate(TBSplineCurve);
783 else if (CurveType == STANDARD_TYPE(PGeom_TrimmedCurve)) {
784 Handle(PGeom_TrimmedCurve)& TTrimmedCurve =
785 (Handle(PGeom_TrimmedCurve)&) PObj;
786 return MgtGeom::Translate(TTrimmedCurve);
788 else if (CurveType == STANDARD_TYPE(PGeom_OffsetCurve)) {
789 Handle(PGeom_OffsetCurve)& TOffsetCurve =
790 (Handle(PGeom_OffsetCurve)&) PObj;
791 return MgtGeom::Translate(TOffsetCurve);
795 cout << "MgtGeom : Unknown curve type ???? : " << endl;
797 Standard_NullObject::Raise("No mapping for the current Persistent Curve");
800 Handle(Geom_Curve) dummy;
805 //=======================================================================
806 //function : Translate
807 //purpose : Translates a Geom_Curve to a PGeom_Curve.
808 //=======================================================================
810 Handle(PGeom_Curve) MgtGeom::Translate(const Handle(Geom_Curve)& TObj)
812 Handle(Standard_Type) CurveType = TObj->DynamicType();
814 if (CurveType == STANDARD_TYPE(Geom_Line)) {
815 Handle(Geom_Line)& PLine =
816 (Handle(Geom_Line)&) TObj;
817 return MgtGeom::Translate(PLine);
819 else if (CurveType == STANDARD_TYPE(Geom_Circle)) {
820 Handle(Geom_Circle)& PCircle =
821 (Handle(Geom_Circle)&) TObj;
822 return MgtGeom::Translate(PCircle);
824 else if (CurveType == STANDARD_TYPE(Geom_Ellipse)) {
825 Handle(Geom_Ellipse)& PEllipse =
826 (Handle(Geom_Ellipse)&) TObj;
827 return MgtGeom::Translate(PEllipse);
829 else if (CurveType == STANDARD_TYPE(Geom_Hyperbola)) {
830 Handle(Geom_Hyperbola)& PHyperbola =
831 (Handle(Geom_Hyperbola)&) TObj;
832 return MgtGeom::Translate(PHyperbola);
834 else if (CurveType == STANDARD_TYPE(Geom_Parabola)) {
835 Handle(Geom_Parabola)& PParabola =
836 (Handle(Geom_Parabola)&) TObj;
837 return MgtGeom::Translate(PParabola);
839 else if (CurveType == STANDARD_TYPE(Geom_BezierCurve)) {
840 Handle(Geom_BezierCurve)& PBezierCurve =
841 (Handle(Geom_BezierCurve)&) TObj;
842 return MgtGeom::Translate(PBezierCurve);
844 else if (CurveType == STANDARD_TYPE(Geom_BSplineCurve)) {
845 Handle(Geom_BSplineCurve)& PBSplineCurve =
846 (Handle(Geom_BSplineCurve)&) TObj;
847 return MgtGeom::Translate(PBSplineCurve);
849 else if (CurveType == STANDARD_TYPE(Geom_TrimmedCurve)) {
850 Handle(Geom_TrimmedCurve)& PTrimmedCurve =
851 (Handle(Geom_TrimmedCurve)&) TObj;
852 return MgtGeom::Translate(PTrimmedCurve);
854 else if (CurveType == STANDARD_TYPE(Geom_OffsetCurve)) {
855 Handle(Geom_OffsetCurve)& POffsetCurve =
856 (Handle(Geom_OffsetCurve)&) TObj;
857 return MgtGeom::Translate(POffsetCurve);
861 cout << "MgtGeom : Unknown curve type ????"<<endl;
863 Standard_NullObject::Raise("No mapping for the current Transient Curve");
867 Handle(PGeom_Curve) dummy;
872 //=======================================================================
873 //function : Translate
874 //purpose : Translates a PGeom_CylindricalSurface to a
875 // Geom_CylindricalSurface.
876 //=======================================================================
878 Handle(Geom_CylindricalSurface) MgtGeom::Translate
879 (const Handle(PGeom_CylindricalSurface)& PObj)
881 return new Geom_CylindricalSurface(PObj->Position(),
886 //=======================================================================
887 //function : Translate
888 //purpose : Translates a Geom_CylindricalSurface to a PGeom_CylindricalSurface.
889 //=======================================================================
891 Handle(PGeom_CylindricalSurface) MgtGeom::Translate(const Handle(Geom_CylindricalSurface)& TObj)
893 return new PGeom_CylindricalSurface(TObj->Position(),
898 //=======================================================================
899 //function : Translate
900 //purpose : Translates a PGeom_Direction to a Geom_Direction.
901 //=======================================================================
903 Handle(Geom_Direction) MgtGeom::Translate
904 (const Handle(PGeom_Direction)& PObj)
906 gp_Vec vec = PObj->Vec();
907 return new Geom_Direction(vec.X(), vec.Y(), vec.Z()); }
910 //=======================================================================
911 //function : Translate
912 //purpose : Translates a Geom_Direction to a PGeom_Direction.
913 //=======================================================================
915 Handle(PGeom_Direction) MgtGeom::Translate
916 (const Handle(Geom_Direction)& TObj)
917 { return new PGeom_Direction(TObj->Vec()); }
920 //=======================================================================
921 //function : Translate
922 //purpose : Translates a PGeom_Ellipse to a Geom_Ellipse.
923 //=======================================================================
925 Handle(Geom_Ellipse) MgtGeom::Translate
926 (const Handle(PGeom_Ellipse)& PObj)
928 return new Geom_Ellipse(PObj->Position(),
930 PObj->MinorRadius());
934 //=======================================================================
935 //function : Translate
936 //purpose : Translates a Geom_Ellipse to a PGeom_Ellipse.
937 //=======================================================================
939 Handle(PGeom_Ellipse) MgtGeom::Translate
940 (const Handle(Geom_Ellipse)& TObj)
942 return new PGeom_Ellipse(TObj->Position(),
944 TObj->MinorRadius());
948 //=======================================================================
949 //function : Translate
950 //purpose : Translates a PGeom_Hyperbola to a Geom_Hyperbola.
951 //=======================================================================
953 Handle(Geom_Hyperbola) MgtGeom::Translate
954 (const Handle(PGeom_Hyperbola)& PObj)
956 return new Geom_Hyperbola(PObj->Position(),
958 PObj->MinorRadius());
962 //=======================================================================
963 //function : Translate
964 //purpose : Translates a Geom_Hyperbola to a PGeom_Hyperbola.
965 //=======================================================================
967 Handle(PGeom_Hyperbola) MgtGeom::Translate(const Handle(Geom_Hyperbola)& TObj)
969 return new PGeom_Hyperbola(TObj->Position(),
971 TObj->MinorRadius());
975 //=======================================================================
976 //function : Translate
977 //purpose : Translates a PGeom_Line to a Geom_Line.
978 //=======================================================================
980 Handle(Geom_Line) MgtGeom::Translate(const Handle(PGeom_Line)& PObj)
981 { return new Geom_Line(PObj->Position()); }
984 //=======================================================================
985 //function : Translate
986 //purpose : Translates a Geom_Line to a PGeom_Line.
987 //=======================================================================
989 Handle(PGeom_Line) MgtGeom::Translate(const Handle(Geom_Line)& TObj)
990 { return new PGeom_Line(TObj->Lin().Position()); }
993 //=======================================================================
994 //function : Translate
995 //purpose : Translates a PGeom_OffsetCurve to a Geom_OffsetCurve.
996 //=======================================================================
998 Handle(Geom_OffsetCurve) MgtGeom::Translate
999 (const Handle(PGeom_OffsetCurve)& PObj)
1001 return new Geom_OffsetCurve(MgtGeom::Translate(PObj->BasisCurve()),
1002 PObj->OffsetValue(),
1003 PObj->OffsetDirection());
1007 //=======================================================================
1008 //function : Translate
1009 //purpose : Translates a Geom_OffsetCurve to a PGeom_OffsetCurve.
1010 //=======================================================================
1012 Handle(PGeom_OffsetCurve) MgtGeom::Translate(const Handle(Geom_OffsetCurve)& TObj)
1014 return new PGeom_OffsetCurve(MgtGeom::Translate(TObj->BasisCurve()),
1020 //=======================================================================
1021 //function : Translate
1022 //purpose : Translates a PGeom_OffsetSurface to a Geom_OffsetSurface.
1023 //=======================================================================
1025 Handle(Geom_OffsetSurface) MgtGeom::Translate
1026 (const Handle(PGeom_OffsetSurface)& PObj)
1028 return new Geom_OffsetSurface(MgtGeom::Translate(PObj->BasisSurface()),
1029 PObj->OffsetValue());
1033 //=======================================================================
1034 //function : Translate
1035 //purpose : Translates a Geom_OffsetSurface to a PGeom_OffsetSurface.
1036 //=======================================================================
1038 Handle(PGeom_OffsetSurface) MgtGeom::Translate
1039 (const Handle(Geom_OffsetSurface)& TObj)
1041 return new PGeom_OffsetSurface(MgtGeom::Translate(TObj->BasisSurface()),
1046 //=======================================================================
1047 //function : Translate
1048 //purpose : Translates a PGeom_Parabola to a Geom_Parabola.
1049 //=======================================================================
1051 Handle(Geom_Parabola) MgtGeom::Translate
1052 (const Handle(PGeom_Parabola)& PObj)
1054 return new Geom_Parabola(PObj->Position(),
1055 PObj->FocalLength());
1059 //=======================================================================
1060 //function : Translate
1061 //purpose : Translates a Geom_Parabola to a PGeom_Parabola.
1062 //=======================================================================
1064 Handle(PGeom_Parabola) MgtGeom::Translate
1065 (const Handle(Geom_Parabola)& TObj)
1067 return new PGeom_Parabola(TObj->Position(),
1072 //=======================================================================
1073 //function : Translate
1074 //purpose : Translates a PGeom_Plane to a Geom_Plane.
1075 //=======================================================================
1077 Handle(Geom_Plane) MgtGeom::Translate(const Handle(PGeom_Plane)& PObj)
1078 { return new Geom_Plane(PObj->Position()); }
1081 //=======================================================================
1082 //function : Translate
1083 //purpose : Translates a Geom_Plane to a PGeom_Plane.
1084 //=======================================================================
1086 Handle(PGeom_Plane) MgtGeom::Translate(const Handle(Geom_Plane)& TObj)
1088 return new PGeom_Plane(TObj->Pln().Position());
1091 //=======================================================================
1092 //function : Translate
1093 //purpose : Translates a PGeom_Point to a Geom_Point.
1094 // : Optimized valid until new subtypes of GeomPoint exist
1095 //=======================================================================
1097 Handle(Geom_Point) MgtGeom::Translate
1098 (const Handle(PGeom_Point)& PObj)
1101 Handle(Geom_Point) GeomP;
1102 Handle(Standard_Type) PointType = PObj->DynamicType();
1104 if (PointType == STANDARD_TYPE(PGeom_CartesianPoint)) {
1105 Handle(PGeom_CartesianPoint)& PCPoint =
1106 (Handle(PGeom_CartesianPoint)&) PObj;
1107 GeomP = MgtGeom::Translate(PCPoint);
1112 Handle(PGeom_CartesianPoint)& PCPoint =
1113 (Handle(PGeom_CartesianPoint)&) PObj;
1114 return new Geom_CartesianPoint(PCPoint->Pnt());
1118 //=======================================================================
1119 //function : Translate
1120 //purpose : Translates a Geom_Point to a PGeom_Point.
1121 // : Optimized valid until new subtypes of GeomPoint exist
1122 //=======================================================================
1124 Handle(PGeom_Point) MgtGeom::Translate
1125 (const Handle(Geom_Point)& TObj)
1128 Handle(PGeom_Point) PGeomP;
1129 Handle(Standard_Type) PointType = TObj->DynamicType();
1131 if (PointType == STANDARD_TYPE(Geom_CartesianPoint)) {
1132 Handle(Geom_CartesianPoint)& TCPoint =
1133 (Handle(Geom_CartesianPoint)&) TObj;
1134 PGeomP = MgtGeom::Translate(TCPoint);
1139 Handle(Geom_CartesianPoint)& TCPoint =
1140 (Handle(Geom_CartesianPoint)&) TObj;
1142 return new PGeom_CartesianPoint(TCPoint->Pnt());
1146 //=======================================================================
1147 //function : Translate
1148 //purpose : Translates a PGeom_RectangularTrimmedSurface to a
1149 // Geom_RectangularTrimmedSurface.
1150 //=======================================================================
1152 Handle(Geom_RectangularTrimmedSurface) MgtGeom::Translate
1153 (const Handle(PGeom_RectangularTrimmedSurface)& PObj)
1155 return new Geom_RectangularTrimmedSurface
1156 (MgtGeom::Translate(PObj->BasisSurface()),
1161 Standard_True, Standard_True); // En attendant leur suppression.
1165 //=======================================================================
1166 //function : Translate
1167 //purpose : Translates a Geom_RectangularTrimmedSurface to a
1168 // PGeom_RectangularTrimmedSurface.
1169 //=======================================================================
1171 Handle(PGeom_RectangularTrimmedSurface) MgtGeom::Translate
1172 (const Handle(Geom_RectangularTrimmedSurface)& TObj)
1174 Standard_Real FirstU, LastU, FirstV, LastV;
1175 TObj->Bounds(FirstU, LastU, FirstV, LastV);
1177 return new PGeom_RectangularTrimmedSurface
1178 (MgtGeom::Translate(TObj->BasisSurface()),
1184 //=======================================================================
1185 //function : Translate
1186 //purpose : Translates a PGeom_SphericalSurface to a
1187 // Geom_SphericalSurface.
1188 //=======================================================================
1190 Handle(Geom_SphericalSurface) MgtGeom::Translate
1191 (const Handle(PGeom_SphericalSurface)& PObj)
1193 return new Geom_SphericalSurface(PObj->Position(),
1198 //=======================================================================
1199 //function : Translate
1200 //purpose : Translates a Geom_SphericalSurface to a
1201 // PGeom_SphericalSurface.
1202 //=======================================================================
1204 Handle(PGeom_SphericalSurface) MgtGeom::Translate
1205 (const Handle(Geom_SphericalSurface)& TObj)
1207 return new PGeom_SphericalSurface(TObj->Position(),
1212 //=======================================================================
1213 //function : Translate
1214 //purpose : Translates a PGeom_Surface to a Geom_Surface.
1215 //=======================================================================
1217 Handle(Geom_Surface) MgtGeom::Translate(const Handle(PGeom_Surface)& PObj)
1219 Handle(Standard_Type) SurfaceType = PObj->DynamicType();
1221 if (SurfaceType == STANDARD_TYPE(PGeom_Plane)) {
1222 Handle(PGeom_Plane)& TPlane =
1223 (Handle(PGeom_Plane)&) PObj;
1224 return MgtGeom::Translate(TPlane);
1226 else if (SurfaceType == STANDARD_TYPE(PGeom_CylindricalSurface)) {
1227 Handle(PGeom_CylindricalSurface)& TCylindricalSurface =
1228 (Handle(PGeom_CylindricalSurface)&) PObj;
1229 return MgtGeom::Translate(TCylindricalSurface);
1231 else if (SurfaceType == STANDARD_TYPE(PGeom_ConicalSurface)) {
1232 Handle(PGeom_ConicalSurface)& TConicalSurface =
1233 (Handle(PGeom_ConicalSurface)&) PObj;
1234 return MgtGeom::Translate(TConicalSurface);
1236 else if (SurfaceType == STANDARD_TYPE(PGeom_SphericalSurface)) {
1237 Handle(PGeom_SphericalSurface)& TSphericalSurface =
1238 (Handle(PGeom_SphericalSurface)&) PObj;
1239 return MgtGeom::Translate(TSphericalSurface);
1241 else if (SurfaceType == STANDARD_TYPE(PGeom_ToroidalSurface)) {
1242 Handle(PGeom_ToroidalSurface)& TToroidalSurface =
1243 (Handle(PGeom_ToroidalSurface)&) PObj;
1244 return MgtGeom::Translate(TToroidalSurface);
1246 else if (SurfaceType == STANDARD_TYPE(PGeom_SurfaceOfLinearExtrusion)) {
1247 Handle(PGeom_SurfaceOfLinearExtrusion)& TSurfaceOfLinearExtrusion =
1248 (Handle(PGeom_SurfaceOfLinearExtrusion)&) PObj;
1249 return MgtGeom::Translate(TSurfaceOfLinearExtrusion);
1251 else if (SurfaceType == STANDARD_TYPE(PGeom_SurfaceOfRevolution)) {
1252 Handle(PGeom_SurfaceOfRevolution)& TSurfaceOfRevolution =
1253 (Handle(PGeom_SurfaceOfRevolution)&) PObj;
1254 return MgtGeom::Translate(TSurfaceOfRevolution);
1256 else if (SurfaceType == STANDARD_TYPE(PGeom_BezierSurface)) {
1257 Handle(PGeom_BezierSurface)& TBezierSurface =
1258 (Handle(PGeom_BezierSurface)&) PObj;
1259 return MgtGeom::Translate(TBezierSurface);
1261 else if (SurfaceType == STANDARD_TYPE(PGeom_BSplineSurface)) {
1262 Handle(PGeom_BSplineSurface)& TBSplineSurface =
1263 (Handle(PGeom_BSplineSurface)&) PObj;
1264 return MgtGeom::Translate(TBSplineSurface);
1266 else if (SurfaceType == STANDARD_TYPE(PGeom_RectangularTrimmedSurface)) {
1267 Handle(PGeom_RectangularTrimmedSurface)& TRectangularTrimmedSurface =
1268 (Handle(PGeom_RectangularTrimmedSurface)&) PObj;
1269 return MgtGeom::Translate(TRectangularTrimmedSurface);
1271 else if (SurfaceType == STANDARD_TYPE(PGeom_OffsetSurface)) {
1272 Handle(PGeom_OffsetSurface)& TOffsetSurface =
1273 (Handle(PGeom_OffsetSurface)&) PObj;
1274 return MgtGeom::Translate(TOffsetSurface);
1278 cout << "MgtGeom : Unknown surface type ????"<<endl;
1280 Standard_NullObject::Raise("No mapping for the current Persistent Surface");
1284 Handle(Geom_Surface) dummy;
1289 //=======================================================================
1290 //function : Translate
1291 //purpose : Translates a Geom_Surface to a PGeom_Surface.
1292 //=======================================================================
1294 Handle(PGeom_Surface) MgtGeom::Translate(const Handle(Geom_Surface)& TObj)
1296 Handle(Standard_Type) SurfaceType = TObj->DynamicType();
1298 if (SurfaceType == STANDARD_TYPE(Geom_Plane)) {
1299 Handle(Geom_Plane)& PPlane =
1300 (Handle(Geom_Plane)&) TObj;
1301 return MgtGeom::Translate(PPlane);
1303 else if (SurfaceType == STANDARD_TYPE(Geom_CylindricalSurface)) {
1304 Handle(Geom_CylindricalSurface)& PCylindricalSurface =
1305 (Handle(Geom_CylindricalSurface)&) TObj;
1306 return MgtGeom::Translate(PCylindricalSurface);
1308 else if (SurfaceType == STANDARD_TYPE(Geom_ConicalSurface)) {
1309 Handle(Geom_ConicalSurface)& PConicalSurface =
1310 (Handle(Geom_ConicalSurface)&) TObj;
1311 return MgtGeom::Translate(PConicalSurface);
1313 else if (SurfaceType == STANDARD_TYPE(Geom_SphericalSurface)) {
1314 Handle(Geom_SphericalSurface)& PSphericalSurface =
1315 (Handle(Geom_SphericalSurface)&) TObj;
1316 return MgtGeom::Translate(PSphericalSurface);
1318 else if (SurfaceType == STANDARD_TYPE(Geom_ToroidalSurface)) {
1319 Handle(Geom_ToroidalSurface)& PToroidalSurface =
1320 (Handle(Geom_ToroidalSurface)&) TObj;
1321 return MgtGeom::Translate(PToroidalSurface);
1323 else if (SurfaceType == STANDARD_TYPE(Geom_SurfaceOfLinearExtrusion)) {
1324 Handle(Geom_SurfaceOfLinearExtrusion)& PSurfaceOfLinearExtrusion =
1325 (Handle(Geom_SurfaceOfLinearExtrusion)&) TObj;
1326 return MgtGeom::Translate(PSurfaceOfLinearExtrusion);
1328 else if (SurfaceType == STANDARD_TYPE(Geom_SurfaceOfRevolution)) {
1329 Handle(Geom_SurfaceOfRevolution)& PSurfaceOfRevolution =
1330 (Handle(Geom_SurfaceOfRevolution)&) TObj;
1331 return MgtGeom::Translate(PSurfaceOfRevolution);
1333 else if (SurfaceType == STANDARD_TYPE(Geom_BezierSurface)) {
1334 Handle(Geom_BezierSurface)& PBezierSurface =
1335 (Handle(Geom_BezierSurface)&) TObj;
1336 return MgtGeom::Translate(PBezierSurface);
1338 else if (SurfaceType == STANDARD_TYPE(Geom_BSplineSurface)) {
1339 Handle(Geom_BSplineSurface)& PBSplineSurface =
1340 (Handle(Geom_BSplineSurface)&) TObj;
1341 return MgtGeom::Translate(PBSplineSurface);
1343 else if (SurfaceType == STANDARD_TYPE(Geom_RectangularTrimmedSurface)) {
1344 Handle(Geom_RectangularTrimmedSurface)& PRectangularTrimmedSurface =
1345 (Handle(Geom_RectangularTrimmedSurface)&) TObj;
1346 return MgtGeom::Translate(PRectangularTrimmedSurface);
1348 else if (SurfaceType == STANDARD_TYPE(Geom_OffsetSurface)) {
1349 Handle(Geom_OffsetSurface)& POffsetSurface =
1350 (Handle(Geom_OffsetSurface)&) TObj;
1351 return MgtGeom::Translate(POffsetSurface);
1355 cout << "MgtGeom : Unknown surface type ????"<<endl;
1357 Standard_NullObject::Raise("No mapping for the current Transient Surface");
1360 Handle(PGeom_Surface) dummy;
1365 //=======================================================================
1366 //function : Translate
1367 //purpose : Translates a PGeom_SurfaceOfLinearExtrusion to a
1368 // Geom_SurfaceOfLinearExtrusion.
1369 //=======================================================================
1371 Handle(Geom_SurfaceOfLinearExtrusion) MgtGeom::Translate
1372 (const Handle(PGeom_SurfaceOfLinearExtrusion)& PObj)
1374 return new Geom_SurfaceOfLinearExtrusion
1375 (MgtGeom::Translate(PObj->BasisCurve()),
1380 //=======================================================================
1381 //function : Translate
1382 //purpose : Translates a Geom_SurfaceOfLinearExtrusion to a
1383 // PGeom_SurfaceOfLinearExtrusion.
1384 //=======================================================================
1386 Handle(PGeom_SurfaceOfLinearExtrusion) MgtGeom::Translate
1387 (const Handle(Geom_SurfaceOfLinearExtrusion)& TObj)
1389 return new PGeom_SurfaceOfLinearExtrusion
1390 (MgtGeom::Translate(TObj->BasisCurve()),
1395 //=======================================================================
1396 //function : Translate
1397 //purpose : Translates a PGeom_SurfaceOfRevolution to a
1398 // Geom_SurfaceOfRevolution.
1399 //=======================================================================
1401 Handle(Geom_SurfaceOfRevolution) MgtGeom::Translate
1402 (const Handle(PGeom_SurfaceOfRevolution)& PObj)
1404 gp_Ax1 axis(PObj->Location(), PObj->Direction());
1405 return new Geom_SurfaceOfRevolution(MgtGeom::Translate(PObj->BasisCurve()),
1411 //=======================================================================
1412 //function : Translate
1413 //purpose : Translates a Geom_SurfaceOfRevolution to a
1414 // PGeom_SurfaceOfRevolution.
1415 //=======================================================================
1417 Handle(PGeom_SurfaceOfRevolution) MgtGeom::Translate
1418 (const Handle(Geom_SurfaceOfRevolution)& TObj)
1420 return new PGeom_SurfaceOfRevolution(MgtGeom::Translate(TObj->BasisCurve()),
1426 //=======================================================================
1427 //function : Translate
1428 //purpose : Translates a PGeom_ToroidalSurface to a Geom_ToroidalSurface.
1429 //=======================================================================
1431 Handle(Geom_ToroidalSurface) MgtGeom::Translate
1432 (const Handle(PGeom_ToroidalSurface)& PObj)
1434 return new Geom_ToroidalSurface(PObj->Position(),
1435 PObj->MajorRadius(),
1436 PObj->MinorRadius());
1440 //=======================================================================
1441 //function : Translate
1442 //purpose : Translates a Geom_ToroidalSurface to a PGeom_ToroidalSurface.
1443 //=======================================================================
1445 Handle(PGeom_ToroidalSurface) MgtGeom::Translate
1446 (const Handle(Geom_ToroidalSurface)& TObj)
1448 return new PGeom_ToroidalSurface(TObj->Position(),
1449 TObj->MajorRadius(),
1450 TObj->MinorRadius());
1454 //=======================================================================
1455 //function : Translate
1456 //purpose : Translates a PGeom_Transformation to a Geom_Transformation.
1457 //=======================================================================
1459 Handle(Geom_Transformation) MgtGeom::Translate
1460 (const Handle(PGeom_Transformation)& PObj)
1461 { return new Geom_Transformation(PObj->Trsf()); }
1464 //=======================================================================
1465 //function : Translate
1466 //purpose : Translates a Geom_Transformation to a PGeom_Transformation.
1467 //=======================================================================
1469 Handle(PGeom_Transformation) MgtGeom::Translate
1470 (const Handle(Geom_Transformation)& TObj)
1471 { return new PGeom_Transformation(TObj->Trsf()); }
1474 //=======================================================================
1475 //function : Translate
1476 //purpose : Translates a PGeom_TrimmedCurve to a Geom_TrimmedCurve.
1477 //=======================================================================
1479 Handle(Geom_TrimmedCurve) MgtGeom::Translate
1480 (const Handle(PGeom_TrimmedCurve)& PObj)
1482 return new Geom_TrimmedCurve(MgtGeom::Translate(PObj->BasisCurve()),
1485 Standard_True); // En attendant sa suppression.
1489 //=======================================================================
1490 //function : Translate
1491 //purpose : Translates a Geom_TrimmedCurve to a PGeom_TrimmedCurve.
1492 //=======================================================================
1494 Handle(PGeom_TrimmedCurve) MgtGeom::Translate
1495 (const Handle(Geom_TrimmedCurve)& TObj)
1497 return new PGeom_TrimmedCurve(MgtGeom::Translate(TObj->BasisCurve()),
1498 TObj->FirstParameter(),
1499 TObj->LastParameter());
1503 //=======================================================================
1504 //function : Translate
1505 //purpose : Translates a PGeom_VectorWithMagnitude to a
1506 // Geom_VectorWithMagnitude.
1507 //=======================================================================
1509 Handle(Geom_VectorWithMagnitude) MgtGeom::Translate
1510 (const Handle(PGeom_VectorWithMagnitude)& PObj)
1511 { return new Geom_VectorWithMagnitude(PObj->Vec()); }
1514 //=======================================================================
1515 //function : Translate
1516 //purpose : Translates a Geom_VectorWithMagnitude to a
1517 // PGeom_VectorWithMagnitude.
1518 //=======================================================================
1520 Handle(PGeom_VectorWithMagnitude) MgtGeom::Translate
1521 (const Handle(Geom_VectorWithMagnitude)& TObj)
1522 { return new PGeom_VectorWithMagnitude(TObj->Vec()); }