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