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