]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
Salome HOME
Merge remote branch 'origin/eap/23307'
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // ---
21 // File    : BLSURFPlugin_Hypothesis.cxx
22 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
23 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
24 // ---
25 //
26 #include "BLSURFPlugin_Hypothesis_i.hxx"
27
28 #include <SMESH_Gen.hxx>
29 #include <SMESH_Gen_i.hxx>
30 #include <SMESH_PythonDump.hxx>
31 #include <SMESHGUI_Utils.h>
32
33 #include <SALOMEDS_wrap.hxx>
34 #include <Utils_CorbaException.hxx>
35 #include <utilities.h>
36
37 #include <stdexcept>
38 #include <cstring>
39 #include <boost/regex.hpp>
40
41 using namespace std;
42
43 //=============================================================================
44 /*!
45  *  BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
46  *
47  *  Constructor
48  */
49 //=============================================================================
50 BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i(PortableServer::POA_ptr thePOA, int theStudyId,
51     ::SMESH_Gen* theGenImpl) :
52   SALOME::GenericObj_i(thePOA), SMESH_Hypothesis_i(thePOA) {
53   MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
54   myBaseImpl = new ::BLSURFPlugin_Hypothesis(theGenImpl->GetANewId(), theStudyId, theGenImpl);
55 }
56
57 //=============================================================================
58 /*!
59  *  BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
60  *
61  *  Destructor
62  */
63 //=============================================================================
64 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() {
65   MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
66 }
67
68 //=============================================================================
69
70 //=============================================================================
71 /*!
72  *  BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
73  *
74  *  Set PhysicalMesh
75  */
76
77 //=============================================================================
78 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh(CORBA::Long theValue) {
79   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
80   ASSERT(myBaseImpl);
81   this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh) theValue);
82   SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
83 }
84
85 //=============================================================================
86 /*!
87  *  BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
88  *
89  *  Get PhysicalMesh
90  */
91 //=============================================================================
92 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() {
93   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
94   ASSERT(myBaseImpl);
95   return this->GetImpl()->GetPhysicalMesh();
96 }
97
98 //=============================================================================
99 /*!
100  *  BLSURFPlugin_Hypothesis_i::SetGeometricMesh
101  *
102  *  Set GeometricMesh
103  */
104
105 //=============================================================================
106 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh(CORBA::Long theValue) {
107   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
108   ASSERT(myBaseImpl);
109   this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh) theValue);
110   SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
111 }
112
113 //=============================================================================
114 /*!
115  *  BLSURFPlugin_Hypothesis_i::GetGeometricMesh
116  *
117  *  Get GeometricMesh
118  */
119 //=============================================================================
120 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() {
121   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
122   ASSERT(myBaseImpl);
123   return this->GetImpl()->GetGeometricMesh();
124 }
125
126 //=============================================================================
127 /*!
128  *  BLSURFPlugin_Hypothesis_i::SetPhySize
129  *
130  *  Set PhySize
131  */
132 //=============================================================================
133 void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
134 //   MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
135   ASSERT(myBaseImpl);
136   this->GetImpl()->SetPhySize(theValue, false);
137   SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
138 }
139
140 //=============================================================================
141 /*!
142  *  BLSURFPlugin_Hypothesis_i::SetPhySizeRel
143  *
144  *  Set Relative PhySize
145  */
146 //=============================================================================
147 void BLSURFPlugin_Hypothesis_i::SetPhySizeRel(CORBA::Double theValue) {
148 //   MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
149   ASSERT(myBaseImpl);
150   this->GetImpl()->SetPhySize(theValue, true);
151   SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
152 }
153
154 //=============================================================================
155 /*!
156  *  BLSURFPlugin_Hypothesis_i::GetPhySize
157  *
158  *  Get PhySize
159  */
160 //=============================================================================
161 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
162 //   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
163   ASSERT(myBaseImpl);
164   return this->GetImpl()->GetPhySize();
165 }
166
167 //=============================================================================
168 /*!
169  *  BLSURFPlugin_Hypothesis_i::IsPhySizeRel
170  *
171  *  Returns True if PhySize is relative
172  */
173 //=============================================================================
174 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsPhySizeRel() {
175 //   MESSAGE("BLSURFPlugin_Hypothesis_i::IsPhySizeRel");
176   ASSERT(myBaseImpl);
177   return this->GetImpl()->IsPhySizeRel();
178 }
179
180 //=============================================================================
181 void BLSURFPlugin_Hypothesis_i::SetMinSize(CORBA::Double theMinSize) {
182   ASSERT(myBaseImpl);
183   if (IsMinSizeRel() || GetMinSize() != theMinSize ) {
184     this->GetImpl()->SetMinSize(theMinSize, false);
185     SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << " )";
186   }
187 }
188
189 //=============================================================================
190 void BLSURFPlugin_Hypothesis_i::SetMinSizeRel(CORBA::Double theMinSize) {
191   ASSERT(myBaseImpl);
192   if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
193     this->GetImpl()->SetMinSize(theMinSize, true);
194     SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
195   }
196 }
197
198 //=============================================================================
199 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMinSize() {
200   ASSERT(myBaseImpl);
201   return this->GetImpl()->GetMinSize();
202 }
203
204 //=============================================================================
205 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMinSizeRel() {
206 //   MESSAGE("BLSURFPlugin_Hypothesis_i::IsMinSizeRel");
207   ASSERT(myBaseImpl);
208   return this->GetImpl()->IsMinSizeRel();
209 }
210
211 //=============================================================================
212 void BLSURFPlugin_Hypothesis_i::SetMaxSize(CORBA::Double theMaxSize) {
213   ASSERT(myBaseImpl);
214   if (IsMaxSizeRel() || GetMaxSize() != theMaxSize) {
215     this->GetImpl()->SetMaxSize(theMaxSize, false);
216     SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << " )";
217   }
218 }
219
220 //=============================================================================
221 void BLSURFPlugin_Hypothesis_i::SetMaxSizeRel(CORBA::Double theMaxSize) {
222   ASSERT(myBaseImpl);
223   if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
224     this->GetImpl()->SetMaxSize(theMaxSize, true);
225     SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
226   }
227 }
228
229 //=============================================================================
230 CORBA::Double BLSURFPlugin_Hypothesis_i::GetMaxSize() {
231   ASSERT(myBaseImpl);
232   return this->GetImpl()->GetMaxSize();
233 }
234
235 //=============================================================================
236 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsMaxSizeRel() {
237 //   MESSAGE("BLSURFPlugin_Hypothesis_i::IsMaxSizeRel");
238   ASSERT(myBaseImpl);
239   return this->GetImpl()->IsMaxSizeRel();
240 }
241
242
243 //=============================================================================
244 /*!
245  *  BLSURFPlugin_Hypothesis_i::SetUseGradation
246  *
247  *  Set true or false
248  */
249 //=============================================================================
250 void BLSURFPlugin_Hypothesis_i::SetUseGradation(CORBA::Boolean theValue) {
251   MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseGradation");
252   ASSERT(myBaseImpl);
253   this->GetImpl()->SetUseGradation(theValue);
254   std::string theValueStr = theValue ? "True" : "False";
255   SMESH::TPythonDump() << _this() << ".SetUseGradation( " << theValueStr.c_str() << " )";
256 }
257
258 //=============================================================================
259 /*!
260  *  BLSURFPlugin_Hypothesis_i::GetUseGradation
261  *
262  *  Get true or false
263  */
264 //=============================================================================
265 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseGradation() {
266   MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseGradation");
267   ASSERT(myBaseImpl);
268   return this->GetImpl()->GetUseGradation();
269 }
270
271 //=============================================================================
272 /*!
273  *  BLSURFPlugin_Hypothesis_i::SetGradation
274  *
275  *  Set Gradation
276  */
277 //=============================================================================
278 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
279   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
280   ASSERT(myBaseImpl);
281   this->GetImpl()->SetGradation(theValue);
282   SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
283 }
284
285 //=============================================================================
286 /*!
287  *  BLSURFPlugin_Hypothesis_i::GetGradation
288  *
289  *  Get Gradation
290  */
291 //=============================================================================
292 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
293   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
294   ASSERT(myBaseImpl);
295   return this->GetImpl()->GetGradation();
296 }
297
298 //=============================================================================
299 /*!
300  *  BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation
301  *
302  *  Set true or false
303  */
304 //=============================================================================
305 void BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation(CORBA::Boolean theValue) {
306   MESSAGE("BLSURFPlugin_Hypothesis_i::SetUseVolumeGradation");
307   ASSERT(myBaseImpl);
308   this->GetImpl()->SetUseVolumeGradation(theValue);
309   std::string theValueStr = theValue ? "True" : "False";
310   SMESH::TPythonDump() << _this() << ".SetUseVolumeGradation( " << theValueStr.c_str() << " )";
311 }
312
313 //=============================================================================
314 /*!
315  *  BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation
316  *
317  *  Get true or false
318  */
319 //=============================================================================
320 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation() {
321   MESSAGE("BLSURFPlugin_Hypothesis_i::GetUseVolumeGradation");
322   ASSERT(myBaseImpl);
323   return this->GetImpl()->GetUseVolumeGradation();
324 }
325
326 //=============================================================================
327 /*!
328  *  BLSURFPlugin_Hypothesis_i::SetVolumeGradation
329  *
330  *  Set VolumeGradation
331  */
332 //=============================================================================
333 void BLSURFPlugin_Hypothesis_i::SetVolumeGradation(CORBA::Double theValue) {
334   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetVolumeGradation");
335   ASSERT(myBaseImpl);
336   this->GetImpl()->SetVolumeGradation(theValue);
337   SMESH::TPythonDump() << _this() << ".SetVolumeGradation( " << theValue << " )";
338 }
339
340 //=============================================================================
341 /*!
342  *  BLSURFPlugin_Hypothesis_i::GetVolumeGradation
343  *
344  *  Get VolumeGradation
345  */
346 //=============================================================================
347 CORBA::Double BLSURFPlugin_Hypothesis_i::GetVolumeGradation() {
348   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetVolumeGradation");
349   ASSERT(myBaseImpl);
350   return this->GetImpl()->GetVolumeGradation();
351 }
352
353 //=============================================================================
354 /*!
355  *  BLSURFPlugin_Hypothesis_i::SetQuadAllowed
356  *
357  *  Set true or false
358  */
359 //=============================================================================
360 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
361   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
362   ASSERT(myBaseImpl);
363   this->GetImpl()->SetQuadAllowed(theValue);
364   std::string theValueStr = theValue ? "True" : "False";
365   SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
366 }
367
368 //=============================================================================
369 /*!
370  *  BLSURFPlugin_Hypothesis_i::GetQuadAllowed
371  *
372  *  Get true or false
373  */
374 //=============================================================================
375 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
376   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
377   ASSERT(myBaseImpl);
378   return this->GetImpl()->GetQuadAllowed();
379 }
380
381 //=============================================================================
382 /*!
383  *  BLSURFPlugin_Hypothesis_i::SetAngleMesh
384  *
385  *  Set AngleMesh
386  */
387 //=============================================================================
388 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
389   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
390   ASSERT(myBaseImpl);
391   this->GetImpl()->SetAngleMesh(theValue);
392   SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
393 }
394
395 //=============================================================================
396 /*!
397  *  BLSURFPlugin_Hypothesis_i::GetAngleMesh
398  *
399  *  Get AngleMesh
400  */
401 //=============================================================================
402 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
403   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
404   ASSERT(myBaseImpl);
405   return this->GetImpl()->GetAngleMesh();
406 }
407
408 //=============================================================================
409 /*!
410  *  BLSURFPlugin_Hypothesis_i::SetChordalError
411  *
412  *  Set Chordal Error
413  */
414 //=============================================================================
415 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
416   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
417   ASSERT(myBaseImpl);
418   this->GetImpl()->SetChordalError(theValue);
419   SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
420 }
421
422 //=============================================================================
423 /*!
424  *  BLSURFPlugin_Hypothesis_i::GetChordalError
425  *
426  *  Get Chordal Error
427  */
428 //=============================================================================
429 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
430   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
431   ASSERT(myBaseImpl);
432   return this->GetImpl()->GetChordalError();
433 }
434
435 //=============================================================================
436 /*!
437  *  BLSURFPlugin_Hypothesis_i::SetAnisotropic
438  *
439  *  Set true or false
440  */
441 //=============================================================================
442 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
443   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
444   ASSERT(myBaseImpl);
445   this->GetImpl()->SetAnisotropic(theValue);
446   std::string theValueStr = theValue ? "True" : "False";
447   SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
448 }
449
450 //=============================================================================
451 /*!
452  *  BLSURFPlugin_Hypothesis_i::GetAnisotropic
453  *
454  *  Get true or false
455  */
456 //=============================================================================
457 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
458   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
459   ASSERT(myBaseImpl);
460   return this->GetImpl()->GetAnisotropic();
461 }
462
463 //=============================================================================
464 /*!
465  *  BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
466  *
467  *  Set Anisotropic Ratio
468  */
469 //=============================================================================
470 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
471   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
472   ASSERT(myBaseImpl);
473   this->GetImpl()->SetAnisotropicRatio(theValue);
474   SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
475 }
476
477 //=============================================================================
478 /*!
479  *  BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
480  *
481  *  Get Anisotropic Ratio
482  */
483 //=============================================================================
484 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
485   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
486   ASSERT(myBaseImpl);
487   return this->GetImpl()->GetAnisotropicRatio();
488 }
489
490
491 //=============================================================================
492 /*!
493  *  BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
494  *
495  *  Set true or false
496  */
497 //=============================================================================
498 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
499   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
500   ASSERT(myBaseImpl);
501   this->GetImpl()->SetRemoveTinyEdges(theValue);
502   std::string theValueStr = theValue ? "True" : "False";
503   SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
504 }
505
506 //=============================================================================
507 /*!
508  *  BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
509  *
510  *  Get true or false
511  */
512 //=============================================================================
513 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
514   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
515   ASSERT(myBaseImpl);
516   return this->GetImpl()->GetRemoveTinyEdges();
517 }
518
519 //=============================================================================
520 /*!
521  *  BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
522  *
523  *  Set Tiny Edge Length
524  */
525 //=============================================================================
526 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
527   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
528   ASSERT(myBaseImpl);
529   this->GetImpl()->SetTinyEdgeLength(theValue);
530   SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
531 }
532
533 //=============================================================================
534 /*!
535  *  BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
536  *
537  *  Get Tiny Edge Length
538  */
539 //=============================================================================
540 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
541   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
542   ASSERT(myBaseImpl);
543   return this->GetImpl()->GetTinyEdgeLength();
544 }
545
546 //=============================================================================
547 /*!
548  *  BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges
549  *
550  *  Set true or false
551  */
552 //=============================================================================
553 void BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges(CORBA::Boolean theValue) {
554   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimiseTinyEdges");
555   ASSERT(myBaseImpl);
556   this->GetImpl()->SetOptimiseTinyEdges(theValue);
557   std::string theValueStr = theValue ? "True" : "False";
558   SMESH::TPythonDump() << _this() << ".SetOptimiseTinyEdges( " << theValueStr.c_str() << " )";
559 }
560
561 //=============================================================================
562 /*!
563  *  BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges
564  *
565  *  Get true or false
566  */
567 //=============================================================================
568 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges() {
569   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimiseTinyEdges");
570   ASSERT(myBaseImpl);
571   return this->GetImpl()->GetOptimiseTinyEdges();
572 }
573
574 //=============================================================================
575 /*!
576  *  BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength
577  *
578  *  Set Tiny Edge OptimisationLength
579  */
580 //=============================================================================
581 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength(CORBA::Double theValue) {
582   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeOptimisationLength");
583   ASSERT(myBaseImpl);
584   this->GetImpl()->SetTinyEdgeOptimisationLength(theValue);
585   SMESH::TPythonDump() << _this() << ".SetTinyEdgeOptimisationLength( " << theValue << " )";
586 }
587
588 //=============================================================================
589 /*!
590  *  BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength
591  *
592  *  Get Tiny Edge OptimisationLength
593  */
594 //=============================================================================
595 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength() {
596   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeOptimisationLength");
597   ASSERT(myBaseImpl);
598   return this->GetImpl()->GetTinyEdgeOptimisationLength();
599 }
600
601 //=============================================================================
602 /*!
603  *  BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection
604  *
605  *  Set true or false
606  */
607 //=============================================================================
608 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection(CORBA::Boolean theValue) {
609   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersection");
610   ASSERT(myBaseImpl);
611   this->GetImpl()->SetCorrectSurfaceIntersection(theValue);
612   std::string theValueStr = theValue ? "True" : "False";
613   SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersection( " << theValueStr.c_str() << " )";
614 }
615
616 //=============================================================================
617 /*!
618  *  BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection
619  *
620  *  Get true or false
621  */
622 //=============================================================================
623 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection() {
624   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersection");
625   ASSERT(myBaseImpl);
626   return this->GetImpl()->GetCorrectSurfaceIntersection();
627 }
628
629 //=============================================================================
630 /*!
631  *  BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost
632  *
633  *  Set Tiny Edge OptimisationLength
634  */
635 //=============================================================================
636 void BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost(CORBA::Double theValue) {
637   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetCorrectSurfaceIntersectionMaxCost");
638   ASSERT(myBaseImpl);
639   this->GetImpl()->SetCorrectSurfaceIntersectionMaxCost(theValue);
640   SMESH::TPythonDump() << _this() << ".SetCorrectSurfaceIntersectionMaxCost( " << theValue << " )";
641 }
642
643 //=============================================================================
644 /*!
645  *  BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost
646  *
647  *  Get Tiny Edge OptimisationLength
648  */
649 //=============================================================================
650 CORBA::Double BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost() {
651   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetCorrectSurfaceIntersectionMaxCost");
652   ASSERT(myBaseImpl);
653   return this->GetImpl()->GetCorrectSurfaceIntersectionMaxCost();
654 }
655
656 //=============================================================================
657 /*!
658  *  BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
659  *
660  *  Set true or false
661  */
662 //=============================================================================
663 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
664   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
665   ASSERT(myBaseImpl);
666   this->GetImpl()->SetBadElementRemoval(theValue);
667   std::string theValueStr = theValue ? "True" : "False";
668   SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
669 }
670
671 //=============================================================================
672 /*!
673  *  BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
674  *
675  *  Get true or false
676  */
677 //=============================================================================
678 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
679   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
680   ASSERT(myBaseImpl);
681   return this->GetImpl()->GetBadElementRemoval();
682 }
683
684 //=============================================================================
685 /*!
686  *  BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
687  *
688  *  Set Bad Surface Element Aspect Ratio
689  */
690 //=============================================================================
691 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
692   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
693   ASSERT(myBaseImpl);
694   this->GetImpl()->SetBadElementAspectRatio(theValue);
695   SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
696 }
697
698 //=============================================================================
699 /*!
700  *  BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
701  *
702  *  Get Bad Surface Element Aspect Ratio
703  */
704 //=============================================================================
705 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
706   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
707   ASSERT(myBaseImpl);
708   return this->GetImpl()->GetBadElementAspectRatio();
709 }
710
711 //=============================================================================
712 /*!
713  *  BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
714  *
715  *  Set true or false
716  */
717 //=============================================================================
718 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
719   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
720   ASSERT(myBaseImpl);
721   this->GetImpl()->SetOptimizeMesh(theValue);
722   std::string theValueStr = theValue ? "True" : "False";
723   SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
724 }
725
726 //=============================================================================
727 /*!
728  *  BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
729  *
730  *  Get true or false
731  */
732 //=============================================================================
733 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
734   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
735   ASSERT(myBaseImpl);
736   return this->GetImpl()->GetOptimizeMesh();
737 }
738
739 //=============================================================================
740 /*!
741  *  BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
742  *
743  *  Set true or false
744  */
745 //=============================================================================
746 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
747   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
748   ASSERT(myBaseImpl);
749   this->GetImpl()->SetQuadraticMesh(theValue);
750   std::string theValueStr = theValue ? "True" : "False";
751   SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
752 }
753
754 //=============================================================================
755 /*!
756  *  BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
757  *
758  *  Get true or false
759  */
760 //=============================================================================
761 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
762   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
763   ASSERT(myBaseImpl);
764   return this->GetImpl()->GetQuadraticMesh();
765 }
766
767
768
769
770
771 /*!
772  *  BLSURFPlugin_Hypothesis_i::SetTopology
773  *
774  *  Set topology
775  */
776
777 //=============================================================================
778 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
779   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
780   ASSERT(myBaseImpl);
781   this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
782   SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
783 }
784
785 //=============================================================================
786 /*!
787  *  BLSURFPlugin_Hypothesis_i::GetTopology
788  *
789  *  Get Topology
790  */
791 //=============================================================================
792 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
793   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
794   ASSERT(myBaseImpl);
795   return this->GetImpl()->GetTopology();
796 }
797
798 //=============================================================================
799 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
800   ASSERT(myBaseImpl);
801   if (theVal < 0 || theVal > 100)
802     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
803   this->GetImpl()->SetVerbosity(theVal);
804   SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
805 }
806
807 //=============================================================================
808
809 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
810   ASSERT(myBaseImpl);
811   return (CORBA::Short) this->GetImpl()->GetVerbosity();
812 }
813
814 //=============================================================================
815 void BLSURFPlugin_Hypothesis_i::SetEnforceCadEdgesSize( CORBA::Boolean toEnforce )
816 {
817   if ( GetEnforceCadEdgesSize() != toEnforce )
818   {
819     this->GetImpl()->SetEnforceCadEdgesSize(toEnforce);
820     SMESH::TPythonDump() << _this() << ".SetEnforceCadEdgesSize( " << toEnforce << " )";
821   }
822 }
823 //=============================================================================
824 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetEnforceCadEdgesSize()
825 {
826   return this->GetImpl()->GetEnforceCadEdgesSize();
827 }
828 //=============================================================================
829
830 void BLSURFPlugin_Hypothesis_i::SetJacobianRectificationRespectGeometry( CORBA::Boolean allowRectification )
831 {
832   if ( GetJacobianRectificationRespectGeometry() != allowRectification )
833   {
834     this->GetImpl()->SetJacobianRectificationRespectGeometry(allowRectification);
835     SMESH::TPythonDump() << _this() << ".SetJacobianRectificationRespectGeometry( " << allowRectification << " )";
836   }
837 }
838 //=============================================================================
839 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectificationRespectGeometry()
840 {
841   return this->GetImpl()->GetJacobianRectificationRespectGeometry();
842 }
843 //=============================================================================
844
845 void BLSURFPlugin_Hypothesis_i::SetJacobianRectification( CORBA::Boolean allowRectification )
846 {
847   if ( GetJacobianRectification() != allowRectification )
848   {
849     this->GetImpl()->SetJacobianRectification(allowRectification);
850     SMESH::TPythonDump() << _this() << ".SetJacobianRectification( " << allowRectification << " )";
851   }
852 }
853 //=============================================================================
854 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetJacobianRectification()
855 {
856   return this->GetImpl()->GetJacobianRectification();
857 }
858 //=============================================================================
859
860 void BLSURFPlugin_Hypothesis_i::SetMaxNumberOfPointsPerPatch( CORBA::Long nb ) throw (SALOME::SALOME_Exception)
861 {
862   if ( GetMaxNumberOfPointsPerPatch() != nb )
863   {
864     try {
865       this->GetImpl()->SetMaxNumberOfPointsPerPatch(nb);
866
867     } catch (const std::invalid_argument& ex) {
868       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
869     } catch (SALOME_Exception& ex) {
870       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
871     }
872     SMESH::TPythonDump() << _this() << ".SetMaxNumberOfPointsPerPatch( " << nb << " )";
873   }
874 }
875 //=============================================================================
876 CORBA::Long BLSURFPlugin_Hypothesis_i::GetMaxNumberOfPointsPerPatch()
877 {
878   return this->GetImpl()->GetMaxNumberOfPointsPerPatch();
879 }
880 //=============================================================================
881
882 void BLSURFPlugin_Hypothesis_i::SetRespectGeometry( CORBA::Boolean toRespect )
883 {
884   if ( GetRespectGeometry() != toRespect )
885   {
886     this->GetImpl()->SetRespectGeometry(toRespect);
887     SMESH::TPythonDump() << _this() << ".SetRespectGeometry( " << toRespect << " )";
888   }
889 }
890 //=============================================================================
891 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRespectGeometry()
892 {
893   return this->GetImpl()->GetRespectGeometry();
894 }
895 //=============================================================================
896
897 void BLSURFPlugin_Hypothesis_i::SetTinyEdgesAvoidSurfaceIntersections( CORBA::Boolean toAvoidIntersection )
898 {
899   if ( GetTinyEdgesAvoidSurfaceIntersections() != toAvoidIntersection )
900   {
901     this->GetImpl()->SetTinyEdgesAvoidSurfaceIntersections(toAvoidIntersection);
902     SMESH::TPythonDump() << _this() << ".SetTinyEdgesAvoidSurfaceIntersections( " << toAvoidIntersection << " )";
903   }
904 }
905 //=============================================================================
906 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetTinyEdgesAvoidSurfaceIntersections()
907 {
908   return this->GetImpl()->GetTinyEdgesAvoidSurfaceIntersections();
909 }
910 //=============================================================================
911
912 void BLSURFPlugin_Hypothesis_i::SetClosedGeometry( CORBA::Boolean isClosed )
913 {
914   if ( GetClosedGeometry() != isClosed )
915   {
916     this->GetImpl()->SetClosedGeometry(isClosed);
917     SMESH::TPythonDump() << _this() << ".SetClosedGeometry( " << isClosed << " )";
918   }
919 }
920 //=============================================================================
921 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetClosedGeometry()
922 {
923   return this->GetImpl()->GetClosedGeometry();
924 }
925 //=============================================================================
926
927 void BLSURFPlugin_Hypothesis_i::SetDebug( CORBA::Boolean isDebug )
928 {
929   if ( GetDebug() != isDebug )
930   {
931     this->GetImpl()->SetDebug(isDebug);
932     SMESH::TPythonDump() << _this() << ".SetDebug( " << isDebug << " )";
933   }
934 }
935 //=============================================================================
936 bool BLSURFPlugin_Hypothesis_i::GetDebug()
937 {
938   return this->GetImpl()->GetDebug();
939 }
940 //=============================================================================
941
942 void BLSURFPlugin_Hypothesis_i::SetPeriodicTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
943 {
944   if ( SMESH::toStdStr( GetPreCADOptionValue("periodic_tolerance")) != SMESH_Comment( tol ))
945   {
946     try
947     {
948       this->GetImpl()->SetPeriodicTolerance(tol);
949
950     } catch (const std::invalid_argument& ex) {
951       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
952     } catch (SALOME_Exception& ex) {
953       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
954     }
955     SMESH::TPythonDump() << _this() << ".SetPeriodicTolerance( " << tol << " )";
956   }
957 }
958 //=============================================================================
959 double BLSURFPlugin_Hypothesis_i::GetPeriodicTolerance() throw (SALOME::SALOME_Exception)
960 {
961   try{
962     return this->GetImpl()->GetPeriodicTolerance();
963
964   } catch (const std::invalid_argument& ex) {
965     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
966   } catch (SALOME_Exception& ex) {
967     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
968   }
969   return -1;
970 }
971 //=============================================================================
972
973 void BLSURFPlugin_Hypothesis_i::SetRequiredEntities( const char* howToTreat ) throw (SALOME::SALOME_Exception)
974 {
975   if ( GetImpl()->GetRequiredEntities() != howToTreat )
976   {
977     try {
978       this->GetImpl()->SetRequiredEntities(howToTreat);
979
980     } catch (const std::invalid_argument& ex) {
981       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
982     } catch (SALOME_Exception& ex) {
983       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
984     }
985     SMESH::TPythonDump() << _this() << ".SetRequiredEntities( '" << howToTreat << "' )";
986   }
987 }
988 //=============================================================================
989 char* BLSURFPlugin_Hypothesis_i::GetRequiredEntities()
990 {
991   return CORBA::string_dup( this->GetImpl()->GetRequiredEntities().c_str() );
992 }
993 //=============================================================================
994
995 void BLSURFPlugin_Hypothesis_i::SetSewingTolerance( CORBA::Double tol ) throw (SALOME::SALOME_Exception)
996 {
997   if ( SMESH::toStdStr( GetPreCADOptionValue("sewing_tolerance")) != SMESH_Comment( tol ))
998   {
999     try
1000     {
1001       this->GetImpl()->SetSewingTolerance(tol);
1002       SMESH::TPythonDump() << _this() << ".SetSewingTolerance( " << tol << " )";
1003
1004     } catch (const std::invalid_argument& ex) {
1005       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1006     } catch (SALOME_Exception& ex) {
1007       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1008     }
1009   }
1010 }
1011 //=============================================================================
1012 CORBA::Double BLSURFPlugin_Hypothesis_i::GetSewingTolerance() throw (SALOME::SALOME_Exception)
1013 {
1014   try
1015   {
1016     return this->GetImpl()->GetSewingTolerance();
1017
1018   } catch (const std::invalid_argument& ex) {
1019     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1020   } catch (SALOME_Exception& ex) {
1021     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1022   }
1023   return -1;
1024 }
1025 //=============================================================================
1026
1027 void BLSURFPlugin_Hypothesis_i::SetTags( const char* howToTreat ) throw (SALOME::SALOME_Exception)
1028 {
1029   if ( GetImpl()->GetTags() != howToTreat )
1030   {
1031     try {
1032       this->GetImpl()->SetTags(howToTreat);
1033     }
1034     catch (const std::invalid_argument& ex) {
1035       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1036     } catch (SALOME_Exception& ex) {
1037       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1038     }
1039   }
1040   SMESH::TPythonDump() << _this() << ".SetTags( '" << howToTreat << "' )";
1041 }
1042 //=============================================================================
1043 char* BLSURFPlugin_Hypothesis_i::GetTags()
1044 {
1045   return CORBA::string_dup( this->GetImpl()->GetTags().c_str() );
1046 }
1047
1048 //=============================================================================
1049 /*!
1050  *  BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
1051  *
1052  *  Set true or false
1053  */
1054 //=============================================================================
1055 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
1056   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
1057   ASSERT(myBaseImpl);
1058   this->GetImpl()->SetPreCADMergeEdges(theValue);
1059   std::string theValueStr = theValue ? "True" : "False";
1060   SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
1061 }
1062
1063 //=============================================================================
1064 /*!
1065  *  BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
1066  *
1067  *  Get true or false
1068  */
1069 //=============================================================================
1070 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
1071   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
1072   ASSERT(myBaseImpl);
1073   return this->GetImpl()->GetPreCADMergeEdges();
1074 }
1075
1076 //=============================================================================
1077 /*!
1078  *  BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges
1079  *
1080  *  Set true or false
1081  */
1082 //=============================================================================
1083 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
1084   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
1085   ASSERT(myBaseImpl);
1086   this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
1087   std::string theValueStr = theValue ? "True" : "False";
1088   SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
1089 }
1090
1091 //=============================================================================
1092 /*!
1093  *  BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
1094  *
1095  *  Get true or false
1096  */
1097 //=============================================================================
1098 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
1099   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
1100   ASSERT(myBaseImpl);
1101   return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
1102 }
1103
1104 //=============================================================================
1105 /*!
1106  *  BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1107  *
1108  *  Set true or false
1109  */
1110 //=============================================================================
1111 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1112   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1113   ASSERT(myBaseImpl);
1114   this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1115   std::string theValueStr = theValue ? "True" : "False";
1116   SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1117 }
1118
1119 //=============================================================================
1120 /*!
1121  *  BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1122  *
1123  *  Get true or false
1124  */
1125 //=============================================================================
1126 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1127   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1128   ASSERT(myBaseImpl);
1129   return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1130 }
1131
1132 //=============================================================================
1133 /*!
1134  *  BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1135  *
1136  *  Set true or false
1137  */
1138 //=============================================================================
1139 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1140   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1141   ASSERT(myBaseImpl);
1142   this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1143   std::string theValueStr = theValue ? "True" : "False";
1144   SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1145 }
1146
1147 //=============================================================================
1148 /*!
1149  *  BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1150  *
1151  *  Get true or false
1152  */
1153 //=============================================================================
1154 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1155   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1156   ASSERT(myBaseImpl);
1157   return this->GetImpl()->GetPreCADProcess3DTopology();
1158 }
1159
1160 //=============================================================================
1161 /*!
1162  *  BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1163  *
1164  *  Set true or false
1165  */
1166 //=============================================================================
1167 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1168   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1169   ASSERT(myBaseImpl);
1170   this->GetImpl()->SetPreCADDiscardInput(theValue);
1171   std::string theValueStr = theValue ? "True" : "False";
1172   SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1173 }
1174
1175 //=============================================================================
1176 /*!
1177  *  BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1178  *
1179  *  Get true or false
1180  */
1181 //=============================================================================
1182 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1183   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1184   ASSERT(myBaseImpl);
1185   return this->GetImpl()->GetPreCADDiscardInput();
1186 }
1187
1188
1189 //=============================================================================
1190
1191 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1192   throw (SALOME::SALOME_Exception) {
1193   ASSERT(myBaseImpl);
1194   try {
1195     std::string name( optionName );
1196     if ( !optionValue || !optionValue[0] )
1197       UnsetOption( optionName );
1198
1199     // basic options (visible in Advanced table)
1200
1201     else if ( name == "enforce_cad_edge_sizes" )
1202       SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1203
1204     else if ( name == "jacobian_rectification_respect_geometry" )
1205       SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1206
1207     else if ( name == "max_number_of_points_per_patch" )
1208       SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1209
1210     else if ( name == "rectify_jacobian" )
1211       SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1212
1213     else if ( name == "respect_geometry" )
1214       SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1215
1216     else if ( name == "tiny_edge_avoid_surface_intersections" )
1217       SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1218
1219     else if ( name == "closed_geometry" )
1220       SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1221
1222     else if ( name == "debug" )
1223       SetDebug( GetImpl()->ToBool( optionValue ));
1224
1225     else if ( name == "discard_input_topology" )
1226       SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1227
1228     else if ( name == "merge_edges" )
1229       SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1230
1231     else if ( name == "periodic_tolerance" )
1232       SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1233
1234     else if ( name == "remove_duplicate_cad_faces" )
1235       SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1236
1237     else if ( name == "required_entities" )
1238       SetRequiredEntities( optionValue );
1239
1240     else if ( name == "sewing_tolerance" )
1241       SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1242
1243     else if ( name == "tags" )
1244       SetTags( optionValue );
1245
1246     // other basic options with specific methods
1247
1248     else if ( name == "correct_surface_intersections" )
1249       SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1250
1251     else if ( name == "optimise_tiny_edges" )
1252       SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1253
1254     else if ( name == "surface_intersections_processing_max_cost" )
1255       SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1256
1257     else if ( name == "volume_gradation" )
1258       SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1259
1260     else if ( name == "tiny_edge_optimisation_length" )
1261       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1262
1263     // advanced options (for backward compatibility)
1264
1265     else if ( name == "create_tag_on_collision" ||
1266               name == "tiny_edge_respect_geometry" )
1267       AddOption( optionName, optionValue );
1268
1269     else {
1270       bool valueChanged;
1271       valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1272                        this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1273       if ( valueChanged )
1274       {
1275         this->GetImpl()->SetOptionValue(optionName, optionValue);
1276         SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1277       }
1278     }
1279   } catch (const std::invalid_argument& ex) {
1280     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1281   } catch (SALOME_Exception& ex) {
1282     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1283   }
1284 }
1285
1286 //=============================================================================
1287
1288 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1289   throw (SALOME::SALOME_Exception) {
1290   ASSERT(myBaseImpl);
1291   bool valueChanged = false;
1292   try {
1293     std::string name( optionName );
1294     if ( !optionValue || !optionValue[0] )
1295       UnsetOption( optionName );
1296
1297     else if ( name == "closed_geometry" )
1298       SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1299
1300     else if ( name == "debug" )
1301       SetDebug( GetImpl()->ToBool( optionValue ));
1302
1303     else if ( name == "discard_input_topology" )
1304       SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1305
1306     else if ( name == "merge_edges" )
1307       SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1308
1309     else if ( name == "periodic_tolerance" )
1310       SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1311
1312     else if ( name == "remove_duplicate_cad_faces" )
1313       SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1314
1315     else if ( name == "required_entities" )
1316       SetRequiredEntities( optionValue );
1317
1318     else if ( name == "sewing_tolerance" )
1319       SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1320
1321     else if ( name == "tags" )
1322       SetTags( optionValue );
1323
1324     // other basic options with specific methods
1325
1326     else if ( name == "correct_surface_intersections" )
1327       SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1328
1329     else if ( name == "optimise_tiny_edges" )
1330       SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1331
1332     else if ( name == "surface_intersections_processing_max_cost" )
1333       SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1334
1335     else if ( name == "volume_gradation" )
1336       SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1337
1338     else if ( name == "tiny_edge_optimisation_length" )
1339       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1340
1341     // advanced options (for backward compatibility)
1342
1343     else if ( name == "create_tag_on_collision" ||
1344               name == "tiny_edge_respect_geometry" )
1345       AddOption( optionName, optionValue );
1346
1347     else {
1348       valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1349       if (valueChanged)
1350         this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1351     }
1352   } catch (const std::invalid_argument& ex) {
1353     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1354   } catch (SALOME_Exception& ex) {
1355     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1356   }
1357   if (valueChanged)
1358     SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1359 }
1360
1361 //=============================================================================
1362
1363 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1364   ASSERT(myBaseImpl);
1365   try {
1366     bool isDefault;
1367     return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1368   } catch (const std::invalid_argument& ex) {
1369     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1370   } catch (SALOME_Exception& ex) {
1371     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1372   }
1373   return 0;
1374 }
1375
1376 //=============================================================================
1377
1378 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1379   ASSERT(myBaseImpl);
1380   try {
1381     bool isDefault;
1382     return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1383   } catch (const std::invalid_argument& ex) {
1384     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1385   } catch (SALOME_Exception& ex) {
1386     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1387   }
1388   return 0;
1389 }
1390
1391 //=============================================================================
1392
1393 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1394   ASSERT(myBaseImpl);
1395   if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1396   {
1397     this->GetImpl()->ClearOption(optionName);
1398     SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1399   }
1400 }
1401
1402 //=============================================================================
1403
1404 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1405   ASSERT(myBaseImpl);
1406   if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1407   {
1408     this->GetImpl()->ClearPreCADOption(optionName);
1409     SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1410   }
1411 }
1412
1413 //=============================================================================
1414
1415 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1416   ASSERT(myBaseImpl);
1417   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1418
1419   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1420   result->length(opts.size());
1421   int i=0;
1422
1423   bool isDefault;
1424   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1425   for (; opIt != opts.end(); ++opIt, ++i) {
1426     string name_value_type = opIt->first;
1427     if (!opIt->second.empty()) {
1428       name_value_type += ":";
1429       name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1430       name_value_type += isDefault ? ":0" : ":1";
1431     }
1432     result[i] = CORBA::string_dup(name_value_type.c_str());
1433   }
1434
1435   return result._retn();
1436 }
1437
1438 //=============================================================================
1439
1440 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1441   ASSERT(myBaseImpl);
1442   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1443
1444   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1445   result->length(opts.size());
1446   int i=0;
1447
1448   bool isDefault;
1449   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1450   for (; opIt != opts.end(); ++opIt, ++i) {
1451     string name_value_type = opIt->first;
1452     if (!opIt->second.empty()) {
1453       name_value_type += ":";
1454       name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1455       name_value_type += isDefault ? ":0" : ":1";
1456     }
1457     result[i] = CORBA::string_dup(name_value_type.c_str());
1458   }
1459   return result._retn();
1460 }
1461
1462 //=============================================================================
1463
1464 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1465 {
1466   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1467
1468   const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1469   result->length(custom_opts.size());
1470   int i=0;
1471
1472   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1473   for (; opIt != custom_opts.end(); ++opIt, ++i) {
1474     string name_value_type = opIt->first;
1475     if (!opIt->second.empty()) {
1476       name_value_type += ":";
1477       name_value_type += opIt->second;
1478       name_value_type += ":1"; // user defined
1479     }
1480     result[i] = CORBA::string_dup(name_value_type.c_str());
1481   }
1482   return result._retn();
1483 }
1484
1485 //=============================================================================
1486
1487 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1488     throw (SALOME::SALOME_Exception) {
1489   ASSERT(myBaseImpl);
1490   for (CORBA::ULong i = 0; i < options.length(); ++i) {
1491     string name_value_type = options[i].in();
1492     if(name_value_type.empty())
1493       continue;
1494     size_t colonPos = name_value_type.find(':');
1495     string name, value;
1496     if (colonPos == string::npos) // ':' not found
1497       name = name_value_type;
1498     else {
1499       name = name_value_type.substr(0, colonPos);
1500       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1501         string value_type = name_value_type.substr(colonPos + 1);
1502         colonPos = value_type.find(':');
1503         value = value_type.substr(0, colonPos);
1504         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1505           if ( value_type.substr(colonPos + 1) == "0" ) // is default
1506             value.clear();
1507       }
1508     }
1509     SetOptionValue(name.c_str(), value.c_str());
1510   }
1511 }
1512
1513 //=============================================================================
1514
1515 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1516     throw (SALOME::SALOME_Exception) {
1517   ASSERT(myBaseImpl);
1518   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1519     string name_value_type = options[i].in();
1520     if(name_value_type.empty())
1521       continue;
1522     size_t colonPos = name_value_type.find(':');
1523     string name, value;
1524     if (colonPos == string::npos) // ':' not found
1525       name = name_value_type;
1526     else {
1527       name = name_value_type.substr(0, colonPos);
1528       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1529         string value_type = name_value_type.substr(colonPos + 1);
1530         colonPos = value_type.find(':');
1531         value = value_type.substr(0, colonPos);
1532         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1533           if ( value_type.substr(colonPos + 1) == "0" ) // is default
1534             value.clear();
1535       }
1536     }
1537     SetPreCADOptionValue(name.c_str(), value.c_str());
1538   }
1539 }
1540
1541 //=============================================================================
1542
1543 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1544 {
1545   SMESH::TPythonDump dump;
1546
1547   string optionsAndValues;
1548   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1549     string name_value_type = options[i].in();
1550     if(name_value_type.empty())
1551       continue;
1552     size_t colonPos = name_value_type.find(':');
1553     string name, value;
1554     if (colonPos == string::npos) // ':' not found
1555       name = name_value_type;
1556     else {
1557       name = name_value_type.substr(0, colonPos);
1558       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1559         string value_type = name_value_type.substr(colonPos + 1);
1560         colonPos = value_type.find(':');
1561         value = value_type.substr(0, colonPos);
1562       }
1563     }
1564     AddOption(name.c_str(), value.c_str());
1565
1566     optionsAndValues += name + " " + value + " ";
1567   }
1568
1569   if ( !optionsAndValues.empty() )
1570     dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1571 }
1572
1573 //=============================================================================
1574
1575 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1576   throw (SALOME::SALOME_Exception)
1577 {
1578   if ( !optionsAndValues ) return;
1579
1580   SMESH::TPythonDump dump;
1581
1582   std::istringstream strm( optionsAndValues );
1583   std::istream_iterator<std::string> sIt( strm ), sEnd;
1584   while ( sIt != sEnd )
1585   {
1586     std::string option = *sIt;
1587     if ( ++sIt != sEnd )
1588     {
1589       std::string value = *sIt;
1590       ++sIt;
1591       AddOption( option.c_str(), value.c_str() );
1592     }
1593     else
1594     {
1595       THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1596     }
1597   }
1598   dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1599 }
1600
1601 //=============================================================================
1602
1603 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1604 {
1605   ASSERT(myBaseImpl);
1606   bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1607   if (valueChanged) {
1608     this->GetImpl()->AddOption(optionName, optionValue);
1609     SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1610   }
1611 }
1612
1613 //=============================================================================
1614
1615 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1616 {
1617   ASSERT(myBaseImpl);
1618   bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1619   if (valueChanged) {
1620     this->GetImpl()->AddPreCADOption(optionName, optionValue);
1621     SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1622   }
1623 }
1624
1625 //=============================================================================
1626
1627 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1628 {
1629   ASSERT(myBaseImpl);
1630   return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1631 }
1632
1633 //=============================================================================
1634
1635 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1636 {
1637   ASSERT(myBaseImpl);
1638   return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1639 }
1640
1641 //=============================================================================
1642
1643 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1644     throw (SALOME::SALOME_Exception) {
1645   ASSERT(myBaseImpl);
1646   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1647   if ( !entry || !entry[0] )
1648     THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1649   bool valueChanged = false;
1650   try {
1651     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1652     if (valueChanged)
1653       this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1654   } catch (const std::invalid_argument& ex) {
1655     SALOME::ExceptionStruct ExDescription;
1656     ExDescription.text = ex.what();
1657     ExDescription.type = SALOME::BAD_PARAM;
1658     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1659     ExDescription.lineNumber = 0;
1660     throw SALOME::SALOME_Exception(ExDescription);
1661   } catch (SALOME_Exception& ex) {
1662     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1663   }
1664   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1665   if (valueChanged)
1666     SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1667 }
1668
1669 //=============================================================================
1670
1671 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1672   throw (SALOME::SALOME_Exception) {
1673   ASSERT(myBaseImpl);
1674   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1675   bool valueChanged = false;
1676   std::ostringstream sizeMapFunction;
1677   switch (shapeType) {
1678   case GEOM::FACE:   sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1679   case GEOM::EDGE:   sizeMapFunction << "def f(t): return " << sizeMap ; break;
1680   case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1681   default:;
1682   }
1683   try {
1684     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1685     if (valueChanged)
1686       this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1687   } catch (const std::invalid_argument& ex) {
1688     SALOME::ExceptionStruct ExDescription;
1689     ExDescription.text = ex.what();
1690     ExDescription.type = SALOME::BAD_PARAM;
1691     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1692     ExDescription.lineNumber = 0;
1693     throw SALOME::SALOME_Exception(ExDescription);
1694   } catch (SALOME_Exception& ex) {
1695     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1696   }
1697   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1698   if (valueChanged)
1699     SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1700 }
1701
1702 //=============================================================================
1703
1704 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1705     throw (SALOME::SALOME_Exception) {
1706   ASSERT(myBaseImpl);
1707   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1708   bool valueChanged = false;
1709   try {
1710     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1711     if ( valueChanged ) {
1712       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1713       if (!boost::regex_match(string(attractor), re))
1714         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1715       this->GetImpl()->SetAttractorEntry(entry, attractor);
1716     }
1717   } catch (const std::invalid_argument& ex) {
1718     SALOME::ExceptionStruct ExDescription;
1719     ExDescription.text = ex.what();
1720     ExDescription.type = SALOME::BAD_PARAM;
1721     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1722     ExDescription.lineNumber = 0;
1723     throw SALOME::SALOME_Exception(ExDescription);
1724   } catch (SALOME_Exception& ex) {
1725     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1726   }
1727   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1728   if (valueChanged)
1729     SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1730 }
1731
1732 //=============================================================================
1733
1734 void BLSURFPlugin_Hypothesis_i::SetClassAttractorEntry(const char* entry, const char* att_entry, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius) //TODO à finir
1735   throw (SALOME::SALOME_Exception)
1736 {
1737   ASSERT(myBaseImpl);
1738   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1739   //bool valueChanged = false;
1740   try {
1741     this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1742   }
1743   catch (const std::invalid_argument& ex) {
1744     SALOME::ExceptionStruct ExDescription;
1745     ExDescription.text = ex.what();
1746     ExDescription.type = SALOME::BAD_PARAM;
1747     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1748     ExDescription.lineNumber = 0;
1749     throw SALOME::SALOME_Exception(ExDescription);
1750   } catch (SALOME_Exception& ex) {
1751     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1752   }
1753   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1754   //if ( valueChanged )
1755   SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1756                        << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1757 }
1758
1759 //=============================================================================
1760
1761 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1762   ASSERT(myBaseImpl);
1763   try {
1764     return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1765   } catch (const std::invalid_argument& ex) {
1766     SALOME::ExceptionStruct ExDescription;
1767     ExDescription.text = ex.what();
1768     ExDescription.type = SALOME::BAD_PARAM;
1769     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1770     ExDescription.lineNumber = 0;
1771     throw SALOME::SALOME_Exception(ExDescription);
1772   } catch (SALOME_Exception& ex) {
1773     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1774   }
1775   return 0;
1776 }
1777
1778 //=============================================================================
1779
1780 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1781   ASSERT(myBaseImpl);
1782   try {
1783     return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1784   } catch (const std::invalid_argument& ex) {
1785     SALOME::ExceptionStruct ExDescription;
1786     ExDescription.text = ex.what();
1787     ExDescription.type = SALOME::BAD_PARAM;
1788     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1789     ExDescription.lineNumber = 0;
1790     throw SALOME::SALOME_Exception(ExDescription);
1791   } catch (SALOME_Exception& ex) {
1792     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1793   }
1794   return 0;
1795 }
1796
1797 // //=============================================================================
1798 // 
1799 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1800 // // A finir pour le dump
1801 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1802 //   throw (SALOME::SALOME_Exception)
1803 // {
1804 //   ASSERT(myBaseImpl);
1805 //   try {
1806 //     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1807 //   }
1808 //   catch (const std::invalid_argument& ex) {
1809 //     SALOME::ExceptionStruct ExDescription;
1810 //     ExDescription.text = ex.what();
1811 //     ExDescription.type = SALOME::BAD_PARAM;
1812 //     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1813 //     ExDescription.lineNumber = 0;
1814 //     throw SALOME::SALOME_Exception(ExDescription);
1815 //   }
1816 //   catch (SALOME_Exception& ex) {
1817 //     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1818 //   }
1819 //   return 0;
1820 // }
1821
1822 //=============================================================================
1823
1824 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1825   ASSERT(myBaseImpl);
1826   this->GetImpl()->ClearEntry(entry);
1827   //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1828 }
1829
1830 //=============================================================================
1831
1832 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1833   ASSERT(myBaseImpl);
1834   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1835
1836   const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1837   result->length(sizeMaps.size());
1838
1839   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1840   for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1841     string entry_sizemap = smIt->first;
1842     if (!smIt->second.empty()) {
1843       entry_sizemap += "|";
1844       entry_sizemap += smIt->second;
1845     }
1846     result[i] = CORBA::string_dup(entry_sizemap.c_str());
1847   }
1848   return result._retn();
1849 }
1850
1851 //=============================================================================
1852
1853 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1854   ASSERT(myBaseImpl);
1855   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1856
1857   const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1858   result->length(attractors.size());
1859
1860   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1861   for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1862     string entry_attractor = atIt->first;
1863     if (!atIt->second.empty()) {
1864       entry_attractor += "|";
1865       entry_attractor += atIt->second;
1866     }
1867     result[i] = CORBA::string_dup(entry_attractor.c_str());
1868   }
1869   return result._retn();
1870 }
1871
1872 //=============================================================================
1873
1874 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1875 {
1876   ASSERT(myBaseImpl);
1877   BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1878
1879   const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1880   result->length( attractors.size() );
1881
1882   ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1883   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1884     string faceEntry = atIt->first;
1885     string attEntry;
1886     double startSize, endSize, infDist, constDist;
1887     if ( !atIt->second->Empty() ) {
1888       attEntry = atIt->second->GetAttractorEntry();
1889       MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1890       std::vector<double> params = atIt->second->GetParameters();
1891       startSize = params[0];
1892       endSize = params[1];
1893       infDist = params[2];
1894       constDist = params[3];
1895     }
1896     result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1897     result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1898     result[i].startSize = startSize;
1899     result[i].endSize = endSize;
1900     result[i].infDist = infDist;
1901     result[i].constDist = constDist;
1902     MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1903     MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1904   }
1905   return result._retn();
1906 }
1907
1908 //=============================================================================
1909
1910 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1911     throw (SALOME::SALOME_Exception) {
1912   ASSERT(myBaseImpl);
1913   for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1914     string entry_sizemap = sizeMaps[i].in();
1915     size_t colonPos = entry_sizemap.find('|');
1916     string entry, sizemap;
1917     if (colonPos == string::npos) // '|' separator not found
1918       entry = entry_sizemap;
1919     else {
1920       entry = entry_sizemap.substr(0, colonPos);
1921       if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1922         sizemap = entry_sizemap.substr(colonPos + 1);
1923     }
1924     this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1925   }
1926 }
1927
1928 //=============================================================================
1929
1930 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1931   ASSERT(myBaseImpl);
1932   this->GetImpl()->ClearSizeMaps();
1933 }
1934
1935 //=============================================================================
1936
1937 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1938   throw (SALOME::SALOME_Exception)
1939 {
1940   ASSERT(myBaseImpl);
1941   string entry;
1942   entry = GeomObj->GetStudyEntry();
1943   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1944   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1945   SetSizeMapEntry(entry.c_str(), sizeMap);
1946 }
1947
1948 //=============================================================================
1949
1950 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1951   ASSERT(myBaseImpl);
1952   string entry = GeomObj->GetStudyEntry();
1953   GEOM::shape_type shapeType = GeomObj->GetShapeType();
1954   if (shapeType == GEOM::COMPOUND)
1955     shapeType = GeomObj->GetMaxShapeType();
1956   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1957   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1958   SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1959 }
1960
1961 //=============================================================================
1962 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1963   ASSERT(myBaseImpl);
1964   string entry;
1965   entry = GeomObj->GetStudyEntry();
1966   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1967   MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1968   UnsetEntry(entry.c_str());
1969   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1970 }
1971
1972 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1973   ASSERT(myBaseImpl);
1974   string entry;
1975   entry = GeomObj->GetStudyEntry();
1976   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1977   MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1978   SetAttractorEntry(entry.c_str(), attractor);
1979 }
1980
1981 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1982   ASSERT(myBaseImpl);
1983   string entry;
1984   entry = GeomObj->GetStudyEntry();
1985   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1986   MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1987   UnsetEntry(entry.c_str());
1988   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1989 }
1990
1991 void BLSURFPlugin_Hypothesis_i::SetAttractorGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theAttractor, CORBA::Double StartSize, CORBA::Double EndSize, CORBA::Double ActionRadius, CORBA::Double ConstantRadius)
1992 {
1993   ASSERT(myBaseImpl);
1994   string theFaceEntry;
1995   string theAttEntry;
1996   theFaceEntry = theFace->GetStudyEntry();
1997   theAttEntry  = theAttractor->GetStudyEntry();
1998   
1999   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2000   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2001   string aName;
2002   
2003   if (theFaceEntry.empty()) {
2004     aName = "Face_";
2005     aName += theFace->GetEntry();
2006     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2007     if (!theSFace->_is_nil())
2008       theFaceEntry = theSFace->GetID();
2009   }
2010   if (theFaceEntry.empty())
2011     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2012   
2013   if (theAttEntry.empty()) {
2014     if (theAttractor->GetShapeType() == GEOM::VERTEX)
2015       aName = "Vertex_";
2016     if (theAttractor->GetShapeType() == GEOM::EDGE)
2017       aName = "Edge_";
2018     if (theAttractor->GetShapeType() == GEOM::WIRE)
2019       aName = "Wire_";
2020     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2021       aName = "Compound_";
2022     aName += theAttractor->GetEntry();
2023     SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2024     if (!theSAtt->_is_nil())
2025       theAttEntry = theSAtt->GetID();
2026   }
2027   if (theAttEntry.empty())
2028     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2029   
2030   TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2031   TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2032   MESSAGE("IDL : GetName : " << theFace->GetName());
2033   MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2034   SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2035 }
2036
2037 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2038                                                    GEOM::GEOM_Object_ptr theAttractor)
2039 {
2040   ASSERT(myBaseImpl);
2041   CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2042   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2043   
2044   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2045   // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2046   // string aName;
2047   
2048   // if (theFaceEntry.empty()) {
2049   //   aName = "Face_";
2050   //   aName += theFace->GetEntry();
2051   //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2052   //   if (!theSFace->_is_nil())
2053   //     theFaceEntry = theSFace->GetID();
2054   // }
2055   if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2056        !theAttrEntry.in() || !theAttrEntry.in()[0] )
2057     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2058   
2059   MESSAGE("IDL : GetName : " << theFace->GetName());
2060   MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2061   GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2062   SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2063                        << theFace << ", " << theAttractor << " )";
2064 }
2065
2066 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2067                                                     const char* attractorEntry)
2068 {
2069   GetImpl()->ClearEntry( faceEntry, attractorEntry );
2070   SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2071                        << faceEntry << "', '" << attractorEntry << "' )";
2072 }
2073
2074
2075 /*
2076  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2077  {}
2078
2079  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2080  {}
2081
2082  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
2083  {}
2084
2085  char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
2086  {}
2087
2088  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2089  {
2090  ASSERT(myBaseImpl);
2091  this->GetImpl()->UnsetCustomSizeMap(entry);
2092  SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2093  }
2094
2095
2096  BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2097  {}
2098
2099  */
2100
2101 // ///////////////////////
2102 // // ENFORCED VERTICES //
2103 // ///////////////////////
2104
2105
2106 /**
2107  * Returns the list of enforced vertices for a given Face entry
2108  * @return A map of Face entry / List of enforced vertices
2109  *
2110  */
2111 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2112   MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2113   ASSERT(myBaseImpl);
2114
2115   BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2116
2117   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2118       this->GetImpl()->_GetAllEnforcedVerticesByFace();
2119   resultMap->length(faceEntryEnfVertexListMap.size());
2120   MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2121
2122   ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2123   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2124   for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2125     BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2126         new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2127     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2128     MESSAGE("Face Entry: " << mapElement->faceEntry);
2129
2130     _enfVertexList = it_entry->second;
2131     BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2132     enfVertexList->length(_enfVertexList.size());
2133     MESSAGE("Number of enf vertex: " << enfVertexList->length());
2134
2135     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2136     ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2137     for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2138       currentEnfVertex = (*it_enfVertex);
2139
2140       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2141
2142       // Name
2143       enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2144
2145       // Geom entry
2146       enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2147
2148       // Coords
2149       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2150       coords->length(currentEnfVertex->coords.size());
2151       for (CORBA::ULong i=0;i<coords->length();i++)
2152         coords[i] = currentEnfVertex->coords[i];
2153       enfVertex->coords = coords;
2154
2155       // Group name
2156       enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2157       
2158       // Face entry list
2159       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2160       faceEntryList->length(currentEnfVertex->faceEntries.size());
2161       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2162       for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2163         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2164       enfVertex->faceEntries = faceEntryList;
2165
2166       ostringstream msg;
2167       msg << "Enforced vertex: \n"
2168           << "Name: " << enfVertex->name << "\n";
2169       if (coords->length())
2170           msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2171       msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2172           << "Group Name: " << enfVertex->grpName;
2173       MESSAGE(msg.str());
2174
2175       enfVertexList[j] = enfVertex;
2176     }
2177     mapElement->enfVertexList = enfVertexList;
2178
2179     resultMap[i] = mapElement;
2180
2181   }
2182   return resultMap._retn();
2183 }
2184
2185 /**
2186  * Returns the list of all enforced vertices
2187  * @return a list of enforced vertices
2188  *
2189  */
2190 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2191   MESSAGE("IDL: GetAllEnforcedVertices()");
2192   ASSERT(myBaseImpl);
2193   BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2194   const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2195   resultMap->length(enfVertexList.size());
2196   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2197
2198   ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2199   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2200   for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2201     MESSAGE("Enforced Vertex #" << i);
2202     currentEnfVertex = (*evlIt);
2203     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2204     // Name
2205     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2206     // Geom entry
2207     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2208     // Coords
2209     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2210     coords->length(currentEnfVertex->coords.size());
2211     for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2212       coords[ind] = currentEnfVertex->coords[ind];
2213     enfVertex->coords = coords;
2214     // Group name
2215     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2216     // Face entry list
2217     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2218     faceEntryList->length(currentEnfVertex->faceEntries.size());
2219     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2220     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2221       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2222     enfVertex->faceEntries = faceEntryList;
2223
2224     ostringstream msg;
2225     msg << "Enforced vertex: \n"
2226         << "Name: " << enfVertex->name << "\n";
2227     if (coords->length())
2228         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2229     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2230         << "Group Name: " << enfVertex->grpName;
2231     MESSAGE(msg.str());
2232
2233     resultMap[i] = enfVertex;
2234   }
2235   return resultMap._retn();
2236
2237 }
2238
2239 /**
2240  * Returns the list of enforced vertices coords for a given Face entry.
2241  * They are the coords of the "manual" enforced vertices.
2242  * @return A map of Face entry / List of enforced vertices coords
2243  *
2244  */
2245 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2246   MESSAGE("IDL: GetAllCoordsByFace()");
2247   ASSERT(myBaseImpl);
2248
2249   BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2250
2251   const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2252   resultMap->length(entryCoordsListMap.size());
2253   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2254
2255   ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2256   ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2257   for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2258     BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2259     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2260     MESSAGE("Face Entry: " << mapElement->faceEntry);
2261
2262     _coordsList = it_entry->second;
2263     BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2264     coordsList->length(_coordsList.size());
2265     MESSAGE("Number of coords: " << coordsList->length());
2266
2267     ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2268     for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2269       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2270       coords->length((*it_coords).size());
2271       for (CORBA::ULong i=0;i<coords->length();i++)
2272         coords[i] = (*it_coords)[i];
2273       coordsList[j] = coords;
2274       MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2275     }
2276     mapElement->coordsList = coordsList;
2277
2278     resultMap[i] = mapElement;
2279
2280   }
2281   return resultMap._retn();
2282 }
2283
2284 /**
2285  * Returns a map of enforced vertices coords / enforced vertex.
2286  * They are the coords of the "manual" enforced vertices.
2287  */
2288 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2289   MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2290   ASSERT(myBaseImpl);
2291
2292   BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2293   const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2294       this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2295   resultMap->length(coordsEnfVertexMap.size());
2296   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2297
2298   ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2299   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2300   for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2301     MESSAGE("Enforced Vertex #" << i);
2302     currentEnfVertex = (it_coords->second);
2303     BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2304     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2305     coords->length(it_coords->first.size());
2306     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2307       coords[ind] = it_coords->first[ind];
2308     mapElement->coords = coords;
2309     MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2310
2311     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2312     // Name
2313     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2314     // Geom entry
2315     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2316     // Coords
2317     BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2318     coords2->length(currentEnfVertex->coords.size());
2319     for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2320       coords2[ind] = currentEnfVertex->coords[ind];
2321     enfVertex->coords = coords2;
2322     // Group name
2323     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2324     // Face entry list
2325     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2326     faceEntryList->length(currentEnfVertex->faceEntries.size());
2327     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2328     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2329       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2330     enfVertex->faceEntries = faceEntryList;
2331       
2332     mapElement->enfVertex = enfVertex;
2333     ostringstream msg;
2334     msg << "Enforced vertex: \n"
2335         << "Name: " << enfVertex->name << "\n";
2336     if (coords->length())
2337         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2338     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2339         << "Group Name: " << enfVertex->grpName;
2340     MESSAGE(msg.str());
2341
2342     resultMap[i] = mapElement;
2343   }
2344   return resultMap._retn();
2345 }
2346
2347 /**
2348  * Returns the list of enforced vertices entries for a given Face entry.
2349  * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2350  * @return A map of Face entry / List of enforced vertices geom entries
2351  *
2352  */
2353 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2354   MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2355   ASSERT(myBaseImpl);
2356
2357   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2358
2359   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2360       this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2361   resultMap->length(entryEnfVertexEntryListMap.size());
2362   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2363
2364   ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2365   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2366       entryEnfVertexEntryListMap.begin();
2367   for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2368     BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2369         new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2370     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2371     MESSAGE("Face Entry: " << mapElement->faceEntry);
2372
2373     _enfVertexEntryList = it_entry->second;
2374     BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2375     enfVertexEntryList->length(_enfVertexEntryList.size());
2376     MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2377
2378     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2379     for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2380       enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2381       MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2382     }
2383     mapElement->enfVertexEntryList = enfVertexEntryList;
2384
2385     resultMap[i] = mapElement;
2386
2387   }
2388   return resultMap._retn();
2389 }
2390
2391 /**
2392  * Returns a map of enforced vertices geom entry / enforced vertex.
2393  * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2394  */
2395 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2396   MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2397   ASSERT(myBaseImpl);
2398
2399   BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2400   const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2401       this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2402   resultMap->length(enfVertexEntryEnfVertexMap.size());
2403   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2404
2405   ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2406   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2407   for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2408     MESSAGE("Enforced Vertex #" << i);
2409     currentEnfVertex = it_enfVertexEntry->second;
2410     BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2411     mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2412     MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2413
2414     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2415     // Name
2416     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2417     // Geom entry
2418     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2419     // Coords
2420     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2421     coords->length(currentEnfVertex->coords.size());
2422     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2423       coords[ind] = currentEnfVertex->coords[ind];
2424     enfVertex->coords = coords;
2425     // Group name
2426     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2427     // Face entry list
2428     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2429     faceEntryList->length(currentEnfVertex->faceEntries.size());
2430     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2431     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2432       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2433     enfVertex->faceEntries = faceEntryList;
2434
2435     ostringstream msg;
2436     msg << "Enforced vertex: \n"
2437         << "Name: " << enfVertex->name << "\n";
2438     if (coords->length())
2439         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2440     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2441         << "Group Name: " << enfVertex->grpName;
2442     MESSAGE(msg.str());
2443
2444     mapElement->enfVertex = enfVertex;
2445     resultMap[i] = mapElement;
2446   }
2447   return resultMap._retn();
2448 }
2449
2450 /**
2451  * Erase all enforced vertices
2452  */
2453 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2454   ASSERT(myBaseImpl);
2455   this->GetImpl()->ClearAllEnforcedVertices();
2456   SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2457 }
2458
2459 /*!
2460  * Set/get/unset an enforced vertex on face
2461  */
2462 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2463     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2464   ASSERT(myBaseImpl);
2465
2466   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2467     MESSAGE("theFace shape type is not FACE or COMPOUND");
2468     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2469   }
2470
2471   string theFaceEntry = theFace->GetStudyEntry();
2472   
2473   if (theFaceEntry.empty()) {
2474     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2475     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2476     string aName;
2477     if (theFace->GetShapeType() == GEOM::FACE)
2478       aName = "Face_";
2479     if (theFace->GetShapeType() == GEOM::COMPOUND)
2480       aName = "Compound_";
2481     aName += theFace->GetEntry();
2482     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2483     if (!theSFace->_is_nil())
2484       theFaceEntry = theSFace->GetID();
2485   }
2486   if (theFaceEntry.empty())
2487     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2488   MESSAGE("IDL : GetName : " << theFace->GetName());
2489   MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2490   try {
2491     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2492   } catch (SALOME_Exception& ex) {
2493     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2494   }
2495 }
2496
2497 /*!
2498  * Set/get/unset an enforced vertex with name on face
2499  */
2500 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2501     CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2502   ASSERT(myBaseImpl);
2503
2504   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2505     MESSAGE("theFace shape type is not FACE or COMPOUND");
2506     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2507   }
2508
2509   string theFaceEntry = theFace->GetStudyEntry();
2510   
2511   if (theFaceEntry.empty()) {
2512     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2513     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2514     string aName;
2515     if (theFace->GetShapeType() == GEOM::FACE)
2516       aName = "Face_";
2517     if (theFace->GetShapeType() == GEOM::COMPOUND)
2518       aName = "Compound_";
2519     aName += theFace->GetEntry();
2520     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2521     if (!theSFace->_is_nil())
2522       theFaceEntry = theSFace->GetID();
2523   }
2524   if (theFaceEntry.empty())
2525     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2526   
2527   MESSAGE("IDL : GetName : " << theFace->GetName());
2528   MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2529   try {
2530     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2531   } catch (SALOME_Exception& ex) {
2532     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2533   }
2534 }
2535
2536 /*!
2537  * Set/get/unset an enforced vertex with geom object on face
2538  */
2539 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2540     throw (SALOME::SALOME_Exception) {
2541   ASSERT(myBaseImpl);
2542
2543   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2544     MESSAGE("theFace shape type is not FACE or COMPOUND");
2545     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2546   }
2547
2548   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2549     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2550     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2551   }
2552
2553   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2554   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2555   //  if (CORBA::is_nil(measureOp))
2556   //    return false;
2557   //
2558   //  CORBA::Double x, y, z;
2559   //  x = y = z = 0.;
2560   //  measureOp->PointCoordinates(theVertex, x, y, z);
2561
2562   string theFaceEntry = theFace->GetStudyEntry();
2563   string theVertexEntry = theVertex->GetStudyEntry();
2564   
2565   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2566   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2567   string aName;
2568   
2569   if (theFaceEntry.empty()) {
2570     if (theFace->GetShapeType() == GEOM::FACE)
2571       aName = "Face_";
2572     if (theFace->GetShapeType() == GEOM::COMPOUND)
2573       aName = "Compound_";
2574     aName += theFace->GetEntry();
2575     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2576     if (!theSFace->_is_nil())
2577       theFaceEntry = theSFace->GetID();
2578   }
2579   if (theFaceEntry.empty())
2580     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2581   
2582   if (theVertexEntry.empty()) {
2583     if (theVertex->GetShapeType() == GEOM::VERTEX)
2584       aName = "Vertex_";
2585     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2586       aName = "Compound_";
2587     aName += theVertex->GetEntry();
2588     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2589     if (!theSVertex->_is_nil())
2590       theVertexEntry = theSVertex->GetID();
2591   }
2592   if (theVertexEntry.empty())
2593     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2594
2595   string theVertexName = theVertex->GetName();
2596   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2597   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2598   MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2599   try {
2600     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2601   } catch (SALOME_Exception& ex) {
2602     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2603   }
2604 }
2605
2606 /*!
2607  * Set an enforced vertex with group name on face
2608  */
2609 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2610  throw (SALOME::SALOME_Exception)
2611 {
2612   ASSERT(myBaseImpl);
2613
2614   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2615     MESSAGE("theFace shape type is not FACE or COMPOUND");
2616     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2617   }
2618
2619   string theFaceEntry = theFace->GetStudyEntry();
2620   
2621   if (theFaceEntry.empty()) {
2622     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2623     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2624     string aName;
2625     if (theFace->GetShapeType() == GEOM::FACE)
2626       aName = "Face_";
2627     if (theFace->GetShapeType() == GEOM::COMPOUND)
2628       aName = "Compound_";
2629     aName += theFace->GetEntry();
2630     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2631     if (!theSFace->_is_nil())
2632       theFaceEntry = theSFace->GetID();
2633   }
2634   if (theFaceEntry.empty())
2635     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2636   MESSAGE("IDL : GetName : " << theFace->GetName());
2637   MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2638   try {
2639     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2640   } catch (SALOME_Exception& ex) {
2641     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2642   }
2643 }
2644
2645 /*!
2646  * Set an enforced vertex with name and group name on face
2647  */
2648 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, 
2649                                                                 const char* theVertexName, const char* theGroupName)
2650  throw (SALOME::SALOME_Exception)
2651 {
2652   ASSERT(myBaseImpl);
2653
2654   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2655     MESSAGE("theFace shape type is not FACE or COMPOUND");
2656     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2657   }
2658
2659   string theFaceEntry = theFace->GetStudyEntry();
2660   
2661   if (theFaceEntry.empty()) {
2662     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2663     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2664     string aName;
2665     if (theFace->GetShapeType() == GEOM::FACE)
2666       aName = "Face_";
2667     if (theFace->GetShapeType() == GEOM::COMPOUND)
2668       aName = "Compound_";
2669     aName += theFace->GetEntry();
2670     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2671     if (!theSFace->_is_nil())
2672       theFaceEntry = theSFace->GetID();
2673   }
2674   if (theFaceEntry.empty())
2675     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2676   MESSAGE("IDL : GetName : " << theFace->GetName());
2677   MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2678   try {
2679     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2680   } catch (SALOME_Exception& ex) {
2681     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2682   }
2683 }
2684
2685 /*!
2686  * Set an enforced vertex with geom entry and group name on face
2687  */
2688 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2689  throw (SALOME::SALOME_Exception)
2690 {
2691   ASSERT(myBaseImpl);
2692
2693   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2694     MESSAGE("theFace shape type is not FACE or COMPOUND");
2695     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2696   }
2697
2698   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2699     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2700     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2701   }
2702
2703   string theFaceEntry = theFace->GetStudyEntry();
2704   string theVertexEntry = theVertex->GetStudyEntry();
2705   
2706   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2707   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2708   string aName;
2709   
2710   if (theFaceEntry.empty()) {
2711     if (theFace->GetShapeType() == GEOM::FACE)
2712       aName = "Face_";
2713     if (theFace->GetShapeType() == GEOM::COMPOUND)
2714       aName = "Compound_";
2715     aName += theFace->GetEntry();
2716     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2717     if (!theSFace->_is_nil())
2718       theFaceEntry = theSFace->GetID();
2719   }
2720   if (theFaceEntry.empty())
2721     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2722   
2723   if (theVertexEntry.empty()) {
2724     if (theVertex->GetShapeType() == GEOM::VERTEX)
2725       aName = "Vertex_";
2726     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2727       aName = "Compound_";
2728     aName += theVertex->GetEntry();
2729     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2730     if (!theSVertex->_is_nil())
2731       theVertexEntry = theSVertex->GetID();
2732   }
2733   if (theVertexEntry.empty())
2734     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2735
2736   string theVertexName = theVertex->GetName();
2737   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2738   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2739   MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2740   try {
2741     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2742   } catch (SALOME_Exception& ex) {
2743     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2744   }
2745 }
2746
2747 //Enable internal enforced vertices on specific face if requested by user
2748 ///*!
2749 // * Are internal enforced vertices used for a face ?
2750 // */
2751 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2752 //    throw (SALOME::SALOME_Exception) {
2753 //  ASSERT(myBaseImpl);
2754
2755 //  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2756 //    MESSAGE("theFace shape type is not FACE or COMPOUND");
2757 //    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2758 //  }
2759
2760 //  string theFaceEntry = theFace->GetStudyEntry();
2761   
2762 //  if (theFaceEntry.empty()) {
2763 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2764 //    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2765 //    string aName;
2766 //    if (theFace->GetShapeType() == GEOM::FACE)
2767 //      aName = "Face_";
2768 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
2769 //      aName = "Compound_";
2770 //    aName += theFace->GetEntry();
2771 //    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2772 //    if (!theSFace->_is_nil())
2773 //      theFaceEntry = theSFace->GetID();
2774 //  }
2775 //  if (theFaceEntry.empty())
2776 //    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2777
2778 //  MESSAGE("IDL : GetName : " << theFace->GetName());
2779 //  MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2780 //  try {
2781 //    return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2782 //  } catch (SALOME_Exception& ex) {
2783 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2784 //  }
2785 //}
2786
2787 /*!
2788  * Get the list of all enforced vertices
2789  */
2790 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2791     throw (SALOME::SALOME_Exception) {
2792   ASSERT(myBaseImpl);
2793
2794   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2795     MESSAGE("theFace shape type is not FACE or COMPOUND");
2796     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2797   }
2798
2799   string theFaceEntry = theFace->GetStudyEntry();
2800   
2801   if (theFaceEntry.empty()) {
2802     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2803     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2804     string aName;
2805     if (theFace->GetShapeType() == GEOM::FACE)
2806       aName = "Face_";
2807     if (theFace->GetShapeType() == GEOM::COMPOUND)
2808       aName = "Compound_";
2809     aName += theFace->GetEntry();
2810     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2811     if (!theSFace->_is_nil())
2812       theFaceEntry = theSFace->GetID();
2813   }
2814   if (theFaceEntry.empty())
2815     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2816
2817   MESSAGE("IDL : GetName : " << theFace->GetName());
2818   MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2819   try {
2820     return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2821   } catch (SALOME_Exception& ex) {
2822     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2823   }
2824 }
2825
2826 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2827     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2828   ASSERT(myBaseImpl);
2829
2830   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2831     MESSAGE("theFace shape type is not FACE or COMPOUND");
2832     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2833   }
2834
2835   string theFaceEntry = theFace->GetStudyEntry();
2836   
2837   if (theFaceEntry.empty()) {
2838     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2839     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2840     string aName;
2841     if (theFace->GetShapeType() == GEOM::FACE)
2842       aName = "Face_";
2843     if (theFace->GetShapeType() == GEOM::COMPOUND)
2844       aName = "Compound_";
2845     aName += theFace->GetEntry();
2846     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2847     if (!theSFace->_is_nil())
2848       theFaceEntry = theSFace->GetID();
2849   }
2850   if (theFaceEntry.empty())
2851     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2852   MESSAGE("IDL : GetName : " << theFace->GetName());
2853   MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2854
2855   try {
2856     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2857   } catch (SALOME_Exception& ex) {
2858     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2859   }
2860 }
2861
2862 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2863     throw (SALOME::SALOME_Exception) {
2864   ASSERT(myBaseImpl);
2865
2866   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2867     MESSAGE("theFace shape type is not FACE or COMPOUND");
2868     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2869   }
2870   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2871     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2872     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2873   }
2874
2875   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2876   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2877   //  if (CORBA::is_nil(measureOp))
2878   //    return false;
2879   //
2880   //  CORBA::Double x, y, z;
2881   //  x = y = z = 0.;
2882   //  measureOp->PointCoordinates(theVertex, x, y, z);
2883
2884   std::string theFaceEntry = theFace->GetStudyEntry();
2885   std::string theVertexEntry = theVertex->GetStudyEntry();
2886   
2887   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2888   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2889   string aName;
2890   
2891   if (theFaceEntry.empty()) {
2892     if (theFace->GetShapeType() == GEOM::FACE)
2893       aName = "Face_";
2894     if (theFace->GetShapeType() == GEOM::COMPOUND)
2895       aName = "Compound_";
2896     aName += theFace->GetEntry();
2897     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2898     if (!theSFace->_is_nil())
2899       theFaceEntry = theSFace->GetID();
2900   }
2901   if (theFaceEntry.empty())
2902     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2903   
2904   if (theVertexEntry.empty()) {
2905     if (theVertex->GetShapeType() == GEOM::VERTEX)
2906       aName = "Vertex_";
2907     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2908       aName = "Compound_";
2909     aName += theVertex->GetEntry();
2910     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2911     if (!theSVertex->_is_nil())
2912       theVertexEntry = theSVertex->GetID();
2913   }
2914   if (theVertexEntry.empty())
2915     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2916   
2917   MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2918
2919   try {
2920     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2921   } catch (SALOME_Exception& ex) {
2922     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2923   }
2924 }
2925
2926 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2927   ASSERT(myBaseImpl);
2928
2929   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2930     MESSAGE("theFace shape type is not FACE or COMPOUND");
2931     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2932   }
2933
2934   string theFaceEntry = theFace->GetStudyEntry();
2935   
2936   if (theFaceEntry.empty()) {
2937     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2938     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2939     string aName;
2940     if (theFace->GetShapeType() == GEOM::FACE)
2941       aName = "Face_";
2942     if (theFace->GetShapeType() == GEOM::COMPOUND)
2943       aName = "Compound_";
2944     aName += theFace->GetEntry();
2945     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2946     if (!theSFace->_is_nil())
2947       theFaceEntry = theSFace->GetID();
2948   }
2949   if (theFaceEntry.empty())
2950     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2951   
2952   MESSAGE("IDL : GetName : " << theFace->GetName());
2953   MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2954
2955   try {
2956     return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2957   } catch (SALOME_Exception& ex) {
2958     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2959   }
2960 }
2961
2962 /*!
2963  * Set/get/unset an enforced vertex on geom object given by entry
2964  */
2965 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2966     CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2967     throw (SALOME::SALOME_Exception) {
2968   ASSERT(myBaseImpl);
2969   MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2970   bool newValue = false;
2971   if (string(theVertexEntry).empty()) {
2972     try {
2973       ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2974         this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2975       ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2976       coords.push_back(x);
2977       coords.push_back(y);
2978       coords.push_back(z);
2979       if (coordsList.find(coords) == coordsList.end()) {
2980         MESSAGE("Coords not found: add it in coordsList");
2981         newValue = true;
2982       } else {
2983         MESSAGE("Coords already found, compare names");
2984         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2985         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2986           MESSAGE("The names are different: update");
2987           //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2988           newValue = true;
2989         }
2990         else {
2991           MESSAGE("The names are identical");
2992         }
2993       }
2994     } catch (const std::invalid_argument& ex) {
2995       // no enforced vertex for entry
2996       MESSAGE("Face entry not found : add it to the list");
2997       newValue = true;
2998     }
2999     if (newValue) {
3000       if (string(theVertexName).empty()) {
3001         if (string(theGroupName).empty())
3002           SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
3003         else
3004           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3005       }
3006       else {
3007         if (string(theGroupName).empty())
3008           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3009         else
3010           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
3011                                << theVertexName << "\", \"" << theGroupName << "\")";
3012       }
3013     }
3014   } else {
3015     try {
3016       ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3017       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3018       if ( it == enfVertexEntryList.end()) {
3019         MESSAGE("Geom entry not found: add it in enfVertexEntryList");
3020         newValue = true;
3021       }
3022       else {
3023         MESSAGE("Geom entry already found, compare names");
3024         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3025         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3026           MESSAGE("The names are different: update");
3027 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
3028           newValue = true;
3029         }
3030         else {
3031           MESSAGE("The names are identical");
3032         }
3033       }
3034     } catch (const std::invalid_argument& ex) {
3035       // no enforced vertex for entry
3036       MESSAGE("Face entry not found : add it to the list");
3037       newValue = true;
3038     }
3039     if (newValue) {
3040       if (string(theGroupName).empty())
3041         SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3042       else
3043         SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
3044     }
3045   }
3046
3047   if (newValue)
3048     this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3049
3050   MESSAGE("IDL : SetEnforcedVertexEntry END");
3051   return newValue;
3052 }
3053
3054 //Enable internal enforced vertices on specific face if requested by user
3055 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
3056 //    throw (SALOME::SALOME_Exception) {
3057 //  ASSERT(myBaseImpl);
3058 //  try {
3059 //    return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
3060 //  } catch (const std::exception& ex) {
3061 //    std::cout << "Exception: " << ex.what() << std::endl;
3062 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3063 //  }
3064 //}
3065   
3066 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3067     throw (SALOME::SALOME_Exception) {
3068   ASSERT(myBaseImpl);
3069   MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
3070
3071   try {
3072     BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3073     ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3074     vertexList->length(_vList.size());
3075     MESSAGE("Number of enforced vertices: " << vertexList->length());
3076     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3077     for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3078       ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3079
3080       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3081
3082       // Name
3083       enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3084       // Geom Vertex Entry
3085       enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3086       // Coords
3087       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3088       coords->length(_enfVertex->coords.size());
3089       for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3090         coords[ind] = _enfVertex->coords[ind];
3091       enfVertex->coords = coords;
3092       // Group Name
3093       enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3094       // Face entry list
3095       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3096       faceEntryList->length(_enfVertex->faceEntries.size());
3097       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3098       for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3099         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3100       enfVertex->faceEntries = faceEntryList;
3101
3102       vertexList[i] = enfVertex;
3103     }
3104     MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3105     return vertexList._retn();
3106   } catch (const std::invalid_argument& ex) {
3107     SALOME::ExceptionStruct ExDescription;
3108     ExDescription.text = ex.what();
3109     ExDescription.type = SALOME::BAD_PARAM;
3110     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3111     ExDescription.lineNumber = 1385;
3112     throw SALOME::SALOME_Exception(ExDescription);
3113   } catch (const std::exception& ex) {
3114     std::cout << "Exception: " << ex.what() << std::endl;
3115     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3116   }
3117 }
3118
3119 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
3120     CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
3121   ASSERT(myBaseImpl);
3122   MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
3123
3124   bool res = false;
3125   try {
3126     res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3127
3128     if (string(theVertexEntry).empty())
3129       SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
3130           << ")";
3131     else
3132       SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
3133
3134   } catch (const std::invalid_argument& ex) {
3135     return false;
3136   } catch (const std::exception& ex) {
3137     std::cout << "Exception: " << ex.what() << std::endl;
3138     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3139   }
3140
3141   MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3142   return res;
3143 }
3144
3145 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
3146 //    CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
3147 //  MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
3148 //
3149 //  bool ret = false;
3150 //
3151 //  try {
3152 //    ret = _unsetEnfVertex(theFaceEntry, x, y, z);
3153 //  } catch (SALOME_Exception& ex) {
3154 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3155 //  }
3156 //
3157 //  if (ret)
3158 //    SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
3159 //        << ")";
3160 //
3161 //  MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
3162 //  return ret;
3163 //}
3164
3165 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
3166   ASSERT(myBaseImpl);
3167   MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
3168
3169   try {
3170     this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3171     SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
3172   } catch (const std::invalid_argument& ex) {
3173     return false;
3174   } catch (const std::exception& ex) {
3175     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3176   }
3177
3178   MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
3179   return true;
3180 }
3181
3182 //=============================================================================
3183 /*!
3184  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3185  *
3186  *  Set true or false
3187  */
3188 //=============================================================================
3189 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
3190   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
3191   ASSERT(myBaseImpl);
3192   this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3193   std::string theValueStr = theValue ? "True" : "False";
3194   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3195 }
3196
3197 //=============================================================================
3198 /*!
3199  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3200  *
3201  *  Get true or false
3202  */
3203 //=============================================================================
3204 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
3205   MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
3206   ASSERT(myBaseImpl);
3207   return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3208 }
3209
3210 //=============================================================================
3211 /*!
3212  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3213  *
3214  *  Set group name
3215  */
3216 //=============================================================================
3217 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char*  groupName) {
3218   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
3219   ASSERT(myBaseImpl);
3220   this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3221   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3222 }
3223
3224 //=============================================================================
3225 /*!
3226  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3227  *
3228  *  Get group name
3229  */
3230 //=============================================================================
3231 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
3232   MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
3233   ASSERT(myBaseImpl);
3234   return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3235 }
3236
3237 /*
3238  * Enable internal enforced vertices on specific face if requested by user
3239  *
3240 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3241  throw (SALOME::SALOME_Exception)
3242 {
3243   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3244   try {
3245     SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3246   } catch (SALOME_Exception& ex) {
3247     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3248   }
3249 }
3250
3251 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3252  throw (SALOME::SALOME_Exception)
3253 {
3254   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3255
3256   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3257     MESSAGE("theFace shape type is not FACE or COMPOUND");
3258     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3259   }
3260
3261   string theFaceEntry = theFace->GetStudyEntry();
3262
3263   if (theFaceEntry.empty()) {
3264     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3265     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3266     string aName;
3267     if (theFace->GetShapeType() == GEOM::FACE)
3268       aName = "Face_";
3269     if (theFace->GetShapeType() == GEOM::COMPOUND)
3270       aName = "Compound_";
3271     aName += theFace->GetEntry();
3272     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3273     if (!theSFace->_is_nil())
3274       theFaceEntry = theSFace->GetID();
3275   }
3276   if (theFaceEntry.empty())
3277     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3278
3279   MESSAGE("IDL : GetName : " << theFace->GetName());
3280   MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3281   try {
3282     SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3283   } catch (SALOME_Exception& ex) {
3284     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3285   }
3286 }
3287
3288 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3289     throw (SALOME::SALOME_Exception)
3290 {
3291   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3292   ASSERT(myBaseImpl);
3293   try {
3294     this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3295     std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3296     if (string(theGroupName).empty())
3297       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3298     else
3299       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3300   } catch (const std::exception& ex) {
3301     std::cout << "Exception: " << ex.what() << std::endl;
3302     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3303   }
3304 }
3305
3306 */
3307
3308 /* TODO GROUPS
3309  char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3310  throw (SALOME::SALOME_Exception)
3311  {
3312  ASSERT(myBaseImpl);
3313  MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3314  try {
3315  return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3316  }
3317  catch (const std::invalid_argument& ex) {
3318  SALOME::ExceptionStruct ExDescription;
3319  ExDescription.text = ex.what();
3320  ExDescription.type = SALOME::BAD_PARAM;
3321  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3322  ExDescription.lineNumber = 1146;
3323  throw SALOME::SALOME_Exception(ExDescription);
3324  }
3325  catch (SALOME_Exception& ex) {
3326  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3327  }
3328  MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3329  return 0;
3330  }
3331
3332
3333  void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3334  throw (SALOME::SALOME_Exception)
3335  {
3336  ASSERT(myBaseImpl);
3337  MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3338  try {
3339  this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3340  }
3341  catch (const std::invalid_argument& ex) {
3342  SALOME::ExceptionStruct ExDescription;
3343  ExDescription.text = ex.what();
3344  ExDescription.type = SALOME::BAD_PARAM;
3345  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3346  ExDescription.lineNumber = 1170;
3347  throw SALOME::SALOME_Exception(ExDescription);
3348  }
3349  catch (SALOME_Exception& ex) {
3350  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3351  }
3352
3353  SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3354  << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3355
3356  MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3357  }
3358  */
3359 ///////////////////////
3360
3361 ///////////////////////
3362 // PERIODICITY       //
3363 ///////////////////////
3364
3365
3366 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3367 {
3368 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3369   std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3370   MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3371   MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3372   MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3373   MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3374   MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3375   MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3376   MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3377   MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3378   MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3379   std::string txtShapeType = MapShapeTypeToString[theShapeType];
3380   return txtShapeType;
3381 }
3382
3383 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3384 {
3385   // Check shape types
3386   bool ok = false;
3387   std::stringstream typesTxt;
3388   for (std::size_t i=0; i<theShapeTypes.size(); i++)
3389     {
3390       GEOM::shape_type theShapeType = theShapeTypes[i];
3391       if (shape->GetShapeType() == theShapeType)
3392         ok = true;
3393       typesTxt << ShapeTypeToString(theShapeType);
3394       if (i < theShapeTypes.size()-1 )
3395         typesTxt << ", ";
3396     }
3397   if (!ok){
3398     std::stringstream msg;
3399     msg << "shape shape type is not in" << typesTxt.str();
3400     MESSAGE(msg.str());
3401     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3402   }
3403 }
3404
3405 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3406 {
3407   // Check shape type
3408   if (shape->GetShapeType() != theShapeType) {
3409     std::stringstream msg;
3410     msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3411     MESSAGE(msg.str());
3412     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3413   }
3414 }
3415
3416 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3417 {
3418   // Check shape is published in the object browser
3419   string shapeEntry = shape->GetStudyEntry();
3420
3421   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3422   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3423   string aName;
3424
3425   // Publish shape if needed
3426   if (shapeEntry.empty()) {
3427     if (shape->GetShapeType() == theShapeType)
3428       aName = prefix;
3429     aName += shape->GetEntry();
3430     SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3431     if (!theSFace1->_is_nil())
3432       shapeEntry = theSFace1->GetID();
3433   }
3434   if (shapeEntry.empty())
3435     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3436   return shapeEntry;
3437 }
3438
3439 // Format the output of two vectors to use it in MESSAGE and PythonDump
3440 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3441 {
3442   std::stringstream listEntriesTxt;
3443
3444   if (!theSourceVerticesEntries.empty())
3445     {
3446       listEntriesTxt << ", [" ;
3447       size_t i =0;
3448       for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3449         {
3450           if (i>0)
3451             listEntriesTxt << ", ";
3452           listEntriesTxt << *it;
3453         }
3454
3455       listEntriesTxt << "], [" ;
3456       i =0;
3457       for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3458         {
3459           if (i>0)
3460             listEntriesTxt << ", ";
3461           listEntriesTxt << *it;
3462         }
3463       listEntriesTxt << "]" ;
3464     }
3465   return listEntriesTxt.str();
3466 }
3467
3468 /**
3469  * Erase all PreCad periodicity associations
3470  */
3471 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3472   ASSERT(myBaseImpl);
3473   this->GetImpl()->ClearPreCadPeriodicityVectors();
3474   SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3475 }
3476
3477 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3478 {
3479   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3480   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3481       this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3482
3483   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3484
3485   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3486   return periodicityList._retn();
3487 }
3488
3489 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3490 {
3491   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3492   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3493       this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3494
3495   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3496
3497   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3498   return periodicityList._retn();
3499 }
3500
3501 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3502 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3503 {
3504   MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3505   BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3506
3507     periodicityList->length(preCadPeriodicityVector.size());
3508
3509     for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3510       {
3511         ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3512
3513         BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3514         myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3515         myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3516
3517         BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3518         if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3519           {
3520             sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3521             for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3522               sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3523           }
3524
3525         myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3526
3527         BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3528         if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3529            {
3530             targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3531              for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3532                targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3533            }
3534
3535         myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3536
3537         periodicityList[i] = myPreCadPeriodicity;
3538       }
3539
3540
3541   return periodicityList._retn();
3542 }
3543
3544
3545 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3546 throw (SALOME::SALOME_Exception)
3547 {
3548   ASSERT(myBaseImpl);
3549   const GEOM::ListOfGO theSourceVertices;
3550   const GEOM::ListOfGO theTargetVertices;
3551   AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3552 }
3553
3554
3555 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3556     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3557 throw (SALOME::SALOME_Exception)
3558 {
3559   ASSERT(myBaseImpl);
3560   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3561
3562   size_t theLength = theSourceVertices.length();
3563   if (theLength != theTargetVertices.length())
3564     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3565
3566   std::vector<GEOM::shape_type> allowedShapeTypes;
3567   allowedShapeTypes.push_back(GEOM::FACE);
3568   allowedShapeTypes.push_back(GEOM::COMPOUND);
3569
3570   string prefix1 = "Source_face_";
3571   CheckShapeTypes(theFace1, allowedShapeTypes);
3572   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3573
3574   string prefix2 = "Target_face_";
3575   CheckShapeTypes(theFace2, allowedShapeTypes);
3576   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3577
3578   string prefix3 = "Source_vertex_";
3579   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3580   theSourceVerticesEntries->length(theLength);
3581   GEOM::GEOM_Object_ptr theVtx_i;
3582   string theEntry_i;
3583   for (size_t ind = 0; ind < theLength; ind++) {
3584       theVtx_i = theSourceVertices[ind];
3585       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3586       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3587   }
3588
3589   string prefix4 = "Target_vertex_";
3590   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3591   theTargetVerticesEntries->length(theLength);
3592   for (size_t ind = 0; ind < theLength; ind++) {
3593       theVtx_i = theTargetVertices[ind];
3594       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3595       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3596   }
3597
3598   string theFace2Name = theFace2->GetName();
3599   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3600   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3601   MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry <<  ")");
3602   try {
3603       AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3604           theSourceVerticesEntries, theTargetVerticesEntries);
3605   } catch (SALOME_Exception& ex) {
3606     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3607   }
3608 }
3609
3610
3611 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3612     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3613     throw (SALOME::SALOME_Exception)
3614 {
3615
3616   ASSERT(myBaseImpl);
3617
3618   // Convert BLSURFPlugin::TEntryList to vector<string>
3619   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3620   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3621       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3622       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3623   }
3624
3625   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3626
3627   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3628
3629   this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3630       theSourceVerticesEntries, theTargetVerticesEntries);
3631
3632   SMESH::TPythonDump pd;
3633   if (!theSourceVerticesEntries.empty())
3634     {
3635       pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3636       pd << listEntriesTxt.c_str();
3637       pd << ")";
3638     }
3639   else
3640     pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3641   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3642 }
3643
3644 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3645       throw (SALOME::SALOME_Exception)
3646 {
3647   ASSERT(myBaseImpl);
3648   const GEOM::ListOfGO theSourceVertices;
3649   const GEOM::ListOfGO theTargetVertices;
3650   AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3651 }
3652
3653 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3654     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3655       throw (SALOME::SALOME_Exception)
3656 {
3657   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3658   ASSERT(myBaseImpl);
3659
3660   size_t theLength = theSourceVertices.length();
3661   if (theLength != theTargetVertices.length())
3662     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3663
3664   std::vector<GEOM::shape_type> allowedShapeTypes;
3665   allowedShapeTypes.push_back(GEOM::EDGE);
3666   allowedShapeTypes.push_back(GEOM::COMPOUND);
3667
3668   string prefix1 = "Source_edge_";
3669   CheckShapeTypes(theEdge1, allowedShapeTypes);
3670   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3671
3672   string prefix2 = "Target_edge_";
3673   CheckShapeTypes(theEdge2, allowedShapeTypes);
3674   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3675
3676   string prefix3 = "Source_vertex_";
3677   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3678   theSourceVerticesEntries->length(theLength);
3679   GEOM::GEOM_Object_ptr theVtx_i;
3680   string theEntry_i;
3681   for (size_t ind = 0; ind < theLength; ind++) {
3682       theVtx_i = theSourceVertices[ind];
3683       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3684       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3685   }
3686
3687   string prefix4 = "Target_vertex_";
3688   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3689   theTargetVerticesEntries->length(theLength);
3690   for (size_t ind = 0; ind < theLength; ind++) {
3691       theVtx_i = theTargetVertices[ind];
3692       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3693       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3694   }
3695
3696   string theEdge2Name = theEdge2->GetName();
3697   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3698   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3699   MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3700   try {
3701       AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3702           theSourceVerticesEntries, theTargetVerticesEntries);
3703   } catch (SALOME_Exception& ex) {
3704     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3705   }
3706 }
3707
3708
3709 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3710     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3711     throw (SALOME::SALOME_Exception)
3712 {
3713
3714   ASSERT(myBaseImpl);
3715
3716   // Convert BLSURFPlugin::TEntryList to vector<string>
3717   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3718   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3719       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3720       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3721   }
3722
3723   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3724
3725   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3726   this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3727       theSourceVerticesEntries, theTargetVerticesEntries);
3728
3729   SMESH::TPythonDump pd;
3730   if (!theSourceVerticesEntries.empty())
3731     {
3732       pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3733       pd << listEntriesTxt.c_str();
3734       pd << ")";
3735     }
3736   else
3737     pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3738
3739   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3740 }
3741
3742
3743 //================================================================================
3744 /*!
3745  * \brief Sets the file for export resulting mesh in GMF format
3746  * \param theFileName - full name of the file (.mesh, .meshb)
3747  * 
3748  * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3749  */
3750 //================================================================================  
3751 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3752 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3753   ASSERT(myBaseImpl);
3754   MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3755   bool valueChanged/*, modeChanged*/ = false;
3756   try {
3757     valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3758 //     modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3759     if (valueChanged)// or (!valueChanged && modeChanged))
3760       this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3761   } catch (const std::exception& ex) {
3762     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3763   }
3764   if (valueChanged)// or (!valueChanged && modeChanged))
3765     SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3766   MESSAGE("IDL : SetGMFFile END ");
3767 }
3768
3769 //================================================================================
3770 /*!
3771  * \brief Gets the file name for export resulting mesh in GMF format
3772  * \retval char* - The file name
3773  * 
3774  * Returns the GMF file name
3775  */
3776 //================================================================================  
3777 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3778   ASSERT(myBaseImpl);
3779 //   MESSAGE("IDL : GetGMFFile()");
3780   return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3781 }
3782
3783 // //================================================================================
3784 // /*!
3785 //  * \brief Gets the file mode for export resulting mesh in GMF format
3786 //  * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3787 //  * 
3788 //  * Returns the GMF file mode
3789 //  */
3790 // //================================================================================  
3791 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3792 //   ASSERT(myBaseImpl);
3793 //   MESSAGE("IDL : GetGMFFileMode()");
3794 //   return this->GetImpl()->GetGMFFileMode();
3795 // }
3796
3797 //=============================================================================
3798 /*!
3799  *  BLSURFPlugin_Hypothesis_i::GetImpl
3800  *
3801  *  Get implementation
3802  */
3803 //=============================================================================
3804 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3805   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3806   return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3807 }
3808
3809 //================================================================================
3810 /*!
3811  * \brief Verify whether hypothesis supports given entity type 
3812  * \param type - dimension (see SMESH::Dimension enumeration)
3813  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3814  * 
3815  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3816  */
3817 //================================================================================  
3818 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3819   return type == SMESH::DIM_2D;
3820 }
3821
3822 //
3823 // Obsolete methods - To be removed in V7
3824 //
3825
3826 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3827   this->SetMinSize(theMinSize);
3828 }
3829 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3830   return this->GetMinSize();
3831 }
3832 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3833   this->SetMaxSize(theMaxSize);
3834 }
3835 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3836   return this->GetMaxSize();
3837 }
3838 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3839   this->SetMinSize(theMinSize);
3840 }
3841 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3842   return this->GetMinSize();
3843 }
3844 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3845   this->SetMaxSize(theMaxSize);
3846 }
3847 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3848   return this->GetMaxSize();
3849 }
3850 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3851   this->SetAngleMesh(theValue);
3852 }
3853 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3854   return this->GetAngleMesh();
3855 }
3856 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3857   this->SetAngleMesh(theValue);
3858 }
3859 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3860   return this->GetAngleMesh();
3861 }
3862 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3863   std::string theValueStr = theValue ? "1" : "0";
3864   this->SetOptionValue("respect_geometry",theValueStr.c_str());
3865 }
3866 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3867   std::string theValueStr = this->GetOptionValue("respect_geometry");
3868   if (theValueStr.empty() || theValueStr == "respect")
3869       return true;
3870   return false;
3871 }
3872 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3873   std::string theValueStr = theValue ? "1" : "0";
3874   this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3875 }
3876 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3877   std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3878   if (theValueStr == "1")
3879       return true;
3880   return false;
3881 }
3882 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3883   std::ostringstream theValueStr;
3884   theValueStr << theValue;
3885   this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3886 }
3887 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3888   std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3889   double result;
3890   theValueStr >> result;
3891   return result;
3892 }