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