]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
Salome HOME
23368: [CEA 1865] Possibility to define faces to mesh as a single one: transpatch...
[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::SetPreCADRemoveTinyUVEdges
1138  *
1139  *  Set true or false
1140  */
1141 //=============================================================================
1142 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges(CORBA::Boolean theValue) {
1143   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveTinyUVEdges");
1144   ASSERT(myBaseImpl);
1145   this->GetImpl()->SetPreCADRemoveTinyUVEdges(theValue);
1146   std::string theValueStr = theValue ? "True" : "False";
1147   SMESH::TPythonDump() << _this() << ".SetPreCADRemoveTinyUVEdges( " << theValueStr.c_str() << " )";
1148 }
1149
1150 //=============================================================================
1151 /*!
1152  *  BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges
1153  *
1154  *  Get true or false
1155  */
1156 //=============================================================================
1157 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges() {
1158   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveTinyUVEdges");
1159   ASSERT(myBaseImpl);
1160   return this->GetImpl()->GetPreCADRemoveTinyUVEdges();
1161 }
1162
1163 //=============================================================================
1164 /*!
1165  *  BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces
1166  *
1167  *  Set true or false
1168  */
1169 //=============================================================================
1170 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces(CORBA::Boolean theValue) {
1171   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveDuplicateCADFaces");
1172   ASSERT(myBaseImpl);
1173   this->GetImpl()->SetPreCADRemoveDuplicateCADFaces(theValue);
1174   std::string theValueStr = theValue ? "True" : "False";
1175   SMESH::TPythonDump() << _this() << ".SetPreCADRemoveDuplicateCADFaces( " << theValueStr.c_str() << " )";
1176 }
1177
1178 //=============================================================================
1179 /*!
1180  *  BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces
1181  *
1182  *  Get true or false
1183  */
1184 //=============================================================================
1185 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces() {
1186   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADRemoveDuplicateCADFaces");
1187   ASSERT(myBaseImpl);
1188   return this->GetImpl()->GetPreCADRemoveDuplicateCADFaces();
1189 }
1190
1191 //=============================================================================
1192 /*!
1193  *  BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
1194  *
1195  *  Set true or false
1196  */
1197 //=============================================================================
1198 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
1199   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
1200   ASSERT(myBaseImpl);
1201   this->GetImpl()->SetPreCADProcess3DTopology(theValue);
1202   std::string theValueStr = theValue ? "True" : "False";
1203   SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
1204 }
1205
1206 //=============================================================================
1207 /*!
1208  *  BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
1209  *
1210  *  Get true or false
1211  */
1212 //=============================================================================
1213 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
1214   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
1215   ASSERT(myBaseImpl);
1216   return this->GetImpl()->GetPreCADProcess3DTopology();
1217 }
1218
1219 //=============================================================================
1220 /*!
1221  *  BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
1222  *
1223  *  Set true or false
1224  */
1225 //=============================================================================
1226 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
1227   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
1228   ASSERT(myBaseImpl);
1229   this->GetImpl()->SetPreCADDiscardInput(theValue);
1230   std::string theValueStr = theValue ? "True" : "False";
1231   SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
1232 }
1233
1234 //=============================================================================
1235 /*!
1236  *  BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
1237  *
1238  *  Get true or false
1239  */
1240 //=============================================================================
1241 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
1242   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
1243   ASSERT(myBaseImpl);
1244   return this->GetImpl()->GetPreCADDiscardInput();
1245 }
1246
1247
1248 //=============================================================================
1249
1250 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
1251   throw (SALOME::SALOME_Exception) {
1252   ASSERT(myBaseImpl);
1253   try {
1254     std::string name( optionName );
1255     if ( !optionValue || !optionValue[0] )
1256       UnsetOption( optionName );
1257
1258     // basic options (visible in Advanced table)
1259
1260     else if ( name == "enforce_cad_edge_sizes" )
1261       SetEnforceCadEdgesSize( GetImpl()->ToBool( optionValue ));
1262
1263     else if ( name == "jacobian_rectification_respect_geometry" )
1264       SetJacobianRectificationRespectGeometry( GetImpl()->ToBool( optionValue ));
1265
1266     else if ( name == "max_number_of_points_per_patch" )
1267       SetMaxNumberOfPointsPerPatch( GetImpl()->ToInt( optionValue ));
1268
1269     else if ( name == "rectify_jacobian" )
1270       SetJacobianRectification( GetImpl()->ToBool( optionValue ));
1271
1272     else if ( name == "respect_geometry" )
1273       SetRespectGeometry( GetImpl()->ToBool( optionValue ));
1274
1275     else if ( name == "tiny_edge_avoid_surface_intersections" )
1276       SetTinyEdgesAvoidSurfaceIntersections( GetImpl()->ToBool( optionValue ));
1277
1278     else if ( name == "closed_geometry" )
1279       SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1280
1281     else if ( name == "debug" )
1282       SetDebug( GetImpl()->ToBool( optionValue ));
1283
1284     else if ( name == "discard_input_topology" )
1285       SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1286
1287     else if ( name == "merge_edges" )
1288       SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1289
1290     else if ( name == "periodic_tolerance" )
1291       SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1292
1293     else if ( name == "remove_duplicate_cad_faces" )
1294       SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1295
1296     else if ( name == "required_entities" )
1297       SetRequiredEntities( optionValue );
1298
1299     else if ( name == "sewing_tolerance" )
1300       SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1301
1302     else if ( name == "tags" )
1303       SetTags( optionValue );
1304
1305     // other basic options with specific methods
1306
1307     else if ( name == "correct_surface_intersections" )
1308       SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1309
1310     else if ( name == "optimise_tiny_edges" )
1311       SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1312
1313     else if ( name == "surface_intersections_processing_max_cost" )
1314       SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1315
1316     else if ( name == "volume_gradation" )
1317       SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1318
1319     else if ( name == "tiny_edge_optimisation_length" )
1320       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1321
1322     // advanced options (for backward compatibility)
1323
1324     else if ( name == "create_tag_on_collision" ||
1325               name == "tiny_edge_respect_geometry" )
1326       AddOption( optionName, optionValue );
1327
1328     else {
1329       bool valueChanged;
1330       valueChanged = ( this->GetImpl()->GetOptionValue( name ) != optionValue &&
1331                        this->GetImpl()->GetOptionValue( name, &valueChanged ) != optionValue );
1332       if ( valueChanged )
1333       {
1334         this->GetImpl()->SetOptionValue(optionName, optionValue);
1335         SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
1336       }
1337     }
1338   } catch (const std::invalid_argument& ex) {
1339     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1340   } catch (SALOME_Exception& ex) {
1341     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1342   }
1343 }
1344
1345 //=============================================================================
1346
1347 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
1348   throw (SALOME::SALOME_Exception) {
1349   ASSERT(myBaseImpl);
1350   bool valueChanged = false;
1351   try {
1352     std::string name( optionName );
1353     if ( !optionValue || !optionValue[0] )
1354       UnsetOption( optionName );
1355
1356     else if ( name == "closed_geometry" )
1357       SetClosedGeometry( GetImpl()->ToBool( optionValue ));
1358
1359     else if ( name == "debug" )
1360       SetDebug( GetImpl()->ToBool( optionValue ));
1361
1362     else if ( name == "discard_input_topology" )
1363       SetPreCADDiscardInput( GetImpl()->ToBool( optionValue ));
1364
1365     else if ( name == "merge_edges" )
1366       SetPreCADMergeEdges( GetImpl()->ToBool( optionValue ));
1367
1368     else if ( name == "periodic_tolerance" )
1369       SetPeriodicTolerance( GetImpl()->ToDbl( optionValue ));
1370
1371     else if ( name == "remove_duplicate_cad_faces" )
1372       SetPreCADRemoveDuplicateCADFaces( GetImpl()->ToBool( optionValue ));
1373
1374     else if ( name == "required_entities" )
1375       SetRequiredEntities( optionValue );
1376
1377     else if ( name == "sewing_tolerance" )
1378       SetSewingTolerance( GetImpl()->ToDbl( optionValue ));
1379
1380     else if ( name == "tags" )
1381       SetTags( optionValue );
1382
1383     // other basic options with specific methods
1384
1385     else if ( name == "correct_surface_intersections" )
1386       SetCorrectSurfaceIntersection( GetImpl()->ToBool( optionValue ));
1387
1388     else if ( name == "optimise_tiny_edges" )
1389       SetOptimiseTinyEdges( GetImpl()->ToBool( optionValue ));
1390
1391     else if ( name == "surface_intersections_processing_max_cost" )
1392       SetCorrectSurfaceIntersectionMaxCost( GetImpl()->ToDbl( optionValue ));
1393
1394     else if ( name == "volume_gradation" )
1395       SetVolumeGradation( GetImpl()->ToDbl( optionValue ));
1396
1397     else if ( name == "tiny_edge_optimisation_length" )
1398       SetTinyEdgeOptimisationLength( GetImpl()->ToDbl( optionValue ));
1399
1400     else if ( name == "remove_tiny_uv_edges" )
1401       SetPreCADRemoveTinyUVEdges( GetImpl()->ToBool( optionValue ));
1402
1403     else if ( name == "process_3d_topology" )
1404       SetPreCADProcess3DTopology( GetImpl()->ToBool( optionValue ));
1405
1406     // advanced options (for backward compatibility)
1407
1408     else if ( name == "create_tag_on_collision" ||
1409               name == "tiny_edge_respect_geometry" ||
1410               name == "remove_tiny_edges" ||
1411               name == "tiny_edge_length")
1412       AddPreCADOption( optionName, optionValue );
1413
1414     else {
1415       valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
1416       if (valueChanged)
1417         this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
1418     }
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   if (valueChanged)
1425     SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
1426 }
1427
1428 //=============================================================================
1429
1430 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1431   ASSERT(myBaseImpl);
1432   try {
1433     bool isDefault;
1434     return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName,&isDefault).c_str());
1435   } catch (const std::invalid_argument& ex) {
1436     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1437   } catch (SALOME_Exception& ex) {
1438     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1439   }
1440   return 0;
1441 }
1442
1443 //=============================================================================
1444
1445 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
1446   ASSERT(myBaseImpl);
1447   try {
1448     bool isDefault;
1449     return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName,&isDefault).c_str());
1450   } catch (const std::invalid_argument& ex) {
1451     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1452   } catch (SALOME_Exception& ex) {
1453     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1454   }
1455   return 0;
1456 }
1457
1458 //=============================================================================
1459
1460 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
1461   ASSERT(myBaseImpl);
1462   if ( !GetImpl()->GetOptionValue( optionName ).empty() )
1463   {
1464     this->GetImpl()->ClearOption(optionName);
1465     SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
1466   }
1467 }
1468
1469 //=============================================================================
1470
1471 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
1472   ASSERT(myBaseImpl);
1473   if ( !GetImpl()->GetPreCADOptionValue( optionName ).empty() )
1474   {
1475     this->GetImpl()->ClearPreCADOption(optionName);
1476     SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
1477   }
1478 }
1479
1480 //=============================================================================
1481
1482 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
1483   ASSERT(myBaseImpl);
1484   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1485
1486   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
1487   result->length(opts.size());
1488   int i=0;
1489
1490   bool isDefault;
1491   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1492   for (; opIt != opts.end(); ++opIt, ++i) {
1493     string name_value_type = opIt->first;
1494     if (!opIt->second.empty()) {
1495       name_value_type += ":";
1496       name_value_type += GetImpl()->GetOptionValue( opIt->first, &isDefault );
1497       name_value_type += isDefault ? ":0" : ":1";
1498     }
1499     result[i] = CORBA::string_dup(name_value_type.c_str());
1500   }
1501
1502   return result._retn();
1503 }
1504
1505 //=============================================================================
1506
1507 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
1508   ASSERT(myBaseImpl);
1509   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1510
1511   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
1512   result->length(opts.size());
1513   int i=0;
1514
1515   bool isDefault;
1516   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
1517   for (; opIt != opts.end(); ++opIt, ++i) {
1518     string name_value_type = opIt->first;
1519     if (!opIt->second.empty()) {
1520       name_value_type += ":";
1521       name_value_type += GetImpl()->GetPreCADOptionValue( opIt->first, &isDefault );
1522       name_value_type += isDefault ? ":0" : ":1";
1523     }
1524     result[i] = CORBA::string_dup(name_value_type.c_str());
1525   }
1526   return result._retn();
1527 }
1528
1529 //=============================================================================
1530
1531 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAdvancedOptionValues()
1532 {
1533   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1534
1535   const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
1536   result->length(custom_opts.size());
1537   int i=0;
1538
1539   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = custom_opts.begin();
1540   for (; opIt != custom_opts.end(); ++opIt, ++i) {
1541     string name_value_type = opIt->first;
1542     if (!opIt->second.empty()) {
1543       name_value_type += ":";
1544       name_value_type += opIt->second;
1545       name_value_type += ":1"; // user defined
1546     }
1547     result[i] = CORBA::string_dup(name_value_type.c_str());
1548   }
1549   return result._retn();
1550 }
1551
1552 //=============================================================================
1553
1554 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
1555     throw (SALOME::SALOME_Exception) {
1556   ASSERT(myBaseImpl);
1557   for (CORBA::ULong i = 0; i < options.length(); ++i) {
1558     string name_value_type = options[i].in();
1559     if(name_value_type.empty())
1560       continue;
1561     size_t colonPos = name_value_type.find(':');
1562     string name, value;
1563     if (colonPos == string::npos) // ':' not found
1564       name = name_value_type;
1565     else {
1566       name = name_value_type.substr(0, colonPos);
1567       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1568         string value_type = name_value_type.substr(colonPos + 1);
1569         colonPos = value_type.find(':');
1570         value = value_type.substr(0, colonPos);
1571         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1572           if ( value_type.substr(colonPos + 1) == "0" ) // is default
1573             value.clear();
1574       }
1575     }
1576     SetOptionValue(name.c_str(), value.c_str());
1577   }
1578 }
1579
1580 //=============================================================================
1581
1582 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
1583     throw (SALOME::SALOME_Exception) {
1584   ASSERT(myBaseImpl);
1585   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1586     string name_value_type = options[i].in();
1587     if(name_value_type.empty())
1588       continue;
1589     size_t colonPos = name_value_type.find(':');
1590     string name, value;
1591     if (colonPos == string::npos) // ':' not found
1592       name = name_value_type;
1593     else {
1594       name = name_value_type.substr(0, colonPos);
1595       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1596         string value_type = name_value_type.substr(colonPos + 1);
1597         colonPos = value_type.find(':');
1598         value = value_type.substr(0, colonPos);
1599         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
1600           if ( value_type.substr(colonPos + 1) == "0" ) // is default
1601             value.clear();
1602       }
1603     }
1604     SetPreCADOptionValue(name.c_str(), value.c_str());
1605   }
1606 }
1607
1608 //=============================================================================
1609
1610 void BLSURFPlugin_Hypothesis_i::SetAdvancedOptionValues(const BLSURFPlugin::string_array& options)
1611 {
1612   SMESH::TPythonDump dump;
1613
1614   string optionsAndValues;
1615   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
1616     string name_value_type = options[i].in();
1617     if(name_value_type.empty())
1618       continue;
1619     size_t colonPos = name_value_type.find(':');
1620     string name, value;
1621     if (colonPos == string::npos) // ':' not found
1622       name = name_value_type;
1623     else {
1624       name = name_value_type.substr(0, colonPos);
1625       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
1626         string value_type = name_value_type.substr(colonPos + 1);
1627         colonPos = value_type.find(':');
1628         value = value_type.substr(0, colonPos);
1629       }
1630     }
1631     AddOption(name.c_str(), value.c_str());
1632
1633     optionsAndValues += name + " " + value + " ";
1634   }
1635
1636   if ( !optionsAndValues.empty() )
1637     dump << _this() << ".SetAdvancedOptions( '" << optionsAndValues.c_str() << "' )";
1638 }
1639
1640 //=============================================================================
1641
1642 void BLSURFPlugin_Hypothesis_i::SetAdvancedOption(const char* optionsAndValues)
1643   throw (SALOME::SALOME_Exception)
1644 {
1645   if ( !optionsAndValues ) return;
1646
1647   SMESH::TPythonDump dump;
1648
1649   std::istringstream strm( optionsAndValues );
1650   std::istream_iterator<std::string> sIt( strm ), sEnd;
1651   while ( sIt != sEnd )
1652   {
1653     std::string option = *sIt;
1654     if ( ++sIt != sEnd )
1655     {
1656       std::string value = *sIt;
1657       ++sIt;
1658       AddOption( option.c_str(), value.c_str() );
1659     }
1660     else
1661     {
1662       THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1663     }
1664   }
1665   dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1666 }
1667
1668 //=============================================================================
1669
1670 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1671 {
1672   ASSERT(myBaseImpl);
1673   bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1674   if (valueChanged) {
1675     this->GetImpl()->AddOption(optionName, optionValue);
1676     SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1677   }
1678 }
1679
1680 //=============================================================================
1681
1682 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1683 {
1684   ASSERT(myBaseImpl);
1685   bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1686   if (valueChanged) {
1687     this->GetImpl()->AddPreCADOption(optionName, optionValue);
1688     SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1689   }
1690 }
1691
1692 //=============================================================================
1693
1694 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1695 {
1696   ASSERT(myBaseImpl);
1697   return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1698 }
1699
1700 //=============================================================================
1701
1702 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1703 {
1704   ASSERT(myBaseImpl);
1705   return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1706 }
1707
1708 //=============================================================================
1709
1710 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1711     throw (SALOME::SALOME_Exception) {
1712   ASSERT(myBaseImpl);
1713   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1714   if ( !entry || !entry[0] )
1715     THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1716   bool valueChanged = false;
1717   try {
1718     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1719     if (valueChanged)
1720       this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1721   } catch (const std::invalid_argument& ex) {
1722     SALOME::ExceptionStruct ExDescription;
1723     ExDescription.text = ex.what();
1724     ExDescription.type = SALOME::BAD_PARAM;
1725     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1726     ExDescription.lineNumber = 0;
1727     throw SALOME::SALOME_Exception(ExDescription);
1728   } catch (SALOME_Exception& ex) {
1729     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1730   }
1731   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1732   if (valueChanged)
1733     SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1734 }
1735
1736 //=============================================================================
1737
1738 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1739   throw (SALOME::SALOME_Exception) {
1740   ASSERT(myBaseImpl);
1741   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1742   bool valueChanged = false;
1743   std::ostringstream sizeMapFunction;
1744   switch (shapeType) {
1745   case GEOM::FACE:   sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1746   case GEOM::EDGE:   sizeMapFunction << "def f(t): return " << sizeMap ; break;
1747   case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1748   default:;
1749   }
1750   try {
1751     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1752     if (valueChanged)
1753       this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1754   } catch (const std::invalid_argument& ex) {
1755     SALOME::ExceptionStruct ExDescription;
1756     ExDescription.text = ex.what();
1757     ExDescription.type = SALOME::BAD_PARAM;
1758     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1759     ExDescription.lineNumber = 0;
1760     throw SALOME::SALOME_Exception(ExDescription);
1761   } catch (SALOME_Exception& ex) {
1762     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1763   }
1764   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1765   if (valueChanged)
1766     SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1767 }
1768
1769 //=============================================================================
1770
1771 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1772     throw (SALOME::SALOME_Exception) {
1773   ASSERT(myBaseImpl);
1774   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1775   bool valueChanged = false;
1776   try {
1777     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1778     if ( valueChanged ) {
1779       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1780       if (!boost::regex_match(string(attractor), re))
1781         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1782       this->GetImpl()->SetAttractorEntry(entry, attractor);
1783     }
1784   } catch (const std::invalid_argument& ex) {
1785     SALOME::ExceptionStruct ExDescription;
1786     ExDescription.text = ex.what();
1787     ExDescription.type = SALOME::BAD_PARAM;
1788     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1789     ExDescription.lineNumber = 0;
1790     throw SALOME::SALOME_Exception(ExDescription);
1791   } catch (SALOME_Exception& ex) {
1792     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1793   }
1794   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1795   if (valueChanged)
1796     SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1797 }
1798
1799 //=============================================================================
1800
1801 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
1802   throw (SALOME::SALOME_Exception)
1803 {
1804   ASSERT(myBaseImpl);
1805   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1806   //bool valueChanged = false;
1807   try {
1808     this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1809   }
1810   catch (const std::invalid_argument& ex) {
1811     SALOME::ExceptionStruct ExDescription;
1812     ExDescription.text = ex.what();
1813     ExDescription.type = SALOME::BAD_PARAM;
1814     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1815     ExDescription.lineNumber = 0;
1816     throw SALOME::SALOME_Exception(ExDescription);
1817   } catch (SALOME_Exception& ex) {
1818     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1819   }
1820   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1821   //if ( valueChanged )
1822   SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1823                        << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1824 }
1825
1826 //=============================================================================
1827
1828 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1829   ASSERT(myBaseImpl);
1830   try {
1831     return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1832   } catch (const std::invalid_argument& ex) {
1833     SALOME::ExceptionStruct ExDescription;
1834     ExDescription.text = ex.what();
1835     ExDescription.type = SALOME::BAD_PARAM;
1836     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1837     ExDescription.lineNumber = 0;
1838     throw SALOME::SALOME_Exception(ExDescription);
1839   } catch (SALOME_Exception& ex) {
1840     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1841   }
1842   return 0;
1843 }
1844
1845 //=============================================================================
1846
1847 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1848   ASSERT(myBaseImpl);
1849   try {
1850     return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1851   } catch (const std::invalid_argument& ex) {
1852     SALOME::ExceptionStruct ExDescription;
1853     ExDescription.text = ex.what();
1854     ExDescription.type = SALOME::BAD_PARAM;
1855     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1856     ExDescription.lineNumber = 0;
1857     throw SALOME::SALOME_Exception(ExDescription);
1858   } catch (SALOME_Exception& ex) {
1859     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1860   }
1861   return 0;
1862 }
1863
1864 // //=============================================================================
1865 // 
1866 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1867 // // A finir pour le dump
1868 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1869 //   throw (SALOME::SALOME_Exception)
1870 // {
1871 //   ASSERT(myBaseImpl);
1872 //   try {
1873 //     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1874 //   }
1875 //   catch (const std::invalid_argument& ex) {
1876 //     SALOME::ExceptionStruct ExDescription;
1877 //     ExDescription.text = ex.what();
1878 //     ExDescription.type = SALOME::BAD_PARAM;
1879 //     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1880 //     ExDescription.lineNumber = 0;
1881 //     throw SALOME::SALOME_Exception(ExDescription);
1882 //   }
1883 //   catch (SALOME_Exception& ex) {
1884 //     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1885 //   }
1886 //   return 0;
1887 // }
1888
1889 //=============================================================================
1890
1891 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1892   ASSERT(myBaseImpl);
1893   this->GetImpl()->ClearEntry(entry);
1894   //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1895 }
1896
1897 //=============================================================================
1898
1899 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1900   ASSERT(myBaseImpl);
1901   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1902
1903   const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1904   result->length(sizeMaps.size());
1905
1906   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1907   for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1908     string entry_sizemap = smIt->first;
1909     if (!smIt->second.empty()) {
1910       entry_sizemap += "|";
1911       entry_sizemap += smIt->second;
1912     }
1913     result[i] = CORBA::string_dup(entry_sizemap.c_str());
1914   }
1915   return result._retn();
1916 }
1917
1918 //=============================================================================
1919
1920 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1921   ASSERT(myBaseImpl);
1922   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1923
1924   const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1925   result->length(attractors.size());
1926
1927   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1928   for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1929     string entry_attractor = atIt->first;
1930     if (!atIt->second.empty()) {
1931       entry_attractor += "|";
1932       entry_attractor += atIt->second;
1933     }
1934     result[i] = CORBA::string_dup(entry_attractor.c_str());
1935   }
1936   return result._retn();
1937 }
1938
1939 //=============================================================================
1940
1941 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1942 {
1943   ASSERT(myBaseImpl);
1944   BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1945
1946   const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1947   result->length( attractors.size() );
1948
1949   ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1950   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1951     string faceEntry = atIt->first;
1952     string attEntry;
1953     double startSize, endSize, infDist, constDist;
1954     if ( !atIt->second->Empty() ) {
1955       attEntry = atIt->second->GetAttractorEntry();
1956       MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1957       std::vector<double> params = atIt->second->GetParameters();
1958       startSize = params[0];
1959       endSize = params[1];
1960       infDist = params[2];
1961       constDist = params[3];
1962     }
1963     result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1964     result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1965     result[i].startSize = startSize;
1966     result[i].endSize = endSize;
1967     result[i].infDist = infDist;
1968     result[i].constDist = constDist;
1969     MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1970     MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1971   }
1972   return result._retn();
1973 }
1974
1975 //=============================================================================
1976
1977 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1978     throw (SALOME::SALOME_Exception) {
1979   ASSERT(myBaseImpl);
1980   for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1981     string entry_sizemap = sizeMaps[i].in();
1982     size_t colonPos = entry_sizemap.find('|');
1983     string entry, sizemap;
1984     if (colonPos == string::npos) // '|' separator not found
1985       entry = entry_sizemap;
1986     else {
1987       entry = entry_sizemap.substr(0, colonPos);
1988       if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1989         sizemap = entry_sizemap.substr(colonPos + 1);
1990     }
1991     this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1992   }
1993 }
1994
1995 //=============================================================================
1996
1997 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1998   ASSERT(myBaseImpl);
1999   this->GetImpl()->ClearSizeMaps();
2000 }
2001
2002 //=============================================================================
2003
2004 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2005   throw (SALOME::SALOME_Exception)
2006 {
2007   ASSERT(myBaseImpl);
2008   string entry;
2009   entry = GeomObj->GetStudyEntry();
2010   MESSAGE("IDL : GetName : " << GeomObj->GetName());
2011   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
2012   SetSizeMapEntry(entry.c_str(), sizeMap);
2013 }
2014
2015 //=============================================================================
2016
2017 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2018   ASSERT(myBaseImpl);
2019   string entry = GeomObj->GetStudyEntry();
2020   GEOM::shape_type shapeType = GeomObj->GetShapeType();
2021   if (shapeType == GEOM::COMPOUND)
2022     shapeType = GeomObj->GetMaxShapeType();
2023   MESSAGE("IDL : GetName : " << GeomObj->GetName());
2024   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
2025   SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2026 }
2027
2028 //=============================================================================
2029 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2030   ASSERT(myBaseImpl);
2031   string entry;
2032   entry = GeomObj->GetStudyEntry();
2033   MESSAGE("IDL : GetName : " << GeomObj->GetName());
2034   MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
2035   UnsetEntry(entry.c_str());
2036   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2037 }
2038
2039 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2040   ASSERT(myBaseImpl);
2041   string entry;
2042   entry = GeomObj->GetStudyEntry();
2043   MESSAGE("IDL : GetName : " << GeomObj->GetName());
2044   MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
2045   SetAttractorEntry(entry.c_str(), attractor);
2046 }
2047
2048 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2049   ASSERT(myBaseImpl);
2050   string entry;
2051   entry = GeomObj->GetStudyEntry();
2052   MESSAGE("IDL : GetName : " << GeomObj->GetName());
2053   MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
2054   UnsetEntry(entry.c_str());
2055   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2056 }
2057
2058 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)
2059 {
2060   ASSERT(myBaseImpl);
2061   string theFaceEntry;
2062   string theAttEntry;
2063   theFaceEntry = theFace->GetStudyEntry();
2064   theAttEntry  = theAttractor->GetStudyEntry();
2065   
2066   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2067   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2068   string aName;
2069   
2070   if (theFaceEntry.empty()) {
2071     aName = "Face_";
2072     aName += theFace->GetEntry();
2073     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2074     if (!theSFace->_is_nil())
2075       theFaceEntry = theSFace->GetID();
2076   }
2077   if (theFaceEntry.empty())
2078     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2079   
2080   if (theAttEntry.empty()) {
2081     if (theAttractor->GetShapeType() == GEOM::VERTEX)
2082       aName = "Vertex_";
2083     if (theAttractor->GetShapeType() == GEOM::EDGE)
2084       aName = "Edge_";
2085     if (theAttractor->GetShapeType() == GEOM::WIRE)
2086       aName = "Wire_";
2087     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2088       aName = "Compound_";
2089     aName += theAttractor->GetEntry();
2090     SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
2091     if (!theSAtt->_is_nil())
2092       theAttEntry = theSAtt->GetID();
2093   }
2094   if (theAttEntry.empty())
2095     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2096   
2097   TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2098   TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2099   MESSAGE("IDL : GetName : " << theFace->GetName());
2100   MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
2101   SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2102 }
2103
2104 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2105                                                    GEOM::GEOM_Object_ptr theAttractor)
2106 {
2107   ASSERT(myBaseImpl);
2108   CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2109   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2110   
2111   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2112   // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2113   // string aName;
2114   
2115   // if (theFaceEntry.empty()) {
2116   //   aName = "Face_";
2117   //   aName += theFace->GetEntry();
2118   //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2119   //   if (!theSFace->_is_nil())
2120   //     theFaceEntry = theSFace->GetID();
2121   // }
2122   if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2123        !theAttrEntry.in() || !theAttrEntry.in()[0] )
2124     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2125   
2126   MESSAGE("IDL : GetName : " << theFace->GetName());
2127   MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
2128   GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2129   SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2130                        << theFace << ", " << theAttractor << " )";
2131 }
2132
2133 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2134                                                     const char* attractorEntry)
2135 {
2136   GetImpl()->ClearEntry( faceEntry, attractorEntry );
2137   SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2138                        << faceEntry << "', '" << attractorEntry << "' )";
2139 }
2140
2141
2142 /*
2143  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2144  {}
2145
2146  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2147  {}
2148
2149  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
2150  {}
2151
2152  char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
2153  {}
2154
2155  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2156  {
2157  ASSERT(myBaseImpl);
2158  this->GetImpl()->UnsetCustomSizeMap(entry);
2159  SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2160  }
2161
2162
2163  BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2164  {}
2165
2166  */
2167
2168 // ///////////////////////
2169 // // ENFORCED VERTICES //
2170 // ///////////////////////
2171
2172
2173 /**
2174  * Returns the list of enforced vertices for a given Face entry
2175  * @return A map of Face entry / List of enforced vertices
2176  *
2177  */
2178 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2179   MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
2180   ASSERT(myBaseImpl);
2181
2182   BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2183
2184   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2185       this->GetImpl()->_GetAllEnforcedVerticesByFace();
2186   resultMap->length(faceEntryEnfVertexListMap.size());
2187   MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
2188
2189   ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2190   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2191   for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2192     BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2193         new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2194     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2195     MESSAGE("Face Entry: " << mapElement->faceEntry);
2196
2197     _enfVertexList = it_entry->second;
2198     BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2199     enfVertexList->length(_enfVertexList.size());
2200     MESSAGE("Number of enf vertex: " << enfVertexList->length());
2201
2202     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2203     ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2204     for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2205       currentEnfVertex = (*it_enfVertex);
2206
2207       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2208
2209       // Name
2210       enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2211
2212       // Geom entry
2213       enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2214
2215       // Coords
2216       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2217       coords->length(currentEnfVertex->coords.size());
2218       for (CORBA::ULong i=0;i<coords->length();i++)
2219         coords[i] = currentEnfVertex->coords[i];
2220       enfVertex->coords = coords;
2221
2222       // Group name
2223       enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2224       
2225       // Face entry list
2226       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2227       faceEntryList->length(currentEnfVertex->faceEntries.size());
2228       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2229       for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2230         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2231       enfVertex->faceEntries = faceEntryList;
2232
2233       ostringstream msg;
2234       msg << "Enforced vertex: \n"
2235           << "Name: " << enfVertex->name << "\n";
2236       if (coords->length())
2237           msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2238       msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2239           << "Group Name: " << enfVertex->grpName;
2240       MESSAGE(msg.str());
2241
2242       enfVertexList[j] = enfVertex;
2243     }
2244     mapElement->enfVertexList = enfVertexList;
2245
2246     resultMap[i] = mapElement;
2247
2248   }
2249   return resultMap._retn();
2250 }
2251
2252 /**
2253  * Returns the list of all enforced vertices
2254  * @return a list of enforced vertices
2255  *
2256  */
2257 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2258   MESSAGE("IDL: GetAllEnforcedVertices()");
2259   ASSERT(myBaseImpl);
2260   BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2261   const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2262   resultMap->length(enfVertexList.size());
2263   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2264
2265   ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2266   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2267   for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2268     MESSAGE("Enforced Vertex #" << i);
2269     currentEnfVertex = (*evlIt);
2270     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2271     // Name
2272     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2273     // Geom entry
2274     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2275     // Coords
2276     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2277     coords->length(currentEnfVertex->coords.size());
2278     for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2279       coords[ind] = currentEnfVertex->coords[ind];
2280     enfVertex->coords = coords;
2281     // Group name
2282     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2283     // Face entry list
2284     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2285     faceEntryList->length(currentEnfVertex->faceEntries.size());
2286     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2287     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2288       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2289     enfVertex->faceEntries = faceEntryList;
2290
2291     ostringstream msg;
2292     msg << "Enforced vertex: \n"
2293         << "Name: " << enfVertex->name << "\n";
2294     if (coords->length())
2295         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2296     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2297         << "Group Name: " << enfVertex->grpName;
2298     MESSAGE(msg.str());
2299
2300     resultMap[i] = enfVertex;
2301   }
2302   return resultMap._retn();
2303
2304 }
2305
2306 /**
2307  * Returns the list of enforced vertices coords for a given Face entry.
2308  * They are the coords of the "manual" enforced vertices.
2309  * @return A map of Face entry / List of enforced vertices coords
2310  *
2311  */
2312 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2313   MESSAGE("IDL: GetAllCoordsByFace()");
2314   ASSERT(myBaseImpl);
2315
2316   BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2317
2318   const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2319   resultMap->length(entryCoordsListMap.size());
2320   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2321
2322   ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2323   ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2324   for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2325     BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2326     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2327     MESSAGE("Face Entry: " << mapElement->faceEntry);
2328
2329     _coordsList = it_entry->second;
2330     BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2331     coordsList->length(_coordsList.size());
2332     MESSAGE("Number of coords: " << coordsList->length());
2333
2334     ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2335     for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2336       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2337       coords->length((*it_coords).size());
2338       for (CORBA::ULong i=0;i<coords->length();i++)
2339         coords[i] = (*it_coords)[i];
2340       coordsList[j] = coords;
2341       MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
2342     }
2343     mapElement->coordsList = coordsList;
2344
2345     resultMap[i] = mapElement;
2346
2347   }
2348   return resultMap._retn();
2349 }
2350
2351 /**
2352  * Returns a map of enforced vertices coords / enforced vertex.
2353  * They are the coords of the "manual" enforced vertices.
2354  */
2355 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2356   MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
2357   ASSERT(myBaseImpl);
2358
2359   BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2360   const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2361       this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2362   resultMap->length(coordsEnfVertexMap.size());
2363   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2364
2365   ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2366   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2367   for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2368     MESSAGE("Enforced Vertex #" << i);
2369     currentEnfVertex = (it_coords->second);
2370     BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2371     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2372     coords->length(it_coords->first.size());
2373     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2374       coords[ind] = it_coords->first[ind];
2375     mapElement->coords = coords;
2376     MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
2377
2378     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2379     // Name
2380     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2381     // Geom entry
2382     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2383     // Coords
2384     BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2385     coords2->length(currentEnfVertex->coords.size());
2386     for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2387       coords2[ind] = currentEnfVertex->coords[ind];
2388     enfVertex->coords = coords2;
2389     // Group name
2390     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2391     // Face entry list
2392     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2393     faceEntryList->length(currentEnfVertex->faceEntries.size());
2394     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2395     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2396       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2397     enfVertex->faceEntries = faceEntryList;
2398       
2399     mapElement->enfVertex = enfVertex;
2400     ostringstream msg;
2401     msg << "Enforced vertex: \n"
2402         << "Name: " << enfVertex->name << "\n";
2403     if (coords->length())
2404         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2405     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2406         << "Group Name: " << enfVertex->grpName;
2407     MESSAGE(msg.str());
2408
2409     resultMap[i] = mapElement;
2410   }
2411   return resultMap._retn();
2412 }
2413
2414 /**
2415  * Returns the list of enforced vertices entries for a given Face entry.
2416  * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2417  * @return A map of Face entry / List of enforced vertices geom entries
2418  *
2419  */
2420 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2421   MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
2422   ASSERT(myBaseImpl);
2423
2424   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2425
2426   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2427       this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2428   resultMap->length(entryEnfVertexEntryListMap.size());
2429   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2430
2431   ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2432   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2433       entryEnfVertexEntryListMap.begin();
2434   for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2435     BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2436         new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2437     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2438     MESSAGE("Face Entry: " << mapElement->faceEntry);
2439
2440     _enfVertexEntryList = it_entry->second;
2441     BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2442     enfVertexEntryList->length(_enfVertexEntryList.size());
2443     MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
2444
2445     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2446     for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2447       enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2448       MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
2449     }
2450     mapElement->enfVertexEntryList = enfVertexEntryList;
2451
2452     resultMap[i] = mapElement;
2453
2454   }
2455   return resultMap._retn();
2456 }
2457
2458 /**
2459  * Returns a map of enforced vertices geom entry / enforced vertex.
2460  * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2461  */
2462 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2463   MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
2464   ASSERT(myBaseImpl);
2465
2466   BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2467   const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2468       this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2469   resultMap->length(enfVertexEntryEnfVertexMap.size());
2470   MESSAGE("Enforced Vertex map size is " << resultMap->length());
2471
2472   ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2473   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2474   for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2475     MESSAGE("Enforced Vertex #" << i);
2476     currentEnfVertex = it_enfVertexEntry->second;
2477     BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2478     mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2479     MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
2480
2481     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2482     // Name
2483     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2484     // Geom entry
2485     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2486     // Coords
2487     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2488     coords->length(currentEnfVertex->coords.size());
2489     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2490       coords[ind] = currentEnfVertex->coords[ind];
2491     enfVertex->coords = coords;
2492     // Group name
2493     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2494     // Face entry list
2495     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2496     faceEntryList->length(currentEnfVertex->faceEntries.size());
2497     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2498     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2499       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2500     enfVertex->faceEntries = faceEntryList;
2501
2502     ostringstream msg;
2503     msg << "Enforced vertex: \n"
2504         << "Name: " << enfVertex->name << "\n";
2505     if (coords->length())
2506         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2507     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2508         << "Group Name: " << enfVertex->grpName;
2509     MESSAGE(msg.str());
2510
2511     mapElement->enfVertex = enfVertex;
2512     resultMap[i] = mapElement;
2513   }
2514   return resultMap._retn();
2515 }
2516
2517 /**
2518  * Erase all enforced vertices
2519  */
2520 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2521   ASSERT(myBaseImpl);
2522   this->GetImpl()->ClearAllEnforcedVertices();
2523   SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2524 }
2525
2526 /*!
2527  * Set/get/unset an enforced vertex on face - OBSOLETE
2528  */
2529 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2530     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2531   ASSERT(myBaseImpl);
2532
2533   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2534     MESSAGE("theFace shape type is not FACE or COMPOUND");
2535     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2536   }
2537
2538   string theFaceEntry = theFace->GetStudyEntry();
2539   
2540   if (theFaceEntry.empty()) {
2541     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2542     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2543     string aName;
2544     if (theFace->GetShapeType() == GEOM::FACE)
2545       aName = "Face_";
2546     if (theFace->GetShapeType() == GEOM::COMPOUND)
2547       aName = "Compound_";
2548     aName += theFace->GetEntry();
2549     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2550     if (!theSFace->_is_nil())
2551       theFaceEntry = theSFace->GetID();
2552   }
2553   if (theFaceEntry.empty())
2554     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2555   MESSAGE("IDL : GetName : " << theFace->GetName());
2556   MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2557   try {
2558     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2559   } catch (SALOME_Exception& ex) {
2560     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2561   }
2562 }
2563
2564 /*!
2565  * Set/get/unset an enforced vertex with name on face
2566  */
2567 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2568     CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2569   ASSERT(myBaseImpl);
2570
2571   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2572     MESSAGE("theFace shape type is not FACE or COMPOUND");
2573     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2574   }
2575
2576   string theFaceEntry = theFace->GetStudyEntry();
2577   
2578   if (theFaceEntry.empty()) {
2579     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2580     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2581     string aName;
2582     if (theFace->GetShapeType() == GEOM::FACE)
2583       aName = "Face_";
2584     if (theFace->GetShapeType() == GEOM::COMPOUND)
2585       aName = "Compound_";
2586     aName += theFace->GetEntry();
2587     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2588     if (!theSFace->_is_nil())
2589       theFaceEntry = theSFace->GetID();
2590   }
2591   if (theFaceEntry.empty())
2592     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2593   
2594   MESSAGE("IDL : GetName : " << theFace->GetName());
2595   MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
2596   try {
2597     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2598   } catch (SALOME_Exception& ex) {
2599     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2600   }
2601 }
2602
2603 /*!
2604  * Set/get/unset an enforced vertex with geom object on face
2605  */
2606 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2607     throw (SALOME::SALOME_Exception) {
2608   ASSERT(myBaseImpl);
2609
2610   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2611     MESSAGE("theFace shape type is not FACE or COMPOUND");
2612     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2613   }
2614
2615   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2616     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2617     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2618   }
2619
2620   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2621   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2622   //  if (CORBA::is_nil(measureOp))
2623   //    return false;
2624   //
2625   //  CORBA::Double x, y, z;
2626   //  x = y = z = 0.;
2627   //  measureOp->PointCoordinates(theVertex, x, y, z);
2628
2629   string theFaceEntry = theFace->GetStudyEntry();
2630   string theVertexEntry = theVertex->GetStudyEntry();
2631   
2632   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2633   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2634   string aName;
2635   
2636   if (theFaceEntry.empty()) {
2637     if (theFace->GetShapeType() == GEOM::FACE)
2638       aName = "Face_";
2639     if (theFace->GetShapeType() == GEOM::COMPOUND)
2640       aName = "Compound_";
2641     aName += theFace->GetEntry();
2642     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2643     if (!theSFace->_is_nil())
2644       theFaceEntry = theSFace->GetID();
2645   }
2646   if (theFaceEntry.empty())
2647     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2648   
2649   if (theVertexEntry.empty()) {
2650     if (theVertex->GetShapeType() == GEOM::VERTEX)
2651       aName = "Vertex_";
2652     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2653       aName = "Compound_";
2654     aName += theVertex->GetEntry();
2655     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2656     if (!theSVertex->_is_nil())
2657       theVertexEntry = theSVertex->GetID();
2658   }
2659   if (theVertexEntry.empty())
2660     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2661
2662   string theVertexName = theVertex->GetName();
2663   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2664   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2665   MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
2666   try {
2667     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2668   } catch (SALOME_Exception& ex) {
2669     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2670   }
2671 }
2672
2673 /*!
2674  * Set an enforced vertex with group name on face
2675  */
2676 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2677  throw (SALOME::SALOME_Exception)
2678 {
2679   ASSERT(myBaseImpl);
2680
2681   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2682     MESSAGE("theFace shape type is not FACE or COMPOUND");
2683     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2684   }
2685
2686   string theFaceEntry = theFace->GetStudyEntry();
2687   
2688   if (theFaceEntry.empty()) {
2689     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2690     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2691     string aName;
2692     if (theFace->GetShapeType() == GEOM::FACE)
2693       aName = "Face_";
2694     if (theFace->GetShapeType() == GEOM::COMPOUND)
2695       aName = "Compound_";
2696     aName += theFace->GetEntry();
2697     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2698     if (!theSFace->_is_nil())
2699       theFaceEntry = theSFace->GetID();
2700   }
2701   if (theFaceEntry.empty())
2702     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2703   MESSAGE("IDL : GetName : " << theFace->GetName());
2704   MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
2705   try {
2706     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2707   } catch (SALOME_Exception& ex) {
2708     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2709   }
2710 }
2711
2712 /*!
2713  * Set an enforced vertex with name and group name on face
2714  */
2715 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, 
2716                                                                 const char* theVertexName, const char* theGroupName)
2717  throw (SALOME::SALOME_Exception)
2718 {
2719   ASSERT(myBaseImpl);
2720
2721   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2722     MESSAGE("theFace shape type is not FACE or COMPOUND");
2723     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2724   }
2725
2726   string theFaceEntry = theFace->GetStudyEntry();
2727   
2728   if (theFaceEntry.empty()) {
2729     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2730     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2731     string aName;
2732     if (theFace->GetShapeType() == GEOM::FACE)
2733       aName = "Face_";
2734     if (theFace->GetShapeType() == GEOM::COMPOUND)
2735       aName = "Compound_";
2736     aName += theFace->GetEntry();
2737     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2738     if (!theSFace->_is_nil())
2739       theFaceEntry = theSFace->GetID();
2740   }
2741   if (theFaceEntry.empty())
2742     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2743   MESSAGE("IDL : GetName : " << theFace->GetName());
2744   MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2745   try {
2746     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2747   } catch (SALOME_Exception& ex) {
2748     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2749   }
2750 }
2751
2752 /*!
2753  * Set an enforced vertex with geom entry and group name on face
2754  */
2755 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2756  throw (SALOME::SALOME_Exception)
2757 {
2758   ASSERT(myBaseImpl);
2759
2760   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2761     MESSAGE("theFace shape type is not FACE or COMPOUND");
2762     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2763   }
2764
2765   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2766     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2767     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2768   }
2769
2770   string theFaceEntry = theFace->GetStudyEntry();
2771   string theVertexEntry = theVertex->GetStudyEntry();
2772   
2773   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2774   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2775   string aName;
2776   
2777   if (theFaceEntry.empty()) {
2778     if (theFace->GetShapeType() == GEOM::FACE)
2779       aName = "Face_";
2780     if (theFace->GetShapeType() == GEOM::COMPOUND)
2781       aName = "Compound_";
2782     aName += theFace->GetEntry();
2783     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2784     if (!theSFace->_is_nil())
2785       theFaceEntry = theSFace->GetID();
2786   }
2787   if (theFaceEntry.empty())
2788     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2789   
2790   if (theVertexEntry.empty()) {
2791     if (theVertex->GetShapeType() == GEOM::VERTEX)
2792       aName = "Vertex_";
2793     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2794       aName = "Compound_";
2795     aName += theVertex->GetEntry();
2796     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2797     if (!theSVertex->_is_nil())
2798       theVertexEntry = theSVertex->GetID();
2799   }
2800   if (theVertexEntry.empty())
2801     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2802
2803   string theVertexName = theVertex->GetName();
2804   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2805   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2806   MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2807   try {
2808     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2809   } catch (SALOME_Exception& ex) {
2810     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2811   }
2812 }
2813
2814 //Enable internal enforced vertices on specific face if requested by user
2815 ///*!
2816 // * Are internal enforced vertices used for a face ?
2817 // */
2818 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2819 //    throw (SALOME::SALOME_Exception) {
2820 //  ASSERT(myBaseImpl);
2821
2822 //  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2823 //    MESSAGE("theFace shape type is not FACE or COMPOUND");
2824 //    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2825 //  }
2826
2827 //  string theFaceEntry = theFace->GetStudyEntry();
2828   
2829 //  if (theFaceEntry.empty()) {
2830 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2831 //    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2832 //    string aName;
2833 //    if (theFace->GetShapeType() == GEOM::FACE)
2834 //      aName = "Face_";
2835 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
2836 //      aName = "Compound_";
2837 //    aName += theFace->GetEntry();
2838 //    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2839 //    if (!theSFace->_is_nil())
2840 //      theFaceEntry = theSFace->GetID();
2841 //  }
2842 //  if (theFaceEntry.empty())
2843 //    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2844
2845 //  MESSAGE("IDL : GetName : " << theFace->GetName());
2846 //  MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2847 //  try {
2848 //    return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2849 //  } catch (SALOME_Exception& ex) {
2850 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2851 //  }
2852 //}
2853
2854 /*!
2855  * Get the list of all enforced vertices
2856  */
2857 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2858     throw (SALOME::SALOME_Exception) {
2859   ASSERT(myBaseImpl);
2860
2861   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2862     MESSAGE("theFace shape type is not FACE or COMPOUND");
2863     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2864   }
2865
2866   string theFaceEntry = theFace->GetStudyEntry();
2867   
2868   if (theFaceEntry.empty()) {
2869     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2870     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2871     string aName;
2872     if (theFace->GetShapeType() == GEOM::FACE)
2873       aName = "Face_";
2874     if (theFace->GetShapeType() == GEOM::COMPOUND)
2875       aName = "Compound_";
2876     aName += theFace->GetEntry();
2877     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2878     if (!theSFace->_is_nil())
2879       theFaceEntry = theSFace->GetID();
2880   }
2881   if (theFaceEntry.empty())
2882     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2883
2884   MESSAGE("IDL : GetName : " << theFace->GetName());
2885   MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2886   try {
2887     return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2888   } catch (SALOME_Exception& ex) {
2889     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2890   }
2891 }
2892
2893 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2894     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2895   ASSERT(myBaseImpl);
2896
2897   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2898     MESSAGE("theFace shape type is not FACE or COMPOUND");
2899     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2900   }
2901
2902   string theFaceEntry = theFace->GetStudyEntry();
2903   
2904   if (theFaceEntry.empty()) {
2905     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2906     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2907     string aName;
2908     if (theFace->GetShapeType() == GEOM::FACE)
2909       aName = "Face_";
2910     if (theFace->GetShapeType() == GEOM::COMPOUND)
2911       aName = "Compound_";
2912     aName += theFace->GetEntry();
2913     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2914     if (!theSFace->_is_nil())
2915       theFaceEntry = theSFace->GetID();
2916   }
2917   if (theFaceEntry.empty())
2918     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2919   MESSAGE("IDL : GetName : " << theFace->GetName());
2920   MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2921
2922   try {
2923     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2924   } catch (SALOME_Exception& ex) {
2925     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2926   }
2927 }
2928
2929 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2930     throw (SALOME::SALOME_Exception) {
2931   ASSERT(myBaseImpl);
2932
2933   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2934     MESSAGE("theFace shape type is not FACE or COMPOUND");
2935     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2936   }
2937   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2938     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2939     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2940   }
2941
2942   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2943   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2944   //  if (CORBA::is_nil(measureOp))
2945   //    return false;
2946   //
2947   //  CORBA::Double x, y, z;
2948   //  x = y = z = 0.;
2949   //  measureOp->PointCoordinates(theVertex, x, y, z);
2950
2951   std::string theFaceEntry = theFace->GetStudyEntry();
2952   std::string theVertexEntry = theVertex->GetStudyEntry();
2953   
2954   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2955   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2956   string aName;
2957   
2958   if (theFaceEntry.empty()) {
2959     if (theFace->GetShapeType() == GEOM::FACE)
2960       aName = "Face_";
2961     if (theFace->GetShapeType() == GEOM::COMPOUND)
2962       aName = "Compound_";
2963     aName += theFace->GetEntry();
2964     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2965     if (!theSFace->_is_nil())
2966       theFaceEntry = theSFace->GetID();
2967   }
2968   if (theFaceEntry.empty())
2969     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2970   
2971   if (theVertexEntry.empty()) {
2972     if (theVertex->GetShapeType() == GEOM::VERTEX)
2973       aName = "Vertex_";
2974     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2975       aName = "Compound_";
2976     aName += theVertex->GetEntry();
2977     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2978     if (!theSVertex->_is_nil())
2979       theVertexEntry = theSVertex->GetID();
2980   }
2981   if (theVertexEntry.empty())
2982     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2983   
2984   MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2985
2986   try {
2987     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2988   } catch (SALOME_Exception& ex) {
2989     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2990   }
2991 }
2992
2993 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2994   ASSERT(myBaseImpl);
2995
2996   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2997     MESSAGE("theFace shape type is not FACE or COMPOUND");
2998     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2999   }
3000
3001   string theFaceEntry = theFace->GetStudyEntry();
3002   
3003   if (theFaceEntry.empty()) {
3004     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3005     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3006     string aName;
3007     if (theFace->GetShapeType() == GEOM::FACE)
3008       aName = "Face_";
3009     if (theFace->GetShapeType() == GEOM::COMPOUND)
3010       aName = "Compound_";
3011     aName += theFace->GetEntry();
3012     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3013     if (!theSFace->_is_nil())
3014       theFaceEntry = theSFace->GetID();
3015   }
3016   if (theFaceEntry.empty())
3017     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3018   
3019   MESSAGE("IDL : GetName : " << theFace->GetName());
3020   MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
3021
3022   try {
3023     return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3024   } catch (SALOME_Exception& ex) {
3025     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3026   }
3027 }
3028
3029 /*!
3030  * Set/get/unset an enforced vertex on face - NEW (no face)
3031  */
3032 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3033 {
3034   ASSERT(myBaseImpl);
3035
3036   try {
3037     return SetEnforcedVertexEntry("", x, y, z);
3038   } catch (SALOME_Exception& ex) {
3039     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3040   }
3041 }
3042
3043 /*!
3044  * Set/get/unset an enforced vertex with name on face
3045  */
3046 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
3047 {
3048   try {
3049     return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3050   } catch (SALOME_Exception& ex) {
3051     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3052   }
3053 }
3054
3055 /*!
3056  * Set/get/unset an enforced vertex with geom object on face
3057  */
3058 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3059     throw (SALOME::SALOME_Exception)
3060 {
3061   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3062     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3063     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3064   }
3065   string theVertexEntry = theVertex->GetStudyEntry();
3066   
3067   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3068   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3069   string aName;
3070   
3071   if (theVertexEntry.empty()) {
3072     if (theVertex->GetShapeType() == GEOM::VERTEX)
3073       aName = "Vertex_";
3074     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3075       aName = "Compound_";
3076     aName += theVertex->GetEntry();
3077     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3078     if (!theSVertex->_is_nil())
3079       theVertexEntry = theSVertex->GetID();
3080   }
3081   if (theVertexEntry.empty())
3082     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3083
3084   string theVertexName = theVertex->GetName();
3085   try {
3086     return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
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 group name on face
3094  */
3095 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3096  throw (SALOME::SALOME_Exception)
3097 {
3098   ASSERT(myBaseImpl);
3099
3100   try {
3101     return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3102   } catch (SALOME_Exception& ex) {
3103     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3104   }
3105 }
3106
3107 /*!
3108  * Set an enforced vertex with name and group name on face
3109  */
3110 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, 
3111                                                                 const char* theVertexName, const char* theGroupName)
3112  throw (SALOME::SALOME_Exception)
3113 {
3114   ASSERT(myBaseImpl);
3115
3116   try {
3117     return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3118   } catch (SALOME_Exception& ex) {
3119     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3120   }
3121 }
3122
3123 /*!
3124  * Set an enforced vertex with geom entry and group name on face
3125  */
3126 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3127  throw (SALOME::SALOME_Exception)
3128 {
3129   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3130     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3131     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3132   }
3133
3134   string theVertexEntry = theVertex->GetStudyEntry();
3135   
3136   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3137   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3138   string aName;
3139   
3140   if (theVertexEntry.empty()) {
3141     if (theVertex->GetShapeType() == GEOM::VERTEX)
3142       aName = "Vertex_";
3143     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3144       aName = "Compound_";
3145     aName += theVertex->GetEntry();
3146     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3147     if (!theSVertex->_is_nil())
3148       theVertexEntry = theSVertex->GetID();
3149   }
3150   if (theVertexEntry.empty())
3151     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3152
3153   string theVertexName = theVertex->GetName();
3154   try {
3155     return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3156   } catch (SALOME_Exception& ex) {
3157     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3158   }
3159 }
3160
3161 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3162 {
3163   try {
3164     return UnsetEnforcedVertexEntry("", x, y, z);
3165   } catch (SALOME_Exception& ex) {
3166     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3167   }
3168 }
3169
3170 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3171     throw (SALOME::SALOME_Exception)
3172 {
3173   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3174     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
3175     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3176   }
3177   std::string theVertexEntry = theVertex->GetStudyEntry();
3178   
3179   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3180   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3181   string aName;
3182   
3183   if (theVertexEntry.empty()) {
3184     if (theVertex->GetShapeType() == GEOM::VERTEX)
3185       aName = "Vertex_";
3186     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3187       aName = "Compound_";
3188     aName += theVertex->GetEntry();
3189     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
3190     if (!theSVertex->_is_nil())
3191       theVertexEntry = theSVertex->GetID();
3192   }
3193   if (theVertexEntry.empty())
3194     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3195   
3196   try {
3197     return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3198   } catch (SALOME_Exception& ex) {
3199     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3200   }
3201 }
3202
3203 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3204 {
3205   try {
3206     return UnsetEnforcedVerticesEntry("");
3207   } catch (SALOME_Exception& ex) {
3208     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3209   }
3210 }
3211
3212 /*!
3213  * Set/get/unset an enforced vertex on geom object given by entry
3214  */
3215 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3216                                                        CORBA::Double x,
3217                                                        CORBA::Double y,
3218                                                        CORBA::Double z,
3219                                                        const char* theVertexName,
3220                                                        const char* theVertexEntry,
3221                                                        const char* theGroupName)
3222   throw (SALOME::SALOME_Exception)
3223 {
3224   bool newValue = false;
3225   if (string(theVertexEntry).empty()) {
3226     try {
3227       ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3228         this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3229       ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3230       coords.push_back(x);
3231       coords.push_back(y);
3232       coords.push_back(z);
3233       if (coordsList.find(coords) == coordsList.end()) {
3234         newValue = true;
3235       } else {
3236         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3237         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3238           newValue = true;
3239         }
3240       }
3241     } catch (const std::invalid_argument& ex) {
3242       // no enforced vertex for entry
3243       newValue = true;
3244     }
3245     if (newValue) {
3246       if (string(theVertexName).empty()) {
3247         if (string(theGroupName).empty())
3248           SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3249         else
3250           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3251       }
3252       else {
3253         if (string(theGroupName).empty())
3254           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3255         else
3256           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3257                                << theVertexName << "\", \"" << theGroupName << "\")";
3258       }
3259     }
3260   } else {
3261     try {
3262       ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3263       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3264       if ( it == enfVertexEntryList.end()) {
3265         newValue = true;
3266       }
3267       else {
3268         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3269         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3270           newValue = true;
3271         }
3272       }
3273     } catch (const std::invalid_argument& ex) {
3274       // no enforced vertex for entry
3275       newValue = true;
3276     }
3277     if (newValue) {
3278       if (string(theGroupName).empty())
3279         SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3280       else
3281         SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3282     }
3283   }
3284
3285   if (newValue)
3286     this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3287
3288   return newValue;
3289 }
3290
3291 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3292     throw (SALOME::SALOME_Exception)
3293 {
3294   try {
3295     BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3296     ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3297     vertexList->length(_vList.size());
3298     MESSAGE("Number of enforced vertices: " << vertexList->length());
3299     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3300     for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3301       ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3302
3303       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3304
3305       // Name
3306       enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3307       // Geom Vertex Entry
3308       enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3309       // Coords
3310       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3311       coords->length(_enfVertex->coords.size());
3312       for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3313         coords[ind] = _enfVertex->coords[ind];
3314       enfVertex->coords = coords;
3315       // Group Name
3316       enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3317       // Face entry list
3318       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3319       faceEntryList->length(_enfVertex->faceEntries.size());
3320       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3321       for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3322         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3323       enfVertex->faceEntries = faceEntryList;
3324
3325       vertexList[i] = enfVertex;
3326     }
3327     MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
3328     return vertexList._retn();
3329   } catch (const std::invalid_argument& ex) {
3330     SALOME::ExceptionStruct ExDescription;
3331     ExDescription.text = ex.what();
3332     ExDescription.type = SALOME::BAD_PARAM;
3333     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3334     ExDescription.lineNumber = 1385;
3335     throw SALOME::SALOME_Exception(ExDescription);
3336   } catch (const std::exception& ex) {
3337     std::cout << "Exception: " << ex.what() << std::endl;
3338     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3339   }
3340 }
3341
3342 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3343 {
3344   ASSERT(myBaseImpl);
3345
3346   bool res = false;
3347   try {
3348     res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3349
3350     if (string(theVertexEntry).empty())
3351       SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3352           << ")";
3353     else
3354       SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3355
3356   } catch (const std::invalid_argument& ex) {
3357     return false;
3358   } catch (const std::exception& ex) {
3359     std::cout << "Exception: " << ex.what() << std::endl;
3360     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3361   }
3362
3363   MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
3364   return res;
3365 }
3366 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3367 {
3368   ASSERT(myBaseImpl);
3369
3370   try {
3371     this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3372     SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3373   } catch (const std::invalid_argument& ex) {
3374     return false;
3375   } catch (const std::exception& ex) {
3376     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3377   }
3378
3379   return true;
3380 }
3381
3382 //=============================================================================
3383 /*!
3384  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3385  *
3386  *  Set true or false
3387  */
3388 //=============================================================================
3389 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3390 {
3391   ASSERT(myBaseImpl);
3392   this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3393   std::string theValueStr = theValue ? "True" : "False";
3394   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3395 }
3396
3397 //=============================================================================
3398 /*!
3399  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3400  *
3401  *  Get true or false
3402  */
3403 //=============================================================================
3404 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3405 {
3406   ASSERT(myBaseImpl);
3407   return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3408 }
3409
3410 //=============================================================================
3411 /*!
3412  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3413  *
3414  *  Set group name
3415  */
3416 //=============================================================================
3417 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char*  groupName)
3418 {
3419   ASSERT(myBaseImpl);
3420   this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3421   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3422 }
3423
3424 //=============================================================================
3425 /*!
3426  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3427  *
3428  *  Get group name
3429  */
3430 //=============================================================================
3431 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3432 {
3433   ASSERT(myBaseImpl);
3434   return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3435 }
3436
3437 /*
3438  * Enable internal enforced vertices on specific face if requested by user
3439  *
3440 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3441  throw (SALOME::SALOME_Exception)
3442 {
3443   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
3444   try {
3445     SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3446   } catch (SALOME_Exception& ex) {
3447     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3448   }
3449 }
3450
3451 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3452  throw (SALOME::SALOME_Exception)
3453 {
3454   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
3455
3456   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3457     MESSAGE("theFace shape type is not FACE or COMPOUND");
3458     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3459   }
3460
3461   string theFaceEntry = theFace->GetStudyEntry();
3462
3463   if (theFaceEntry.empty()) {
3464     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3465     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3466     string aName;
3467     if (theFace->GetShapeType() == GEOM::FACE)
3468       aName = "Face_";
3469     if (theFace->GetShapeType() == GEOM::COMPOUND)
3470       aName = "Compound_";
3471     aName += theFace->GetEntry();
3472     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
3473     if (!theSFace->_is_nil())
3474       theFaceEntry = theSFace->GetID();
3475   }
3476   if (theFaceEntry.empty())
3477     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3478
3479   MESSAGE("IDL : GetName : " << theFace->GetName());
3480   MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
3481   try {
3482     SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3483   } catch (SALOME_Exception& ex) {
3484     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3485   }
3486 }
3487
3488 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3489     throw (SALOME::SALOME_Exception)
3490 {
3491   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
3492   ASSERT(myBaseImpl);
3493   try {
3494     this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3495     std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3496     if (string(theGroupName).empty())
3497       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3498     else
3499       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3500   } catch (const std::exception& ex) {
3501     std::cout << "Exception: " << ex.what() << std::endl;
3502     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3503   }
3504 }
3505
3506 */
3507
3508 /* TODO GROUPS
3509  char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3510  throw (SALOME::SALOME_Exception)
3511  {
3512  ASSERT(myBaseImpl);
3513  MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
3514  try {
3515  return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3516  }
3517  catch (const std::invalid_argument& ex) {
3518  SALOME::ExceptionStruct ExDescription;
3519  ExDescription.text = ex.what();
3520  ExDescription.type = SALOME::BAD_PARAM;
3521  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3522  ExDescription.lineNumber = 1146;
3523  throw SALOME::SALOME_Exception(ExDescription);
3524  }
3525  catch (SALOME_Exception& ex) {
3526  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3527  }
3528  MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
3529  return 0;
3530  }
3531
3532
3533  void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3534  throw (SALOME::SALOME_Exception)
3535  {
3536  ASSERT(myBaseImpl);
3537  MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
3538  try {
3539  this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3540  }
3541  catch (const std::invalid_argument& ex) {
3542  SALOME::ExceptionStruct ExDescription;
3543  ExDescription.text = ex.what();
3544  ExDescription.type = SALOME::BAD_PARAM;
3545  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3546  ExDescription.lineNumber = 1170;
3547  throw SALOME::SALOME_Exception(ExDescription);
3548  }
3549  catch (SALOME_Exception& ex) {
3550  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3551  }
3552
3553  SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3554  << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3555
3556  MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
3557  }
3558  */
3559 ///////////////////////
3560
3561 ///////////////////////
3562 // PERIODICITY       //
3563 ///////////////////////
3564
3565
3566 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3567 {
3568 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
3569   std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3570   MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3571   MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3572   MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3573   MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3574   MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3575   MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3576   MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3577   MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3578   MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3579   std::string txtShapeType = MapShapeTypeToString[theShapeType];
3580   return txtShapeType;
3581 }
3582
3583 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3584 {
3585   // Check shape types
3586   bool ok = false;
3587   std::stringstream typesTxt;
3588   for (std::size_t i=0; i<theShapeTypes.size(); i++)
3589     {
3590       GEOM::shape_type theShapeType = theShapeTypes[i];
3591       if (shape->GetShapeType() == theShapeType)
3592         ok = true;
3593       typesTxt << ShapeTypeToString(theShapeType);
3594       if (i < theShapeTypes.size()-1 )
3595         typesTxt << ", ";
3596     }
3597   if (!ok){
3598     std::stringstream msg;
3599     msg << "shape shape type is not in" << typesTxt.str();
3600     MESSAGE(msg.str());
3601     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3602   }
3603 }
3604
3605 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3606 {
3607   // Check shape type
3608   if (shape->GetShapeType() != theShapeType) {
3609     std::stringstream msg;
3610     msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3611     MESSAGE(msg.str());
3612     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3613   }
3614 }
3615
3616 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3617 {
3618   // Check shape is published in the object browser
3619   string shapeEntry = shape->GetStudyEntry();
3620
3621   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
3622   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3623   string aName;
3624
3625   // Publish shape if needed
3626   if (shapeEntry.empty()) {
3627     if (shape->GetShapeType() == theShapeType)
3628       aName = prefix;
3629     aName += shape->GetEntry();
3630     SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
3631     if (!theSFace1->_is_nil())
3632       shapeEntry = theSFace1->GetID();
3633   }
3634   if (shapeEntry.empty())
3635     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3636   return shapeEntry;
3637 }
3638
3639 // Format the output of two vectors to use it in MESSAGE and PythonDump
3640 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3641 {
3642   std::stringstream listEntriesTxt;
3643
3644   if (!theSourceVerticesEntries.empty())
3645     {
3646       listEntriesTxt << ", [" ;
3647       size_t i =0;
3648       for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3649         {
3650           if (i>0)
3651             listEntriesTxt << ", ";
3652           listEntriesTxt << *it;
3653         }
3654
3655       listEntriesTxt << "], [" ;
3656       i =0;
3657       for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3658         {
3659           if (i>0)
3660             listEntriesTxt << ", ";
3661           listEntriesTxt << *it;
3662         }
3663       listEntriesTxt << "]" ;
3664     }
3665   return listEntriesTxt.str();
3666 }
3667
3668 /**
3669  * Erase all PreCad periodicity associations
3670  */
3671 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3672   ASSERT(myBaseImpl);
3673   this->GetImpl()->ClearPreCadPeriodicityVectors();
3674   SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3675 }
3676
3677 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3678 {
3679   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
3680   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3681       this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3682
3683   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3684
3685   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
3686   return periodicityList._retn();
3687 }
3688
3689 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3690 {
3691   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
3692   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3693       this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3694
3695   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3696
3697   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
3698   return periodicityList._retn();
3699 }
3700
3701 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3702 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3703 {
3704   MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
3705   BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3706
3707     periodicityList->length(preCadPeriodicityVector.size());
3708
3709     for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3710       {
3711         ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3712
3713         BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3714         myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3715         myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3716
3717         BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3718         if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3719           {
3720             sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3721             for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3722               sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3723           }
3724
3725         myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3726
3727         BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3728         if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3729            {
3730             targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3731              for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3732                targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3733            }
3734
3735         myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3736
3737         periodicityList[i] = myPreCadPeriodicity;
3738       }
3739
3740
3741   return periodicityList._retn();
3742 }
3743
3744
3745 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3746 throw (SALOME::SALOME_Exception)
3747 {
3748   ASSERT(myBaseImpl);
3749   const GEOM::ListOfGO theSourceVertices;
3750   const GEOM::ListOfGO theTargetVertices;
3751   AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3752 }
3753
3754
3755 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3756     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3757 throw (SALOME::SALOME_Exception)
3758 {
3759   ASSERT(myBaseImpl);
3760   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
3761
3762   size_t theLength = theSourceVertices.length();
3763   if (theLength != theTargetVertices.length())
3764     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3765
3766   std::vector<GEOM::shape_type> allowedShapeTypes;
3767   allowedShapeTypes.push_back(GEOM::FACE);
3768   allowedShapeTypes.push_back(GEOM::COMPOUND);
3769
3770   string prefix1 = "Source_face_";
3771   CheckShapeTypes(theFace1, allowedShapeTypes);
3772   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3773
3774   string prefix2 = "Target_face_";
3775   CheckShapeTypes(theFace2, allowedShapeTypes);
3776   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3777
3778   string prefix3 = "Source_vertex_";
3779   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3780   theSourceVerticesEntries->length(theLength);
3781   GEOM::GEOM_Object_ptr theVtx_i;
3782   string theEntry_i;
3783   for (size_t ind = 0; ind < theLength; ind++) {
3784       theVtx_i = theSourceVertices[ind];
3785       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3786       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3787   }
3788
3789   string prefix4 = "Target_vertex_";
3790   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3791   theTargetVerticesEntries->length(theLength);
3792   for (size_t ind = 0; ind < theLength; ind++) {
3793       theVtx_i = theTargetVertices[ind];
3794       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3795       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3796   }
3797
3798   string theFace2Name = theFace2->GetName();
3799   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3800   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3801   MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry <<  ")");
3802   try {
3803       AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3804           theSourceVerticesEntries, theTargetVerticesEntries);
3805   } catch (SALOME_Exception& ex) {
3806     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3807   }
3808 }
3809
3810
3811 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3812     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3813     throw (SALOME::SALOME_Exception)
3814 {
3815
3816   ASSERT(myBaseImpl);
3817
3818   // Convert BLSURFPlugin::TEntryList to vector<string>
3819   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3820   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3821       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3822       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3823   }
3824
3825   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3826
3827   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
3828
3829   this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3830       theSourceVerticesEntries, theTargetVerticesEntries);
3831
3832   SMESH::TPythonDump pd;
3833   if (!theSourceVerticesEntries.empty())
3834     {
3835       pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3836       pd << listEntriesTxt.c_str();
3837       pd << ")";
3838     }
3839   else
3840     pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3841   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
3842 }
3843
3844 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3845       throw (SALOME::SALOME_Exception)
3846 {
3847   ASSERT(myBaseImpl);
3848   const GEOM::ListOfGO theSourceVertices;
3849   const GEOM::ListOfGO theTargetVertices;
3850   AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3851 }
3852
3853 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3854     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3855       throw (SALOME::SALOME_Exception)
3856 {
3857   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
3858   ASSERT(myBaseImpl);
3859
3860   size_t theLength = theSourceVertices.length();
3861   if (theLength != theTargetVertices.length())
3862     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3863
3864   std::vector<GEOM::shape_type> allowedShapeTypes;
3865   allowedShapeTypes.push_back(GEOM::EDGE);
3866   allowedShapeTypes.push_back(GEOM::COMPOUND);
3867
3868   string prefix1 = "Source_edge_";
3869   CheckShapeTypes(theEdge1, allowedShapeTypes);
3870   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3871
3872   string prefix2 = "Target_edge_";
3873   CheckShapeTypes(theEdge2, allowedShapeTypes);
3874   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3875
3876   string prefix3 = "Source_vertex_";
3877   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3878   theSourceVerticesEntries->length(theLength);
3879   GEOM::GEOM_Object_ptr theVtx_i;
3880   string theEntry_i;
3881   for (size_t ind = 0; ind < theLength; ind++) {
3882       theVtx_i = theSourceVertices[ind];
3883       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3884       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3885   }
3886
3887   string prefix4 = "Target_vertex_";
3888   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3889   theTargetVerticesEntries->length(theLength);
3890   for (size_t ind = 0; ind < theLength; ind++) {
3891       theVtx_i = theTargetVertices[ind];
3892       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3893       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3894   }
3895
3896   string theEdge2Name = theEdge2->GetName();
3897   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3898   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3899   MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3900   try {
3901       AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3902           theSourceVerticesEntries, theTargetVerticesEntries);
3903   } catch (SALOME_Exception& ex) {
3904     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3905   }
3906 }
3907
3908
3909 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3910     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3911     throw (SALOME::SALOME_Exception)
3912 {
3913
3914   ASSERT(myBaseImpl);
3915
3916   // Convert BLSURFPlugin::TEntryList to vector<string>
3917   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3918   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3919       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3920       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3921   }
3922
3923   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3924
3925   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3926   this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3927       theSourceVerticesEntries, theTargetVerticesEntries);
3928
3929   SMESH::TPythonDump pd;
3930   if (!theSourceVerticesEntries.empty())
3931     {
3932       pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3933       pd << listEntriesTxt.c_str();
3934       pd << ")";
3935     }
3936   else
3937     pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3938
3939   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3940 }
3941
3942
3943 //================================================================================
3944 /*!
3945  * \brief Sets the file for export resulting mesh in GMF format
3946  * \param theFileName - full name of the file (.mesh, .meshb)
3947  * 
3948  * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3949  */
3950 //================================================================================  
3951 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3952 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3953   ASSERT(myBaseImpl);
3954   MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3955   bool valueChanged/*, modeChanged*/ = false;
3956   try {
3957     valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3958 //     modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3959     if (valueChanged)// or (!valueChanged && modeChanged))
3960       this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3961   } catch (const std::exception& ex) {
3962     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3963   }
3964   if (valueChanged)// or (!valueChanged && modeChanged))
3965     SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3966   MESSAGE("IDL : SetGMFFile END ");
3967 }
3968
3969 //================================================================================
3970 /*!
3971  * \brief Gets the file name for export resulting mesh in GMF format
3972  * \retval char* - The file name
3973  * 
3974  * Returns the GMF file name
3975  */
3976 //================================================================================  
3977 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3978   ASSERT(myBaseImpl);
3979 //   MESSAGE("IDL : GetGMFFile()");
3980   return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3981 }
3982
3983 // //================================================================================
3984 // /*!
3985 //  * \brief Gets the file mode for export resulting mesh in GMF format
3986 //  * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3987 //  * 
3988 //  * Returns the GMF file mode
3989 //  */
3990 // //================================================================================  
3991 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3992 //   ASSERT(myBaseImpl);
3993 //   MESSAGE("IDL : GetGMFFileMode()");
3994 //   return this->GetImpl()->GetGMFFileMode();
3995 // }
3996
3997 //=============================================================================
3998 /*!
3999  *  BLSURFPlugin_Hypothesis_i::GetImpl
4000  *
4001  *  Get implementation
4002  */
4003 //=============================================================================
4004 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
4005   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
4006   return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
4007 }
4008
4009 //================================================================================
4010 /*!
4011  * \brief Verify whether hypothesis supports given entity type 
4012  * \param type - dimension (see SMESH::Dimension enumeration)
4013  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
4014  * 
4015  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
4016  */
4017 //================================================================================  
4018 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
4019   return type == SMESH::DIM_2D;
4020 }
4021
4022 //
4023 // Obsolete methods - To be removed in V7
4024 //
4025
4026 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
4027   this->SetMinSize(theMinSize);
4028 }
4029 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
4030   return this->GetMinSize();
4031 }
4032 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
4033   this->SetMaxSize(theMaxSize);
4034 }
4035 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
4036   return this->GetMaxSize();
4037 }
4038 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
4039   this->SetMinSize(theMinSize);
4040 }
4041 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
4042   return this->GetMinSize();
4043 }
4044 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
4045   this->SetMaxSize(theMaxSize);
4046 }
4047 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
4048   return this->GetMaxSize();
4049 }
4050 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
4051   this->SetAngleMesh(theValue);
4052 }
4053 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
4054   return this->GetAngleMesh();
4055 }
4056 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
4057   this->SetAngleMesh(theValue);
4058 }
4059 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
4060   return this->GetAngleMesh();
4061 }
4062 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
4063   std::string theValueStr = theValue ? "1" : "0";
4064   this->SetOptionValue("respect_geometry",theValueStr.c_str());
4065 }
4066 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
4067   std::string theValueStr = this->GetOptionValue("respect_geometry");
4068   if (theValueStr.empty() || theValueStr == "respect")
4069       return true;
4070   return false;
4071 }
4072 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
4073   std::string theValueStr = theValue ? "1" : "0";
4074   this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
4075 }
4076 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
4077   std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
4078   if (theValueStr == "1")
4079       return true;
4080   return false;
4081 }
4082 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
4083   std::ostringstream theValueStr;
4084   theValueStr << theValue;
4085   this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
4086 }
4087 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
4088   std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
4089   double result;
4090   theValueStr >> result;
4091   return result;
4092 }