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