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