Salome HOME
b6132132ce491f8cfe60708a52c4402a0434d3e0
[modules/geom.git] / src / GEOM_I / GEOM_IMeasureOperations_i.cc
1 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22 #include <Standard_Stream.hxx>
23
24 #include "GEOM_IMeasureOperations_i.hh"
25
26 #include "utilities.h"
27 #include "OpUtil.hxx"
28
29 #include "GEOM_Engine.hxx"
30 #include "GEOM_Object.hxx"
31
32 //=============================================================================
33 /*!
34  *   constructor:
35  */
36 //=============================================================================
37 GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA,
38                                                       GEOM::GEOM_Gen_ptr theEngine,
39                                                       ::GEOMImpl_IMeasureOperations* theImpl)
40 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
41 {
42   MESSAGE("GEOM_IMeasureOperations_i::GEOM_IMeasureOperations_i");
43 }
44
45 //=============================================================================
46 /*!
47  *  destructor
48  */
49 //=============================================================================
50 GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i()
51 {
52   MESSAGE("GEOM_IMeasureOperations_i::~GEOM_IMeasureOperations_i");
53 }
54
55 //=============================================================================
56 /*!
57  *  KindOfShape
58  */
59 //=============================================================================
60 GEOM::GEOM_IKindOfShape::shape_kind GEOM_IMeasureOperations_i::KindOfShape
61                                    (GEOM::GEOM_Object_ptr  theShape,
62                                     GEOM::ListOfLong_out   theIntegers,
63                                     GEOM::ListOfDouble_out theDoubles)
64 {
65   GEOMImpl_IMeasureOperations::ShapeKind aKind = GEOMImpl_IMeasureOperations::SK_NO_SHAPE;
66
67   // allocate the CORBA arrays
68   GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong();
69   GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble();
70
71   //Get the reference shape
72   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
73
74   if (!aShape.IsNull()) {
75     Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
76     Handle(TColStd_HSequenceOfReal)    aDoubles   = new TColStd_HSequenceOfReal;
77
78     // Detect kind of shape and parameters
79     aKind = GetOperations()->KindOfShape(aShape, anIntegers, aDoubles);
80
81     int nbInts = anIntegers->Length();
82     int nbDbls = aDoubles->Length();
83
84     anIntegersArray->length(nbInts);
85     aDoublesArray->length(nbDbls);
86
87     for (int ii = 0; ii < nbInts; ii++) {
88       anIntegersArray[ii] = anIntegers->Value(ii + 1);
89     }
90     for (int id = 0; id < nbDbls; id++) {
91       aDoublesArray[id] = aDoubles->Value(id + 1);
92     }
93   }
94
95   // initialize out-parameters with local arrays
96   theIntegers = anIntegersArray._retn();
97   theDoubles  = aDoublesArray._retn();
98   return (GEOM::GEOM_IKindOfShape::shape_kind)aKind;
99 }
100
101 //=============================================================================
102 /*!
103  *  GetPosition
104  */
105 //=============================================================================
106 void GEOM_IMeasureOperations_i::GetPosition
107                  (GEOM::GEOM_Object_ptr theShape,
108                   CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz,
109                   CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz,
110                   CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz)
111 {
112   //Set a not done flag
113   GetOperations()->SetNotDone();
114
115   //Set default values: global CS
116   Ox = Oy = Oz = Zx = Zy = Xy = Xz = 0.;
117   Zz = Xx = 1.;
118
119   //Get the reference shape
120   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
121   if (aShape.IsNull()) return;
122
123   // Get shape parameters
124   GetOperations()->GetPosition(aShape, Ox,Oy,Oz, Zx,Zy,Zz, Xx,Xy,Xz);
125 }
126
127 //=============================================================================
128 /*!
129  *  GetCentreOfMass
130  */
131 //=============================================================================
132 GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetCentreOfMass
133                                               (GEOM::GEOM_Object_ptr theShape)
134 {
135   GEOM::GEOM_Object_var aGEOMObject;
136
137   //Set a not done flag
138   GetOperations()->SetNotDone();
139
140   //Get the reference shape
141   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
142   if (aShape.IsNull()) return aGEOMObject._retn();
143
144   // Make Point - centre of mass of theShape
145   Handle(GEOM_Object) anObject = GetOperations()->GetCentreOfMass(aShape);
146   if (!GetOperations()->IsDone() || anObject.IsNull())
147     return aGEOMObject._retn();
148
149   return GetObject(anObject);
150 }
151
152 //=============================================================================
153 /*!
154  *  GetVertexByIndex
155  */
156 //=============================================================================
157 GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetVertexByIndex
158   (GEOM::GEOM_Object_ptr theShape, CORBA::Long theIndex)
159 {
160   GEOM::GEOM_Object_var aGEOMObject;
161
162   //Set a not done flag
163   GetOperations()->SetNotDone();
164
165   //Get the reference shape
166   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
167   if ( aShape.IsNull() ) return aGEOMObject._retn();
168
169   // Get vertex by index
170   Handle(GEOM_Object) anObject = GetOperations()->GetVertexByIndex(aShape, theIndex);
171   if (!GetOperations()->IsDone() || anObject.IsNull())
172     return aGEOMObject._retn();
173
174   return GetObject(anObject);
175 }
176
177 //=============================================================================
178 /*!
179  *  GetNormal
180  */
181 //=============================================================================
182 GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::GetNormal
183                                        (GEOM::GEOM_Object_ptr theFace,
184                                         GEOM::GEOM_Object_ptr theOptionalPoint)
185 {
186   GEOM::GEOM_Object_var aGEOMObject;
187
188   //Set a not done flag
189   GetOperations()->SetNotDone();
190
191   //Get the reference shape
192   Handle(GEOM_Object) aFace = GetObjectImpl(theFace);
193   if (aFace.IsNull()) return aGEOMObject._retn();
194
195   // Get the OptionalPoint (can be not defined)
196   Handle(GEOM_Object) anOptionalPoint = GetObjectImpl(theOptionalPoint);
197
198   // Make Vector - normal to theFace (in point theOptionalPoint if the face is not planar)
199   Handle(GEOM_Object) anObject = GetOperations()->GetNormal(aFace, anOptionalPoint);
200   if (!GetOperations()->IsDone() || anObject.IsNull())
201     return aGEOMObject._retn();
202
203   return GetObject(anObject);
204 }
205
206 //=============================================================================
207 /*!
208  *  GetBasicProperties
209  */
210 //=============================================================================
211 void GEOM_IMeasureOperations_i::GetBasicProperties (GEOM::GEOM_Object_ptr theShape,
212                                                     CORBA::Double& theLength,
213                                                     CORBA::Double& theSurfArea,
214                                                     CORBA::Double& theVolume)
215 {
216   //Set a not done flag
217   GetOperations()->SetNotDone();
218
219   //Get the reference shape
220   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
221   if (aShape.IsNull()) return;
222
223   // Get shape parameters
224   GetOperations()->GetBasicProperties(aShape, theLength, theSurfArea, theVolume);
225 }
226
227 //=============================================================================
228 /*!
229  *  GetInertia
230  */
231 //=============================================================================
232 void GEOM_IMeasureOperations_i::GetInertia
233   (GEOM::GEOM_Object_ptr theShape,
234    CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13,
235    CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23,
236    CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33,
237    CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz)
238 {
239   //Set a not done flag
240   GetOperations()->SetNotDone();
241
242   //Get the reference shape
243   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
244   if (aShape.IsNull()) return;
245
246   // Get shape parameters
247   GetOperations()->GetInertia(aShape,
248                               I11, I12, I13,
249                               I21, I22, I23,
250                               I31, I32, I33,
251                               Ix , Iy , Iz);
252 }
253
254 //=============================================================================
255 /*!
256  *  GetBoundingBox
257  */
258 //=============================================================================
259 void GEOM_IMeasureOperations_i::GetBoundingBox (GEOM::GEOM_Object_ptr theShape,
260                                                 CORBA::Double& Xmin, CORBA::Double& Xmax,
261                                                 CORBA::Double& Ymin, CORBA::Double& Ymax,
262                                                 CORBA::Double& Zmin, CORBA::Double& Zmax)
263 {
264   //Set a not done flag
265   GetOperations()->SetNotDone();
266
267   //Get the reference shape
268   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
269   if (aShape.IsNull()) return;
270
271   // Get shape parameters
272   GetOperations()->GetBoundingBox(aShape, Xmin, Xmax, Ymin, Ymax, Zmin, Zmax);
273 }
274
275 //=============================================================================
276 /*!
277  *  MakeBoundingBox
278  */
279 //=============================================================================
280 GEOM::GEOM_Object_ptr GEOM_IMeasureOperations_i::MakeBoundingBox
281                                               (GEOM::GEOM_Object_ptr theShape)
282 {
283   GEOM::GEOM_Object_var aGEOMObject;
284
285   //Set a not done flag
286   GetOperations()->SetNotDone();
287
288   //Get the reference shape
289   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
290   if (aShape.IsNull()) return aGEOMObject._retn();
291
292   // Make Box - bounding box of theShape
293   Handle(GEOM_Object) anObject = GetOperations()->GetBoundingBox(aShape);
294   if (!GetOperations()->IsDone() || anObject.IsNull())
295     return aGEOMObject._retn();
296
297   return GetObject(anObject);
298 }
299
300 //=============================================================================
301 /*!
302  *  GetTolerance
303  */
304 //=============================================================================
305 void GEOM_IMeasureOperations_i::GetTolerance
306                                 (GEOM::GEOM_Object_ptr theShape,
307                                  CORBA::Double& FaceMin, CORBA::Double& FaceMax,
308                                  CORBA::Double& EdgeMin, CORBA::Double& EdgeMax,
309                                  CORBA::Double& VertMin, CORBA::Double& VertMax)
310 {
311   //Set a not done flag
312   GetOperations()->SetNotDone();
313
314   //Get the reference shape
315   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
316   if (aShape.IsNull()) return;
317
318   // Get shape parameters
319   GetOperations()->GetTolerance(aShape,
320                                 FaceMin, FaceMax,
321                                 EdgeMin, EdgeMax,
322                                 VertMin, VertMax);
323 }
324
325 //=============================================================================
326 /*!
327  *  CheckShape
328  */
329 //=============================================================================
330 CORBA::Boolean GEOM_IMeasureOperations_i::CheckShape (GEOM::GEOM_Object_ptr theShape,
331                                                       CORBA::String_out     theDescription)
332 {
333   //Set a not done flag
334   GetOperations()->SetNotDone();
335
336   if (CORBA::is_nil(theShape))
337   {
338     theDescription = CORBA::string_dup("null");
339     return 0;
340   }
341
342   //Get the reference shape
343   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
344
345   if (aShape.IsNull())
346   {
347     theDescription = CORBA::string_dup("null2");
348     return 0;
349   }
350
351   // Get shape parameters
352   TCollection_AsciiString aDump;
353   if (GetOperations()->CheckShape(aShape, /*check_geom = */false, aDump))
354   {
355     theDescription = CORBA::string_dup("OK");
356     return 1;
357   }
358   theDescription = CORBA::string_dup(aDump.ToCString());
359   return 0;
360 }
361
362 CORBA::Boolean GEOM_IMeasureOperations_i::CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
363                                                                   CORBA::String_out     theDescription)
364 {
365   //Set a not done flag
366   GetOperations()->SetNotDone();
367
368   if (CORBA::is_nil(theShape))
369   {
370     theDescription = CORBA::string_dup("null");
371     return 0;
372   }
373
374   //Get the reference shape
375   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
376
377   if (aShape.IsNull())
378   {
379     theDescription = CORBA::string_dup("null2");
380     return 0;
381   }
382
383   // Get shape parameters
384   TCollection_AsciiString aDump;
385   if (GetOperations()->CheckShape(aShape, /*check_geom = */true, aDump))
386   {
387     theDescription = CORBA::string_dup("OK");
388     return 1;
389   }
390   theDescription = CORBA::string_dup(aDump.ToCString());
391   return 0;
392 }
393
394 //=============================================================================
395 /*!
396  *  CheckSelfIntersections
397  */
398 //=============================================================================
399 CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Object_ptr theShape,
400                                                                   GEOM::ListOfLong_out  theIntersections)
401 {
402   // Set a not done flag
403   GetOperations()->SetNotDone();
404
405   bool isGood = false;
406
407   // Allocate the CORBA arrays
408   GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong();
409
410   // Get the reference shape
411   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
412
413   if (!aShape.IsNull()) {
414     Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger;
415
416     // Detect self-intersections
417     isGood = GetOperations()->CheckSelfIntersections(aShape, anIntegers);
418
419     int nbInts = anIntegers->Length();
420
421     anIntegersArray->length(nbInts);
422
423     for (int ii = 0; ii < nbInts; ii++) {
424       anIntegersArray[ii] = anIntegers->Value(ii + 1);
425     }
426   }
427
428   // Initialize out-parameters with local arrays
429   theIntersections = anIntegersArray._retn();
430   return isGood;
431 }
432
433 //=============================================================================
434 /*!
435  *  IsGoodForSolid
436  */
437 //=============================================================================
438 char* GEOM_IMeasureOperations_i::IsGoodForSolid (GEOM::GEOM_Object_ptr theShape)
439 {
440   //Set a not done flag
441   GetOperations()->SetNotDone();
442
443   //Get the reference shape
444   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
445   if (aShape.IsNull()) return CORBA::string_dup("WRN_NULL_OBJECT_OR_SHAPE");
446
447   // Get shape parameters
448   TCollection_AsciiString aDescription = GetOperations()->IsGoodForSolid(aShape);
449   return CORBA::string_dup(aDescription.ToCString());
450 }
451
452 //=============================================================================
453 /*!
454  *  WhatIs
455  */
456 //=============================================================================
457 char* GEOM_IMeasureOperations_i::WhatIs (GEOM::GEOM_Object_ptr theShape)
458 {
459   //Set a not done flag
460   GetOperations()->SetNotDone();
461
462   //Get the reference shape
463   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
464   if (aShape.IsNull()) return NULL;
465
466   // Get shape parameters
467   TCollection_AsciiString aDescription = GetOperations()->WhatIs(aShape);
468   return CORBA::string_dup(aDescription.ToCString());
469 }
470
471 //=============================================================================
472 /*!
473  *  AreCoordsInside
474  */
475 //=============================================================================
476 GEOM::ListOfBool* GEOM_IMeasureOperations_i::AreCoordsInside (GEOM::GEOM_Object_ptr theShape,
477                                                               const GEOM::ListOfDouble& theCoords,
478                                                               CORBA::Double tolerance)
479 {
480   //Set a not done flag
481   GetOperations()->SetNotDone();
482   
483   unsigned int nb_points = theCoords.length()/3;
484
485   GEOM::ListOfBool_var aResults = new GEOM::ListOfBool;
486   aResults->length(nb_points);
487   
488   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
489   
490   std::vector<double> tmp(3*nb_points);
491   for (int i = 0; i < 3*nb_points; i++)
492     tmp[i] = theCoords[i];
493   std::vector<bool> res = GetOperations()->AreCoordsInside(aShape, tmp, tolerance);
494   for (int i = 0; i < nb_points; i++)
495     aResults[i] = i < res.size() ? res[i] : false;
496   return aResults._retn();
497 }
498
499 //=============================================================================
500 /*!
501  *  GetMinDistance
502  */
503 //=============================================================================
504 CORBA::Double GEOM_IMeasureOperations_i::GetMinDistance
505   (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2,
506    CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1,
507    CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2)
508 {
509   //Set a not done flag
510   GetOperations()->SetNotDone();
511
512   //Get the reference shape
513   Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
514   Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
515   if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
516
517   // Get shape parameters
518   return GetOperations()->GetMinDistance(aShape1, aShape2, X1, Y1, Z1, X2, Y2, Z2);
519 }
520
521 //=============================================================================
522 /*!
523  *  ClosestPoints
524  */
525 //=============================================================================
526 CORBA::Long GEOM_IMeasureOperations_i::ClosestPoints
527   (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2,
528    GEOM::ListOfDouble_out theCoords)
529 {
530   //Set a not done flag
531   GetOperations()->SetNotDone();
532
533   // allocate the CORBA array
534   int nbSols = 0;
535   GEOM::ListOfDouble_var aDoublesArray = new GEOM::ListOfDouble();
536
537   //Get the reference shape
538   Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
539   Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
540
541   if (!aShape1.IsNull() && !aShape2.IsNull()) {
542     Handle(TColStd_HSequenceOfReal) aDoubles = new TColStd_HSequenceOfReal;
543     // Get shape parameters
544     nbSols = GetOperations()->ClosestPoints(aShape1, aShape2, aDoubles);
545     int nbDbls = aDoubles->Length();
546     aDoublesArray->length(nbDbls);
547     for (int id = 0; id < nbDbls; id++) {
548       aDoublesArray[id] = aDoubles->Value(id + 1);
549     }
550   }
551
552   theCoords = aDoublesArray._retn();
553   return nbSols;
554 }
555
556 //=============================================================================
557 /*!
558  *  PointCoordinates
559  */
560 //=============================================================================
561 void GEOM_IMeasureOperations_i::PointCoordinates (GEOM::GEOM_Object_ptr theShape,
562                                                   CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z)
563
564 {
565   //Set a not done flag
566   GetOperations()->SetNotDone();
567
568   //Get the reference shape
569   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
570   if (aShape.IsNull())
571     return;
572
573   // Get shape parameters
574   GetOperations()->PointCoordinates( aShape, X, Y, Z );
575 }
576
577 //=============================================================================
578 /*!
579  *  GetAngle
580  */
581 //=============================================================================
582 CORBA::Double GEOM_IMeasureOperations_i::GetAngle (GEOM::GEOM_Object_ptr theShape1,
583                                                    GEOM::GEOM_Object_ptr theShape2)
584 {
585   //Set a not done flag
586   GetOperations()->SetNotDone();
587
588   //Get the reference shapes
589   Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
590   Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
591   if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
592
593   // Get the angle
594   return GetOperations()->GetAngle(aShape1, aShape2);
595 }
596
597 //=============================================================================
598 /*!
599  *  GetAngle
600  */
601 //=============================================================================
602 CORBA::Double GEOM_IMeasureOperations_i::GetAngleBtwVectors (GEOM::GEOM_Object_ptr theShape1,
603                                                              GEOM::GEOM_Object_ptr theShape2)
604 {
605   //Set a not done flag
606   GetOperations()->SetNotDone();
607
608   //Get the reference shapes
609   Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
610   Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
611   if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
612
613   // Get the angle
614   return GetOperations()->GetAngleBtwVectors(aShape1, aShape2);
615 }
616
617
618 //=============================================================================
619 /*!
620  *  CurveCurvatureByParam
621  */
622 //=============================================================================
623 CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByParam
624                        (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParam)
625 {
626   //Set a not done flag
627   GetOperations()->SetNotDone();
628
629   //Get the reference shape
630   Handle(GEOM_Object) aShape = GetObjectImpl(theCurve);
631   if(aShape.IsNull()) return -1.0;
632
633   return GetOperations()->CurveCurvatureByParam(aShape,theParam);
634 }
635
636 //=============================================================================
637 /*!
638  *  CurveCurvatureByPoint
639  */
640 //=============================================================================
641 CORBA::Double GEOM_IMeasureOperations_i::CurveCurvatureByPoint
642                (GEOM::GEOM_Object_ptr theCurve, GEOM::GEOM_Object_ptr thePoint)
643 {
644   //Set a not done flag
645   GetOperations()->SetNotDone();
646
647   //Get the reference shape
648   Handle(GEOM_Object) aShape = GetObjectImpl(theCurve);
649   Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
650   if( aShape.IsNull() || aPoint.IsNull() ) return -1.0;
651
652   return GetOperations()->CurveCurvatureByPoint(aShape,aPoint);
653 }
654
655
656 //=============================================================================
657 /*!
658  *  MaxSurfaceCurvatureByParam
659  */
660 //=============================================================================
661 CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByParam
662                                                 (GEOM::GEOM_Object_ptr theSurf,
663                                                  CORBA::Double theUParam,
664                                                  CORBA::Double theVParam)
665 {
666   //Set a not done flag
667   GetOperations()->SetNotDone();
668
669   //Get the reference shape
670   Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
671   if(aShape.IsNull()) return -1.0;
672
673   return GetOperations()->MaxSurfaceCurvatureByParam(aShape,theUParam,theVParam);
674 }
675
676 //=============================================================================
677 /*!
678  *  MaxSurfaceCurvatureByPoint
679  */
680 //=============================================================================
681 CORBA::Double GEOM_IMeasureOperations_i::MaxSurfaceCurvatureByPoint
682                 (GEOM::GEOM_Object_ptr theSurf, GEOM::GEOM_Object_ptr thePoint)
683 {
684   //Set a not done flag
685   GetOperations()->SetNotDone();
686
687   //Get the reference shape
688   Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
689   Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
690   if( aShape.IsNull() || aPoint.IsNull() ) return -1.0;
691
692   return GetOperations()->MaxSurfaceCurvatureByPoint(aShape,aPoint);
693 }
694
695 //=============================================================================
696 /*!
697  *  MinSurfaceCurvatureByParam
698  */
699 //=============================================================================
700 CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByParam
701                                                 (GEOM::GEOM_Object_ptr theSurf,
702                                                  CORBA::Double theUParam,
703                                                  CORBA::Double theVParam)
704 {
705   //Set a not done flag
706   GetOperations()->SetNotDone();
707
708   //Get the reference shape
709   Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
710   if (aShape.IsNull()) return -1.0;
711
712   return GetOperations()->MinSurfaceCurvatureByParam(aShape,theUParam,theVParam);
713 }
714
715 //=============================================================================
716 /*!
717  *  MinSurfaceCurvatureByPoint
718  */
719 //=============================================================================
720 CORBA::Double GEOM_IMeasureOperations_i::MinSurfaceCurvatureByPoint
721                 (GEOM::GEOM_Object_ptr theSurf, GEOM::GEOM_Object_ptr thePoint)
722 {
723   //Set a not done flag
724   GetOperations()->SetNotDone();
725
726   //Get the reference shape
727   Handle(GEOM_Object) aShape = GetObjectImpl(theSurf);
728   Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
729   if (aShape.IsNull() || aPoint.IsNull()) return -1.0;
730
731   return GetOperations()->MinSurfaceCurvatureByPoint(aShape,aPoint);
732 }