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