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