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