]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
Salome HOME
Export MeshGems version, to be able to check it in scripts
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2007-2019  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) throw (SALOME::SALOME_Exception) {
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 ) throw (SALOME::SALOME_Exception)
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 ) throw (SALOME::SALOME_Exception)
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 ) throw (SALOME::SALOME_Exception)
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() throw (SALOME::SALOME_Exception)
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 ) throw (SALOME::SALOME_Exception)
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 ) throw (SALOME::SALOME_Exception)
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() throw (SALOME::SALOME_Exception)
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 ) throw (SALOME::SALOME_Exception)
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   throw (SALOME::SALOME_Exception) {
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   throw (SALOME::SALOME_Exception) {
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) throw (SALOME::SALOME_Exception) {
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) throw (SALOME::SALOME_Exception) {
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   throw (SALOME::SALOME_Exception) {
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   throw (SALOME::SALOME_Exception) {
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   throw (SALOME::SALOME_Exception)
1754 {
1755   if ( !optionsAndValues ) return;
1756
1757   SMESH::TPythonDump dump;
1758
1759   std::istringstream strm( optionsAndValues );
1760   std::istream_iterator<std::string> sIt( strm ), sEnd;
1761   while ( sIt != sEnd )
1762   {
1763     std::string option = *sIt;
1764     if ( ++sIt != sEnd )
1765     {
1766       std::string value = *sIt;
1767       ++sIt;
1768       AddOption( option.c_str(), value.c_str() );
1769     }
1770     else
1771     {
1772       THROW_SALOME_CORBA_EXCEPTION( "Uneven number of options and values" ,SALOME::BAD_PARAM );
1773     }
1774   }
1775   dump << _this() << ".SetAdvancedOption( '" << optionsAndValues << "' )";
1776 }
1777
1778 //=============================================================================
1779
1780 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
1781 {
1782   // backward compatibility
1783   {
1784     std::string name( optionName );
1785     if ( name == "proximity" )
1786       SetVolumeProximity( GetImpl()->ToBool( optionValue ));
1787
1788     else if ( name == "prox_ratio" )
1789       SetVolumeProximityRatio( GetImpl()->ToDbl( optionValue ));
1790
1791     else if ( name == "prox_nb_layer" )
1792       SetNbVolumeProximityLayers( GetImpl()->ToInt( optionValue ));
1793   }
1794   bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
1795   if (valueChanged) {
1796     this->GetImpl()->AddOption(optionName, optionValue);
1797     SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
1798   }
1799 }
1800
1801 //=============================================================================
1802
1803 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
1804 {
1805   ASSERT(myBaseImpl);
1806   bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
1807   if (valueChanged) {
1808     this->GetImpl()->AddPreCADOption(optionName, optionValue);
1809     SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
1810   }
1811 }
1812
1813 //=============================================================================
1814
1815 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
1816 {
1817   ASSERT(myBaseImpl);
1818   return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
1819 }
1820
1821 //=============================================================================
1822
1823 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
1824 {
1825   ASSERT(myBaseImpl);
1826   return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
1827 }
1828
1829 //=============================================================================
1830
1831 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
1832   throw (SALOME::SALOME_Exception) {
1833   ASSERT(myBaseImpl);
1834   if ( !entry || !entry[0] )
1835     THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
1836   bool valueChanged = false;
1837   try {
1838     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
1839     if (valueChanged)
1840       this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
1841   } catch (const std::invalid_argument& ex) {
1842     SALOME::ExceptionStruct ExDescription;
1843     ExDescription.text = ex.what();
1844     ExDescription.type = SALOME::BAD_PARAM;
1845     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1846     ExDescription.lineNumber = 0;
1847     throw SALOME::SALOME_Exception(ExDescription);
1848   } catch (SALOME_Exception& ex) {
1849     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1850   }
1851   if (valueChanged)
1852     SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
1853 }
1854
1855 //=============================================================================
1856
1857 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1858   throw (SALOME::SALOME_Exception) {
1859   ASSERT(myBaseImpl);
1860   bool valueChanged = false;
1861   std::ostringstream sizeMapFunction;
1862   switch (shapeType) {
1863   case GEOM::FACE:   sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1864   case GEOM::EDGE:   sizeMapFunction << "def f(t): return " << sizeMap ; break;
1865   case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1866   default:;
1867   }
1868   try {
1869     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1870     if (valueChanged)
1871       this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1872   } catch (const std::invalid_argument& ex) {
1873     SALOME::ExceptionStruct ExDescription;
1874     ExDescription.text = ex.what();
1875     ExDescription.type = SALOME::BAD_PARAM;
1876     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1877     ExDescription.lineNumber = 0;
1878     throw SALOME::SALOME_Exception(ExDescription);
1879   } catch (SALOME_Exception& ex) {
1880     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1881   }
1882   if (valueChanged)
1883     SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
1884 }
1885
1886 //=============================================================================
1887
1888 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1889   throw (SALOME::SALOME_Exception) {
1890   ASSERT(myBaseImpl);
1891   bool valueChanged = false;
1892   try {
1893     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1894     if ( valueChanged ) {
1895       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1896       if (!boost::regex_match(string(attractor), re))
1897         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1898       this->GetImpl()->SetAttractorEntry(entry, attractor);
1899     }
1900   } catch (const std::invalid_argument& ex) {
1901     SALOME::ExceptionStruct ExDescription;
1902     ExDescription.text = ex.what();
1903     ExDescription.type = SALOME::BAD_PARAM;
1904     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1905     ExDescription.lineNumber = 0;
1906     throw SALOME::SALOME_Exception(ExDescription);
1907   } catch (SALOME_Exception& ex) {
1908     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1909   }
1910   if (valueChanged)
1911     SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1912 }
1913
1914 //=============================================================================
1915
1916 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
1917   throw (SALOME::SALOME_Exception)
1918 {
1919   ASSERT(myBaseImpl);
1920   //bool valueChanged = false;
1921   try {
1922     this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1923   }
1924   catch (const std::invalid_argument& ex) {
1925     SALOME::ExceptionStruct ExDescription;
1926     ExDescription.text = ex.what();
1927     ExDescription.type = SALOME::BAD_PARAM;
1928     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1929     ExDescription.lineNumber = 0;
1930     throw SALOME::SALOME_Exception(ExDescription);
1931   } catch (SALOME_Exception& ex) {
1932     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1933   }
1934   //if ( valueChanged )
1935   SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1936                        << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1937 }
1938
1939 //=============================================================================
1940
1941 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1942   ASSERT(myBaseImpl);
1943   try {
1944     return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1945   } catch (const std::invalid_argument& ex) {
1946     SALOME::ExceptionStruct ExDescription;
1947     ExDescription.text = ex.what();
1948     ExDescription.type = SALOME::BAD_PARAM;
1949     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1950     ExDescription.lineNumber = 0;
1951     throw SALOME::SALOME_Exception(ExDescription);
1952   } catch (SALOME_Exception& ex) {
1953     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1954   }
1955   return 0;
1956 }
1957
1958 //=============================================================================
1959
1960 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1961   ASSERT(myBaseImpl);
1962   try {
1963     return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1964   } catch (const std::invalid_argument& ex) {
1965     SALOME::ExceptionStruct ExDescription;
1966     ExDescription.text = ex.what();
1967     ExDescription.type = SALOME::BAD_PARAM;
1968     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1969     ExDescription.lineNumber = 0;
1970     throw SALOME::SALOME_Exception(ExDescription);
1971   } catch (SALOME_Exception& ex) {
1972     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1973   }
1974   return 0;
1975 }
1976
1977 // //=============================================================================
1978 // 
1979 // // TODO coder cette fonction (utilis??e pour savoir si la valeur a chang??
1980 // // A finir pour le dump
1981 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1982 //   throw (SALOME::SALOME_Exception)
1983 // {
1984 //   ASSERT(myBaseImpl);
1985 //   try {
1986 //     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1987 //   }
1988 //   catch (const std::invalid_argument& ex) {
1989 //     SALOME::ExceptionStruct ExDescription;
1990 //     ExDescription.text = ex.what();
1991 //     ExDescription.type = SALOME::BAD_PARAM;
1992 //     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1993 //     ExDescription.lineNumber = 0;
1994 //     throw SALOME::SALOME_Exception(ExDescription);
1995 //   }
1996 //   catch (SALOME_Exception& ex) {
1997 //     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1998 //   }
1999 //   return 0;
2000 // }
2001
2002 //=============================================================================
2003
2004 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
2005   ASSERT(myBaseImpl);
2006   this->GetImpl()->ClearEntry(entry);
2007   //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
2008 }
2009
2010 //=============================================================================
2011
2012 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
2013   ASSERT(myBaseImpl);
2014   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2015
2016   const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
2017   result->length(sizeMaps.size());
2018
2019   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
2020   for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
2021     string entry_sizemap = smIt->first;
2022     if (!smIt->second.empty()) {
2023       entry_sizemap += "|";
2024       entry_sizemap += smIt->second;
2025     }
2026     result[i] = CORBA::string_dup(entry_sizemap.c_str());
2027   }
2028   return result._retn();
2029 }
2030
2031 //=============================================================================
2032
2033 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
2034   ASSERT(myBaseImpl);
2035   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
2036
2037   const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
2038   result->length(attractors.size());
2039
2040   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
2041   for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
2042     string entry_attractor = atIt->first;
2043     if (!atIt->second.empty()) {
2044       entry_attractor += "|";
2045       entry_attractor += atIt->second;
2046     }
2047     result[i] = CORBA::string_dup(entry_attractor.c_str());
2048   }
2049   return result._retn();
2050 }
2051
2052 //=============================================================================
2053
2054 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
2055 {
2056   ASSERT(myBaseImpl);
2057   BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
2058
2059   const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
2060   result->length( attractors.size() );
2061
2062   ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
2063   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
2064     string faceEntry = atIt->first;
2065     string attEntry;
2066     double startSize, endSize, infDist, constDist;
2067     if ( !atIt->second->Empty() ) {
2068       attEntry = atIt->second->GetAttractorEntry();
2069       std::vector<double> params = atIt->second->GetParameters();
2070       startSize = params[0];
2071       endSize = params[1];
2072       infDist = params[2];
2073       constDist = params[3];
2074     }
2075     result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
2076     result[i].attEntry = CORBA::string_dup(attEntry.c_str());
2077     result[i].startSize = startSize;
2078     result[i].endSize = endSize;
2079     result[i].infDist = infDist;
2080     result[i].constDist = constDist;
2081   }
2082   return result._retn();
2083 }
2084
2085 //=============================================================================
2086
2087 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
2088   throw (SALOME::SALOME_Exception) {
2089   ASSERT(myBaseImpl);
2090   for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
2091     string entry_sizemap = sizeMaps[i].in();
2092     size_t colonPos = entry_sizemap.find('|');
2093     string entry, sizemap;
2094     if (colonPos == string::npos) // '|' separator not found
2095       entry = entry_sizemap;
2096     else {
2097       entry = entry_sizemap.substr(0, colonPos);
2098       if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
2099         sizemap = entry_sizemap.substr(colonPos + 1);
2100     }
2101     this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
2102   }
2103 }
2104
2105 //=============================================================================
2106
2107 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
2108   ASSERT(myBaseImpl);
2109   this->GetImpl()->ClearSizeMaps();
2110 }
2111
2112 //=============================================================================
2113
2114 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2115   throw (SALOME::SALOME_Exception)
2116 {
2117   ASSERT(myBaseImpl);
2118   string entry;
2119   entry = GeomObj->GetStudyEntry();
2120   SetSizeMapEntry(entry.c_str(), sizeMap);
2121 }
2122
2123 //=============================================================================
2124
2125 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
2126   ASSERT(myBaseImpl);
2127   string entry = GeomObj->GetStudyEntry();
2128   GEOM::shape_type shapeType = GeomObj->GetShapeType();
2129   if (shapeType == GEOM::COMPOUND)
2130     shapeType = GeomObj->GetMaxShapeType();
2131   SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
2132 }
2133
2134 //=============================================================================
2135 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
2136   ASSERT(myBaseImpl);
2137   string entry;
2138   entry = GeomObj->GetStudyEntry();
2139   UnsetEntry(entry.c_str());
2140   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
2141 }
2142
2143 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
2144   ASSERT(myBaseImpl);
2145   string entry;
2146   entry = GeomObj->GetStudyEntry();
2147   SetAttractorEntry(entry.c_str(), attractor);
2148 }
2149
2150 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
2151   ASSERT(myBaseImpl);
2152   string entry;
2153   entry = GeomObj->GetStudyEntry();
2154   UnsetEntry(entry.c_str());
2155   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
2156 }
2157
2158 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)
2159 {
2160   ASSERT(myBaseImpl);
2161   string theFaceEntry;
2162   string theAttEntry;
2163   theFaceEntry = theFace->GetStudyEntry();
2164   theAttEntry  = theAttractor->GetStudyEntry();
2165   
2166   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2167   string aName;
2168   
2169   if (theFaceEntry.empty()) {
2170     aName = "Face_";
2171     aName += theFace->GetEntry();
2172     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2173     if (!theSFace->_is_nil())
2174       theFaceEntry = theSFace->GetID();
2175   }
2176   if (theFaceEntry.empty())
2177     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2178   
2179   if (theAttEntry.empty()) {
2180     if (theAttractor->GetShapeType() == GEOM::VERTEX)
2181       aName = "Vertex_";
2182     if (theAttractor->GetShapeType() == GEOM::EDGE)
2183       aName = "Edge_";
2184     if (theAttractor->GetShapeType() == GEOM::WIRE)
2185       aName = "Wire_";
2186     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
2187       aName = "Compound_";
2188     aName += theAttractor->GetEntry();
2189     SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(NULL, theAttractor, aName.c_str());
2190     if (!theSAtt->_is_nil())
2191       theAttEntry = theSAtt->GetID();
2192   }
2193   if (theAttEntry.empty())
2194     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2195   
2196   TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
2197   TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
2198   SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
2199 }
2200
2201 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
2202                                                    GEOM::GEOM_Object_ptr theAttractor)
2203 {
2204   ASSERT(myBaseImpl);
2205   CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
2206   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
2207   
2208   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2209   // string aName;
2210   
2211   // if (theFaceEntry.empty()) {
2212   //   aName = "Face_";
2213   //   aName += theFace->GetEntry();
2214   //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2215   //   if (!theSFace->_is_nil())
2216   //     theFaceEntry = theSFace->GetID();
2217   // }
2218   if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
2219        !theAttrEntry.in() || !theAttrEntry.in()[0] )
2220     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2221   
2222   GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
2223   SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
2224                        << theFace << ", " << theAttractor << " )";
2225 }
2226
2227 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
2228                                                     const char* attractorEntry)
2229 {
2230   GetImpl()->ClearEntry( faceEntry, attractorEntry );
2231   SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
2232                        << faceEntry << "', '" << attractorEntry << "' )";
2233 }
2234
2235
2236 /*
2237   void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
2238   {}
2239
2240   void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
2241   {}
2242
2243   void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
2244   {}
2245
2246   char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
2247   {}
2248
2249   void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
2250   {
2251   ASSERT(myBaseImpl);
2252   this->GetImpl()->UnsetCustomSizeMap(entry);
2253   SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
2254   }
2255
2256
2257   BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
2258   {}
2259
2260 */
2261
2262 // ///////////////////////
2263 // // ENFORCED VERTICES //
2264 // ///////////////////////
2265
2266
2267 /**
2268  * Returns the list of enforced vertices for a given Face entry
2269  * @return A map of Face entry / List of enforced vertices
2270  *
2271  */
2272 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
2273   ASSERT(myBaseImpl);
2274
2275   BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
2276
2277   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
2278     this->GetImpl()->_GetAllEnforcedVerticesByFace();
2279   resultMap->length(faceEntryEnfVertexListMap.size());
2280
2281   ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
2282   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
2283   for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
2284     BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
2285       new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
2286     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2287
2288     _enfVertexList = it_entry->second;
2289     BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
2290     enfVertexList->length(_enfVertexList.size());
2291
2292     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
2293     ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2294     for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
2295       currentEnfVertex = (*it_enfVertex);
2296
2297       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2298
2299       // Name
2300       enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2301
2302       // Geom entry
2303       enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2304
2305       // Coords
2306       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2307       coords->length(currentEnfVertex->coords.size());
2308       for (CORBA::ULong i=0;i<coords->length();i++)
2309         coords[i] = currentEnfVertex->coords[i];
2310       enfVertex->coords = coords;
2311
2312       // Group name
2313       enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
2314       
2315       // Face entry list
2316       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2317       faceEntryList->length(currentEnfVertex->faceEntries.size());
2318       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2319       for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2320         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2321       enfVertex->faceEntries = faceEntryList;
2322
2323       ostringstream msg;
2324       msg << "Enforced vertex: \n"
2325           << "Name: " << enfVertex->name << "\n";
2326       if (coords->length())
2327         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2328       msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2329           << "Group Name: " << enfVertex->grpName;
2330
2331       enfVertexList[j] = enfVertex;
2332     }
2333     mapElement->enfVertexList = enfVertexList;
2334
2335     resultMap[i] = mapElement;
2336
2337   }
2338   return resultMap._retn();
2339 }
2340
2341 /**
2342  * Returns the list of all enforced vertices
2343  * @return a list of enforced vertices
2344  *
2345  */
2346 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
2347   ASSERT(myBaseImpl);
2348   BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
2349   const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
2350   resultMap->length(enfVertexList.size());
2351
2352   ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
2353   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2354   for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
2355     currentEnfVertex = (*evlIt);
2356     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2357     // Name
2358     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2359     // Geom entry
2360     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2361     // Coords
2362     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2363     coords->length(currentEnfVertex->coords.size());
2364     for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
2365       coords[ind] = currentEnfVertex->coords[ind];
2366     enfVertex->coords = coords;
2367     // Group name
2368     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2369     // Face entry list
2370     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2371     faceEntryList->length(currentEnfVertex->faceEntries.size());
2372     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2373     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2374       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2375     enfVertex->faceEntries = faceEntryList;
2376
2377     ostringstream msg;
2378     msg << "Enforced vertex: \n"
2379         << "Name: " << enfVertex->name << "\n";
2380     if (coords->length())
2381       msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2382     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2383         << "Group Name: " << enfVertex->grpName;
2384
2385     resultMap[i] = enfVertex;
2386   }
2387   return resultMap._retn();
2388
2389 }
2390
2391 /**
2392  * Returns the list of enforced vertices coords for a given Face entry.
2393  * They are the coords of the "manual" enforced vertices.
2394  * @return A map of Face entry / List of enforced vertices coords
2395  *
2396  */
2397 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
2398   ASSERT(myBaseImpl);
2399
2400   BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
2401
2402   const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
2403   resultMap->length(entryCoordsListMap.size());
2404
2405   ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
2406   ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
2407   for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
2408     BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
2409     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2410
2411     _coordsList = it_entry->second;
2412     BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
2413     coordsList->length(_coordsList.size());
2414
2415     ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
2416     for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
2417       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2418       coords->length((*it_coords).size());
2419       for (CORBA::ULong i=0;i<coords->length();i++)
2420         coords[i] = (*it_coords)[i];
2421       coordsList[j] = coords;
2422     }
2423     mapElement->coordsList = coordsList;
2424
2425     resultMap[i] = mapElement;
2426
2427   }
2428   return resultMap._retn();
2429 }
2430
2431 /**
2432  * Returns a map of enforced vertices coords / enforced vertex.
2433  * They are the coords of the "manual" enforced vertices.
2434  */
2435 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
2436   ASSERT(myBaseImpl);
2437
2438   BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
2439   const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
2440     this->GetImpl()->_GetAllEnforcedVerticesByCoords();
2441   resultMap->length(coordsEnfVertexMap.size());
2442
2443   ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
2444   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2445   for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
2446     currentEnfVertex = (it_coords->second);
2447     BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
2448     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2449     coords->length(it_coords->first.size());
2450     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2451       coords[ind] = it_coords->first[ind];
2452     mapElement->coords = coords;
2453
2454     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2455     // Name
2456     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2457     // Geom entry
2458     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2459     // Coords
2460     BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
2461     coords2->length(currentEnfVertex->coords.size());
2462     for (CORBA::ULong ind=0;ind<coords2->length();ind++)
2463       coords2[ind] = currentEnfVertex->coords[ind];
2464     enfVertex->coords = coords2;
2465     // Group name
2466     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2467     // Face entry list
2468     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2469     faceEntryList->length(currentEnfVertex->faceEntries.size());
2470     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2471     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2472       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2473     enfVertex->faceEntries = faceEntryList;
2474       
2475     mapElement->enfVertex = enfVertex;
2476     ostringstream msg;
2477     msg << "Enforced vertex: \n"
2478         << "Name: " << enfVertex->name << "\n";
2479     if (coords->length())
2480       msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2481     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2482         << "Group Name: " << enfVertex->grpName;
2483
2484     resultMap[i] = mapElement;
2485   }
2486   return resultMap._retn();
2487 }
2488
2489 /**
2490  * Returns the list of enforced vertices entries for a given Face entry.
2491  * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
2492  * @return A map of Face entry / List of enforced vertices geom entries
2493  *
2494  */
2495 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
2496   ASSERT(myBaseImpl);
2497
2498   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
2499
2500   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
2501     this->GetImpl()->_GetAllEnfVertexEntriesByFace();
2502   resultMap->length(entryEnfVertexEntryListMap.size());
2503
2504   ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
2505   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
2506       entryEnfVertexEntryListMap.begin();
2507   for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
2508     BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
2509       new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
2510     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
2511
2512     _enfVertexEntryList = it_entry->second;
2513     BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
2514     enfVertexEntryList->length(_enfVertexEntryList.size());
2515
2516     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
2517     for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
2518       enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
2519     }
2520     mapElement->enfVertexEntryList = enfVertexEntryList;
2521
2522     resultMap[i] = mapElement;
2523
2524   }
2525   return resultMap._retn();
2526 }
2527
2528 /**
2529  * Returns a map of enforced vertices geom entry / enforced vertex.
2530  * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
2531  */
2532 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
2533   ASSERT(myBaseImpl);
2534
2535   BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
2536   const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
2537     this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
2538   resultMap->length(enfVertexEntryEnfVertexMap.size());
2539
2540   ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
2541   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
2542   for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
2543     currentEnfVertex = it_enfVertexEntry->second;
2544     BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
2545     mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
2546
2547     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2548     // Name
2549     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
2550     // Geom entry
2551     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
2552     // Coords
2553     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2554     coords->length(currentEnfVertex->coords.size());
2555     for (CORBA::ULong ind=0;ind<coords->length();ind++)
2556       coords[ind] = currentEnfVertex->coords[ind];
2557     enfVertex->coords = coords;
2558     // Group name
2559     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
2560     // Face entry list
2561     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2562     faceEntryList->length(currentEnfVertex->faceEntries.size());
2563     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
2564     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
2565       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2566     enfVertex->faceEntries = faceEntryList;
2567
2568     ostringstream msg;
2569     msg << "Enforced vertex: \n"
2570         << "Name: " << enfVertex->name << "\n";
2571     if (coords->length())
2572       msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
2573     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
2574         << "Group Name: " << enfVertex->grpName;
2575
2576     mapElement->enfVertex = enfVertex;
2577     resultMap[i] = mapElement;
2578   }
2579   return resultMap._retn();
2580 }
2581
2582 /**
2583  * Erase all enforced vertices
2584  */
2585 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
2586   ASSERT(myBaseImpl);
2587   this->GetImpl()->ClearAllEnforcedVertices();
2588   SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
2589 }
2590
2591 /*!
2592  * Set/get/unset an enforced vertex on face - OBSOLETE
2593  */
2594 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2595                                                   CORBA::Double z) throw (SALOME::SALOME_Exception) {
2596   ASSERT(myBaseImpl);
2597
2598   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2599     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2600   }
2601
2602   string theFaceEntry = theFace->GetStudyEntry();
2603   
2604   if (theFaceEntry.empty()) {
2605     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2606     string aName;
2607     if (theFace->GetShapeType() == GEOM::FACE)
2608       aName = "Face_";
2609     if (theFace->GetShapeType() == GEOM::COMPOUND)
2610       aName = "Compound_";
2611     aName += theFace->GetEntry();
2612     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2613     if (!theSFace->_is_nil())
2614       theFaceEntry = theSFace->GetID();
2615   }
2616   if (theFaceEntry.empty())
2617     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2618   try {
2619     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2620   } catch (SALOME_Exception& ex) {
2621     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2622   }
2623 }
2624
2625 /*!
2626  * Set/get/unset an enforced vertex with name on face
2627  */
2628 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2629                                                        CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
2630   ASSERT(myBaseImpl);
2631
2632   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2633     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2634   }
2635
2636   string theFaceEntry = theFace->GetStudyEntry();
2637   
2638   if (theFaceEntry.empty()) {
2639     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2640     string aName;
2641     if (theFace->GetShapeType() == GEOM::FACE)
2642       aName = "Face_";
2643     if (theFace->GetShapeType() == GEOM::COMPOUND)
2644       aName = "Compound_";
2645     aName += theFace->GetEntry();
2646     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2647     if (!theSFace->_is_nil())
2648       theFaceEntry = theSFace->GetID();
2649   }
2650   if (theFaceEntry.empty())
2651     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2652   
2653   try {
2654     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
2655   } catch (SALOME_Exception& ex) {
2656     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2657   }
2658 }
2659
2660 /*!
2661  * Set/get/unset an enforced vertex with geom object on face
2662  */
2663 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2664   throw (SALOME::SALOME_Exception) {
2665   ASSERT(myBaseImpl);
2666
2667   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2668     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2669   }
2670
2671   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2672     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2673   }
2674
2675   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2676   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2677   //  if (CORBA::is_nil(measureOp))
2678   //    return false;
2679   //
2680   //  CORBA::Double x, y, z;
2681   //  x = y = z = 0.;
2682   //  measureOp->PointCoordinates(theVertex, x, y, z);
2683
2684   string theFaceEntry = theFace->GetStudyEntry();
2685   string theVertexEntry = theVertex->GetStudyEntry();
2686   
2687   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2688   string aName;
2689   
2690   if (theFaceEntry.empty()) {
2691     if (theFace->GetShapeType() == GEOM::FACE)
2692       aName = "Face_";
2693     if (theFace->GetShapeType() == GEOM::COMPOUND)
2694       aName = "Compound_";
2695     aName += theFace->GetEntry();
2696     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2697     if (!theSFace->_is_nil())
2698       theFaceEntry = theSFace->GetID();
2699   }
2700   if (theFaceEntry.empty())
2701     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2702   
2703   if (theVertexEntry.empty()) {
2704     if (theVertex->GetShapeType() == GEOM::VERTEX)
2705       aName = "Vertex_";
2706     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2707       aName = "Compound_";
2708     aName += theVertex->GetEntry();
2709     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2710     if (!theSVertex->_is_nil())
2711       theVertexEntry = theSVertex->GetID();
2712   }
2713   if (theVertexEntry.empty())
2714     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2715
2716   string theVertexName = theVertex->GetName();
2717   try {
2718     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
2719   } catch (SALOME_Exception& ex) {
2720     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2721   }
2722 }
2723
2724 /*!
2725  * Set an enforced vertex with group name on face
2726  */
2727 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
2728   throw (SALOME::SALOME_Exception)
2729 {
2730   ASSERT(myBaseImpl);
2731
2732   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2733     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2734   }
2735
2736   string theFaceEntry = theFace->GetStudyEntry();
2737   
2738   if (theFaceEntry.empty()) {
2739     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2740     string aName;
2741     if (theFace->GetShapeType() == GEOM::FACE)
2742       aName = "Face_";
2743     if (theFace->GetShapeType() == GEOM::COMPOUND)
2744       aName = "Compound_";
2745     aName += theFace->GetEntry();
2746     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2747     if (!theSFace->_is_nil())
2748       theFaceEntry = theSFace->GetID();
2749   }
2750   if (theFaceEntry.empty())
2751     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2752   try {
2753     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
2754   } catch (SALOME_Exception& ex) {
2755     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2756   }
2757 }
2758
2759 /*!
2760  * Set an enforced vertex with name and group name on face
2761  */
2762 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, 
2763                                                                 const char* theVertexName, const char* theGroupName)
2764   throw (SALOME::SALOME_Exception)
2765 {
2766   ASSERT(myBaseImpl);
2767
2768   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2769     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2770   }
2771
2772   string theFaceEntry = theFace->GetStudyEntry();
2773   
2774   if (theFaceEntry.empty()) {
2775     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2776     string aName;
2777     if (theFace->GetShapeType() == GEOM::FACE)
2778       aName = "Face_";
2779     if (theFace->GetShapeType() == GEOM::COMPOUND)
2780       aName = "Compound_";
2781     aName += theFace->GetEntry();
2782     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2783     if (!theSFace->_is_nil())
2784       theFaceEntry = theSFace->GetID();
2785   }
2786   if (theFaceEntry.empty())
2787     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2788   try {
2789     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2790   } catch (SALOME_Exception& ex) {
2791     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2792   }
2793 }
2794
2795 /*!
2796  * Set an enforced vertex with geom entry and group name on face
2797  */
2798 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2799   throw (SALOME::SALOME_Exception)
2800 {
2801   ASSERT(myBaseImpl);
2802
2803   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2804     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2805   }
2806
2807   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2808     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2809   }
2810
2811   string theFaceEntry = theFace->GetStudyEntry();
2812   string theVertexEntry = theVertex->GetStudyEntry();
2813   
2814   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2815   string aName;
2816   
2817   if (theFaceEntry.empty()) {
2818     if (theFace->GetShapeType() == GEOM::FACE)
2819       aName = "Face_";
2820     if (theFace->GetShapeType() == GEOM::COMPOUND)
2821       aName = "Compound_";
2822     aName += theFace->GetEntry();
2823     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2824     if (!theSFace->_is_nil())
2825       theFaceEntry = theSFace->GetID();
2826   }
2827   if (theFaceEntry.empty())
2828     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2829   
2830   if (theVertexEntry.empty()) {
2831     if (theVertex->GetShapeType() == GEOM::VERTEX)
2832       aName = "Vertex_";
2833     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2834       aName = "Compound_";
2835     aName += theVertex->GetEntry();
2836     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
2837     if (!theSVertex->_is_nil())
2838       theVertexEntry = theSVertex->GetID();
2839   }
2840   if (theVertexEntry.empty())
2841     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2842
2843   string theVertexName = theVertex->GetName();
2844   try {
2845     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2846   } catch (SALOME_Exception& ex) {
2847     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2848   }
2849 }
2850
2851 //Enable internal enforced vertices on specific face if requested by user
2852 ///*!
2853 // * Are internal enforced vertices used for a face ?
2854 // */
2855 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2856 //    throw (SALOME::SALOME_Exception) {
2857 //  ASSERT(myBaseImpl);
2858
2859 //  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2860 //    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2861 //  }
2862
2863 //  string theFaceEntry = theFace->GetStudyEntry();
2864   
2865 //  if (theFaceEntry.empty()) {
2866 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2867 //    string aName;
2868 //    if (theFace->GetShapeType() == GEOM::FACE)
2869 //      aName = "Face_";
2870 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
2871 //      aName = "Compound_";
2872 //    aName += theFace->GetEntry();
2873 //    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2874 //    if (!theSFace->_is_nil())
2875 //      theFaceEntry = theSFace->GetID();
2876 //  }
2877 //  if (theFaceEntry.empty())
2878 //    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2879
2880 //  try {
2881 //    return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2882 //  } catch (SALOME_Exception& ex) {
2883 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2884 //  }
2885 //}
2886
2887 /*!
2888  * Get the list of all enforced vertices
2889  */
2890 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2891   throw (SALOME::SALOME_Exception) {
2892   ASSERT(myBaseImpl);
2893
2894   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2895     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2896   }
2897
2898   string theFaceEntry = theFace->GetStudyEntry();
2899   
2900   if (theFaceEntry.empty()) {
2901     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2902     string aName;
2903     if (theFace->GetShapeType() == GEOM::FACE)
2904       aName = "Face_";
2905     if (theFace->GetShapeType() == GEOM::COMPOUND)
2906       aName = "Compound_";
2907     aName += theFace->GetEntry();
2908     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2909     if (!theSFace->_is_nil())
2910       theFaceEntry = theSFace->GetID();
2911   }
2912   if (theFaceEntry.empty())
2913     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2914
2915   try {
2916     return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2917   } catch (SALOME_Exception& ex) {
2918     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2919   }
2920 }
2921
2922 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2923                                                     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2924   ASSERT(myBaseImpl);
2925
2926   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2927     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2928   }
2929
2930   string theFaceEntry = theFace->GetStudyEntry();
2931   
2932   if (theFaceEntry.empty()) {
2933     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2934     string aName;
2935     if (theFace->GetShapeType() == GEOM::FACE)
2936       aName = "Face_";
2937     if (theFace->GetShapeType() == GEOM::COMPOUND)
2938       aName = "Compound_";
2939     aName += theFace->GetEntry();
2940     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2941     if (!theSFace->_is_nil())
2942       theFaceEntry = theSFace->GetID();
2943   }
2944   if (theFaceEntry.empty())
2945     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2946
2947   try {
2948     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2949   } catch (SALOME_Exception& ex) {
2950     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2951   }
2952 }
2953
2954 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2955   throw (SALOME::SALOME_Exception) {
2956   ASSERT(myBaseImpl);
2957
2958   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2959     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2960   }
2961   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2962     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2963   }
2964
2965   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2966   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations();
2967   //  if (CORBA::is_nil(measureOp))
2968   //    return false;
2969   //
2970   //  CORBA::Double x, y, z;
2971   //  x = y = z = 0.;
2972   //  measureOp->PointCoordinates(theVertex, x, y, z);
2973
2974   std::string theFaceEntry = theFace->GetStudyEntry();
2975   std::string theVertexEntry = theVertex->GetStudyEntry();
2976   
2977   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
2978   string aName;
2979   
2980   if (theFaceEntry.empty()) {
2981     if (theFace->GetShapeType() == GEOM::FACE)
2982       aName = "Face_";
2983     if (theFace->GetShapeType() == GEOM::COMPOUND)
2984       aName = "Compound_";
2985     aName += theFace->GetEntry();
2986     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
2987     if (!theSFace->_is_nil())
2988       theFaceEntry = theSFace->GetID();
2989   }
2990   if (theFaceEntry.empty())
2991     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2992   
2993   if (theVertexEntry.empty()) {
2994     if (theVertex->GetShapeType() == GEOM::VERTEX)
2995       aName = "Vertex_";
2996     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2997       aName = "Compound_";
2998     aName += theVertex->GetEntry();
2999     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(NULL, theVertex, aName.c_str());
3000     if (!theSVertex->_is_nil())
3001       theVertexEntry = theSVertex->GetID();
3002   }
3003   if (theVertexEntry.empty())
3004     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3005   
3006
3007   try {
3008     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
3009   } catch (SALOME_Exception& ex) {
3010     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3011   }
3012 }
3013
3014 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
3015   ASSERT(myBaseImpl);
3016
3017   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3018     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3019   }
3020
3021   string theFaceEntry = theFace->GetStudyEntry();
3022   
3023   if (theFaceEntry.empty()) {
3024     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3025     string aName;
3026     if (theFace->GetShapeType() == GEOM::FACE)
3027       aName = "Face_";
3028     if (theFace->GetShapeType() == GEOM::COMPOUND)
3029       aName = "Compound_";
3030     aName += theFace->GetEntry();
3031     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3032     if (!theSFace->_is_nil())
3033       theFaceEntry = theSFace->GetID();
3034   }
3035   if (theFaceEntry.empty())
3036     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3037   
3038
3039   try {
3040     return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
3041   } catch (SALOME_Exception& ex) {
3042     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3043   }
3044 }
3045
3046 /*!
3047  * Set/get/unset an enforced vertex on face - NEW (no face)
3048  */
3049 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3050 {
3051   ASSERT(myBaseImpl);
3052
3053   try {
3054     return SetEnforcedVertexEntry("", x, y, z);
3055   } catch (SALOME_Exception& ex) {
3056     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3057   }
3058 }
3059
3060 /*!
3061  * Set/get/unset an enforced vertex with name on face
3062  */
3063 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception)
3064 {
3065   try {
3066     return SetEnforcedVertexEntry("", x, y, z, theVertexName);
3067   } catch (SALOME_Exception& ex) {
3068     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3069   }
3070 }
3071
3072 /*!
3073  * Set/get/unset an enforced vertex with geom object on face
3074  */
3075 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3076   throw (SALOME::SALOME_Exception)
3077 {
3078   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3079     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3080   }
3081   string theVertexEntry = theVertex->GetStudyEntry();
3082   
3083   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3084   string aName;
3085   
3086   if (theVertexEntry.empty()) {
3087     if (theVertex->GetShapeType() == GEOM::VERTEX)
3088       aName = "Vertex_";
3089     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3090       aName = "Compound_";
3091     aName += theVertex->GetEntry();
3092     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3093     if (!theSVertex->_is_nil())
3094       theVertexEntry = theSVertex->GetID();
3095   }
3096   if (theVertexEntry.empty())
3097     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3098
3099   string theVertexName = theVertex->GetName();
3100   try {
3101     return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
3102   } catch (SALOME_Exception& ex) {
3103     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3104   }
3105 }
3106
3107 /*!
3108  * Set an enforced vertex with group name on face
3109  */
3110 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
3111   throw (SALOME::SALOME_Exception)
3112 {
3113   ASSERT(myBaseImpl);
3114
3115   try {
3116     return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName);
3117   } catch (SALOME_Exception& ex) {
3118     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3119   }
3120 }
3121
3122 /*!
3123  * Set an enforced vertex with name and group name on face
3124  */
3125 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, 
3126                                                                 const char* theVertexName, const char* theGroupName)
3127   throw (SALOME::SALOME_Exception)
3128 {
3129   ASSERT(myBaseImpl);
3130
3131   try {
3132     return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName);
3133   } catch (SALOME_Exception& ex) {
3134     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3135   }
3136 }
3137
3138 /*!
3139  * Set an enforced vertex with geom entry and group name on face
3140  */
3141 bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
3142   throw (SALOME::SALOME_Exception)
3143 {
3144   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3145     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3146   }
3147
3148   string theVertexEntry = theVertex->GetStudyEntry();
3149   
3150   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3151   string aName;
3152   
3153   if (theVertexEntry.empty()) {
3154     if (theVertex->GetShapeType() == GEOM::VERTEX)
3155       aName = "Vertex_";
3156     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3157       aName = "Compound_";
3158     aName += theVertex->GetEntry();
3159     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3160     if (!theSVertex->_is_nil())
3161       theVertexEntry = theSVertex->GetID();
3162   }
3163   if (theVertexEntry.empty())
3164     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3165
3166   string theVertexName = theVertex->GetName();
3167   try {
3168     return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
3169   } catch (SALOME_Exception& ex) {
3170     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3171   }
3172 }
3173
3174 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception)
3175 {
3176   try {
3177     return UnsetEnforcedVertexEntry("", x, y, z);
3178   } catch (SALOME_Exception& ex) {
3179     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3180   }
3181 }
3182
3183 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex)
3184   throw (SALOME::SALOME_Exception)
3185 {
3186   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
3187     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
3188   }
3189   std::string theVertexEntry = theVertex->GetStudyEntry();
3190   
3191   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theVertex );
3192   string aName;
3193   
3194   if (theVertexEntry.empty()) {
3195     if (theVertex->GetShapeType() == GEOM::VERTEX)
3196       aName = "Vertex_";
3197     if (theVertex->GetShapeType() == GEOM::COMPOUND)
3198       aName = "Compound_";
3199     aName += theVertex->GetEntry();
3200     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy( NULL, theVertex, aName.c_str());
3201     if (!theSVertex->_is_nil())
3202       theVertexEntry = theSVertex->GetID();
3203   }
3204   if (theVertexEntry.empty())
3205     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3206   
3207   try {
3208     return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str());
3209   } catch (SALOME_Exception& ex) {
3210     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3211   }
3212 }
3213
3214 bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception)
3215 {
3216   try {
3217     return UnsetEnforcedVerticesEntry("");
3218   } catch (SALOME_Exception& ex) {
3219     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3220   }
3221 }
3222
3223 /*!
3224  * Set/get/unset an enforced vertex on geom object given by entry
3225  */
3226 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry,
3227                                                        CORBA::Double x,
3228                                                        CORBA::Double y,
3229                                                        CORBA::Double z,
3230                                                        const char* theVertexName,
3231                                                        const char* theVertexEntry,
3232                                                        const char* theGroupName)
3233   throw (SALOME::SALOME_Exception)
3234 {
3235   bool newValue = false;
3236   if (string(theVertexEntry).empty()) {
3237     try {
3238       ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
3239         this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
3240       ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
3241       coords.push_back(x);
3242       coords.push_back(y);
3243       coords.push_back(z);
3244       if (coordsList.find(coords) == coordsList.end()) {
3245         newValue = true;
3246       } else {
3247         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
3248         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3249           newValue = true;
3250         }
3251       }
3252     } catch (const std::invalid_argument& ex) {
3253       // no enforced vertex for entry
3254       newValue = true;
3255     }
3256     if (newValue) {
3257       if (string(theVertexName).empty()) {
3258         if (string(theGroupName).empty())
3259           SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")";
3260         else
3261           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
3262       }
3263       else {
3264         if (string(theGroupName).empty())
3265           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
3266         else
3267           SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \""
3268                                << theVertexName << "\", \"" << theGroupName << "\")";
3269       }
3270     }
3271   } else {
3272     try {
3273       ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
3274       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
3275       if ( it == enfVertexEntryList.end()) {
3276         newValue = true;
3277       }
3278       else {
3279         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
3280         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
3281           newValue = true;
3282         }
3283       }
3284     } catch (const std::invalid_argument& ex) {
3285       // no enforced vertex for entry
3286       newValue = true;
3287     }
3288     if (newValue) {
3289       if (string(theGroupName).empty())
3290         SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")";
3291       else
3292         SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")";
3293     }
3294   }
3295
3296   if (newValue)
3297     this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
3298
3299   return newValue;
3300 }
3301
3302 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
3303   throw (SALOME::SALOME_Exception)
3304 {
3305   try {
3306     BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
3307     ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
3308     vertexList->length(_vList.size());
3309     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
3310     for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
3311       ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
3312
3313       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
3314
3315       // Name
3316       enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
3317       // Geom Vertex Entry
3318       enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
3319       // Coords
3320       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
3321       coords->length(_enfVertex->coords.size());
3322       for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
3323         coords[ind] = _enfVertex->coords[ind];
3324       enfVertex->coords = coords;
3325       // Group Name
3326       enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
3327       // Face entry list
3328       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
3329       faceEntryList->length(_enfVertex->faceEntries.size());
3330       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
3331       for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
3332         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
3333       enfVertex->faceEntries = faceEntryList;
3334
3335       vertexList[i] = enfVertex;
3336     }
3337     return vertexList._retn();
3338   } catch (const std::invalid_argument& ex) {
3339     SALOME::ExceptionStruct ExDescription;
3340     ExDescription.text = ex.what();
3341     ExDescription.type = SALOME::BAD_PARAM;
3342     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
3343     ExDescription.lineNumber = 1385;
3344     throw SALOME::SALOME_Exception(ExDescription);
3345   } catch (const std::exception& ex) {
3346     std::cout << "Exception: " << ex.what() << std::endl;
3347     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3348   }
3349 }
3350
3351 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception)
3352 {
3353   ASSERT(myBaseImpl);
3354
3355   bool res = false;
3356   try {
3357     res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
3358
3359     if (string(theVertexEntry).empty())
3360       SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z
3361                            << ")";
3362     else
3363       SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")";
3364
3365   } catch (const std::invalid_argument& ex) {
3366     return false;
3367   } catch (const std::exception& ex) {
3368     std::cout << "Exception: " << ex.what() << std::endl;
3369     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3370   }
3371
3372   return res;
3373 }
3374 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception)
3375 {
3376   ASSERT(myBaseImpl);
3377
3378   try {
3379     this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
3380     SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()";
3381   } catch (const std::invalid_argument& ex) {
3382     return false;
3383   } catch (const std::exception& ex) {
3384     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3385   }
3386
3387   return true;
3388 }
3389
3390 //=============================================================================
3391 /*!
3392  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
3393  *
3394  *  Set true or false
3395  */
3396 //=============================================================================
3397 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue)
3398 {
3399   ASSERT(myBaseImpl);
3400   this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
3401   std::string theValueStr = theValue ? "True" : "False";
3402   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
3403 }
3404
3405 //=============================================================================
3406 /*!
3407  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
3408  *
3409  *  Get true or false
3410  */
3411 //=============================================================================
3412 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces()
3413 {
3414   ASSERT(myBaseImpl);
3415   return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
3416 }
3417
3418 //=============================================================================
3419 /*!
3420  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
3421  *
3422  *  Set group name
3423  */
3424 //=============================================================================
3425 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char*  groupName)
3426 {
3427   ASSERT(myBaseImpl);
3428   this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
3429   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
3430 }
3431
3432 //=============================================================================
3433 /*!
3434  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
3435  *
3436  *  Get group name
3437  */
3438 //=============================================================================
3439 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup()
3440 {
3441   ASSERT(myBaseImpl);
3442   return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
3443 }
3444
3445 /*
3446  * Enable internal enforced vertices on specific face if requested by user
3447  *
3448  void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
3449  throw (SALOME::SALOME_Exception)
3450  {
3451  try {
3452  SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
3453  } catch (SALOME_Exception& ex) {
3454  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3455  }
3456  }
3457
3458  void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3459  throw (SALOME::SALOME_Exception)
3460  {
3461
3462  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
3463  THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
3464  }
3465
3466  string theFaceEntry = theFace->GetStudyEntry();
3467
3468  if (theFaceEntry.empty()) {
3469  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( theFace );
3470  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
3471  string aName;
3472  if (theFace->GetShapeType() == GEOM::FACE)
3473  aName = "Face_";
3474  if (theFace->GetShapeType() == GEOM::COMPOUND)
3475  aName = "Compound_";
3476  aName += theFace->GetEntry();
3477  SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(NULL, theFace, aName.c_str());
3478  if (!theSFace->_is_nil())
3479  theFaceEntry = theSFace->GetID();
3480  }
3481  if (theFaceEntry.empty())
3482  THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3483
3484  try {
3485  SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
3486  } catch (SALOME_Exception& ex) {
3487  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3488  }
3489  }
3490
3491  void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
3492  throw (SALOME::SALOME_Exception)
3493  {
3494  ASSERT(myBaseImpl);
3495  try {
3496  this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
3497  std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
3498  if (string(theGroupName).empty())
3499  SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
3500  else
3501  SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
3502  } catch (const std::exception& ex) {
3503  std::cout << "Exception: " << ex.what() << std::endl;
3504  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3505  }
3506  }
3507
3508 */
3509
3510 /* TODO GROUPS
3511    char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
3512    throw (SALOME::SALOME_Exception)
3513    {
3514    ASSERT(myBaseImpl);
3515    try {
3516    return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
3517    }
3518    catch (const std::invalid_argument& ex) {
3519    SALOME::ExceptionStruct ExDescription;
3520    ExDescription.text = ex.what();
3521    ExDescription.type = SALOME::BAD_PARAM;
3522    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
3523    ExDescription.lineNumber = 1146;
3524    throw SALOME::SALOME_Exception(ExDescription);
3525    }
3526    catch (SALOME_Exception& ex) {
3527    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3528    }
3529    return 0;
3530    }
3531
3532
3533    void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
3534    throw (SALOME::SALOME_Exception)
3535    {
3536    ASSERT(myBaseImpl);
3537    try {
3538    this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
3539    }
3540    catch (const std::invalid_argument& ex) {
3541    SALOME::ExceptionStruct ExDescription;
3542    ExDescription.text = ex.what();
3543    ExDescription.type = SALOME::BAD_PARAM;
3544    ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
3545    ExDescription.lineNumber = 1170;
3546    throw SALOME::SALOME_Exception(ExDescription);
3547    }
3548    catch (SALOME_Exception& ex) {
3549    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3550    }
3551
3552    SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
3553    << x << ", " << y << ", " << z << ", '" << groupName << "' )";
3554
3555    }
3556 */
3557 ///////////////////////
3558
3559 ///////////////////////
3560 // PERIODICITY       //
3561 ///////////////////////
3562
3563
3564 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
3565 {
3566   std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
3567   MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
3568   MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
3569   MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
3570   MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
3571   MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
3572   MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
3573   MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
3574   MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
3575   MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
3576   std::string txtShapeType = MapShapeTypeToString[theShapeType];
3577   return txtShapeType;
3578 }
3579
3580 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
3581 {
3582   // Check shape types
3583   bool ok = false;
3584   std::stringstream typesTxt;
3585   for (std::size_t i=0; i<theShapeTypes.size(); i++)
3586   {
3587     GEOM::shape_type theShapeType = theShapeTypes[i];
3588     if (shape->GetShapeType() == theShapeType)
3589       ok = true;
3590     typesTxt << ShapeTypeToString(theShapeType);
3591     if (i < theShapeTypes.size()-1 )
3592       typesTxt << ", ";
3593   }
3594   if (!ok){
3595     std::stringstream msg;
3596     msg << "shape type is not in" << typesTxt.str();
3597     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3598   }
3599 }
3600
3601 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
3602 {
3603   // Check shape type
3604   if (shape->GetShapeType() != theShapeType) {
3605     std::stringstream msg;
3606     msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
3607     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
3608   }
3609 }
3610
3611 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
3612 {
3613   // Check shape is published in the object browser
3614   string shapeEntry = shape->GetStudyEntry();
3615
3616   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine( shape );
3617   string aName;
3618
3619   // Publish shape if needed
3620   if (shapeEntry.empty()) {
3621     if (shape->GetShapeType() == theShapeType)
3622       aName = prefix;
3623     aName += shape->GetEntry();
3624     SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(NULL, shape, aName.c_str());
3625     if (!theSFace1->_is_nil())
3626       shapeEntry = theSFace1->GetID();
3627   }
3628   if (shapeEntry.empty())
3629     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
3630   return shapeEntry;
3631 }
3632
3633 // Format the output of two vectors to use it in MESSAGE and PythonDump
3634 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
3635 {
3636   std::stringstream listEntriesTxt;
3637
3638   if (!theSourceVerticesEntries.empty())
3639   {
3640     listEntriesTxt << ", [" ;
3641     size_t i =0;
3642     for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
3643     {
3644       if (i>0)
3645         listEntriesTxt << ", ";
3646       listEntriesTxt << *it;
3647     }
3648
3649     listEntriesTxt << "], [" ;
3650     i =0;
3651     for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
3652     {
3653       if (i>0)
3654         listEntriesTxt << ", ";
3655       listEntriesTxt << *it;
3656     }
3657     listEntriesTxt << "]" ;
3658   }
3659   return listEntriesTxt.str();
3660 }
3661
3662 /**
3663  * Erase all PreCad periodicity associations
3664  */
3665 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
3666   ASSERT(myBaseImpl);
3667   this->GetImpl()->ClearPreCadPeriodicityVectors();
3668   SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
3669 }
3670
3671 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
3672 {
3673   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3674     this->GetImpl()->_GetPreCadFacesPeriodicityVector();
3675
3676   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3677
3678   return periodicityList._retn();
3679 }
3680
3681 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
3682 {
3683   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
3684     this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
3685
3686   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
3687
3688   return periodicityList._retn();
3689 }
3690
3691 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
3692 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
3693 {
3694   BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
3695
3696   periodicityList->length(preCadPeriodicityVector.size());
3697
3698   for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
3699   {
3700     ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
3701
3702     BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
3703     myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
3704     myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
3705
3706     BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
3707     if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
3708     {
3709       sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
3710       for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
3711         sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
3712     }
3713
3714     myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
3715
3716     BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
3717     if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
3718     {
3719       targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
3720       for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
3721         targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
3722     }
3723
3724     myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
3725
3726     periodicityList[i] = myPreCadPeriodicity;
3727   }
3728
3729
3730   return periodicityList._retn();
3731 }
3732
3733
3734 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3735   throw (SALOME::SALOME_Exception)
3736 {
3737   ASSERT(myBaseImpl);
3738   const GEOM::ListOfGO theSourceVertices;
3739   const GEOM::ListOfGO theTargetVertices;
3740   AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
3741 }
3742
3743
3744 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
3745                                                                       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3746   throw (SALOME::SALOME_Exception)
3747 {
3748   ASSERT(myBaseImpl);
3749
3750   size_t theLength = theSourceVertices.length();
3751   if (theLength != theTargetVertices.length())
3752     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3753
3754   std::vector<GEOM::shape_type> allowedShapeTypes;
3755   allowedShapeTypes.push_back(GEOM::FACE);
3756   allowedShapeTypes.push_back(GEOM::COMPOUND);
3757
3758   string prefix1 = "Source_face_";
3759   CheckShapeTypes(theFace1, allowedShapeTypes);
3760   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3761
3762   string prefix2 = "Target_face_";
3763   CheckShapeTypes(theFace2, allowedShapeTypes);
3764   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3765
3766   string prefix3 = "Source_vertex_";
3767   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3768   theSourceVerticesEntries->length(theLength);
3769   GEOM::GEOM_Object_ptr theVtx_i;
3770   string theEntry_i;
3771   for (size_t ind = 0; ind < theLength; ind++) {
3772     theVtx_i = theSourceVertices[ind];
3773     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3774     theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3775   }
3776
3777   string prefix4 = "Target_vertex_";
3778   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3779   theTargetVerticesEntries->length(theLength);
3780   for (size_t ind = 0; ind < theLength; ind++) {
3781     theVtx_i = theTargetVertices[ind];
3782     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3783     theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3784   }
3785
3786   string theFace2Name = theFace2->GetName();
3787   try {
3788     AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
3789                                    theSourceVerticesEntries, theTargetVerticesEntries);
3790   } catch (SALOME_Exception& ex) {
3791     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3792   }
3793 }
3794
3795
3796 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
3797                                                                const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3798   throw (SALOME::SALOME_Exception)
3799 {
3800
3801   ASSERT(myBaseImpl);
3802
3803   // Convert BLSURFPlugin::TEntryList to vector<string>
3804   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3805   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3806     theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3807     theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3808   }
3809
3810   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3811
3812
3813   this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
3814                                              theSourceVerticesEntries, theTargetVerticesEntries);
3815
3816   SMESH::TPythonDump pd;
3817   if (!theSourceVerticesEntries.empty())
3818   {
3819     pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
3820     pd << listEntriesTxt.c_str();
3821     pd << ")";
3822   }
3823   else
3824     pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3825 }
3826
3827 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
3828   throw (SALOME::SALOME_Exception)
3829 {
3830   ASSERT(myBaseImpl);
3831   const GEOM::ListOfGO theSourceVertices;
3832   const GEOM::ListOfGO theTargetVertices;
3833   AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
3834 }
3835
3836 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
3837                                                                       const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
3838   throw (SALOME::SALOME_Exception)
3839 {
3840   ASSERT(myBaseImpl);
3841
3842   size_t theLength = theSourceVertices.length();
3843   if (theLength != theTargetVertices.length())
3844     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
3845
3846   std::vector<GEOM::shape_type> allowedShapeTypes;
3847   allowedShapeTypes.push_back(GEOM::EDGE);
3848   allowedShapeTypes.push_back(GEOM::COMPOUND);
3849
3850   string prefix1 = "Source_edge_";
3851   CheckShapeTypes(theEdge1, allowedShapeTypes);
3852   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3853
3854   string prefix2 = "Target_edge_";
3855   CheckShapeTypes(theEdge2, allowedShapeTypes);
3856   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3857
3858   string prefix3 = "Source_vertex_";
3859   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3860   theSourceVerticesEntries->length(theLength);
3861   GEOM::GEOM_Object_ptr theVtx_i;
3862   string theEntry_i;
3863   for (size_t ind = 0; ind < theLength; ind++) {
3864     theVtx_i = theSourceVertices[ind];
3865     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3866     theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3867   }
3868
3869   string prefix4 = "Target_vertex_";
3870   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3871   theTargetVerticesEntries->length(theLength);
3872   for (size_t ind = 0; ind < theLength; ind++) {
3873     theVtx_i = theTargetVertices[ind];
3874     theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3875     theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3876   }
3877
3878   string theEdge2Name = theEdge2->GetName();
3879   try {
3880     AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3881                                    theSourceVerticesEntries, theTargetVerticesEntries);
3882   } catch (SALOME_Exception& ex) {
3883     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3884   }
3885 }
3886
3887
3888 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3889                                                                const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3890   throw (SALOME::SALOME_Exception)
3891 {
3892
3893   ASSERT(myBaseImpl);
3894
3895   // Convert BLSURFPlugin::TEntryList to vector<string>
3896   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3897   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3898     theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3899     theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3900   }
3901
3902   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3903
3904   this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3905                                              theSourceVerticesEntries, theTargetVerticesEntries);
3906
3907   SMESH::TPythonDump pd;
3908   if (!theSourceVerticesEntries.empty())
3909   {
3910     pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3911     pd << listEntriesTxt.c_str();
3912     pd << ")";
3913   }
3914   else
3915     pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3916
3917 }
3918
3919
3920 //================================================================================
3921 /*!
3922  * \brief Sets the file for export resulting mesh in GMF format
3923  * \param theFileName - full name of the file (.mesh, .meshb)
3924  * 
3925  * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3926  */
3927 //================================================================================  
3928 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3929 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3930   ASSERT(myBaseImpl);
3931   bool valueChanged/*, modeChanged*/ = false;
3932   try {
3933     valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3934     //     modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3935     if (valueChanged)// or (!valueChanged && modeChanged))
3936       this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3937   } catch (const std::exception& ex) {
3938     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3939   }
3940   if (valueChanged)// or (!valueChanged && modeChanged))
3941     SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3942 }
3943
3944 //================================================================================
3945 /*!
3946  * \brief Gets the file name for export resulting mesh in GMF format
3947  * \retval char* - The file name
3948  * 
3949  * Returns the GMF file name
3950  */
3951 //================================================================================  
3952 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3953   ASSERT(myBaseImpl);
3954   return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3955 }
3956
3957 // //================================================================================
3958 // /*!
3959 //  * \brief Gets the file mode for export resulting mesh in GMF format
3960 //  * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3961 //  * 
3962 //  * Returns the GMF file mode
3963 //  */
3964 // //================================================================================  
3965 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3966 //   ASSERT(myBaseImpl);
3967 //   return this->GetImpl()->GetGMFFileMode();
3968 // }
3969
3970 //=============================================================================
3971 /*!
3972  *  BLSURFPlugin_Hypothesis_i::GetImpl
3973  *
3974  *  Get implementation
3975  */
3976 //=============================================================================
3977 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3978   return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3979 }
3980
3981 //================================================================================
3982 /*!
3983  * \brief Verify whether hypothesis supports given entity type
3984  * \param type - dimension (see SMESH::Dimension enumeration)
3985  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3986  *
3987  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3988  */
3989 //================================================================================
3990 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3991   return type == SMESH::DIM_2D;
3992 }
3993
3994
3995 //================================================================================
3996 /*!
3997  * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
3998  */
3999 //================================================================================
4000
4001 bool
4002 BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
4003                                                std::vector< int >         & subIDArray ) const
4004 {
4005   typedef ::BLSURFPlugin_Hypothesis BH;
4006   const BH* impl = static_cast<const BH*>( myBaseImpl );
4007
4008   {
4009     const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
4010     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4011     for ( ; entry2size != sizeMap.cend(); ++entry2size )
4012       entryArray.push_back( entry2size->first );
4013   }
4014   {
4015     const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
4016     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4017     for ( ; entry2size != sizeMap.cend(); ++entry2size )
4018       entryArray.push_back( entry2size->first );
4019   }
4020   {
4021     const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
4022     BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
4023     for ( ; entry2size != classAttractors.cend(); ++entry2size )
4024       entryArray.push_back( entry2size->first );
4025   }
4026   {
4027     const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
4028     BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
4029     for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
4030     {
4031       entryArray.push_back( entry2evList->first );
4032
4033       const BH::TEnfVertexList& evList = entry2evList->second;
4034       BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
4035       for ( ; evIt != evList.cend(); ++evIt )
4036       {
4037         const BH::TEnfVertex* ev = *evIt;
4038         entryArray.push_back( ev->geomEntry );
4039         entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
4040       }
4041     }
4042   }
4043   // { // duplicated data of faceEntryEnfVertexListMap
4044   //   const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
4045   //   const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
4046   //   const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV  //   const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert  // }
4047   {
4048     const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
4049     BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
4050     for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
4051     {
4052       entryArray.push_back( pcp->shape1Entry );
4053       entryArray.push_back( pcp->shape2Entry );
4054       entryArray.insert( entryArray.end(),
4055                          pcp->theSourceVerticesEntries.cbegin(),
4056                          pcp->theSourceVerticesEntries.cend() );
4057       entryArray.insert( entryArray.end(),
4058                          pcp->theTargetVerticesEntries.cbegin(),
4059                          pcp->theTargetVerticesEntries.cend() );
4060     }
4061   }
4062   {
4063     const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
4064     BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
4065     for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
4066     {
4067       entryArray.push_back( pcp->shape1Entry );
4068       entryArray.push_back( pcp->shape2Entry );
4069       entryArray.insert( entryArray.end(),
4070                          pcp->theSourceVerticesEntries.cbegin(),
4071                          pcp->theSourceVerticesEntries.cend() );
4072       entryArray.insert( entryArray.end(),
4073                          pcp->theTargetVerticesEntries.cbegin(),
4074                          pcp->theTargetVerticesEntries.cend() );
4075     }
4076   }
4077   {
4078     const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
4079     BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
4080     for ( ; idSet != hyperPatchList.cend(); ++idSet )
4081     {
4082       subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
4083     }
4084   }
4085   return true;
4086 }
4087
4088 //================================================================================
4089 /*!
4090  * \brief Set new geometry instead of that returned by getObjectsDependOn()
4091  */
4092 //================================================================================
4093
4094 bool
4095 BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
4096                                                std::vector< int >         & subIDArray )
4097 {
4098   typedef ::BLSURFPlugin_Hypothesis BH;
4099   BH* impl = static_cast<BH*>( myBaseImpl );
4100
4101   size_t iEnt = 0;
4102   {
4103     BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
4104     BH::TSizeMap sizeMap;
4105     sizeMap.swap( sizeMapNew );
4106     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4107     for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4108       if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4109         sizeMapNew[ entryArray[ iEnt ]] =  entry2size->second;
4110   }
4111   {
4112     BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
4113     BH::TSizeMap sizeMap;
4114     sizeMap.swap( sizeMapNew );
4115     BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
4116     for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
4117       if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4118         sizeMapNew[ entryArray[ iEnt ]] =  entry2size->second;
4119   }
4120   {
4121     BH::TAttractorMap& attrMapNew =
4122       const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
4123     BH::TAttractorMap attrMap;
4124     attrMap.swap( attrMapNew );
4125     BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
4126     for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
4127       if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
4128         attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
4129       else
4130         delete entry2size->second;
4131   }
4132   {
4133     BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
4134       const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
4135     BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
4136     faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
4137
4138     BH::TEnfVertexList& enfVertexList =
4139       const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
4140     enfVertexList.clear(); // avoid removal
4141
4142     impl->ClearAllEnforcedVertices();
4143
4144     BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
4145     for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
4146     {
4147       const BH::TEntry& entry = entryArray[ iEnt++ ];
4148       bool faceOk = ( entry.empty() == entry2evList->first.empty() );
4149
4150       BH::TEnfVertexList& evList = entry2evList->second;
4151       BH::TEnfVertexList::iterator evIt = evList.begin();
4152       for ( ; evIt != evList.end(); ++evIt )
4153       {
4154         BH::TEnfVertex* ev = *evIt;
4155         bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
4156         ev->geomEntry = entryArray[ iEnt++ ];
4157         BH::TEntryList faceEntriesNew;
4158         BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
4159         for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
4160         {
4161           if ( !entryArray[ iEnt ].empty() )
4162             faceEntriesNew.insert( entryArray[ iEnt ]);
4163         }
4164         if ( ok )
4165         {
4166           ev->faceEntries.swap( faceEntriesNew );
4167           impl->AddEnforcedVertex( entry, ev );
4168         }
4169         else
4170         {
4171           delete ev;
4172         }
4173       }
4174     }
4175   }
4176   {
4177     BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4178       const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
4179     BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4180     for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4181     {
4182       pcp->shape1Entry = entryArray[ iEnt++ ];
4183       pcp->shape2Entry = entryArray[ iEnt++ ];
4184       for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4185         pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4186
4187       for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4188         pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4189     }
4190   }
4191   {
4192     BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
4193       const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
4194     BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
4195     for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
4196     {
4197       pcp->shape1Entry = entryArray[ iEnt++ ];
4198       pcp->shape2Entry = entryArray[ iEnt++ ];
4199       for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
4200         pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
4201
4202       for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
4203         pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
4204     }
4205   }
4206
4207   size_t iID = 0;
4208   {
4209     BH::THyperPatchList& hyperPatchListNew =
4210       const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
4211     BH::THyperPatchList hyperPatchList;
4212     hyperPatchList.swap( hyperPatchListNew );
4213     BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
4214     for ( ; idSet != hyperPatchList.end(); ++idSet )
4215     {
4216       BH::THyperPatchTags& ids = *idSet;
4217       BH::THyperPatchTags idsNew;
4218       BH::THyperPatchTags::iterator i = ids.begin();
4219       for ( ; i != ids.end(); ++i, ++iID )
4220         if ( subIDArray[ iID ] > 0 )
4221           idsNew.insert( subIDArray[ iID ]);
4222       if ( !idsNew.empty() )
4223         hyperPatchListNew.push_back( idsNew );
4224     }
4225   }
4226
4227   return ( iEnt == entryArray.size() && iID == subIDArray.size() );
4228 }