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