]> SALOME platform Git repositories - plugins/blsurfplugin.git/blob - src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
Salome HOME
remove "using namespace std" from SMESH headers
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.cxx
1 // Copyright (C) 2007-2015  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  *  BLSURFPlugin_Hypothesis_i::SetGradation
244  *
245  *  Set Gradation
246  */
247 //=============================================================================
248 void BLSURFPlugin_Hypothesis_i::SetGradation(CORBA::Double theValue) {
249   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
250   ASSERT(myBaseImpl);
251   this->GetImpl()->SetGradation(theValue);
252   SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
253 }
254
255 //=============================================================================
256 /*!
257  *  BLSURFPlugin_Hypothesis_i::GetGradation
258  *
259  *  Get Gradation
260  */
261 //=============================================================================
262 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() {
263   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
264   ASSERT(myBaseImpl);
265   return this->GetImpl()->GetGradation();
266 }
267
268 //=============================================================================
269 /*!
270  *  BLSURFPlugin_Hypothesis_i::SetQuadAllowed
271  *
272  *  Set true or false
273  */
274 //=============================================================================
275 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed(CORBA::Boolean theValue) {
276   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
277   ASSERT(myBaseImpl);
278   this->GetImpl()->SetQuadAllowed(theValue);
279   std::string theValueStr = theValue ? "True" : "False";
280   SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
281 }
282
283 //=============================================================================
284 /*!
285  *  BLSURFPlugin_Hypothesis_i::GetQuadAllowed
286  *
287  *  Get true or false
288  */
289 //=============================================================================
290 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() {
291   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
292   ASSERT(myBaseImpl);
293   return this->GetImpl()->GetQuadAllowed();
294 }
295
296 //=============================================================================
297 /*!
298  *  BLSURFPlugin_Hypothesis_i::SetAngleMesh
299  *
300  *  Set AngleMesh
301  */
302 //=============================================================================
303 void BLSURFPlugin_Hypothesis_i::SetAngleMesh(CORBA::Double theValue) {
304   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMesh");
305   ASSERT(myBaseImpl);
306   this->GetImpl()->SetAngleMesh(theValue);
307   SMESH::TPythonDump() << _this() << ".SetAngleMesh( " << theValue << " )";
308 }
309
310 //=============================================================================
311 /*!
312  *  BLSURFPlugin_Hypothesis_i::GetAngleMesh
313  *
314  *  Get AngleMesh
315  */
316 //=============================================================================
317 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMesh() {
318   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMesh");
319   ASSERT(myBaseImpl);
320   return this->GetImpl()->GetAngleMesh();
321 }
322
323 //=============================================================================
324 /*!
325  *  BLSURFPlugin_Hypothesis_i::SetChordalError
326  *
327  *  Set Chordal Error
328  */
329 //=============================================================================
330 void BLSURFPlugin_Hypothesis_i::SetChordalError(CORBA::Double theValue) {
331   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetChordalError");
332   ASSERT(myBaseImpl);
333   this->GetImpl()->SetChordalError(theValue);
334   SMESH::TPythonDump() << _this() << ".SetChordalError( " << theValue << " )";
335 }
336
337 //=============================================================================
338 /*!
339  *  BLSURFPlugin_Hypothesis_i::GetChordalError
340  *
341  *  Get Chordal Error
342  */
343 //=============================================================================
344 CORBA::Double BLSURFPlugin_Hypothesis_i::GetChordalError() {
345   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetChordalError");
346   ASSERT(myBaseImpl);
347   return this->GetImpl()->GetChordalError();
348 }
349
350 //=============================================================================
351 /*!
352  *  BLSURFPlugin_Hypothesis_i::SetAnisotropic
353  *
354  *  Set true or false
355  */
356 //=============================================================================
357 void BLSURFPlugin_Hypothesis_i::SetAnisotropic(CORBA::Boolean theValue) {
358   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropic");
359   ASSERT(myBaseImpl);
360   this->GetImpl()->SetAnisotropic(theValue);
361   std::string theValueStr = theValue ? "True" : "False";
362   SMESH::TPythonDump() << _this() << ".SetAnisotropic( " << theValueStr.c_str() << " )";
363 }
364
365 //=============================================================================
366 /*!
367  *  BLSURFPlugin_Hypothesis_i::GetAnisotropic
368  *
369  *  Get true or false
370  */
371 //=============================================================================
372 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetAnisotropic() {
373   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropic");
374   ASSERT(myBaseImpl);
375   return this->GetImpl()->GetAnisotropic();
376 }
377
378 //=============================================================================
379 /*!
380  *  BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio
381  *
382  *  Set Anisotropic Ratio
383  */
384 //=============================================================================
385 void BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio(CORBA::Double theValue) {
386   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAnisotropicRatio");
387   ASSERT(myBaseImpl);
388   this->GetImpl()->SetAnisotropicRatio(theValue);
389   SMESH::TPythonDump() << _this() << ".SetAnisotropicRatio( " << theValue << " )";
390 }
391
392 //=============================================================================
393 /*!
394  *  BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio
395  *
396  *  Get Anisotropic Ratio
397  */
398 //=============================================================================
399 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio() {
400   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAnisotropicRatio");
401   ASSERT(myBaseImpl);
402   return this->GetImpl()->GetAnisotropicRatio();
403 }
404
405
406 //=============================================================================
407 /*!
408  *  BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges
409  *
410  *  Set true or false
411  */
412 //=============================================================================
413 void BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges(CORBA::Boolean theValue) {
414   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetRemoveTinyEdges");
415   ASSERT(myBaseImpl);
416   this->GetImpl()->SetRemoveTinyEdges(theValue);
417   std::string theValueStr = theValue ? "True" : "False";
418   SMESH::TPythonDump() << _this() << ".SetRemoveTinyEdges( " << theValueStr.c_str() << " )";
419 }
420
421 //=============================================================================
422 /*!
423  *  BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges
424  *
425  *  Get true or false
426  */
427 //=============================================================================
428 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges() {
429   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetRemoveTinyEdges");
430   ASSERT(myBaseImpl);
431   return this->GetImpl()->GetRemoveTinyEdges();
432 }
433
434 //=============================================================================
435 /*!
436  *  BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength
437  *
438  *  Set Tiny Edge Length
439  */
440 //=============================================================================
441 void BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength(CORBA::Double theValue) {
442   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTinyEdgeLength");
443   ASSERT(myBaseImpl);
444   this->GetImpl()->SetTinyEdgeLength(theValue);
445   SMESH::TPythonDump() << _this() << ".SetTinyEdgeLength( " << theValue << " )";
446 }
447
448 //=============================================================================
449 /*!
450  *  BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength
451  *
452  *  Get Tiny Edge Length
453  */
454 //=============================================================================
455 CORBA::Double BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength() {
456   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTinyEdgeLength");
457   ASSERT(myBaseImpl);
458   return this->GetImpl()->GetTinyEdgeLength();
459 }
460
461 //=============================================================================
462 /*!
463  *  BLSURFPlugin_Hypothesis_i::SetBadElementRemoval
464  *
465  *  Set true or false
466  */
467 //=============================================================================
468 void BLSURFPlugin_Hypothesis_i::SetBadElementRemoval(CORBA::Boolean theValue) {
469   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementRemoval");
470   ASSERT(myBaseImpl);
471   this->GetImpl()->SetBadElementRemoval(theValue);
472   std::string theValueStr = theValue ? "True" : "False";
473   SMESH::TPythonDump() << _this() << ".SetBadElementRemoval( " << theValueStr.c_str() << " )";
474 }
475
476 //=============================================================================
477 /*!
478  *  BLSURFPlugin_Hypothesis_i::GetBadElementRemoval
479  *
480  *  Get true or false
481  */
482 //=============================================================================
483 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetBadElementRemoval() {
484   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementRemoval");
485   ASSERT(myBaseImpl);
486   return this->GetImpl()->GetBadElementRemoval();
487 }
488
489 //=============================================================================
490 /*!
491  *  BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio
492  *
493  *  Set Bad Surface Element Aspect Ratio
494  */
495 //=============================================================================
496 void BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio(CORBA::Double theValue) {
497   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetBadElementAspectRatio");
498   ASSERT(myBaseImpl);
499   this->GetImpl()->SetBadElementAspectRatio(theValue);
500   SMESH::TPythonDump() << _this() << ".SetBadElementAspectRatio( " << theValue << " )";
501 }
502
503 //=============================================================================
504 /*!
505  *  BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio
506  *
507  *  Get Bad Surface Element Aspect Ratio
508  */
509 //=============================================================================
510 CORBA::Double BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio() {
511   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetBadElementAspectRatio");
512   ASSERT(myBaseImpl);
513   return this->GetImpl()->GetBadElementAspectRatio();
514 }
515
516 //=============================================================================
517 /*!
518  *  BLSURFPlugin_Hypothesis_i::SetOptimizeMesh
519  *
520  *  Set true or false
521  */
522 //=============================================================================
523 void BLSURFPlugin_Hypothesis_i::SetOptimizeMesh(CORBA::Boolean theValue) {
524   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetOptimizeMesh");
525   ASSERT(myBaseImpl);
526   this->GetImpl()->SetOptimizeMesh(theValue);
527   std::string theValueStr = theValue ? "True" : "False";
528   SMESH::TPythonDump() << _this() << ".SetOptimizeMesh( " << theValueStr.c_str() << " )";
529 }
530
531 //=============================================================================
532 /*!
533  *  BLSURFPlugin_Hypothesis_i::GetOptimizeMesh
534  *
535  *  Get true or false
536  */
537 //=============================================================================
538 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetOptimizeMesh() {
539   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetOptimizeMesh");
540   ASSERT(myBaseImpl);
541   return this->GetImpl()->GetOptimizeMesh();
542 }
543
544 //=============================================================================
545 /*!
546  *  BLSURFPlugin_Hypothesis_i::SetQuadraticMesh
547  *
548  *  Set true or false
549  */
550 //=============================================================================
551 void BLSURFPlugin_Hypothesis_i::SetQuadraticMesh(CORBA::Boolean theValue) {
552   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadraticMesh");
553   ASSERT(myBaseImpl);
554   this->GetImpl()->SetQuadraticMesh(theValue);
555   std::string theValueStr = theValue ? "True" : "False";
556   SMESH::TPythonDump() << _this() << ".SetQuadraticMesh( " << theValueStr.c_str() << " )";
557 }
558
559 //=============================================================================
560 /*!
561  *  BLSURFPlugin_Hypothesis_i::GetQuadraticMesh
562  *
563  *  Get true or false
564  */
565 //=============================================================================
566 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadraticMesh() {
567   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadraticMesh");
568   ASSERT(myBaseImpl);
569   return this->GetImpl()->GetQuadraticMesh();
570 }
571
572
573
574
575
576 /*!
577  *  BLSURFPlugin_Hypothesis_i::SetTopology
578  *
579  *  Set topology
580  */
581
582 //=============================================================================
583 void BLSURFPlugin_Hypothesis_i::SetTopology(CORBA::Long theValue) {
584   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
585   ASSERT(myBaseImpl);
586   this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology) theValue);
587   SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
588 }
589
590 //=============================================================================
591 /*!
592  *  BLSURFPlugin_Hypothesis_i::GetTopology
593  *
594  *  Get Topology
595  */
596 //=============================================================================
597 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology() {
598   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
599   ASSERT(myBaseImpl);
600   return this->GetImpl()->GetTopology();
601 }
602
603 //=============================================================================
604 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal) throw (SALOME::SALOME_Exception) {
605   ASSERT(myBaseImpl);
606   if (theVal < 0 || theVal > 100)
607     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
608   this->GetImpl()->SetVerbosity(theVal);
609   SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
610 }
611
612 //=============================================================================
613
614 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity() {
615   ASSERT(myBaseImpl);
616   return (CORBA::Short) this->GetImpl()->GetVerbosity();
617 }
618
619 //=============================================================================
620 /*!
621  *  BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges
622  *
623  *  Set true or false
624  */
625 //=============================================================================
626 void BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges(CORBA::Boolean theValue) {
627   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
628   ASSERT(myBaseImpl);
629   this->GetImpl()->SetPreCADMergeEdges(theValue);
630   std::string theValueStr = theValue ? "True" : "False";
631   SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
632 }
633
634 //=============================================================================
635 /*!
636  *  BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges
637  *
638  *  Get true or false
639  */
640 //=============================================================================
641 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges() {
642   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADMergeEdges");
643   ASSERT(myBaseImpl);
644   return this->GetImpl()->GetPreCADMergeEdges();
645 }
646
647 //=============================================================================
648 /*!
649  *  BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology
650  *
651  *  Set true or false
652  */
653 //=============================================================================
654 void BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology(CORBA::Boolean theValue) {
655   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADProcess3DTopology");
656   ASSERT(myBaseImpl);
657   this->GetImpl()->SetPreCADProcess3DTopology(theValue);
658   std::string theValueStr = theValue ? "True" : "False";
659   SMESH::TPythonDump() << _this() << ".SetPreCADProcess3DTopology( " << theValueStr.c_str() << " )";
660 }
661
662 //=============================================================================
663 /*!
664  *  BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology
665  *
666  *  Get true or false
667  */
668 //=============================================================================
669 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology() {
670   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADProcess3DTopology");
671   ASSERT(myBaseImpl);
672   return this->GetImpl()->GetPreCADProcess3DTopology();
673 }
674
675 //=============================================================================
676 /*!
677  *  BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput
678  *
679  *  Set true or false
680  */
681 //=============================================================================
682 void BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput(CORBA::Boolean theValue) {
683   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
684   ASSERT(myBaseImpl);
685   this->GetImpl()->SetPreCADDiscardInput(theValue);
686   std::string theValueStr = theValue ? "True" : "False";
687   SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
688 }
689
690 //=============================================================================
691 /*!
692  *  BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput
693  *
694  *  Get true or false
695  */
696 //=============================================================================
697 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput() {
698   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADDiscardInput");
699   ASSERT(myBaseImpl);
700   return this->GetImpl()->GetPreCADDiscardInput();
701 }
702
703
704 //=============================================================================
705
706 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName, const char* optionValue)
707     throw (SALOME::SALOME_Exception) {
708   ASSERT(myBaseImpl);
709   bool valueChanged = false;
710   try {
711     valueChanged = (this->GetImpl()->GetOptionValue(optionName) != optionValue);
712     if (valueChanged)
713       this->GetImpl()->SetOptionValue(optionName, optionValue);
714   } catch (const std::invalid_argument& ex) {
715     SALOME::ExceptionStruct ExDescription;
716     ExDescription.text = ex.what();
717     ExDescription.type = SALOME::BAD_PARAM;
718     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
719     ExDescription.lineNumber = 0;
720     throw SALOME::SALOME_Exception(ExDescription);
721   } catch (SALOME_Exception& ex) {
722     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
723   }
724   if (valueChanged)
725     SMESH::TPythonDump() << _this() << ".SetOptionValue( '" << optionName << "', '" << optionValue << "' )";
726 }
727
728 //=============================================================================
729
730 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
731     throw (SALOME::SALOME_Exception) {
732   ASSERT(myBaseImpl);
733   bool valueChanged = false;
734   try {
735     valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
736     if (valueChanged)
737       this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
738   } catch (const std::invalid_argument& ex) {
739     SALOME::ExceptionStruct ExDescription;
740     ExDescription.text = ex.what();
741     ExDescription.type = SALOME::BAD_PARAM;
742     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
743     ExDescription.lineNumber = 0;
744     throw SALOME::SALOME_Exception(ExDescription);
745   } catch (SALOME_Exception& ex) {
746     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
747   }
748   if (valueChanged)
749     SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
750 }
751
752 //=============================================================================
753
754 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
755   ASSERT(myBaseImpl);
756   try {
757     return CORBA::string_dup(this->GetImpl()->GetOptionValue(optionName).c_str());
758   } catch (const std::invalid_argument& ex) {
759     SALOME::ExceptionStruct ExDescription;
760     ExDescription.text = ex.what();
761     ExDescription.type = SALOME::BAD_PARAM;
762     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
763     ExDescription.lineNumber = 0;
764     throw SALOME::SALOME_Exception(ExDescription);
765   } catch (SALOME_Exception& ex) {
766     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
767   }
768   return 0;
769 }
770
771 //=============================================================================
772
773 char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
774   ASSERT(myBaseImpl);
775   try {
776     return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
777   } catch (const std::invalid_argument& ex) {
778     SALOME::ExceptionStruct ExDescription;
779     ExDescription.text = ex.what();
780     ExDescription.type = SALOME::BAD_PARAM;
781     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(name)";
782     ExDescription.lineNumber = 0;
783     throw SALOME::SALOME_Exception(ExDescription);
784   } catch (SALOME_Exception& ex) {
785     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
786   }
787   return 0;
788 }
789
790 //=============================================================================
791
792 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName) {
793   ASSERT(myBaseImpl);
794   this->GetImpl()->ClearOption(optionName);
795   SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
796 }
797
798 //=============================================================================
799
800 void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
801   ASSERT(myBaseImpl);
802   this->GetImpl()->ClearPreCADOption(optionName);
803   SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
804 }
805
806 //=============================================================================
807
808 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
809   ASSERT(myBaseImpl);
810   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
811
812   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
813   const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
814   result->length(opts.size()+custom_opts.size());
815   int i=0;
816
817   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
818   for (; opIt != opts.end(); ++opIt, ++i) {
819     string name_value_type = opIt->first;
820     if (!opIt->second.empty()) {
821       name_value_type += ":";
822       name_value_type += opIt->second;
823       name_value_type += ":0";
824     }
825     result[i] = CORBA::string_dup(name_value_type.c_str());
826   }
827
828   opIt = custom_opts.begin();
829   for (; opIt != custom_opts.end(); ++opIt,++i) {
830     string name_value_type = opIt->first;
831     if (!opIt->second.empty()) {
832       name_value_type += ":";
833       name_value_type += opIt->second;
834       name_value_type += ":1";
835     }
836     result[i] = CORBA::string_dup(name_value_type.c_str());
837   }
838   return result._retn();
839 }
840
841 //=============================================================================
842
843 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
844   ASSERT(myBaseImpl);
845   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
846
847   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
848   const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
849   result->length(opts.size()+custom_opts.size());
850   int i=0;
851
852   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
853   for (; opIt != opts.end(); ++opIt, ++i) {
854     string name_value_type = opIt->first;
855     if (!opIt->second.empty()) {
856       name_value_type += ":";
857       name_value_type += opIt->second;
858       name_value_type += ":0";
859     }
860     result[i] = CORBA::string_dup(name_value_type.c_str());
861   }
862
863   opIt = custom_opts.begin();
864   for (; opIt != custom_opts.end(); ++opIt,++i) {
865     string name_value_type = opIt->first;
866     if (!opIt->second.empty()) {
867       name_value_type += ":";
868       name_value_type += opIt->second;
869       name_value_type += ":1";
870     }
871     result[i] = CORBA::string_dup(name_value_type.c_str());
872   }
873   return result._retn();
874 }
875
876 //=============================================================================
877
878 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
879     throw (SALOME::SALOME_Exception) {
880   ASSERT(myBaseImpl);
881   for (CORBA::ULong i = 0; i < options.length(); ++i) {
882     string name_value_type = options[i].in();
883     if(name_value_type.empty())
884       continue;
885     size_t colonPos = name_value_type.find(':');
886     string name, value;
887     bool custom = false;
888     if (colonPos == string::npos) // ':' not found
889       name = name_value_type;
890     else {
891       name = name_value_type.substr(0, colonPos);
892       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
893         string value_type = name_value_type.substr(colonPos + 1);
894         colonPos = value_type.find(':');
895         value = value_type.substr(0, colonPos);
896         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
897           custom = atoi((value_type.substr(colonPos + 1)).c_str());
898       }
899     }
900     custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
901   }
902 }
903
904 //=============================================================================
905
906 void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
907     throw (SALOME::SALOME_Exception) {
908   ASSERT(myBaseImpl);
909   for ( CORBA::ULong i = 0; i < options.length(); ++i) {
910     string name_value_type = options[i].in();
911     if(name_value_type.empty())
912       continue;
913     size_t colonPos = name_value_type.find(':');
914     string name, value;
915     bool custom = false;
916     if (colonPos == string::npos) // ':' not found
917       name = name_value_type;
918     else {
919       name = name_value_type.substr(0, colonPos);
920       if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
921         string value_type = name_value_type.substr(colonPos + 1);
922         colonPos = value_type.find(':');
923         value = value_type.substr(0, colonPos);
924         if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
925           custom = atoi((value_type.substr(colonPos + 1)).c_str());
926       }
927     }
928     custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
929   }
930 }
931
932 //=============================================================================
933
934 void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
935 {
936   ASSERT(myBaseImpl);
937   bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
938   if (valueChanged) {
939     this->GetImpl()->AddOption(optionName, optionValue);
940     SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
941   }
942 }
943
944 //=============================================================================
945
946 void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
947 {
948   ASSERT(myBaseImpl);
949   bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
950   if (valueChanged) {
951     this->GetImpl()->AddPreCADOption(optionName, optionValue);
952     SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
953   }
954 }
955
956 //=============================================================================
957
958 char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
959 {
960   ASSERT(myBaseImpl);
961   return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
962 }
963
964 //=============================================================================
965
966 char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
967 {
968   ASSERT(myBaseImpl);
969   return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
970 }
971
972 //=============================================================================
973
974 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
975     throw (SALOME::SALOME_Exception) {
976   ASSERT(myBaseImpl);
977   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
978   if ( !entry || !entry[0] )
979     THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
980   bool valueChanged = false;
981   try {
982     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
983     if (valueChanged)
984       this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
985   } catch (const std::invalid_argument& ex) {
986     SALOME::ExceptionStruct ExDescription;
987     ExDescription.text = ex.what();
988     ExDescription.type = SALOME::BAD_PARAM;
989     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
990     ExDescription.lineNumber = 0;
991     throw SALOME::SALOME_Exception(ExDescription);
992   } catch (SALOME_Exception& ex) {
993     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
994   }
995   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
996   if (valueChanged)
997     SMESH::TPythonDump() << _this() << ".SetSizeMap(" << entry << ", '" << sizeMap << "' )";
998 }
999
1000 //=============================================================================
1001
1002 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM::shape_type shapeType, CORBA::Double sizeMap)
1003   throw (SALOME::SALOME_Exception) {
1004   ASSERT(myBaseImpl);
1005   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
1006   bool valueChanged = false;
1007   std::ostringstream sizeMapFunction;
1008   switch (shapeType) {
1009   case GEOM::FACE:   sizeMapFunction << "def f(u,v): return " << sizeMap ; break;
1010   case GEOM::EDGE:   sizeMapFunction << "def f(t): return " << sizeMap ; break;
1011   case GEOM::VERTEX: sizeMapFunction << "def f(): return " << sizeMap ; break;
1012   default:;
1013   }
1014   try {
1015     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1016     if (valueChanged)
1017       this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1018   } catch (const std::invalid_argument& ex) {
1019     SALOME::ExceptionStruct ExDescription;
1020     ExDescription.text = ex.what();
1021     ExDescription.type = SALOME::BAD_PARAM;
1022     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1023     ExDescription.lineNumber = 0;
1024     throw SALOME::SALOME_Exception(ExDescription);
1025   } catch (SALOME_Exception& ex) {
1026     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1027   }
1028   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1029   if (valueChanged)
1030     SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1031 }
1032
1033 //=============================================================================
1034
1035 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1036     throw (SALOME::SALOME_Exception) {
1037   ASSERT(myBaseImpl);
1038   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1039   bool valueChanged = false;
1040   try {
1041     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1042     if ( valueChanged ) {
1043       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1044       if (!boost::regex_match(string(attractor), re))
1045         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1046       this->GetImpl()->SetAttractorEntry(entry, attractor);
1047     }
1048   } catch (const std::invalid_argument& ex) {
1049     SALOME::ExceptionStruct ExDescription;
1050     ExDescription.text = ex.what();
1051     ExDescription.type = SALOME::BAD_PARAM;
1052     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1053     ExDescription.lineNumber = 0;
1054     throw SALOME::SALOME_Exception(ExDescription);
1055   } catch (SALOME_Exception& ex) {
1056     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1057   }
1058   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1059   if (valueChanged)
1060     SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1061 }
1062
1063 //=============================================================================
1064
1065 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
1066   throw (SALOME::SALOME_Exception)
1067 {
1068   ASSERT(myBaseImpl);
1069   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1070   //bool valueChanged = false;
1071   try {
1072     this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1073   }
1074   catch (const std::invalid_argument& ex) {
1075     SALOME::ExceptionStruct ExDescription;
1076     ExDescription.text = ex.what();
1077     ExDescription.type = SALOME::BAD_PARAM;
1078     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1079     ExDescription.lineNumber = 0;
1080     throw SALOME::SALOME_Exception(ExDescription);
1081   } catch (SALOME_Exception& ex) {
1082     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1083   }
1084   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1085   //if ( valueChanged )
1086   SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1087                        << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1088 }
1089
1090 //=============================================================================
1091
1092 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1093   ASSERT(myBaseImpl);
1094   try {
1095     return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1096   } catch (const std::invalid_argument& ex) {
1097     SALOME::ExceptionStruct ExDescription;
1098     ExDescription.text = ex.what();
1099     ExDescription.type = SALOME::BAD_PARAM;
1100     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1101     ExDescription.lineNumber = 0;
1102     throw SALOME::SALOME_Exception(ExDescription);
1103   } catch (SALOME_Exception& ex) {
1104     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1105   }
1106   return 0;
1107 }
1108
1109 //=============================================================================
1110
1111 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1112   ASSERT(myBaseImpl);
1113   try {
1114     return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1115   } catch (const std::invalid_argument& ex) {
1116     SALOME::ExceptionStruct ExDescription;
1117     ExDescription.text = ex.what();
1118     ExDescription.type = SALOME::BAD_PARAM;
1119     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1120     ExDescription.lineNumber = 0;
1121     throw SALOME::SALOME_Exception(ExDescription);
1122   } catch (SALOME_Exception& ex) {
1123     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1124   }
1125   return 0;
1126 }
1127
1128 // //=============================================================================
1129 // 
1130 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1131 // // A finir pour le dump
1132 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1133 //   throw (SALOME::SALOME_Exception)
1134 // {
1135 //   ASSERT(myBaseImpl);
1136 //   try {
1137 //     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1138 //   }
1139 //   catch (const std::invalid_argument& ex) {
1140 //     SALOME::ExceptionStruct ExDescription;
1141 //     ExDescription.text = ex.what();
1142 //     ExDescription.type = SALOME::BAD_PARAM;
1143 //     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1144 //     ExDescription.lineNumber = 0;
1145 //     throw SALOME::SALOME_Exception(ExDescription);
1146 //   }
1147 //   catch (SALOME_Exception& ex) {
1148 //     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1149 //   }
1150 //   return 0;
1151 // }
1152
1153 //=============================================================================
1154
1155 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1156   ASSERT(myBaseImpl);
1157   this->GetImpl()->ClearEntry(entry);
1158   //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1159 }
1160
1161 //=============================================================================
1162
1163 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1164   ASSERT(myBaseImpl);
1165   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1166
1167   const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1168   result->length(sizeMaps.size());
1169
1170   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1171   for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1172     string entry_sizemap = smIt->first;
1173     if (!smIt->second.empty()) {
1174       entry_sizemap += "|";
1175       entry_sizemap += smIt->second;
1176     }
1177     result[i] = CORBA::string_dup(entry_sizemap.c_str());
1178   }
1179   return result._retn();
1180 }
1181
1182 //=============================================================================
1183
1184 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1185   ASSERT(myBaseImpl);
1186   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1187
1188   const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1189   result->length(attractors.size());
1190
1191   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1192   for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1193     string entry_attractor = atIt->first;
1194     if (!atIt->second.empty()) {
1195       entry_attractor += "|";
1196       entry_attractor += atIt->second;
1197     }
1198     result[i] = CORBA::string_dup(entry_attractor.c_str());
1199   }
1200   return result._retn();
1201 }
1202
1203 //=============================================================================
1204
1205 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1206 {
1207   ASSERT(myBaseImpl);
1208   BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1209
1210   const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1211   result->length( attractors.size() );
1212
1213   ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1214   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1215     string faceEntry = atIt->first;
1216     string attEntry;
1217     double startSize, endSize, infDist, constDist;
1218     if ( !atIt->second->Empty() ) {
1219       attEntry = atIt->second->GetAttractorEntry();
1220       MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1221       std::vector<double> params = atIt->second->GetParameters();
1222       startSize = params[0];
1223       endSize = params[1];
1224       infDist = params[2];
1225       constDist = params[3];
1226     }
1227     result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1228     result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1229     result[i].startSize = startSize;
1230     result[i].endSize = endSize;
1231     result[i].infDist = infDist;
1232     result[i].constDist = constDist;
1233     MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1234     MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1235   }
1236   return result._retn();
1237 }
1238
1239 //=============================================================================
1240
1241 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1242     throw (SALOME::SALOME_Exception) {
1243   ASSERT(myBaseImpl);
1244   for ( CORBA::ULong i = 0; i < sizeMaps.length(); ++i) {
1245     string entry_sizemap = sizeMaps[i].in();
1246     size_t colonPos = entry_sizemap.find('|');
1247     string entry, sizemap;
1248     if (colonPos == string::npos) // '|' separator not found
1249       entry = entry_sizemap;
1250     else {
1251       entry = entry_sizemap.substr(0, colonPos);
1252       if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1253         sizemap = entry_sizemap.substr(colonPos + 1);
1254     }
1255     this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1256   }
1257 }
1258
1259 //=============================================================================
1260
1261 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1262   ASSERT(myBaseImpl);
1263   this->GetImpl()->ClearSizeMaps();
1264 }
1265
1266 //=============================================================================
1267
1268 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1269   throw (SALOME::SALOME_Exception)
1270 {
1271   ASSERT(myBaseImpl);
1272   string entry;
1273   entry = GeomObj->GetStudyEntry();
1274   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1275   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1276   SetSizeMapEntry(entry.c_str(), sizeMap);
1277 }
1278
1279 //=============================================================================
1280
1281 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1282   ASSERT(myBaseImpl);
1283   string entry = GeomObj->GetStudyEntry();
1284   GEOM::shape_type shapeType = GeomObj->GetShapeType();
1285   if (shapeType == GEOM::COMPOUND)
1286     shapeType = GeomObj->GetMaxShapeType();
1287   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1288   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1289   SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1290 }
1291
1292 //=============================================================================
1293 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1294   ASSERT(myBaseImpl);
1295   string entry;
1296   entry = GeomObj->GetStudyEntry();
1297   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1298   MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1299   UnsetEntry(entry.c_str());
1300   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1301 }
1302
1303 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1304   ASSERT(myBaseImpl);
1305   string entry;
1306   entry = GeomObj->GetStudyEntry();
1307   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1308   MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1309   SetAttractorEntry(entry.c_str(), attractor);
1310 }
1311
1312 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1313   ASSERT(myBaseImpl);
1314   string entry;
1315   entry = GeomObj->GetStudyEntry();
1316   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1317   MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1318   UnsetEntry(entry.c_str());
1319   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1320 }
1321
1322 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)
1323 {
1324   ASSERT(myBaseImpl);
1325   string theFaceEntry;
1326   string theAttEntry;
1327   theFaceEntry = theFace->GetStudyEntry();
1328   theAttEntry  = theAttractor->GetStudyEntry();
1329   
1330   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1331   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1332   string aName;
1333   
1334   if (theFaceEntry.empty()) {
1335     aName = "Face_";
1336     aName += theFace->GetEntry();
1337     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1338     if (!theSFace->_is_nil())
1339       theFaceEntry = theSFace->GetID();
1340   }
1341   if (theFaceEntry.empty())
1342     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1343   
1344   if (theAttEntry.empty()) {
1345     if (theAttractor->GetShapeType() == GEOM::VERTEX)
1346       aName = "Vertex_";
1347     if (theAttractor->GetShapeType() == GEOM::EDGE)
1348       aName = "Edge_";
1349     if (theAttractor->GetShapeType() == GEOM::WIRE)
1350       aName = "Wire_";
1351     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1352       aName = "Compound_";
1353     aName += theAttractor->GetEntry();
1354     SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1355     if (!theSAtt->_is_nil())
1356       theAttEntry = theSAtt->GetID();
1357   }
1358   if (theAttEntry.empty())
1359     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1360   
1361   TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1362   TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1363   MESSAGE("IDL : GetName : " << theFace->GetName());
1364   MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1365   SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1366 }
1367
1368 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1369                                                    GEOM::GEOM_Object_ptr theAttractor)
1370 {
1371   ASSERT(myBaseImpl);
1372   CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1373   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1374   
1375   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1376   // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1377   // string aName;
1378   
1379   // if (theFaceEntry.empty()) {
1380   //   aName = "Face_";
1381   //   aName += theFace->GetEntry();
1382   //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1383   //   if (!theSFace->_is_nil())
1384   //     theFaceEntry = theSFace->GetID();
1385   // }
1386   if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1387        !theAttrEntry.in() || !theAttrEntry.in()[0] )
1388     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1389   
1390   MESSAGE("IDL : GetName : " << theFace->GetName());
1391   MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1392   GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1393   SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1394                        << theFace << ", " << theAttractor << " )";
1395 }
1396
1397 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1398                                                     const char* attractorEntry)
1399 {
1400   GetImpl()->ClearEntry( faceEntry, attractorEntry );
1401   SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1402                        << faceEntry << "', '" << attractorEntry << "' )";
1403 }
1404
1405
1406 /*
1407  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1408  {}
1409
1410  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1411  {}
1412
1413  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
1414  {}
1415
1416  char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
1417  {}
1418
1419  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1420  {
1421  ASSERT(myBaseImpl);
1422  this->GetImpl()->UnsetCustomSizeMap(entry);
1423  SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1424  }
1425
1426
1427  BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1428  {}
1429
1430  */
1431
1432 // ///////////////////////
1433 // // ENFORCED VERTICES //
1434 // ///////////////////////
1435
1436
1437 /**
1438  * Returns the list of enforced vertices for a given Face entry
1439  * @return A map of Face entry / List of enforced vertices
1440  *
1441  */
1442 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1443   MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1444   ASSERT(myBaseImpl);
1445
1446   BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1447
1448   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1449       this->GetImpl()->_GetAllEnforcedVerticesByFace();
1450   resultMap->length(faceEntryEnfVertexListMap.size());
1451   MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1452
1453   ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1454   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1455   for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1456     BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1457         new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1458     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1459     MESSAGE("Face Entry: " << mapElement->faceEntry);
1460
1461     _enfVertexList = it_entry->second;
1462     BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1463     enfVertexList->length(_enfVertexList.size());
1464     MESSAGE("Number of enf vertex: " << enfVertexList->length());
1465
1466     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1467     ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1468     for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1469       currentEnfVertex = (*it_enfVertex);
1470
1471       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1472
1473       // Name
1474       enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1475
1476       // Geom entry
1477       enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1478
1479       // Coords
1480       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1481       coords->length(currentEnfVertex->coords.size());
1482       for (CORBA::ULong i=0;i<coords->length();i++)
1483         coords[i] = currentEnfVertex->coords[i];
1484       enfVertex->coords = coords;
1485
1486       // Group name
1487       enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1488       
1489       // Face entry list
1490       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1491       faceEntryList->length(currentEnfVertex->faceEntries.size());
1492       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1493       for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1494         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1495       enfVertex->faceEntries = faceEntryList;
1496
1497       ostringstream msg;
1498       msg << "Enforced vertex: \n"
1499           << "Name: " << enfVertex->name << "\n";
1500       if (coords->length())
1501           msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1502       msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1503           << "Group Name: " << enfVertex->grpName;
1504       MESSAGE(msg.str());
1505
1506       enfVertexList[j] = enfVertex;
1507     }
1508     mapElement->enfVertexList = enfVertexList;
1509
1510     resultMap[i] = mapElement;
1511
1512   }
1513   return resultMap._retn();
1514 }
1515
1516 /**
1517  * Returns the list of all enforced vertices
1518  * @return a list of enforced vertices
1519  *
1520  */
1521 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1522   MESSAGE("IDL: GetAllEnforcedVertices()");
1523   ASSERT(myBaseImpl);
1524   BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1525   const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1526   resultMap->length(enfVertexList.size());
1527   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1528
1529   ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1530   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1531   for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1532     MESSAGE("Enforced Vertex #" << i);
1533     currentEnfVertex = (*evlIt);
1534     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1535     // Name
1536     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1537     // Geom entry
1538     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1539     // Coords
1540     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1541     coords->length(currentEnfVertex->coords.size());
1542     for (CORBA::ULong ind = 0; ind < coords->length(); ind++)
1543       coords[ind] = currentEnfVertex->coords[ind];
1544     enfVertex->coords = coords;
1545     // Group name
1546     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
1547     // Face entry list
1548     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1549     faceEntryList->length(currentEnfVertex->faceEntries.size());
1550     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1551     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1552       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1553     enfVertex->faceEntries = faceEntryList;
1554
1555     ostringstream msg;
1556     msg << "Enforced vertex: \n"
1557         << "Name: " << enfVertex->name << "\n";
1558     if (coords->length())
1559         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1560     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1561         << "Group Name: " << enfVertex->grpName;
1562     MESSAGE(msg.str());
1563
1564     resultMap[i] = enfVertex;
1565   }
1566   return resultMap._retn();
1567
1568 }
1569
1570 /**
1571  * Returns the list of enforced vertices coords for a given Face entry.
1572  * They are the coords of the "manual" enforced vertices.
1573  * @return A map of Face entry / List of enforced vertices coords
1574  *
1575  */
1576 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1577   MESSAGE("IDL: GetAllCoordsByFace()");
1578   ASSERT(myBaseImpl);
1579
1580   BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1581
1582   const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1583   resultMap->length(entryCoordsListMap.size());
1584   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1585
1586   ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1587   ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1588   for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1589     BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1590     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1591     MESSAGE("Face Entry: " << mapElement->faceEntry);
1592
1593     _coordsList = it_entry->second;
1594     BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1595     coordsList->length(_coordsList.size());
1596     MESSAGE("Number of coords: " << coordsList->length());
1597
1598     ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1599     for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1600       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1601       coords->length((*it_coords).size());
1602       for (CORBA::ULong i=0;i<coords->length();i++)
1603         coords[i] = (*it_coords)[i];
1604       coordsList[j] = coords;
1605       MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1606     }
1607     mapElement->coordsList = coordsList;
1608
1609     resultMap[i] = mapElement;
1610
1611   }
1612   return resultMap._retn();
1613 }
1614
1615 /**
1616  * Returns a map of enforced vertices coords / enforced vertex.
1617  * They are the coords of the "manual" enforced vertices.
1618  */
1619 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1620   MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1621   ASSERT(myBaseImpl);
1622
1623   BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1624   const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1625       this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1626   resultMap->length(coordsEnfVertexMap.size());
1627   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1628
1629   ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1630   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1631   for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1632     MESSAGE("Enforced Vertex #" << i);
1633     currentEnfVertex = (it_coords->second);
1634     BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1635     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1636     coords->length(it_coords->first.size());
1637     for (CORBA::ULong ind=0;ind<coords->length();ind++)
1638       coords[ind] = it_coords->first[ind];
1639     mapElement->coords = coords;
1640     MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1641
1642     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1643     // Name
1644     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1645     // Geom entry
1646     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1647     // Coords
1648     BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1649     coords2->length(currentEnfVertex->coords.size());
1650     for (CORBA::ULong ind=0;ind<coords2->length();ind++)
1651       coords2[ind] = currentEnfVertex->coords[ind];
1652     enfVertex->coords = coords2;
1653     // Group name
1654     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
1655     // Face entry list
1656     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1657     faceEntryList->length(currentEnfVertex->faceEntries.size());
1658     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1659     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1660       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1661     enfVertex->faceEntries = faceEntryList;
1662       
1663     mapElement->enfVertex = enfVertex;
1664     ostringstream msg;
1665     msg << "Enforced vertex: \n"
1666         << "Name: " << enfVertex->name << "\n";
1667     if (coords->length())
1668         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1669     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1670         << "Group Name: " << enfVertex->grpName;
1671     MESSAGE(msg.str());
1672
1673     resultMap[i] = mapElement;
1674   }
1675   return resultMap._retn();
1676 }
1677
1678 /**
1679  * Returns the list of enforced vertices entries for a given Face entry.
1680  * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1681  * @return A map of Face entry / List of enforced vertices geom entries
1682  *
1683  */
1684 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1685   MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1686   ASSERT(myBaseImpl);
1687
1688   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1689
1690   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1691       this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1692   resultMap->length(entryEnfVertexEntryListMap.size());
1693   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1694
1695   ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1696   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1697       entryEnfVertexEntryListMap.begin();
1698   for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1699     BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1700         new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1701     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1702     MESSAGE("Face Entry: " << mapElement->faceEntry);
1703
1704     _enfVertexEntryList = it_entry->second;
1705     BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1706     enfVertexEntryList->length(_enfVertexEntryList.size());
1707     MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1708
1709     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1710     for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1711       enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1712       MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1713     }
1714     mapElement->enfVertexEntryList = enfVertexEntryList;
1715
1716     resultMap[i] = mapElement;
1717
1718   }
1719   return resultMap._retn();
1720 }
1721
1722 /**
1723  * Returns a map of enforced vertices geom entry / enforced vertex.
1724  * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1725  */
1726 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1727   MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1728   ASSERT(myBaseImpl);
1729
1730   BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1731   const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1732       this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1733   resultMap->length(enfVertexEntryEnfVertexMap.size());
1734   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1735
1736   ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1737   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1738   for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1739     MESSAGE("Enforced Vertex #" << i);
1740     currentEnfVertex = it_enfVertexEntry->second;
1741     BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1742     mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1743     MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1744
1745     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1746     // Name
1747     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1748     // Geom entry
1749     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1750     // Coords
1751     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1752     coords->length(currentEnfVertex->coords.size());
1753     for (CORBA::ULong ind=0;ind<coords->length();ind++)
1754       coords[ind] = currentEnfVertex->coords[ind];
1755     enfVertex->coords = coords;
1756     // Group name
1757     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
1758     // Face entry list
1759     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1760     faceEntryList->length(currentEnfVertex->faceEntries.size());
1761     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1762     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1763       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1764     enfVertex->faceEntries = faceEntryList;
1765
1766     ostringstream msg;
1767     msg << "Enforced vertex: \n"
1768         << "Name: " << enfVertex->name << "\n";
1769     if (coords->length())
1770         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1771     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1772         << "Group Name: " << enfVertex->grpName;
1773     MESSAGE(msg.str());
1774
1775     mapElement->enfVertex = enfVertex;
1776     resultMap[i] = mapElement;
1777   }
1778   return resultMap._retn();
1779 }
1780
1781 /**
1782  * Erase all enforced vertices
1783  */
1784 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1785   ASSERT(myBaseImpl);
1786   this->GetImpl()->ClearAllEnforcedVertices();
1787   SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1788 }
1789
1790 /*!
1791  * Set/get/unset an enforced vertex on face
1792  */
1793 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1794     CORBA::Double z) throw (SALOME::SALOME_Exception) {
1795   ASSERT(myBaseImpl);
1796
1797   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1798     MESSAGE("theFace shape type is not FACE or COMPOUND");
1799     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1800   }
1801
1802   string theFaceEntry = theFace->GetStudyEntry();
1803   
1804   if (theFaceEntry.empty()) {
1805     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1806     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1807     string aName;
1808     if (theFace->GetShapeType() == GEOM::FACE)
1809       aName = "Face_";
1810     if (theFace->GetShapeType() == GEOM::COMPOUND)
1811       aName = "Compound_";
1812     aName += theFace->GetEntry();
1813     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1814     if (!theSFace->_is_nil())
1815       theFaceEntry = theSFace->GetID();
1816   }
1817   if (theFaceEntry.empty())
1818     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1819   MESSAGE("IDL : GetName : " << theFace->GetName());
1820   MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1821   try {
1822     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1823   } catch (SALOME_Exception& ex) {
1824     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1825   }
1826 }
1827
1828 /*!
1829  * Set/get/unset an enforced vertex with name on face
1830  */
1831 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1832     CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1833   ASSERT(myBaseImpl);
1834
1835   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1836     MESSAGE("theFace shape type is not FACE or COMPOUND");
1837     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1838   }
1839
1840   string theFaceEntry = theFace->GetStudyEntry();
1841   
1842   if (theFaceEntry.empty()) {
1843     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1844     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1845     string aName;
1846     if (theFace->GetShapeType() == GEOM::FACE)
1847       aName = "Face_";
1848     if (theFace->GetShapeType() == GEOM::COMPOUND)
1849       aName = "Compound_";
1850     aName += theFace->GetEntry();
1851     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1852     if (!theSFace->_is_nil())
1853       theFaceEntry = theSFace->GetID();
1854   }
1855   if (theFaceEntry.empty())
1856     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1857   
1858   MESSAGE("IDL : GetName : " << theFace->GetName());
1859   MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1860   try {
1861     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1862   } catch (SALOME_Exception& ex) {
1863     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1864   }
1865 }
1866
1867 /*!
1868  * Set/get/unset an enforced vertex with geom object on face
1869  */
1870 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1871     throw (SALOME::SALOME_Exception) {
1872   ASSERT(myBaseImpl);
1873
1874   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1875     MESSAGE("theFace shape type is not FACE or COMPOUND");
1876     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1877   }
1878
1879   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1880     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1881     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1882   }
1883
1884   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1885   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1886   //  if (CORBA::is_nil(measureOp))
1887   //    return false;
1888   //
1889   //  CORBA::Double x, y, z;
1890   //  x = y = z = 0.;
1891   //  measureOp->PointCoordinates(theVertex, x, y, z);
1892
1893   string theFaceEntry = theFace->GetStudyEntry();
1894   string theVertexEntry = theVertex->GetStudyEntry();
1895   
1896   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1897   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1898   string aName;
1899   
1900   if (theFaceEntry.empty()) {
1901     if (theFace->GetShapeType() == GEOM::FACE)
1902       aName = "Face_";
1903     if (theFace->GetShapeType() == GEOM::COMPOUND)
1904       aName = "Compound_";
1905     aName += theFace->GetEntry();
1906     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1907     if (!theSFace->_is_nil())
1908       theFaceEntry = theSFace->GetID();
1909   }
1910   if (theFaceEntry.empty())
1911     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1912   
1913   if (theVertexEntry.empty()) {
1914     if (theVertex->GetShapeType() == GEOM::VERTEX)
1915       aName = "Vertex_";
1916     if (theVertex->GetShapeType() == GEOM::COMPOUND)
1917       aName = "Compound_";
1918     aName += theVertex->GetEntry();
1919     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1920     if (!theSVertex->_is_nil())
1921       theVertexEntry = theSVertex->GetID();
1922   }
1923   if (theVertexEntry.empty())
1924     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1925
1926   string theVertexName = theVertex->GetName();
1927   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1928   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1929   MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1930   try {
1931     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1932   } catch (SALOME_Exception& ex) {
1933     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1934   }
1935 }
1936
1937 /*!
1938  * Set an enforced vertex with group name on face
1939  */
1940 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1941  throw (SALOME::SALOME_Exception)
1942 {
1943   ASSERT(myBaseImpl);
1944
1945   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1946     MESSAGE("theFace shape type is not FACE or COMPOUND");
1947     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1948   }
1949
1950   string theFaceEntry = theFace->GetStudyEntry();
1951   
1952   if (theFaceEntry.empty()) {
1953     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1954     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1955     string aName;
1956     if (theFace->GetShapeType() == GEOM::FACE)
1957       aName = "Face_";
1958     if (theFace->GetShapeType() == GEOM::COMPOUND)
1959       aName = "Compound_";
1960     aName += theFace->GetEntry();
1961     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1962     if (!theSFace->_is_nil())
1963       theFaceEntry = theSFace->GetID();
1964   }
1965   if (theFaceEntry.empty())
1966     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1967   MESSAGE("IDL : GetName : " << theFace->GetName());
1968   MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1969   try {
1970     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1971   } catch (SALOME_Exception& ex) {
1972     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1973   }
1974 }
1975
1976 /*!
1977  * Set an enforced vertex with name and group name on face
1978  */
1979 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, 
1980                                                                 const char* theVertexName, const char* theGroupName)
1981  throw (SALOME::SALOME_Exception)
1982 {
1983   ASSERT(myBaseImpl);
1984
1985   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1986     MESSAGE("theFace shape type is not FACE or COMPOUND");
1987     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1988   }
1989
1990   string theFaceEntry = theFace->GetStudyEntry();
1991   
1992   if (theFaceEntry.empty()) {
1993     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1994     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1995     string aName;
1996     if (theFace->GetShapeType() == GEOM::FACE)
1997       aName = "Face_";
1998     if (theFace->GetShapeType() == GEOM::COMPOUND)
1999       aName = "Compound_";
2000     aName += theFace->GetEntry();
2001     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2002     if (!theSFace->_is_nil())
2003       theFaceEntry = theSFace->GetID();
2004   }
2005   if (theFaceEntry.empty())
2006     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2007   MESSAGE("IDL : GetName : " << theFace->GetName());
2008   MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2009   try {
2010     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2011   } catch (SALOME_Exception& ex) {
2012     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2013   }
2014 }
2015
2016 /*!
2017  * Set an enforced vertex with geom entry and group name on face
2018  */
2019 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2020  throw (SALOME::SALOME_Exception)
2021 {
2022   ASSERT(myBaseImpl);
2023
2024   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2025     MESSAGE("theFace shape type is not FACE or COMPOUND");
2026     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2027   }
2028
2029   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2030     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2031     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2032   }
2033
2034   string theFaceEntry = theFace->GetStudyEntry();
2035   string theVertexEntry = theVertex->GetStudyEntry();
2036   
2037   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2038   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2039   string aName;
2040   
2041   if (theFaceEntry.empty()) {
2042     if (theFace->GetShapeType() == GEOM::FACE)
2043       aName = "Face_";
2044     if (theFace->GetShapeType() == GEOM::COMPOUND)
2045       aName = "Compound_";
2046     aName += theFace->GetEntry();
2047     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2048     if (!theSFace->_is_nil())
2049       theFaceEntry = theSFace->GetID();
2050   }
2051   if (theFaceEntry.empty())
2052     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2053   
2054   if (theVertexEntry.empty()) {
2055     if (theVertex->GetShapeType() == GEOM::VERTEX)
2056       aName = "Vertex_";
2057     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2058       aName = "Compound_";
2059     aName += theVertex->GetEntry();
2060     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2061     if (!theSVertex->_is_nil())
2062       theVertexEntry = theSVertex->GetID();
2063   }
2064   if (theVertexEntry.empty())
2065     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2066
2067   string theVertexName = theVertex->GetName();
2068   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2069   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2070   MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2071   try {
2072     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2073   } catch (SALOME_Exception& ex) {
2074     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2075   }
2076 }
2077
2078 //Enable internal enforced vertices on specific face if requested by user
2079 ///*!
2080 // * Are internal enforced vertices used for a face ?
2081 // */
2082 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2083 //    throw (SALOME::SALOME_Exception) {
2084 //  ASSERT(myBaseImpl);
2085
2086 //  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2087 //    MESSAGE("theFace shape type is not FACE or COMPOUND");
2088 //    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2089 //  }
2090
2091 //  string theFaceEntry = theFace->GetStudyEntry();
2092   
2093 //  if (theFaceEntry.empty()) {
2094 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2095 //    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2096 //    string aName;
2097 //    if (theFace->GetShapeType() == GEOM::FACE)
2098 //      aName = "Face_";
2099 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
2100 //      aName = "Compound_";
2101 //    aName += theFace->GetEntry();
2102 //    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2103 //    if (!theSFace->_is_nil())
2104 //      theFaceEntry = theSFace->GetID();
2105 //  }
2106 //  if (theFaceEntry.empty())
2107 //    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2108
2109 //  MESSAGE("IDL : GetName : " << theFace->GetName());
2110 //  MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2111 //  try {
2112 //    return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2113 //  } catch (SALOME_Exception& ex) {
2114 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2115 //  }
2116 //}
2117
2118 /*!
2119  * Get the list of all enforced vertices
2120  */
2121 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2122     throw (SALOME::SALOME_Exception) {
2123   ASSERT(myBaseImpl);
2124
2125   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2126     MESSAGE("theFace shape type is not FACE or COMPOUND");
2127     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2128   }
2129
2130   string theFaceEntry = theFace->GetStudyEntry();
2131   
2132   if (theFaceEntry.empty()) {
2133     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2134     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2135     string aName;
2136     if (theFace->GetShapeType() == GEOM::FACE)
2137       aName = "Face_";
2138     if (theFace->GetShapeType() == GEOM::COMPOUND)
2139       aName = "Compound_";
2140     aName += theFace->GetEntry();
2141     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2142     if (!theSFace->_is_nil())
2143       theFaceEntry = theSFace->GetID();
2144   }
2145   if (theFaceEntry.empty())
2146     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2147
2148   MESSAGE("IDL : GetName : " << theFace->GetName());
2149   MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2150   try {
2151     return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2152   } catch (SALOME_Exception& ex) {
2153     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2154   }
2155 }
2156
2157 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2158     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2159   ASSERT(myBaseImpl);
2160
2161   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2162     MESSAGE("theFace shape type is not FACE or COMPOUND");
2163     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2164   }
2165
2166   string theFaceEntry = theFace->GetStudyEntry();
2167   
2168   if (theFaceEntry.empty()) {
2169     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2170     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2171     string aName;
2172     if (theFace->GetShapeType() == GEOM::FACE)
2173       aName = "Face_";
2174     if (theFace->GetShapeType() == GEOM::COMPOUND)
2175       aName = "Compound_";
2176     aName += theFace->GetEntry();
2177     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2178     if (!theSFace->_is_nil())
2179       theFaceEntry = theSFace->GetID();
2180   }
2181   if (theFaceEntry.empty())
2182     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2183   MESSAGE("IDL : GetName : " << theFace->GetName());
2184   MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2185
2186   try {
2187     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2188   } catch (SALOME_Exception& ex) {
2189     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2190   }
2191 }
2192
2193 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2194     throw (SALOME::SALOME_Exception) {
2195   ASSERT(myBaseImpl);
2196
2197   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2198     MESSAGE("theFace shape type is not FACE or COMPOUND");
2199     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2200   }
2201   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2202     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2203     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2204   }
2205
2206   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2207   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2208   //  if (CORBA::is_nil(measureOp))
2209   //    return false;
2210   //
2211   //  CORBA::Double x, y, z;
2212   //  x = y = z = 0.;
2213   //  measureOp->PointCoordinates(theVertex, x, y, z);
2214
2215   std::string theFaceEntry = theFace->GetStudyEntry();
2216   std::string theVertexEntry = theVertex->GetStudyEntry();
2217   
2218   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2219   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2220   string aName;
2221   
2222   if (theFaceEntry.empty()) {
2223     if (theFace->GetShapeType() == GEOM::FACE)
2224       aName = "Face_";
2225     if (theFace->GetShapeType() == GEOM::COMPOUND)
2226       aName = "Compound_";
2227     aName += theFace->GetEntry();
2228     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2229     if (!theSFace->_is_nil())
2230       theFaceEntry = theSFace->GetID();
2231   }
2232   if (theFaceEntry.empty())
2233     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2234   
2235   if (theVertexEntry.empty()) {
2236     if (theVertex->GetShapeType() == GEOM::VERTEX)
2237       aName = "Vertex_";
2238     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2239       aName = "Compound_";
2240     aName += theVertex->GetEntry();
2241     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2242     if (!theSVertex->_is_nil())
2243       theVertexEntry = theSVertex->GetID();
2244   }
2245   if (theVertexEntry.empty())
2246     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2247   
2248   MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2249
2250   try {
2251     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2252   } catch (SALOME_Exception& ex) {
2253     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2254   }
2255 }
2256
2257 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2258   ASSERT(myBaseImpl);
2259
2260   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2261     MESSAGE("theFace shape type is not FACE or COMPOUND");
2262     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2263   }
2264
2265   string theFaceEntry = theFace->GetStudyEntry();
2266   
2267   if (theFaceEntry.empty()) {
2268     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2269     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2270     string aName;
2271     if (theFace->GetShapeType() == GEOM::FACE)
2272       aName = "Face_";
2273     if (theFace->GetShapeType() == GEOM::COMPOUND)
2274       aName = "Compound_";
2275     aName += theFace->GetEntry();
2276     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2277     if (!theSFace->_is_nil())
2278       theFaceEntry = theSFace->GetID();
2279   }
2280   if (theFaceEntry.empty())
2281     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2282   
2283   MESSAGE("IDL : GetName : " << theFace->GetName());
2284   MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2285
2286   try {
2287     return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2288   } catch (SALOME_Exception& ex) {
2289     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2290   }
2291 }
2292
2293 /*!
2294  * Set/get/unset an enforced vertex on geom object given by entry
2295  */
2296 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2297     CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2298     throw (SALOME::SALOME_Exception) {
2299   ASSERT(myBaseImpl);
2300   MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2301   bool newValue = false;
2302   if (string(theVertexEntry).empty()) {
2303     try {
2304       ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2305         this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2306       ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2307       coords.push_back(x);
2308       coords.push_back(y);
2309       coords.push_back(z);
2310       if (coordsList.find(coords) == coordsList.end()) {
2311         MESSAGE("Coords not found: add it in coordsList");
2312         newValue = true;
2313       } else {
2314         MESSAGE("Coords already found, compare names");
2315         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2316         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2317           MESSAGE("The names are different: update");
2318           //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2319           newValue = true;
2320         }
2321         else {
2322           MESSAGE("The names are identical");
2323         }
2324       }
2325     } catch (const std::invalid_argument& ex) {
2326       // no enforced vertex for entry
2327       MESSAGE("Face entry not found : add it to the list");
2328       newValue = true;
2329     }
2330     if (newValue) {
2331       if (string(theVertexName).empty()) {
2332         if (string(theGroupName).empty())
2333           SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2334         else
2335           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2336       }
2337       else {
2338         if (string(theGroupName).empty())
2339           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2340         else
2341           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
2342                                << theVertexName << "\", \"" << theGroupName << "\")";
2343       }
2344     }
2345   } else {
2346     try {
2347       ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2348       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2349       if ( it == enfVertexEntryList.end()) {
2350         MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2351         newValue = true;
2352       }
2353       else {
2354         MESSAGE("Geom entry already found, compare names");
2355         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2356         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2357           MESSAGE("The names are different: update");
2358 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2359           newValue = true;
2360         }
2361         else {
2362           MESSAGE("The names are identical");
2363         }
2364       }
2365     } catch (const std::invalid_argument& ex) {
2366       // no enforced vertex for entry
2367       MESSAGE("Face entry not found : add it to the list");
2368       newValue = true;
2369     }
2370     if (newValue) {
2371       if (string(theGroupName).empty())
2372         SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2373       else
2374         SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2375     }
2376   }
2377
2378   if (newValue)
2379     this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2380
2381   MESSAGE("IDL : SetEnforcedVertexEntry END");
2382   return newValue;
2383 }
2384
2385 //Enable internal enforced vertices on specific face if requested by user
2386 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2387 //    throw (SALOME::SALOME_Exception) {
2388 //  ASSERT(myBaseImpl);
2389 //  try {
2390 //    return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2391 //  } catch (const std::exception& ex) {
2392 //    std::cout << "Exception: " << ex.what() << std::endl;
2393 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2394 //  }
2395 //}
2396   
2397 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2398     throw (SALOME::SALOME_Exception) {
2399   ASSERT(myBaseImpl);
2400   MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2401
2402   try {
2403     BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2404     ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2405     vertexList->length(_vList.size());
2406     MESSAGE("Number of enforced vertices: " << vertexList->length());
2407     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2408     for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2409       ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2410
2411       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2412
2413       // Name
2414       enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2415       // Geom Vertex Entry
2416       enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2417       // Coords
2418       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2419       coords->length(_enfVertex->coords.size());
2420       for ( CORBA::ULong ind = 0; ind < coords->length(); ind++ )
2421         coords[ind] = _enfVertex->coords[ind];
2422       enfVertex->coords = coords;
2423       // Group Name
2424       enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2425       // Face entry list
2426       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2427       faceEntryList->length(_enfVertex->faceEntries.size());
2428       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2429       for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2430         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2431       enfVertex->faceEntries = faceEntryList;
2432
2433       vertexList[i] = enfVertex;
2434     }
2435     MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2436     return vertexList._retn();
2437   } catch (const std::invalid_argument& ex) {
2438     SALOME::ExceptionStruct ExDescription;
2439     ExDescription.text = ex.what();
2440     ExDescription.type = SALOME::BAD_PARAM;
2441     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2442     ExDescription.lineNumber = 1385;
2443     throw SALOME::SALOME_Exception(ExDescription);
2444   } catch (const std::exception& ex) {
2445     std::cout << "Exception: " << ex.what() << std::endl;
2446     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2447   }
2448 }
2449
2450 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2451     CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2452   ASSERT(myBaseImpl);
2453   MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2454
2455   bool res = false;
2456   try {
2457     res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2458
2459     if (string(theVertexEntry).empty())
2460       SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2461           << ")";
2462     else
2463       SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2464
2465   } catch (const std::invalid_argument& ex) {
2466     return false;
2467   } catch (const std::exception& ex) {
2468     std::cout << "Exception: " << ex.what() << std::endl;
2469     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2470   }
2471
2472   MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2473   return res;
2474 }
2475
2476 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2477 //    CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2478 //  MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2479 //
2480 //  bool ret = false;
2481 //
2482 //  try {
2483 //    ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2484 //  } catch (SALOME_Exception& ex) {
2485 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2486 //  }
2487 //
2488 //  if (ret)
2489 //    SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2490 //        << ")";
2491 //
2492 //  MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2493 //  return ret;
2494 //}
2495
2496 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2497   ASSERT(myBaseImpl);
2498   MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2499
2500   try {
2501     this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2502     SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2503   } catch (const std::invalid_argument& ex) {
2504     return false;
2505   } catch (const std::exception& ex) {
2506     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2507   }
2508
2509   MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2510   return true;
2511 }
2512
2513 //=============================================================================
2514 /*!
2515  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2516  *
2517  *  Set true or false
2518  */
2519 //=============================================================================
2520 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2521   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2522   ASSERT(myBaseImpl);
2523   this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2524   std::string theValueStr = theValue ? "True" : "False";
2525   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2526 }
2527
2528 //=============================================================================
2529 /*!
2530  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2531  *
2532  *  Get true or false
2533  */
2534 //=============================================================================
2535 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2536   MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2537   ASSERT(myBaseImpl);
2538   return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2539 }
2540
2541 //=============================================================================
2542 /*!
2543  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2544  *
2545  *  Set group name
2546  */
2547 //=============================================================================
2548 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char*  groupName) {
2549   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2550   ASSERT(myBaseImpl);
2551   this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2552   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2553 }
2554
2555 //=============================================================================
2556 /*!
2557  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2558  *
2559  *  Get group name
2560  */
2561 //=============================================================================
2562 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2563   MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2564   ASSERT(myBaseImpl);
2565   return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2566 }
2567
2568 /*
2569  * Enable internal enforced vertices on specific face if requested by user
2570  *
2571 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2572  throw (SALOME::SALOME_Exception)
2573 {
2574   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2575   try {
2576     SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2577   } catch (SALOME_Exception& ex) {
2578     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2579   }
2580 }
2581
2582 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2583  throw (SALOME::SALOME_Exception)
2584 {
2585   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2586
2587   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2588     MESSAGE("theFace shape type is not FACE or COMPOUND");
2589     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2590   }
2591
2592   string theFaceEntry = theFace->GetStudyEntry();
2593
2594   if (theFaceEntry.empty()) {
2595     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2596     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2597     string aName;
2598     if (theFace->GetShapeType() == GEOM::FACE)
2599       aName = "Face_";
2600     if (theFace->GetShapeType() == GEOM::COMPOUND)
2601       aName = "Compound_";
2602     aName += theFace->GetEntry();
2603     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2604     if (!theSFace->_is_nil())
2605       theFaceEntry = theSFace->GetID();
2606   }
2607   if (theFaceEntry.empty())
2608     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2609
2610   MESSAGE("IDL : GetName : " << theFace->GetName());
2611   MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2612   try {
2613     SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2614   } catch (SALOME_Exception& ex) {
2615     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2616   }
2617 }
2618
2619 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2620     throw (SALOME::SALOME_Exception)
2621 {
2622   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2623   ASSERT(myBaseImpl);
2624   try {
2625     this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2626     std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2627     if (string(theGroupName).empty())
2628       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2629     else
2630       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2631   } catch (const std::exception& ex) {
2632     std::cout << "Exception: " << ex.what() << std::endl;
2633     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2634   }
2635 }
2636
2637 */
2638
2639 /* TODO GROUPS
2640  char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2641  throw (SALOME::SALOME_Exception)
2642  {
2643  ASSERT(myBaseImpl);
2644  MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2645  try {
2646  return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2647  }
2648  catch (const std::invalid_argument& ex) {
2649  SALOME::ExceptionStruct ExDescription;
2650  ExDescription.text = ex.what();
2651  ExDescription.type = SALOME::BAD_PARAM;
2652  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2653  ExDescription.lineNumber = 1146;
2654  throw SALOME::SALOME_Exception(ExDescription);
2655  }
2656  catch (SALOME_Exception& ex) {
2657  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2658  }
2659  MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2660  return 0;
2661  }
2662
2663
2664  void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2665  throw (SALOME::SALOME_Exception)
2666  {
2667  ASSERT(myBaseImpl);
2668  MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2669  try {
2670  this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2671  }
2672  catch (const std::invalid_argument& ex) {
2673  SALOME::ExceptionStruct ExDescription;
2674  ExDescription.text = ex.what();
2675  ExDescription.type = SALOME::BAD_PARAM;
2676  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2677  ExDescription.lineNumber = 1170;
2678  throw SALOME::SALOME_Exception(ExDescription);
2679  }
2680  catch (SALOME_Exception& ex) {
2681  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2682  }
2683
2684  SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2685  << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2686
2687  MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2688  }
2689  */
2690 ///////////////////////
2691
2692 ///////////////////////
2693 // PERIODICITY       //
2694 ///////////////////////
2695
2696
2697 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2698 {
2699 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2700   std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2701   MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2702   MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2703   MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2704   MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2705   MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2706   MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2707   MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2708   MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2709   MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2710   std::string txtShapeType = MapShapeTypeToString[theShapeType];
2711   return txtShapeType;
2712 }
2713
2714 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2715 {
2716   // Check shape types
2717   bool ok = false;
2718   std::stringstream typesTxt;
2719   for (std::size_t i=0; i<theShapeTypes.size(); i++)
2720     {
2721       GEOM::shape_type theShapeType = theShapeTypes[i];
2722       if (shape->GetShapeType() == theShapeType)
2723         ok = true;
2724       typesTxt << ShapeTypeToString(theShapeType);
2725       if (i < theShapeTypes.size()-1 )
2726         typesTxt << ", ";
2727     }
2728   if (!ok){
2729     std::stringstream msg;
2730     msg << "shape shape type is not in" << typesTxt.str();
2731     MESSAGE(msg);
2732     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2733   }
2734 }
2735
2736 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2737 {
2738   // Check shape type
2739   if (shape->GetShapeType() != theShapeType) {
2740     std::stringstream msg;
2741     msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2742     MESSAGE(msg);
2743     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2744   }
2745 }
2746
2747 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2748 {
2749   // Check shape is published in the object browser
2750   string shapeEntry = shape->GetStudyEntry();
2751
2752   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2753   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2754   string aName;
2755
2756   // Publish shape if needed
2757   if (shapeEntry.empty()) {
2758     if (shape->GetShapeType() == theShapeType)
2759       aName = prefix;
2760     aName += shape->GetEntry();
2761     SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2762     if (!theSFace1->_is_nil())
2763       shapeEntry = theSFace1->GetID();
2764   }
2765   if (shapeEntry.empty())
2766     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2767   return shapeEntry;
2768 }
2769
2770 // Format the output of two vectors to use it in MESSAGE and PythonDump
2771 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2772 {
2773   std::stringstream listEntriesTxt;
2774
2775   if (!theSourceVerticesEntries.empty())
2776     {
2777       listEntriesTxt << ", [" ;
2778       size_t i =0;
2779       for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2780         {
2781           if (i>0)
2782             listEntriesTxt << ", ";
2783           listEntriesTxt << *it;
2784         }
2785
2786       listEntriesTxt << "], [" ;
2787       i =0;
2788       for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2789         {
2790           if (i>0)
2791             listEntriesTxt << ", ";
2792           listEntriesTxt << *it;
2793         }
2794       listEntriesTxt << "]" ;
2795     }
2796   return listEntriesTxt.str();
2797 }
2798
2799 /**
2800  * Erase all PreCad periodicity associations
2801  */
2802 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2803   ASSERT(myBaseImpl);
2804   this->GetImpl()->ClearPreCadPeriodicityVectors();
2805   SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2806 }
2807
2808 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2809 {
2810   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2811   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2812       this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2813
2814   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2815
2816   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2817   return periodicityList._retn();
2818 }
2819
2820 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2821 {
2822   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2823   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2824       this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2825
2826   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2827
2828   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2829   return periodicityList._retn();
2830 }
2831
2832 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2833 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2834 {
2835   MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2836   BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2837
2838     periodicityList->length(preCadPeriodicityVector.size());
2839
2840     for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2841       {
2842         ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2843
2844         BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2845         myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2846         myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2847
2848         BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2849         if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2850           {
2851             sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2852             for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2853               sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2854           }
2855
2856         myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2857
2858         BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2859         if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2860            {
2861             targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2862              for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2863                targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2864            }
2865
2866         myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2867
2868         periodicityList[i] = myPreCadPeriodicity;
2869       }
2870
2871
2872   return periodicityList._retn();
2873 }
2874
2875
2876 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2877 throw (SALOME::SALOME_Exception)
2878 {
2879   ASSERT(myBaseImpl);
2880   const GEOM::ListOfGO theSourceVertices;
2881   const GEOM::ListOfGO theTargetVertices;
2882   AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2883 }
2884
2885
2886 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2887     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2888 throw (SALOME::SALOME_Exception)
2889 {
2890   ASSERT(myBaseImpl);
2891   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2892
2893   size_t theLength = theSourceVertices.length();
2894   if (theLength != theTargetVertices.length())
2895     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2896
2897   std::vector<GEOM::shape_type> allowedShapeTypes;
2898   allowedShapeTypes.push_back(GEOM::FACE);
2899   allowedShapeTypes.push_back(GEOM::COMPOUND);
2900
2901   string prefix1 = "Source_face_";
2902   CheckShapeTypes(theFace1, allowedShapeTypes);
2903   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2904
2905   string prefix2 = "Target_face_";
2906   CheckShapeTypes(theFace2, allowedShapeTypes);
2907   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2908
2909   string prefix3 = "Source_vertex_";
2910   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2911   theSourceVerticesEntries->length(theLength);
2912   GEOM::GEOM_Object_ptr theVtx_i;
2913   string theEntry_i;
2914   for (size_t ind = 0; ind < theLength; ind++) {
2915       theVtx_i = theSourceVertices[ind];
2916       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2917       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2918   }
2919
2920   string prefix4 = "Target_vertex_";
2921   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2922   theTargetVerticesEntries->length(theLength);
2923   for (size_t ind = 0; ind < theLength; ind++) {
2924       theVtx_i = theTargetVertices[ind];
2925       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2926       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2927   }
2928
2929   string theFace2Name = theFace2->GetName();
2930   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2931   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2932   MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry <<  ")");
2933   try {
2934       AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2935           theSourceVerticesEntries, theTargetVerticesEntries);
2936   } catch (SALOME_Exception& ex) {
2937     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2938   }
2939 }
2940
2941
2942 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2943     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2944     throw (SALOME::SALOME_Exception)
2945 {
2946
2947   ASSERT(myBaseImpl);
2948
2949   // Convert BLSURFPlugin::TEntryList to vector<string>
2950   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2951   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2952       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2953       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2954   }
2955
2956   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2957
2958   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2959
2960   this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2961       theSourceVerticesEntries, theTargetVerticesEntries);
2962
2963   SMESH::TPythonDump pd;
2964   if (!theSourceVerticesEntries.empty())
2965     {
2966       pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2967       pd << listEntriesTxt.c_str();
2968       pd << ")";
2969     }
2970   else
2971     pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2972   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2973 }
2974
2975 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2976       throw (SALOME::SALOME_Exception)
2977 {
2978   ASSERT(myBaseImpl);
2979   const GEOM::ListOfGO theSourceVertices;
2980   const GEOM::ListOfGO theTargetVertices;
2981   AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2982 }
2983
2984 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2985     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2986       throw (SALOME::SALOME_Exception)
2987 {
2988   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2989   ASSERT(myBaseImpl);
2990
2991   size_t theLength = theSourceVertices.length();
2992   if (theLength != theTargetVertices.length())
2993     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2994
2995   std::vector<GEOM::shape_type> allowedShapeTypes;
2996   allowedShapeTypes.push_back(GEOM::EDGE);
2997   allowedShapeTypes.push_back(GEOM::COMPOUND);
2998
2999   string prefix1 = "Source_edge_";
3000   CheckShapeTypes(theEdge1, allowedShapeTypes);
3001   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
3002
3003   string prefix2 = "Target_edge_";
3004   CheckShapeTypes(theEdge2, allowedShapeTypes);
3005   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
3006
3007   string prefix3 = "Source_vertex_";
3008   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3009   theSourceVerticesEntries->length(theLength);
3010   GEOM::GEOM_Object_ptr theVtx_i;
3011   string theEntry_i;
3012   for (size_t ind = 0; ind < theLength; ind++) {
3013       theVtx_i = theSourceVertices[ind];
3014       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3015       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3016   }
3017
3018   string prefix4 = "Target_vertex_";
3019   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3020   theTargetVerticesEntries->length(theLength);
3021   for (size_t ind = 0; ind < theLength; ind++) {
3022       theVtx_i = theTargetVertices[ind];
3023       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3024       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3025   }
3026
3027   string theEdge2Name = theEdge2->GetName();
3028   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3029   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3030   MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3031   try {
3032       AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3033           theSourceVerticesEntries, theTargetVerticesEntries);
3034   } catch (SALOME_Exception& ex) {
3035     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3036   }
3037 }
3038
3039
3040 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3041     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3042     throw (SALOME::SALOME_Exception)
3043 {
3044
3045   ASSERT(myBaseImpl);
3046
3047   // Convert BLSURFPlugin::TEntryList to vector<string>
3048   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3049   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3050       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3051       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3052   }
3053
3054   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3055
3056   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3057   this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3058       theSourceVerticesEntries, theTargetVerticesEntries);
3059
3060   SMESH::TPythonDump pd;
3061   if (!theSourceVerticesEntries.empty())
3062     {
3063       pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3064       pd << listEntriesTxt.c_str();
3065       pd << ")";
3066     }
3067   else
3068     pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3069
3070   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3071 }
3072
3073 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3074     throw (SALOME::SALOME_Exception)
3075 {
3076   ASSERT(myBaseImpl);
3077
3078   string prefix1 = "Source_face_";
3079   CheckShapeType(theFace1, GEOM::FACE);
3080   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3081   string prefix2 = "Target_face_";
3082   CheckShapeType(theFace2, GEOM::FACE);
3083   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3084
3085   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3086   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3087   MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3088   try {
3089       AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
3090   } catch (SALOME_Exception& ex) {
3091     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3092   }
3093
3094
3095 }
3096
3097 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3098     throw (SALOME::SALOME_Exception){
3099
3100   ASSERT(myBaseImpl);
3101
3102   MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3103   this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3104   SMESH::TPythonDump pd;
3105   pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3106   MESSAGE("IDL : AddFacePeriodicityEntry END");
3107 }
3108
3109
3110 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3111                                                    GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3112                                                    CORBA::Long edge_orientation)
3113     throw (SALOME::SALOME_Exception){
3114   ASSERT(myBaseImpl);
3115
3116   string prefix_theFace1 = "Source_face_";
3117   CheckShapeType(theFace1, GEOM::FACE);
3118   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3119   string prefix_theFace2 = "Target_face_";
3120   CheckShapeType(theFace2, GEOM::FACE);
3121   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3122
3123   string prefix_theEdge1 = "Source_edge_";
3124   CheckShapeType(theEdge1, GEOM::EDGE);
3125   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3126   string prefix_theEdge2 = "Target_edge_";
3127   CheckShapeType(theEdge2, GEOM::EDGE);
3128   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3129
3130   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3131   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3132   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3133   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3134   MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
3135   try {
3136       AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3137   } catch (SALOME_Exception& ex) {
3138     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3139   }
3140
3141
3142 }
3143
3144 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3145                                                                GEOM::GEOM_Object_ptr theEdge2,
3146                                                                CORBA::Long edge_orientation)
3147     throw (SALOME::SALOME_Exception){
3148   ASSERT(myBaseImpl);
3149
3150   string theFace1Entry = "";
3151   string theFace2Entry = "";
3152
3153   string prefix_theEdge1 = "Source_edge_";
3154   CheckShapeType(theEdge1, GEOM::EDGE);
3155   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3156   string prefix_theEdge2 = "Target_edge_";
3157   CheckShapeType(theEdge2, GEOM::EDGE);
3158   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3159
3160   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3161   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3162   MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
3163   try {
3164       AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3165   } catch (SALOME_Exception& ex) {
3166     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3167   }
3168
3169
3170 }
3171
3172 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3173     throw (SALOME::SALOME_Exception){
3174
3175   ASSERT(myBaseImpl);
3176
3177   MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
3178   this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3179   SMESH::TPythonDump pd;
3180   if (theFace1Entry)
3181     pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation <<")";
3182   else
3183     pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3184   MESSAGE("IDL : AddEdgePeriodicityEntry END");
3185 }
3186
3187 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3188     GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3189     throw (SALOME::SALOME_Exception){
3190   ASSERT(myBaseImpl);
3191
3192   string prefix_theEdge1 = "Source_edge_";
3193   CheckShapeType(theEdge1, GEOM::EDGE);
3194   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3195   string prefix_theEdge2 = "Target_edge_";
3196   CheckShapeType(theEdge2, GEOM::EDGE);
3197   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3198
3199   string prefix_theVertex1 = "Source_vertex_";
3200   CheckShapeType(theVertex1, GEOM::VERTEX);
3201   string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3202   string prefix_theVertex2 = "Target_vertex_";
3203   CheckShapeType(theVertex2, GEOM::VERTEX);
3204   string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3205
3206   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3207   MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3208   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3209   MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3210   MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")");
3211   try {
3212       AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3213   } catch (SALOME_Exception& ex) {
3214     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3215   }
3216
3217
3218 }
3219
3220 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3221     throw (SALOME::SALOME_Exception){
3222
3223   ASSERT(myBaseImpl);
3224
3225   MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")");
3226   this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3227   SMESH::TPythonDump pd;
3228   pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")";
3229   MESSAGE("IDL : AddVertexPeriodicityEntry END");
3230 }
3231
3232
3233 //================================================================================
3234 /*!
3235  * \brief Sets the file for export resulting mesh in GMF format
3236  * \param theFileName - full name of the file (.mesh, .meshb)
3237  * 
3238  * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3239  */
3240 //================================================================================  
3241 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3242 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3243   ASSERT(myBaseImpl);
3244   MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3245   bool valueChanged/*, modeChanged*/ = false;
3246   try {
3247     valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3248 //     modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3249     if (valueChanged)// or (!valueChanged && modeChanged))
3250       this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3251   } catch (const std::exception& ex) {
3252     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3253   }
3254   if (valueChanged)// or (!valueChanged && modeChanged))
3255     SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3256   MESSAGE("IDL : SetGMFFile END ");
3257 }
3258
3259 //================================================================================
3260 /*!
3261  * \brief Gets the file name for export resulting mesh in GMF format
3262  * \retval char* - The file name
3263  * 
3264  * Returns the GMF file name
3265  */
3266 //================================================================================  
3267 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3268   ASSERT(myBaseImpl);
3269 //   MESSAGE("IDL : GetGMFFile()");
3270   return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3271 }
3272
3273 // //================================================================================
3274 // /*!
3275 //  * \brief Gets the file mode for export resulting mesh in GMF format
3276 //  * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3277 //  * 
3278 //  * Returns the GMF file mode
3279 //  */
3280 // //================================================================================  
3281 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3282 //   ASSERT(myBaseImpl);
3283 //   MESSAGE("IDL : GetGMFFileMode()");
3284 //   return this->GetImpl()->GetGMFFileMode();
3285 // }
3286
3287 //=============================================================================
3288 /*!
3289  *  BLSURFPlugin_Hypothesis_i::GetImpl
3290  *
3291  *  Get implementation
3292  */
3293 //=============================================================================
3294 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3295   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3296   return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3297 }
3298
3299 //================================================================================
3300 /*!
3301  * \brief Verify whether hypothesis supports given entity type 
3302  * \param type - dimension (see SMESH::Dimension enumeration)
3303  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3304  * 
3305  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3306  */
3307 //================================================================================  
3308 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3309   return type == SMESH::DIM_2D;
3310 }
3311
3312 //
3313 // Obsolete methods - To be removed in V7
3314 //
3315
3316 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3317   this->SetMinSize(theMinSize);
3318 }
3319 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3320   return this->GetMinSize();
3321 }
3322 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3323   this->SetMaxSize(theMaxSize);
3324 }
3325 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3326   return this->GetMaxSize();
3327 }
3328 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3329   this->SetMinSize(theMinSize);
3330 }
3331 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3332   return this->GetMinSize();
3333 }
3334 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3335   this->SetMaxSize(theMaxSize);
3336 }
3337 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3338   return this->GetMaxSize();
3339 }
3340 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3341   this->SetAngleMesh(theValue);
3342 }
3343 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3344   return this->GetAngleMesh();
3345 }
3346 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3347   this->SetAngleMesh(theValue);
3348 }
3349 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3350   return this->GetAngleMesh();
3351 }
3352 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3353   std::string theValueStr = theValue ? "1" : "0";
3354   this->SetOptionValue("respect_geometry",theValueStr.c_str());
3355 }
3356 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3357   std::string theValueStr = this->GetOptionValue("respect_geometry");
3358   if (theValueStr.empty() || theValueStr == "respect")
3359       return true;
3360   return false;
3361 }
3362 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3363   std::string theValueStr = theValue ? "1" : "0";
3364   this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3365 }
3366 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3367   std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3368   if (theValueStr == "1")
3369       return true;
3370   return false;
3371 }
3372 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3373   std::ostringstream theValueStr;
3374   theValueStr << theValue;
3375   this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3376 }
3377 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3378   std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3379   double result;
3380   theValueStr >> result;
3381   return result;
3382 }