Salome HOME
Enable C++0x/C++11 support
[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   }
1011   try {
1012     valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMapFunction.str());
1013     if (valueChanged)
1014       this->GetImpl()->SetSizeMapEntry(entry, sizeMapFunction.str());
1015   } catch (const std::invalid_argument& ex) {
1016     SALOME::ExceptionStruct ExDescription;
1017     ExDescription.text = ex.what();
1018     ExDescription.type = SALOME::BAD_PARAM;
1019     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
1020     ExDescription.lineNumber = 0;
1021     throw SALOME::SALOME_Exception(ExDescription);
1022   } catch (SALOME_Exception& ex) {
1023     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1024   }
1025   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
1026   if (valueChanged)
1027     SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
1028 }
1029
1030 //=============================================================================
1031
1032 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry, const char* attractor)
1033     throw (SALOME::SALOME_Exception) {
1034   ASSERT(myBaseImpl);
1035   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1036   bool valueChanged = false;
1037   try {
1038     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
1039     if ( valueChanged ) {
1040       boost::regex re("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$");
1041       if (!boost::regex_match(string(attractor), re))
1042         throw std::invalid_argument("Error: an attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False;d(opt.))");
1043       this->GetImpl()->SetAttractorEntry(entry, attractor);
1044     }
1045   } catch (const std::invalid_argument& ex) {
1046     SALOME::ExceptionStruct ExDescription;
1047     ExDescription.text = ex.what();
1048     ExDescription.type = SALOME::BAD_PARAM;
1049     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
1050     ExDescription.lineNumber = 0;
1051     throw SALOME::SALOME_Exception(ExDescription);
1052   } catch (SALOME_Exception& ex) {
1053     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1054   }
1055   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1056   if (valueChanged)
1057     SMESH::TPythonDump() << _this() << ".SetAttractor(" << entry << ", '" << attractor << "' )";
1058 }
1059
1060 //=============================================================================
1061
1062 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
1063   throw (SALOME::SALOME_Exception)
1064 {
1065   ASSERT(myBaseImpl);
1066   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
1067   bool valueChanged = false;
1068   try {
1069     this->GetImpl()->SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius);
1070   }
1071   catch (const std::invalid_argument& ex) {
1072     SALOME::ExceptionStruct ExDescription;
1073     ExDescription.text = ex.what();
1074     ExDescription.type = SALOME::BAD_PARAM;
1075     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetClassAttractorEntry(entry, att_entry, StartSize, EndSize, ActionRadius, ConstantRadius)";
1076     ExDescription.lineNumber = 0;
1077     throw SALOME::SALOME_Exception(ExDescription);
1078   } catch (SALOME_Exception& ex) {
1079     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1080   }
1081   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
1082   //if ( valueChanged )
1083   SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
1084                        << entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
1085 }
1086
1087 //=============================================================================
1088
1089 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1090   ASSERT(myBaseImpl);
1091   try {
1092     return CORBA::string_dup(this->GetImpl()->GetSizeMapEntry(entry).c_str());
1093   } catch (const std::invalid_argument& ex) {
1094     SALOME::ExceptionStruct ExDescription;
1095     ExDescription.text = ex.what();
1096     ExDescription.type = SALOME::BAD_PARAM;
1097     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
1098     ExDescription.lineNumber = 0;
1099     throw SALOME::SALOME_Exception(ExDescription);
1100   } catch (SALOME_Exception& ex) {
1101     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1102   }
1103   return 0;
1104 }
1105
1106 //=============================================================================
1107
1108 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry) throw (SALOME::SALOME_Exception) {
1109   ASSERT(myBaseImpl);
1110   try {
1111     return CORBA::string_dup(this->GetImpl()->GetAttractorEntry(entry).c_str());
1112   } catch (const std::invalid_argument& ex) {
1113     SALOME::ExceptionStruct ExDescription;
1114     ExDescription.text = ex.what();
1115     ExDescription.type = SALOME::BAD_PARAM;
1116     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
1117     ExDescription.lineNumber = 0;
1118     throw SALOME::SALOME_Exception(ExDescription);
1119   } catch (SALOME_Exception& ex) {
1120     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1121   }
1122   return 0;
1123 }
1124
1125 // //=============================================================================
1126 // 
1127 // // TODO coder cette fonction (utilisée pour savoir si la valeur a changé
1128 // // A finir pour le dump
1129 // char* BLSURFPlugin_Hypothesis_i::GetClassAttractorEntry(const char* entry)
1130 //   throw (SALOME::SALOME_Exception)
1131 // {
1132 //   ASSERT(myBaseImpl);
1133 //   try {
1134 //     return CORBA::string_dup( this->GetImpl()->GetClassAttractorEntry(entry).c_str());
1135 //   }
1136 //   catch (const std::invalid_argument& ex) {
1137 //     SALOME::ExceptionStruct ExDescription;
1138 //     ExDescription.text = ex.what();
1139 //     ExDescription.type = SALOME::BAD_PARAM;
1140 //     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetClassAttractorEntry(name)";
1141 //     ExDescription.lineNumber = 0;
1142 //     throw SALOME::SALOME_Exception(ExDescription);
1143 //   }
1144 //   catch (SALOME_Exception& ex) {
1145 //     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1146 //   }
1147 //   return 0;
1148 // }
1149
1150 //=============================================================================
1151
1152 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry) {
1153   ASSERT(myBaseImpl);
1154   this->GetImpl()->ClearEntry(entry);
1155   //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
1156 }
1157
1158 //=============================================================================
1159
1160 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries() {
1161   ASSERT(myBaseImpl);
1162   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1163
1164   const ::BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = this->GetImpl()->_GetSizeMapEntries();
1165   result->length(sizeMaps.size());
1166
1167   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
1168   for (int i = 0; smIt != sizeMaps.end(); ++smIt, ++i) {
1169     string entry_sizemap = smIt->first;
1170     if (!smIt->second.empty()) {
1171       entry_sizemap += "|";
1172       entry_sizemap += smIt->second;
1173     }
1174     result[i] = CORBA::string_dup(entry_sizemap.c_str());
1175   }
1176   return result._retn();
1177 }
1178
1179 //=============================================================================
1180
1181 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries() {
1182   ASSERT(myBaseImpl);
1183   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
1184
1185   const ::BLSURFPlugin_Hypothesis::TSizeMap attractors = this->GetImpl()->_GetAttractorEntries();
1186   result->length(attractors.size());
1187
1188   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
1189   for (int i = 0; atIt != attractors.end(); ++atIt, ++i) {
1190     string entry_attractor = atIt->first;
1191     if (!atIt->second.empty()) {
1192       entry_attractor += "|";
1193       entry_attractor += atIt->second;
1194     }
1195     result[i] = CORBA::string_dup(entry_attractor.c_str());
1196   }
1197   return result._retn();
1198 }
1199
1200 //=============================================================================
1201
1202 BLSURFPlugin::TAttParamsMap* BLSURFPlugin_Hypothesis_i::GetAttractorParams()
1203 {
1204   ASSERT(myBaseImpl);
1205   BLSURFPlugin::TAttParamsMap_var result = new BLSURFPlugin::TAttParamsMap();
1206
1207   const ::BLSURFPlugin_Hypothesis::TAttractorMap attractors= this->GetImpl()->_GetClassAttractorEntries();
1208   result->length( attractors.size() );
1209
1210   ::BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator atIt = attractors.begin();
1211   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
1212     string faceEntry = atIt->first;
1213     string attEntry;
1214     double startSize, endSize, infDist, constDist;
1215     if ( !atIt->second->Empty() ) {
1216       attEntry = atIt->second->GetAttractorEntry();
1217       MESSAGE("GetAttractorParams : attEntry ="<<attEntry)
1218       std::vector<double> params = atIt->second->GetParameters();
1219       startSize = params[0];
1220       endSize = params[1];
1221       infDist = params[2];
1222       constDist = params[3];
1223     }
1224     result[i].faceEntry = CORBA::string_dup(faceEntry.c_str());
1225     result[i].attEntry = CORBA::string_dup(attEntry.c_str());
1226     result[i].startSize = startSize;
1227     result[i].endSize = endSize;
1228     result[i].infDist = infDist;
1229     result[i].constDist = constDist;
1230     MESSAGE("GetAttractorParams : result[i].attEntry ="<<result[i].attEntry)
1231     MESSAGE("GetAttractorParams : result[i].faceEntry ="<<result[i].faceEntry)
1232   }
1233   return result._retn();
1234 }
1235
1236 //=============================================================================
1237
1238 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
1239     throw (SALOME::SALOME_Exception) {
1240   ASSERT(myBaseImpl);
1241   for (int i = 0; i < sizeMaps.length(); ++i) {
1242     string entry_sizemap = sizeMaps[i].in();
1243     int colonPos = entry_sizemap.find('|');
1244     string entry, sizemap;
1245     if (colonPos == string::npos) // '|' separator not found
1246       entry = entry_sizemap;
1247     else {
1248       entry = entry_sizemap.substr(0, colonPos);
1249       if (colonPos < entry_sizemap.size() - 1 && entry_sizemap[colonPos] != ' ')
1250         sizemap = entry_sizemap.substr(colonPos + 1);
1251     }
1252     this->GetImpl()->SetSizeMapEntry(entry.c_str(), sizemap.c_str());
1253   }
1254 }
1255
1256 //=============================================================================
1257
1258 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps() {
1259   ASSERT(myBaseImpl);
1260   this->GetImpl()->ClearSizeMaps();
1261 }
1262
1263 //=============================================================================
1264
1265 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1266   throw (SALOME::SALOME_Exception)
1267 {
1268   ASSERT(myBaseImpl);
1269   string entry;
1270   entry = GeomObj->GetStudyEntry();
1271   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1272   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1273   SetSizeMapEntry(entry.c_str(), sizeMap);
1274 }
1275
1276 //=============================================================================
1277
1278 void BLSURFPlugin_Hypothesis_i::SetConstantSizeMap(const GEOM::GEOM_Object_ptr GeomObj, CORBA::Double sizeMap) {
1279   ASSERT(myBaseImpl);
1280   string entry = GeomObj->GetStudyEntry();
1281   GEOM::shape_type shapeType = GeomObj->GetShapeType();
1282   if (shapeType == GEOM::COMPOUND)
1283     shapeType = GeomObj->GetMaxShapeType();
1284   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1285   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")");
1286   SetConstantSizeMapEntry(entry.c_str(), shapeType, sizeMap);
1287 }
1288
1289 //=============================================================================
1290 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj) {
1291   ASSERT(myBaseImpl);
1292   string entry;
1293   entry = GeomObj->GetStudyEntry();
1294   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1295   MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
1296   UnsetEntry(entry.c_str());
1297   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
1298 }
1299
1300 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor) {
1301   ASSERT(myBaseImpl);
1302   string entry;
1303   entry = GeomObj->GetStudyEntry();
1304   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1305   MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
1306   SetAttractorEntry(entry.c_str(), attractor);
1307 }
1308
1309 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj) {
1310   ASSERT(myBaseImpl);
1311   string entry;
1312   entry = GeomObj->GetStudyEntry();
1313   MESSAGE("IDL : GetName : " << GeomObj->GetName());
1314   MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
1315   UnsetEntry(entry.c_str());
1316   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
1317 }
1318
1319 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)
1320 {
1321   ASSERT(myBaseImpl);
1322   string theFaceEntry;
1323   string theAttEntry;
1324   theFaceEntry = theFace->GetStudyEntry();
1325   theAttEntry  = theAttractor->GetStudyEntry();
1326   
1327   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1328   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1329   string aName;
1330   
1331   if (theFaceEntry.empty()) {
1332     aName = "Face_";
1333     aName += theFace->GetEntry();
1334     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1335     if (!theSFace->_is_nil())
1336       theFaceEntry = theSFace->GetID();
1337   }
1338   if (theFaceEntry.empty())
1339     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1340   
1341   if (theAttEntry.empty()) {
1342     if (theAttractor->GetShapeType() == GEOM::VERTEX)
1343       aName = "Vertex_";
1344     if (theAttractor->GetShapeType() == GEOM::EDGE)
1345       aName = "Edge_";
1346     if (theAttractor->GetShapeType() == GEOM::WIRE)
1347       aName = "Wire_";
1348     if (theAttractor->GetShapeType() == GEOM::COMPOUND)
1349       aName = "Compound_";
1350     aName += theAttractor->GetEntry();
1351     SALOMEDS::SObject_wrap theSAtt = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theAttractor, aName.c_str());
1352     if (!theSAtt->_is_nil())
1353       theAttEntry = theSAtt->GetID();
1354   }
1355   if (theAttEntry.empty())
1356     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1357   
1358   TopoDS_Face FaceShape = TopoDS::Face(SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theFace ));
1359   TopoDS_Shape AttractorShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theAttractor );
1360   MESSAGE("IDL : GetName : " << theFace->GetName());
1361   MESSAGE("IDL : SETATTRACTOR () ");//<< entry << " , " << att_entry << ")");
1362   SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
1363 }
1364
1365 void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
1366                                                    GEOM::GEOM_Object_ptr theAttractor)
1367 {
1368   ASSERT(myBaseImpl);
1369   CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
1370   CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
1371   
1372   // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1373   // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1374   // string aName;
1375   
1376   // if (theFaceEntry.empty()) {
1377   //   aName = "Face_";
1378   //   aName += theFace->GetEntry();
1379   //   SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1380   //   if (!theSFace->_is_nil())
1381   //     theFaceEntry = theSFace->GetID();
1382   // }
1383   if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
1384        !theAttrEntry.in() || !theAttrEntry.in()[0] )
1385     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1386   
1387   MESSAGE("IDL : GetName : " << theFace->GetName());
1388   MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
1389   GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
1390   SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
1391                        << theFace << ", " << theAttractor << " )";
1392 }
1393
1394 void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
1395                                                     const char* attractorEntry)
1396 {
1397   GetImpl()->ClearEntry( faceEntry, attractorEntry );
1398   SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
1399                        << faceEntry << "', '" << attractorEntry << "' )";
1400 }
1401
1402
1403 /*
1404  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
1405  {}
1406
1407  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
1408  {}
1409
1410  void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
1411  {}
1412
1413  char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
1414  {}
1415
1416  void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
1417  {
1418  ASSERT(myBaseImpl);
1419  this->GetImpl()->UnsetCustomSizeMap(entry);
1420  SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
1421  }
1422
1423
1424  BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
1425  {}
1426
1427  */
1428
1429 // ///////////////////////
1430 // // ENFORCED VERTICES //
1431 // ///////////////////////
1432
1433
1434 /**
1435  * Returns the list of enforced vertices for a given Face entry
1436  * @return A map of Face entry / List of enforced vertices
1437  *
1438  */
1439 BLSURFPlugin::TFaceEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByFace() {
1440   MESSAGE("IDL: GetAllEnforcedVerticesByFace()");
1441   ASSERT(myBaseImpl);
1442
1443   BLSURFPlugin::TFaceEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexListMap();
1444
1445   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap =
1446       this->GetImpl()->_GetAllEnforcedVerticesByFace();
1447   resultMap->length(faceEntryEnfVertexListMap.size());
1448   MESSAGE("Face entry to Enforced Vertex map size is " << resultMap->length());
1449
1450   ::BLSURFPlugin_Hypothesis::TEnfVertexList _enfVertexList;
1451   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator it_entry = faceEntryEnfVertexListMap.begin();
1452   for (int i = 0; it_entry != faceEntryEnfVertexListMap.end(); ++it_entry, ++i) {
1453     BLSURFPlugin::TFaceEntryEnfVertexListMapElement_var mapElement =
1454         new BLSURFPlugin::TFaceEntryEnfVertexListMapElement();
1455     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1456     MESSAGE("Face Entry: " << mapElement->faceEntry);
1457
1458     _enfVertexList = it_entry->second;
1459     BLSURFPlugin::TEnfVertexList_var enfVertexList = new BLSURFPlugin::TEnfVertexList();
1460     enfVertexList->length(_enfVertexList.size());
1461     MESSAGE("Number of enf vertex: " << enfVertexList->length());
1462
1463     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator it_enfVertex = _enfVertexList.begin();
1464     ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1465     for (int j = 0; it_enfVertex != _enfVertexList.end(); ++it_enfVertex, ++j) {
1466       currentEnfVertex = (*it_enfVertex);
1467
1468       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1469
1470       // Name
1471       enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1472
1473       // Geom entry
1474       enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1475
1476       // Coords
1477       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1478       coords->length(currentEnfVertex->coords.size());
1479       for (int i=0;i<coords->length();i++)
1480         coords[i] = currentEnfVertex->coords[i];
1481       enfVertex->coords = coords;
1482
1483       // Group name
1484       enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());
1485       
1486       // Face entry list
1487       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1488       faceEntryList->length(currentEnfVertex->faceEntries.size());
1489       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1490       for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1491         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1492       enfVertex->faceEntries = faceEntryList;
1493
1494       ostringstream msg;
1495       msg << "Enforced vertex: \n"
1496           << "Name: " << enfVertex->name << "\n";
1497       if (coords->length())
1498           msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1499       msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1500           << "Group Name: " << enfVertex->grpName;
1501       MESSAGE(msg.str());
1502
1503       enfVertexList[j] = enfVertex;
1504     }
1505     mapElement->enfVertexList = enfVertexList;
1506
1507     resultMap[i] = mapElement;
1508
1509   }
1510   return resultMap._retn();
1511 }
1512
1513 /**
1514  * Returns the list of all enforced vertices
1515  * @return a list of enforced vertices
1516  *
1517  */
1518 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices() {
1519   MESSAGE("IDL: GetAllEnforcedVertices()");
1520   ASSERT(myBaseImpl);
1521   BLSURFPlugin::TEnfVertexList_var resultMap = new BLSURFPlugin::TEnfVertexList();
1522   const ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList = this->GetImpl()->_GetAllEnforcedVertices();
1523   resultMap->length(enfVertexList.size());
1524   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1525
1526   ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
1527   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1528   for (int i = 0; evlIt != enfVertexList.end(); ++evlIt, ++i) {
1529     MESSAGE("Enforced Vertex #" << i);
1530     currentEnfVertex = (*evlIt);
1531     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1532     // Name
1533     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1534     // Geom entry
1535     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1536     // Coords
1537     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1538     coords->length(currentEnfVertex->coords.size());
1539     for (int ind = 0; ind < coords->length(); ind++)
1540       coords[ind] = currentEnfVertex->coords[ind];
1541     enfVertex->coords = coords;
1542     // Group name
1543     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
1544     // Face entry list
1545     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1546     faceEntryList->length(currentEnfVertex->faceEntries.size());
1547     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1548     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1549       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1550     enfVertex->faceEntries = faceEntryList;
1551
1552     ostringstream msg;
1553     msg << "Enforced vertex: \n"
1554         << "Name: " << enfVertex->name << "\n";
1555     if (coords->length())
1556         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1557     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1558         << "Group Name: " << enfVertex->grpName;
1559     MESSAGE(msg.str());
1560
1561     resultMap[i] = enfVertex;
1562   }
1563   return resultMap._retn();
1564
1565 }
1566
1567 /**
1568  * Returns the list of enforced vertices coords for a given Face entry.
1569  * They are the coords of the "manual" enforced vertices.
1570  * @return A map of Face entry / List of enforced vertices coords
1571  *
1572  */
1573 BLSURFPlugin::TFaceEntryCoordsListMap* BLSURFPlugin_Hypothesis_i::GetAllCoordsByFace() {
1574   MESSAGE("IDL: GetAllCoordsByFace()");
1575   ASSERT(myBaseImpl);
1576
1577   BLSURFPlugin::TFaceEntryCoordsListMap_var resultMap = new BLSURFPlugin::TFaceEntryCoordsListMap();
1578
1579   const ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap entryCoordsListMap = this->GetImpl()->_GetAllCoordsByFace();
1580   resultMap->length(entryCoordsListMap.size());
1581   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1582
1583   ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList _coordsList;
1584   ::BLSURFPlugin_Hypothesis::TFaceEntryCoordsListMap::const_iterator it_entry = entryCoordsListMap.begin();
1585   for (int i = 0; it_entry != entryCoordsListMap.end(); ++it_entry, ++i) {
1586     BLSURFPlugin::TFaceEntryCoordsListMapElement_var mapElement = new BLSURFPlugin::TFaceEntryCoordsListMapElement();
1587     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1588     MESSAGE("Face Entry: " << mapElement->faceEntry);
1589
1590     _coordsList = it_entry->second;
1591     BLSURFPlugin::TEnfVertexCoordsList_var coordsList = new BLSURFPlugin::TEnfVertexCoordsList();
1592     coordsList->length(_coordsList.size());
1593     MESSAGE("Number of coords: " << coordsList->length());
1594
1595     ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator it_coords = _coordsList.begin();
1596     for (int j = 0; it_coords != _coordsList.end(); ++it_coords, ++j) {
1597       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1598       coords->length((*it_coords).size());
1599       for (int i=0;i<coords->length();i++)
1600         coords[i] = (*it_coords)[i];
1601       coordsList[j] = coords;
1602       MESSAGE("Coords #" << j << ": " << coords[0] << ", " << coords[1] << ", " << coords[2]);
1603     }
1604     mapElement->coordsList = coordsList;
1605
1606     resultMap[i] = mapElement;
1607
1608   }
1609   return resultMap._retn();
1610 }
1611
1612 /**
1613  * Returns a map of enforced vertices coords / enforced vertex.
1614  * They are the coords of the "manual" enforced vertices.
1615  */
1616 BLSURFPlugin::TCoordsEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByCoords() {
1617   MESSAGE("IDL: GetAllEnforcedVerticesByCoords()");
1618   ASSERT(myBaseImpl);
1619
1620   BLSURFPlugin::TCoordsEnfVertexMap_var resultMap = new BLSURFPlugin::TCoordsEnfVertexMap();
1621   const ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap coordsEnfVertexMap =
1622       this->GetImpl()->_GetAllEnforcedVerticesByCoords();
1623   resultMap->length(coordsEnfVertexMap.size());
1624   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1625
1626   ::BLSURFPlugin_Hypothesis::TCoordsEnfVertexMap::const_iterator it_coords = coordsEnfVertexMap.begin();
1627   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1628   for (int i = 0; it_coords != coordsEnfVertexMap.end(); ++it_coords, ++i) {
1629     MESSAGE("Enforced Vertex #" << i);
1630     currentEnfVertex = (it_coords->second);
1631     BLSURFPlugin::TCoordsEnfVertexElement_var mapElement = new BLSURFPlugin::TCoordsEnfVertexElement();
1632     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1633     coords->length(it_coords->first.size());
1634     for (int ind=0;ind<coords->length();ind++)
1635       coords[ind] = it_coords->first[ind];
1636     mapElement->coords = coords;
1637     MESSAGE("Coords: " << mapElement->coords[0] << ", " << mapElement->coords[1] << ", " << mapElement->coords[2]);
1638
1639     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1640     // Name
1641     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1642     // Geom entry
1643     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1644     // Coords
1645     BLSURFPlugin::TEnfVertexCoords_var coords2 = new BLSURFPlugin::TEnfVertexCoords();
1646     coords2->length(currentEnfVertex->coords.size());
1647     for (int ind=0;ind<coords2->length();ind++)
1648       coords2[ind] = currentEnfVertex->coords[ind];
1649     enfVertex->coords = coords2;
1650     // Group name
1651     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
1652     // Face entry list
1653     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1654     faceEntryList->length(currentEnfVertex->faceEntries.size());
1655     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1656     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1657       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1658     enfVertex->faceEntries = faceEntryList;
1659       
1660     mapElement->enfVertex = enfVertex;
1661     ostringstream msg;
1662     msg << "Enforced vertex: \n"
1663         << "Name: " << enfVertex->name << "\n";
1664     if (coords->length())
1665         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1666     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1667         << "Group Name: " << enfVertex->grpName;
1668     MESSAGE(msg.str());
1669
1670     resultMap[i] = mapElement;
1671   }
1672   return resultMap._retn();
1673 }
1674
1675 /**
1676  * Returns the list of enforced vertices entries for a given Face entry.
1677  * They are the geom entries of the enforced vertices based on geom shape (vertex, compound, group).
1678  * @return A map of Face entry / List of enforced vertices geom entries
1679  *
1680  */
1681 BLSURFPlugin::TFaceEntryEnfVertexEntryListMap* BLSURFPlugin_Hypothesis_i::GetAllEnfVertexEntriesByFace() {
1682   MESSAGE("IDL: GetAllEnfVertexEntriesByFace()");
1683   ASSERT(myBaseImpl);
1684
1685   BLSURFPlugin::TFaceEntryEnfVertexEntryListMap_var resultMap = new BLSURFPlugin::TFaceEntryEnfVertexEntryListMap();
1686
1687   const ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap entryEnfVertexEntryListMap =
1688       this->GetImpl()->_GetAllEnfVertexEntriesByFace();
1689   resultMap->length(entryEnfVertexEntryListMap.size());
1690   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1691
1692   ::BLSURFPlugin_Hypothesis::TEntryList _enfVertexEntryList;
1693   ::BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexEntryListMap::const_iterator it_entry =
1694       entryEnfVertexEntryListMap.begin();
1695   for (int i = 0; it_entry != entryEnfVertexEntryListMap.end(); ++it_entry, ++i) {
1696     BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement_var mapElement =
1697         new BLSURFPlugin::TFaceEntryEnfVertexEntryListMapElement();
1698     mapElement->faceEntry = CORBA::string_dup(it_entry->first.c_str());
1699     MESSAGE("Face Entry: " << mapElement->faceEntry);
1700
1701     _enfVertexEntryList = it_entry->second;
1702     BLSURFPlugin::TEntryList_var enfVertexEntryList = new BLSURFPlugin::TEntryList();
1703     enfVertexEntryList->length(_enfVertexEntryList.size());
1704     MESSAGE("Number of enf vertex entries: " << enfVertexEntryList->length());
1705
1706     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_enfVertexEntry = _enfVertexEntryList.begin();
1707     for (int j = 0; it_enfVertexEntry != _enfVertexEntryList.end(); ++it_enfVertexEntry, ++j) {
1708       enfVertexEntryList[j] = CORBA::string_dup((*it_enfVertexEntry).c_str());
1709       MESSAGE("Enf Vertex Entry #" << j << ": " << enfVertexEntryList[j]);
1710     }
1711     mapElement->enfVertexEntryList = enfVertexEntryList;
1712
1713     resultMap[i] = mapElement;
1714
1715   }
1716   return resultMap._retn();
1717 }
1718
1719 /**
1720  * Returns a map of enforced vertices geom entry / enforced vertex.
1721  * They are the geom entries of the enforced vertices defined with geom shape (vertex, compound, group).
1722  */
1723 BLSURFPlugin::TEnfVertexEntryEnfVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVerticesByEnfVertexEntry() {
1724   MESSAGE("IDL: GetAllEnforcedVerticesByEnfVertexEntry()");
1725   ASSERT(myBaseImpl);
1726
1727   BLSURFPlugin::TEnfVertexEntryEnfVertexMap_var resultMap = new BLSURFPlugin::TEnfVertexEntryEnfVertexMap();
1728   const ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap enfVertexEntryEnfVertexMap =
1729       this->GetImpl()->_GetAllEnforcedVerticesByEnfVertexEntry();
1730   resultMap->length(enfVertexEntryEnfVertexMap.size());
1731   MESSAGE("Enforced Vertex map size is " << resultMap->length());
1732
1733   ::BLSURFPlugin_Hypothesis::TEnfVertexEntryEnfVertexMap::const_iterator it_enfVertexEntry = enfVertexEntryEnfVertexMap.begin();
1734   ::BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
1735   for (int i = 0; it_enfVertexEntry != enfVertexEntryEnfVertexMap.end(); ++it_enfVertexEntry, ++i) {
1736     MESSAGE("Enforced Vertex #" << i);
1737     currentEnfVertex = it_enfVertexEntry->second;
1738     BLSURFPlugin::TEnfVertexEntryEnfVertexElement_var mapElement = new BLSURFPlugin::TEnfVertexEntryEnfVertexElement();
1739     mapElement->enfVertexEntry = CORBA::string_dup(it_enfVertexEntry->first.c_str());;
1740     MESSAGE("Enf Vertex Entry #" << i << ": " << mapElement->enfVertexEntry);
1741
1742     BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
1743     // Name
1744     enfVertex->name = CORBA::string_dup(currentEnfVertex->name.c_str());
1745     // Geom entry
1746     enfVertex->geomEntry = CORBA::string_dup(currentEnfVertex->geomEntry.c_str());
1747     // Coords
1748     BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
1749     coords->length(currentEnfVertex->coords.size());
1750     for (int ind=0;ind<coords->length();ind++)
1751       coords[ind] = currentEnfVertex->coords[ind];
1752     enfVertex->coords = coords;
1753     // Group name
1754     enfVertex->grpName = CORBA::string_dup(currentEnfVertex->grpName.c_str());  
1755     // Face entry list
1756     BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
1757     faceEntryList->length(currentEnfVertex->faceEntries.size());
1758     ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = currentEnfVertex->faceEntries.begin();
1759     for (int ind = 0; it_entry != currentEnfVertex->faceEntries.end();++it_entry, ++ind)
1760       faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
1761     enfVertex->faceEntries = faceEntryList;
1762
1763     ostringstream msg;
1764     msg << "Enforced vertex: \n"
1765         << "Name: " << enfVertex->name << "\n";
1766     if (coords->length())
1767         msg << "Coords: " << enfVertex->coords[0] << ", " << enfVertex->coords[1] << ", " << enfVertex->coords[2] << "\n";
1768     msg << "Geom entry: " << enfVertex->geomEntry << "\n"
1769         << "Group Name: " << enfVertex->grpName;
1770     MESSAGE(msg.str());
1771
1772     mapElement->enfVertex = enfVertex;
1773     resultMap[i] = mapElement;
1774   }
1775   return resultMap._retn();
1776 }
1777
1778 /**
1779  * Erase all enforced vertices
1780  */
1781 void BLSURFPlugin_Hypothesis_i::ClearAllEnforcedVertices() {
1782   ASSERT(myBaseImpl);
1783   this->GetImpl()->ClearAllEnforcedVertices();
1784   SMESH::TPythonDump() << _this() << ".ClearAllEnforcedVertices()";
1785 }
1786
1787 /*!
1788  * Set/get/unset an enforced vertex on face
1789  */
1790 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1791     CORBA::Double z) throw (SALOME::SALOME_Exception) {
1792   ASSERT(myBaseImpl);
1793
1794   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1795     MESSAGE("theFace shape type is not FACE or COMPOUND");
1796     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1797   }
1798
1799   string theFaceEntry = theFace->GetStudyEntry();
1800   
1801   if (theFaceEntry.empty()) {
1802     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1803     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1804     string aName;
1805     if (theFace->GetShapeType() == GEOM::FACE)
1806       aName = "Face_";
1807     if (theFace->GetShapeType() == GEOM::COMPOUND)
1808       aName = "Compound_";
1809     aName += theFace->GetEntry();
1810     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1811     if (!theSFace->_is_nil())
1812       theFaceEntry = theSFace->GetID();
1813   }
1814   if (theFaceEntry.empty())
1815     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1816   MESSAGE("IDL : GetName : " << theFace->GetName());
1817   MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
1818   try {
1819     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
1820   } catch (SALOME_Exception& ex) {
1821     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1822   }
1823 }
1824
1825 /*!
1826  * Set/get/unset an enforced vertex with name on face
1827  */
1828 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
1829     CORBA::Double z, const char* theVertexName) throw (SALOME::SALOME_Exception) {
1830   ASSERT(myBaseImpl);
1831
1832   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1833     MESSAGE("theFace shape type is not FACE or COMPOUND");
1834     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1835   }
1836
1837   string theFaceEntry = theFace->GetStudyEntry();
1838   
1839   if (theFaceEntry.empty()) {
1840     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1841     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1842     string aName;
1843     if (theFace->GetShapeType() == GEOM::FACE)
1844       aName = "Face_";
1845     if (theFace->GetShapeType() == GEOM::COMPOUND)
1846       aName = "Compound_";
1847     aName += theFace->GetEntry();
1848     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1849     if (!theSFace->_is_nil())
1850       theFaceEntry = theSFace->GetID();
1851   }
1852   if (theFaceEntry.empty())
1853     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1854   
1855   MESSAGE("IDL : GetName : " << theFace->GetName());
1856   MESSAGE("IDL : SetEnforcedVertexNamed( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ")");
1857   try {
1858     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName);
1859   } catch (SALOME_Exception& ex) {
1860     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1861   }
1862 }
1863
1864 /*!
1865  * Set/get/unset an enforced vertex with geom object on face
1866  */
1867 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
1868     throw (SALOME::SALOME_Exception) {
1869   ASSERT(myBaseImpl);
1870
1871   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1872     MESSAGE("theFace shape type is not FACE or COMPOUND");
1873     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1874   }
1875
1876   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
1877     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
1878     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
1879   }
1880
1881   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1882   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
1883   //  if (CORBA::is_nil(measureOp))
1884   //    return false;
1885   //
1886   //  CORBA::Double x, y, z;
1887   //  x = y = z = 0.;
1888   //  measureOp->PointCoordinates(theVertex, x, y, z);
1889
1890   string theFaceEntry = theFace->GetStudyEntry();
1891   string theVertexEntry = theVertex->GetStudyEntry();
1892   
1893   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1894   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1895   string aName;
1896   
1897   if (theFaceEntry.empty()) {
1898     if (theFace->GetShapeType() == GEOM::FACE)
1899       aName = "Face_";
1900     if (theFace->GetShapeType() == GEOM::COMPOUND)
1901       aName = "Compound_";
1902     aName += theFace->GetEntry();
1903     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1904     if (!theSFace->_is_nil())
1905       theFaceEntry = theSFace->GetID();
1906   }
1907   if (theFaceEntry.empty())
1908     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1909   
1910   if (theVertexEntry.empty()) {
1911     if (theVertex->GetShapeType() == GEOM::VERTEX)
1912       aName = "Vertex_";
1913     if (theVertex->GetShapeType() == GEOM::COMPOUND)
1914       aName = "Compound_";
1915     aName += theVertex->GetEntry();
1916     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
1917     if (!theSVertex->_is_nil())
1918       theVertexEntry = theSVertex->GetID();
1919   }
1920   if (theVertexEntry.empty())
1921     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1922
1923   string theVertexName = theVertex->GetName();
1924   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
1925   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
1926   MESSAGE("IDL : SetEnforcedVertexGeom( "<< theFaceEntry << ", " << theVertexEntry<< ")");
1927   try {
1928     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str());
1929   } catch (SALOME_Exception& ex) {
1930     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1931   }
1932 }
1933
1934 /*!
1935  * Set an enforced vertex with group name on face
1936  */
1937 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName)
1938  throw (SALOME::SALOME_Exception)
1939 {
1940   ASSERT(myBaseImpl);
1941
1942   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1943     MESSAGE("theFace shape type is not FACE or COMPOUND");
1944     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1945   }
1946
1947   string theFaceEntry = theFace->GetStudyEntry();
1948   
1949   if (theFaceEntry.empty()) {
1950     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1951     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1952     string aName;
1953     if (theFace->GetShapeType() == GEOM::FACE)
1954       aName = "Face_";
1955     if (theFace->GetShapeType() == GEOM::COMPOUND)
1956       aName = "Compound_";
1957     aName += theFace->GetEntry();
1958     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1959     if (!theSFace->_is_nil())
1960       theFaceEntry = theSFace->GetID();
1961   }
1962   if (theFaceEntry.empty())
1963     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
1964   MESSAGE("IDL : GetName : " << theFace->GetName());
1965   MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
1966   try {
1967     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, "", "", theGroupName);
1968   } catch (SALOME_Exception& ex) {
1969     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
1970   }
1971 }
1972
1973 /*!
1974  * Set an enforced vertex with name and group name on face
1975  */
1976 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexNamedWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, 
1977                                                                 const char* theVertexName, const char* theGroupName)
1978  throw (SALOME::SALOME_Exception)
1979 {
1980   ASSERT(myBaseImpl);
1981
1982   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
1983     MESSAGE("theFace shape type is not FACE or COMPOUND");
1984     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
1985   }
1986
1987   string theFaceEntry = theFace->GetStudyEntry();
1988   
1989   if (theFaceEntry.empty()) {
1990     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
1991     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
1992     string aName;
1993     if (theFace->GetShapeType() == GEOM::FACE)
1994       aName = "Face_";
1995     if (theFace->GetShapeType() == GEOM::COMPOUND)
1996       aName = "Compound_";
1997     aName += theFace->GetEntry();
1998     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
1999     if (!theSFace->_is_nil())
2000       theFaceEntry = theSFace->GetID();
2001   }
2002   if (theFaceEntry.empty())
2003     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2004   MESSAGE("IDL : GetName : " << theFace->GetName());
2005   MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
2006   try {
2007     return SetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z, theVertexName, "", theGroupName);
2008   } catch (SALOME_Exception& ex) {
2009     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2010   }
2011 }
2012
2013 /*!
2014  * Set an enforced vertex with geom entry and group name on face
2015  */
2016 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex, const char* theGroupName)
2017  throw (SALOME::SALOME_Exception)
2018 {
2019   ASSERT(myBaseImpl);
2020
2021   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2022     MESSAGE("theFace shape type is not FACE or COMPOUND");
2023     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2024   }
2025
2026   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2027     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2028     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2029   }
2030
2031   string theFaceEntry = theFace->GetStudyEntry();
2032   string theVertexEntry = theVertex->GetStudyEntry();
2033   
2034   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2035   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2036   string aName;
2037   
2038   if (theFaceEntry.empty()) {
2039     if (theFace->GetShapeType() == GEOM::FACE)
2040       aName = "Face_";
2041     if (theFace->GetShapeType() == GEOM::COMPOUND)
2042       aName = "Compound_";
2043     aName += theFace->GetEntry();
2044     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2045     if (!theSFace->_is_nil())
2046       theFaceEntry = theSFace->GetID();
2047   }
2048   if (theFaceEntry.empty())
2049     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2050   
2051   if (theVertexEntry.empty()) {
2052     if (theVertex->GetShapeType() == GEOM::VERTEX)
2053       aName = "Vertex_";
2054     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2055       aName = "Compound_";
2056     aName += theVertex->GetEntry();
2057     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2058     if (!theSVertex->_is_nil())
2059       theVertexEntry = theSVertex->GetID();
2060   }
2061   if (theVertexEntry.empty())
2062     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2063
2064   string theVertexName = theVertex->GetName();
2065   MESSAGE("IDL : theFace->GetName : " << theFace->GetName());
2066   MESSAGE("IDL : theVertex->GetName : " << theVertexName);
2067   MESSAGE("IDL : SetEnforcedVertexGeomWithGroup( "<< theFaceEntry << ", " << theVertexEntry<< ", " << theGroupName<< ")");
2068   try {
2069     return SetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName);
2070   } catch (SALOME_Exception& ex) {
2071     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2072   }
2073 }
2074
2075 //Enable internal enforced vertices on specific face if requested by user
2076 ///*!
2077 // * Are internal enforced vertices used for a face ?
2078 // */
2079 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
2080 //    throw (SALOME::SALOME_Exception) {
2081 //  ASSERT(myBaseImpl);
2082
2083 //  if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2084 //    MESSAGE("theFace shape type is not FACE or COMPOUND");
2085 //    THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2086 //  }
2087
2088 //  string theFaceEntry = theFace->GetStudyEntry();
2089   
2090 //  if (theFaceEntry.empty()) {
2091 //    GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2092 //    SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2093 //    string aName;
2094 //    if (theFace->GetShapeType() == GEOM::FACE)
2095 //      aName = "Face_";
2096 //    if (theFace->GetShapeType() == GEOM::COMPOUND)
2097 //      aName = "Compound_";
2098 //    aName += theFace->GetEntry();
2099 //    SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2100 //    if (!theSFace->_is_nil())
2101 //      theFaceEntry = theSFace->GetID();
2102 //  }
2103 //  if (theFaceEntry.empty())
2104 //    THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2105
2106 //  MESSAGE("IDL : GetName : " << theFace->GetName());
2107 //  MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2108 //  try {
2109 //    return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
2110 //  } catch (SALOME_Exception& ex) {
2111 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2112 //  }
2113 //}
2114
2115 /*!
2116  * Get the list of all enforced vertices
2117  */
2118 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr theFace)
2119     throw (SALOME::SALOME_Exception) {
2120   ASSERT(myBaseImpl);
2121
2122   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2123     MESSAGE("theFace shape type is not FACE or COMPOUND");
2124     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2125   }
2126
2127   string theFaceEntry = theFace->GetStudyEntry();
2128   
2129   if (theFaceEntry.empty()) {
2130     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2131     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2132     string aName;
2133     if (theFace->GetShapeType() == GEOM::FACE)
2134       aName = "Face_";
2135     if (theFace->GetShapeType() == GEOM::COMPOUND)
2136       aName = "Compound_";
2137     aName += theFace->GetEntry();
2138     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2139     if (!theSFace->_is_nil())
2140       theFaceEntry = theSFace->GetID();
2141   }
2142   if (theFaceEntry.empty())
2143     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2144
2145   MESSAGE("IDL : GetName : " << theFace->GetName());
2146   MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
2147   try {
2148     return GetEnforcedVerticesEntry(theFaceEntry.c_str());
2149   } catch (SALOME_Exception& ex) {
2150     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2151   }
2152 }
2153
2154 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y,
2155     CORBA::Double z) throw (SALOME::SALOME_Exception) {
2156   ASSERT(myBaseImpl);
2157
2158   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2159     MESSAGE("theFace shape type is not FACE or COMPOUND");
2160     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2161   }
2162
2163   string theFaceEntry = theFace->GetStudyEntry();
2164   
2165   if (theFaceEntry.empty()) {
2166     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2167     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2168     string aName;
2169     if (theFace->GetShapeType() == GEOM::FACE)
2170       aName = "Face_";
2171     if (theFace->GetShapeType() == GEOM::COMPOUND)
2172       aName = "Compound_";
2173     aName += theFace->GetEntry();
2174     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2175     if (!theSFace->_is_nil())
2176       theFaceEntry = theSFace->GetID();
2177   }
2178   if (theFaceEntry.empty())
2179     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2180   MESSAGE("IDL : GetName : " << theFace->GetName());
2181   MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
2182
2183   try {
2184     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), x, y, z);
2185   } catch (SALOME_Exception& ex) {
2186     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2187   }
2188 }
2189
2190 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexGeom(GEOM::GEOM_Object_ptr theFace, GEOM::GEOM_Object_ptr theVertex)
2191     throw (SALOME::SALOME_Exception) {
2192   ASSERT(myBaseImpl);
2193
2194   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2195     MESSAGE("theFace shape type is not FACE or COMPOUND");
2196     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2197   }
2198   if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) {
2199     MESSAGE("theVertex shape type is not VERTEX or COMPOUND");
2200     THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM);
2201   }
2202
2203   //  GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2204   //  GEOM::GEOM_IMeasureOperations_var measureOp = geomGen->GetIMeasureOperations(this->GetImpl()->GetStudyId());
2205   //  if (CORBA::is_nil(measureOp))
2206   //    return false;
2207   //
2208   //  CORBA::Double x, y, z;
2209   //  x = y = z = 0.;
2210   //  measureOp->PointCoordinates(theVertex, x, y, z);
2211
2212   std::string theFaceEntry = theFace->GetStudyEntry();
2213   std::string theVertexEntry = theVertex->GetStudyEntry();
2214   
2215   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2216   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2217   string aName;
2218   
2219   if (theFaceEntry.empty()) {
2220     if (theFace->GetShapeType() == GEOM::FACE)
2221       aName = "Face_";
2222     if (theFace->GetShapeType() == GEOM::COMPOUND)
2223       aName = "Compound_";
2224     aName += theFace->GetEntry();
2225     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2226     if (!theSFace->_is_nil())
2227       theFaceEntry = theSFace->GetID();
2228   }
2229   if (theFaceEntry.empty())
2230     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2231   
2232   if (theVertexEntry.empty()) {
2233     if (theVertex->GetShapeType() == GEOM::VERTEX)
2234       aName = "Vertex_";
2235     if (theVertex->GetShapeType() == GEOM::COMPOUND)
2236       aName = "Compound_";
2237     aName += theVertex->GetEntry();
2238     SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str());
2239     if (!theSVertex->_is_nil())
2240       theVertexEntry = theSVertex->GetID();
2241   }
2242   if (theVertexEntry.empty())
2243     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2244   
2245   MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
2246
2247   try {
2248     return UnsetEnforcedVertexEntry(theFaceEntry.c_str(), 0, 0, 0, theVertexEntry.c_str());
2249   } catch (SALOME_Exception& ex) {
2250     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2251   }
2252 }
2253
2254 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception) {
2255   ASSERT(myBaseImpl);
2256
2257   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2258     MESSAGE("theFace shape type is not FACE or COMPOUND");
2259     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2260   }
2261
2262   string theFaceEntry = theFace->GetStudyEntry();
2263   
2264   if (theFaceEntry.empty()) {
2265     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2266     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2267     string aName;
2268     if (theFace->GetShapeType() == GEOM::FACE)
2269       aName = "Face_";
2270     if (theFace->GetShapeType() == GEOM::COMPOUND)
2271       aName = "Compound_";
2272     aName += theFace->GetEntry();
2273     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2274     if (!theSFace->_is_nil())
2275       theFaceEntry = theSFace->GetID();
2276   }
2277   if (theFaceEntry.empty())
2278     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2279   
2280   MESSAGE("IDL : GetName : " << theFace->GetName());
2281   MESSAGE("IDL : UnsetEnforcedVertices ( "<< theFaceEntry << ")");
2282
2283   try {
2284     return UnsetEnforcedVerticesEntry(theFaceEntry.c_str());
2285   } catch (SALOME_Exception& ex) {
2286     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2287   }
2288 }
2289
2290 /*!
2291  * Set/get/unset an enforced vertex on geom object given by entry
2292  */
2293 bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2294     CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
2295     throw (SALOME::SALOME_Exception) {
2296   ASSERT(myBaseImpl);
2297   MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
2298   bool newValue = false;
2299   if (string(theVertexEntry).empty()) {
2300     try {
2301       ::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
2302           this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
2303       ::BLSURFPlugin_Hypothesis::TEnfVertexCoords coords;
2304       coords.push_back(x);
2305       coords.push_back(y);
2306       coords.push_back(z);
2307       if (coordsList.find(coords) == coordsList.end()) {
2308         MESSAGE("Coords not found: add it in coordsList");
2309         newValue = true;
2310       } else {
2311         MESSAGE("Coords already found, compare names");
2312         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords);
2313         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2314           MESSAGE("The names are different: update");
2315 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2316           newValue = true;
2317         }
2318         else {
2319           MESSAGE("The names are identical");
2320         }
2321       }
2322     } catch (const std::invalid_argument& ex) {
2323       // no enforced vertex for entry
2324       MESSAGE("Face entry not found : add it to the list");
2325       newValue = true;
2326     }
2327     if (newValue)
2328       if (string(theVertexName).empty())
2329         if (string(theGroupName).empty())
2330           SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
2331         else
2332           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
2333       else
2334         if (string(theGroupName).empty())
2335           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
2336         else
2337           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" 
2338                                           << theVertexName << "\", \"" << theGroupName << "\")";
2339   } else {
2340     try {
2341       ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
2342       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
2343       if ( it == enfVertexEntryList.end()) {
2344         MESSAGE("Geom entry not found: add it in enfVertexEntryList");
2345         newValue = true;
2346       }
2347       else {
2348         MESSAGE("Geom entry already found, compare names");
2349         ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
2350         if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
2351           MESSAGE("The names are different: update");
2352 //          this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
2353           newValue = true;
2354         }
2355         else {
2356           MESSAGE("The names are identical");
2357         }
2358       }
2359     } catch (const std::invalid_argument& ex) {
2360       // no enforced vertex for entry
2361       MESSAGE("Face entry not found : add it to the list");
2362       newValue = true;
2363     }
2364     if (newValue)
2365         if (string(theGroupName).empty())
2366           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2367         else
2368           SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
2369   }
2370
2371   if (newValue)
2372     this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z);
2373
2374   MESSAGE("IDL : SetEnforcedVertexEntry END");
2375   return newValue;
2376 }
2377
2378 //Enable internal enforced vertices on specific face if requested by user
2379 //CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry)
2380 //    throw (SALOME::SALOME_Exception) {
2381 //  ASSERT(myBaseImpl);
2382 //  try {
2383 //    return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry);
2384 //  } catch (const std::exception& ex) {
2385 //    std::cout << "Exception: " << ex.what() << std::endl;
2386 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2387 //  }
2388 //}
2389   
2390 BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
2391     throw (SALOME::SALOME_Exception) {
2392   ASSERT(myBaseImpl);
2393   MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry);
2394
2395   try {
2396     BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
2397     ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry);
2398     vertexList->length(_vList.size());
2399     MESSAGE("Number of enforced vertices: " << vertexList->length());
2400     ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
2401     for (int i = 0; evlIt != _vList.end(); ++evlIt, ++i) {
2402       ::BLSURFPlugin_Hypothesis::TEnfVertex *_enfVertex = (*evlIt);
2403
2404       BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
2405
2406       // Name
2407       enfVertex->name = CORBA::string_dup(_enfVertex->name.c_str());
2408       // Geom Vertex Entry
2409       enfVertex->geomEntry = CORBA::string_dup(_enfVertex->geomEntry.c_str());
2410       // Coords
2411       BLSURFPlugin::TEnfVertexCoords_var coords = new BLSURFPlugin::TEnfVertexCoords();
2412       coords->length(_enfVertex->coords.size());
2413       for (int ind=0;ind<coords->length();ind++)
2414         coords[ind] = _enfVertex->coords[ind];
2415       enfVertex->coords = coords;
2416       // Group Name
2417       enfVertex->grpName = CORBA::string_dup(_enfVertex->grpName.c_str());
2418       // Face entry list
2419       BLSURFPlugin::TEntryList_var faceEntryList = new BLSURFPlugin::TEntryList();
2420       faceEntryList->length(_enfVertex->faceEntries.size());
2421       ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it_entry = _enfVertex->faceEntries.begin();
2422       for (int ind = 0; it_entry != _enfVertex->faceEntries.end();++it_entry, ++ind)
2423         faceEntryList[ind] = CORBA::string_dup((*it_entry).c_str());
2424       enfVertex->faceEntries = faceEntryList;
2425
2426       vertexList[i] = enfVertex;
2427     }
2428     MESSAGE("ENGINE : GetEnforcedVerticesEntry END ENTRY : " << entry);
2429     return vertexList._retn();
2430   } catch (const std::invalid_argument& ex) {
2431     SALOME::ExceptionStruct ExDescription;
2432     ExDescription.text = ex.what();
2433     ExDescription.type = SALOME::BAD_PARAM;
2434     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
2435     ExDescription.lineNumber = 1385;
2436     throw SALOME::SALOME_Exception(ExDescription);
2437   } catch (const std::exception& ex) {
2438     std::cout << "Exception: " << ex.what() << std::endl;
2439     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2440   }
2441 }
2442
2443 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y,
2444     CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) {
2445   ASSERT(myBaseImpl);
2446   MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")");
2447
2448   bool res = false;
2449   try {
2450     res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
2451
2452     if (string(theVertexEntry).empty())
2453       SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
2454           << ")";
2455     else
2456       SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
2457
2458   } catch (const std::invalid_argument& ex) {
2459     return false;
2460   } catch (const std::exception& ex) {
2461     std::cout << "Exception: " << ex.what() << std::endl;
2462     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2463   }
2464
2465   MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry);
2466   return res;
2467 }
2468
2469 //bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry,
2470 //    CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) {
2471 //  MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry);
2472 //
2473 //  bool ret = false;
2474 //
2475 //  try {
2476 //    ret = _unsetEnfVertex(theFaceEntry, x, y, z);
2477 //  } catch (SALOME_Exception& ex) {
2478 //    THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2479 //  }
2480 //
2481 //  if (ret)
2482 //    SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry
2483 //        << ")";
2484 //
2485 //  MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry);
2486 //  return ret;
2487 //}
2488
2489 bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) {
2490   ASSERT(myBaseImpl);
2491   MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")");
2492
2493   try {
2494     this->GetImpl()->ClearEnforcedVertices(theFaceEntry);
2495     SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")";
2496   } catch (const std::invalid_argument& ex) {
2497     return false;
2498   } catch (const std::exception& ex) {
2499     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2500   }
2501
2502   MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry);
2503   return true;
2504 }
2505
2506 //=============================================================================
2507 /*!
2508  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
2509  *
2510  *  Set true or false
2511  */
2512 //=============================================================================
2513 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
2514   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
2515   ASSERT(myBaseImpl);
2516   this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
2517   std::string theValueStr = theValue ? "True" : "False";
2518   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
2519 }
2520
2521 //=============================================================================
2522 /*!
2523  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
2524  *
2525  *  Get true or false
2526  */
2527 //=============================================================================
2528 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
2529   MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
2530   ASSERT(myBaseImpl);
2531   return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
2532 }
2533
2534 //=============================================================================
2535 /*!
2536  *  BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
2537  *
2538  *  Set group name
2539  */
2540 //=============================================================================
2541 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char*  groupName) {
2542   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
2543   ASSERT(myBaseImpl);
2544   this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
2545   SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
2546 }
2547
2548 //=============================================================================
2549 /*!
2550  *  BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
2551  *
2552  *  Get group name
2553  */
2554 //=============================================================================
2555 char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
2556   MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
2557   ASSERT(myBaseImpl);
2558   return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
2559 }
2560
2561 /*
2562  * Enable internal enforced vertices on specific face if requested by user
2563  *
2564 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
2565  throw (SALOME::SALOME_Exception)
2566 {
2567   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
2568   try {
2569     SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
2570   } catch (SALOME_Exception& ex) {
2571     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2572   }
2573 }
2574
2575 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2576  throw (SALOME::SALOME_Exception)
2577 {
2578   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
2579
2580   if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
2581     MESSAGE("theFace shape type is not FACE or COMPOUND");
2582     THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
2583   }
2584
2585   string theFaceEntry = theFace->GetStudyEntry();
2586
2587   if (theFaceEntry.empty()) {
2588     GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2589     SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2590     string aName;
2591     if (theFace->GetShapeType() == GEOM::FACE)
2592       aName = "Face_";
2593     if (theFace->GetShapeType() == GEOM::COMPOUND)
2594       aName = "Compound_";
2595     aName += theFace->GetEntry();
2596     SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
2597     if (!theSFace->_is_nil())
2598       theFaceEntry = theSFace->GetID();
2599   }
2600   if (theFaceEntry.empty())
2601     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2602
2603   MESSAGE("IDL : GetName : " << theFace->GetName());
2604   MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
2605   try {
2606     SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
2607   } catch (SALOME_Exception& ex) {
2608     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2609   }
2610 }
2611
2612 void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
2613     throw (SALOME::SALOME_Exception)
2614 {
2615   MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
2616   ASSERT(myBaseImpl);
2617   try {
2618     this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
2619     std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
2620     if (string(theGroupName).empty())
2621       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
2622     else
2623       SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
2624   } catch (const std::exception& ex) {
2625     std::cout << "Exception: " << ex.what() << std::endl;
2626     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2627   }
2628 }
2629
2630 */
2631
2632 /* TODO GROUPS
2633  char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
2634  throw (SALOME::SALOME_Exception)
2635  {
2636  ASSERT(myBaseImpl);
2637  MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
2638  try {
2639  return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
2640  }
2641  catch (const std::invalid_argument& ex) {
2642  SALOME::ExceptionStruct ExDescription;
2643  ExDescription.text = ex.what();
2644  ExDescription.type = SALOME::BAD_PARAM;
2645  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
2646  ExDescription.lineNumber = 1146;
2647  throw SALOME::SALOME_Exception(ExDescription);
2648  }
2649  catch (SALOME_Exception& ex) {
2650  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2651  }
2652  MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
2653  return 0;
2654  }
2655
2656
2657  void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
2658  throw (SALOME::SALOME_Exception)
2659  {
2660  ASSERT(myBaseImpl);
2661  MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
2662  try {
2663  this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
2664  }
2665  catch (const std::invalid_argument& ex) {
2666  SALOME::ExceptionStruct ExDescription;
2667  ExDescription.text = ex.what();
2668  ExDescription.type = SALOME::BAD_PARAM;
2669  ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
2670  ExDescription.lineNumber = 1170;
2671  throw SALOME::SALOME_Exception(ExDescription);
2672  }
2673  catch (SALOME_Exception& ex) {
2674  THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2675  }
2676
2677  SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
2678  << x << ", " << y << ", " << z << ", '" << groupName << "' )";
2679
2680  MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
2681  }
2682  */
2683 ///////////////////////
2684
2685 ///////////////////////
2686 // PERIODICITY       //
2687 ///////////////////////
2688
2689
2690 std::string BLSURFPlugin_Hypothesis_i::ShapeTypeToString(GEOM::shape_type theShapeType)
2691 {
2692 //enum shape_type { COMPOUND, COMPSOLID, SOLID, SHELL, FACE, WIRE, EDGE, VERTEX, SHAPE /*, __max_shape_type=0xffffffff */ };
2693   std::map<GEOM::shape_type, std::string> MapShapeTypeToString;
2694   MapShapeTypeToString[GEOM::COMPOUND] = std::string("COMPOUND");
2695   MapShapeTypeToString[GEOM::COMPSOLID] = std::string("COMPSOLID");
2696   MapShapeTypeToString[GEOM::SOLID] = std::string("SOLID");
2697   MapShapeTypeToString[GEOM::SHELL] = std::string("SHELL");
2698   MapShapeTypeToString[GEOM::FACE] = std::string("FACE");
2699   MapShapeTypeToString[GEOM::WIRE] = std::string("WIRE");
2700   MapShapeTypeToString[GEOM::EDGE] = std::string("EDGE");
2701   MapShapeTypeToString[GEOM::VERTEX] = std::string("VERTEX");
2702   MapShapeTypeToString[GEOM::SHAPE] = std::string("SHAPE");
2703   std::string txtShapeType = MapShapeTypeToString[theShapeType];
2704   return txtShapeType;
2705 }
2706
2707 void BLSURFPlugin_Hypothesis_i::CheckShapeTypes(GEOM::GEOM_Object_ptr shape, std::vector<GEOM::shape_type> theShapeTypes)
2708 {
2709   // Check shape types
2710   bool ok = false;
2711   std::stringstream typesTxt;
2712   for (std::size_t i=0; i<theShapeTypes.size(); i++)
2713     {
2714       GEOM::shape_type theShapeType = theShapeTypes[i];
2715       if (shape->GetShapeType() == theShapeType)
2716         ok = true;
2717       typesTxt << ShapeTypeToString(theShapeType);
2718       if (i < theShapeTypes.size()-1 )
2719         typesTxt << ", ";
2720     }
2721   if (!ok){
2722     std::stringstream msg;
2723     msg << "shape shape type is not in" << typesTxt;
2724     MESSAGE(msg);
2725     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2726   }
2727 }
2728
2729 void BLSURFPlugin_Hypothesis_i::CheckShapeType(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType)
2730 {
2731   // Check shape type
2732   if (shape->GetShapeType() != theShapeType) {
2733     std::stringstream msg;
2734     msg << "shape shape type is not " << ShapeTypeToString(theShapeType);
2735     MESSAGE(msg);
2736     THROW_SALOME_CORBA_EXCEPTION(msg.str().c_str(), SALOME::BAD_PARAM);
2737   }
2738 }
2739
2740 std::string BLSURFPlugin_Hypothesis_i::PublishIfNeeded(GEOM::GEOM_Object_ptr shape, GEOM::shape_type theShapeType, std::string prefix)
2741 {
2742   // Check shape is published in the object browser
2743   string shapeEntry = shape->GetStudyEntry();
2744
2745   GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
2746   SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
2747   string aName;
2748
2749   // Publish shape if needed
2750   if (shapeEntry.empty()) {
2751     if (shape->GetShapeType() == theShapeType)
2752       aName = prefix;
2753     aName += shape->GetEntry();
2754     SALOMEDS::SObject_wrap theSFace1 = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, shape, aName.c_str());
2755     if (!theSFace1->_is_nil())
2756       shapeEntry = theSFace1->GetID();
2757   }
2758   if (shapeEntry.empty())
2759     THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
2760   return shapeEntry;
2761 }
2762
2763 // Format the output of two vectors to use it in MESSAGE and PythonDump
2764 std::string BLSURFPlugin_Hypothesis_i::FormatVerticesEntries(vector<string> &theSourceVerticesEntries, vector<string> &theTargetVerticesEntries)
2765 {
2766   std::stringstream listEntriesTxt;
2767
2768   if (!theSourceVerticesEntries.empty())
2769     {
2770       listEntriesTxt << ", [" ;
2771       size_t i =0;
2772       for (std::vector<std::string>::const_iterator it = theSourceVerticesEntries.begin(); it != theSourceVerticesEntries.end(); it++, i++)
2773         {
2774           if (i>0)
2775             listEntriesTxt << ", ";
2776           listEntriesTxt << *it;
2777         }
2778
2779       listEntriesTxt << "], [" ;
2780       i =0;
2781       for (std::vector<std::string>::const_iterator it = theTargetVerticesEntries.begin(); it != theTargetVerticesEntries.end(); it++, i++)
2782         {
2783           if (i>0)
2784             listEntriesTxt << ", ";
2785           listEntriesTxt << *it;
2786         }
2787       listEntriesTxt << "]" ;
2788     }
2789   return listEntriesTxt.str();
2790 }
2791
2792 /**
2793  * Erase all PreCad periodicity associations
2794  */
2795 void BLSURFPlugin_Hypothesis_i::ClearPreCadPeriodicityVectors() {
2796   ASSERT(myBaseImpl);
2797   this->GetImpl()->ClearPreCadPeriodicityVectors();
2798   SMESH::TPythonDump() << _this() << ".ClearPreCadPeriodicityVectors()";
2799 }
2800
2801 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector()
2802 {
2803   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector");
2804   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2805       this->GetImpl()->_GetPreCadFacesPeriodicityVector();
2806
2807   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2808
2809   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadFacesPeriodicityVector end");
2810   return periodicityList._retn();
2811 }
2812
2813 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector()
2814 {
2815   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector");
2816   const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadPeriodicityVector =
2817       this->GetImpl()->_GetPreCadEdgesPeriodicityVector();
2818
2819   BLSURFPlugin::TPeriodicityList_var periodicityList = PreCadVectorToSequence(preCadPeriodicityVector);
2820
2821   MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCadEdgesPeriodicityVector end");
2822   return periodicityList._retn();
2823 }
2824
2825 // convert a vector preCadPeriodicityVector into TPeriodicityList Corba sequence
2826 BLSURFPlugin::TPeriodicityList* BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence(const ::BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector& preCadPeriodicityVector)
2827 {
2828   MESSAGE("BLSURFPlugin_Hypothesis_i::PreCadVectorToSequence");
2829   BLSURFPlugin::TPeriodicityList_var periodicityList = new BLSURFPlugin::TPeriodicityList();
2830
2831     periodicityList->length(preCadPeriodicityVector.size());
2832
2833     for (size_t i = 0; i<preCadPeriodicityVector.size(); i++)
2834       {
2835         ::BLSURFPlugin_Hypothesis::TPreCadPeriodicity preCadPeriodicityVector_i = preCadPeriodicityVector[i];
2836
2837         BLSURFPlugin::TPreCadPeriodicity_var myPreCadPeriodicity = new BLSURFPlugin::TPreCadPeriodicity();
2838         myPreCadPeriodicity->shape1Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape1Entry.c_str());
2839         myPreCadPeriodicity->shape2Entry = CORBA::string_dup(preCadPeriodicityVector_i.shape2Entry.c_str());
2840
2841         BLSURFPlugin::TEntryList_var sourceVertices = new BLSURFPlugin::TEntryList();
2842         if (! preCadPeriodicityVector_i.theSourceVerticesEntries.empty())
2843           {
2844             sourceVertices->length(preCadPeriodicityVector_i.theSourceVerticesEntries.size());
2845             for (size_t j=0; j<preCadPeriodicityVector_i.theSourceVerticesEntries.size(); j++)
2846               sourceVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theSourceVerticesEntries[j].c_str());
2847           }
2848
2849         myPreCadPeriodicity->theSourceVerticesEntries = sourceVertices;
2850
2851         BLSURFPlugin::TEntryList_var targetVertices = new BLSURFPlugin::TEntryList();
2852         if (! preCadPeriodicityVector_i.theTargetVerticesEntries.empty())
2853            {
2854             targetVertices->length(preCadPeriodicityVector_i.theTargetVerticesEntries.size());
2855              for (size_t j=0; j<preCadPeriodicityVector_i.theTargetVerticesEntries.size(); j++)
2856                targetVertices[j]=CORBA::string_dup(preCadPeriodicityVector_i.theTargetVerticesEntries[j].c_str());
2857            }
2858
2859         myPreCadPeriodicity->theTargetVerticesEntries = targetVertices;
2860
2861         periodicityList[i] = myPreCadPeriodicity;
2862       }
2863
2864
2865   return periodicityList._retn();
2866 }
2867
2868
2869 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
2870 throw (SALOME::SALOME_Exception)
2871 {
2872   ASSERT(myBaseImpl);
2873   const GEOM::ListOfGO theSourceVertices;
2874   const GEOM::ListOfGO theTargetVertices;
2875   AddPreCadFacesPeriodicityWithVertices(theFace1, theFace2, theSourceVertices, theTargetVertices);
2876 }
2877
2878
2879 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2,
2880     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2881 throw (SALOME::SALOME_Exception)
2882 {
2883   ASSERT(myBaseImpl);
2884   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityWithVertices");
2885
2886   size_t theLength = theSourceVertices.length();
2887   if (theLength != theTargetVertices.length())
2888     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2889
2890   std::vector<GEOM::shape_type> allowedShapeTypes;
2891   allowedShapeTypes.push_back(GEOM::FACE);
2892   allowedShapeTypes.push_back(GEOM::COMPOUND);
2893
2894   string prefix1 = "Source_face_";
2895   CheckShapeTypes(theFace1, allowedShapeTypes);
2896   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
2897
2898   string prefix2 = "Target_face_";
2899   CheckShapeTypes(theFace2, allowedShapeTypes);
2900   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
2901
2902   string prefix3 = "Source_vertex_";
2903   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
2904   theSourceVerticesEntries->length(theLength);
2905   GEOM::GEOM_Object_ptr theVtx_i;
2906   string theEntry_i;
2907   for (size_t ind = 0; ind < theLength; ind++) {
2908       theVtx_i = theSourceVertices[ind];
2909       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
2910       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2911   }
2912
2913   string prefix4 = "Target_vertex_";
2914   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
2915   theTargetVerticesEntries->length(theLength);
2916   for (size_t ind = 0; ind < theLength; ind++) {
2917       theVtx_i = theTargetVertices[ind];
2918       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
2919       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
2920   }
2921
2922   string theFace2Name = theFace2->GetName();
2923   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
2924   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
2925   MESSAGE("IDL : AddPreCadFacesPeriodicity( "<< theFace1Entry << ", " << theFace2Entry <<  ")");
2926   try {
2927       AddPreCadFacesPeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str(),
2928           theSourceVerticesEntries, theTargetVerticesEntries);
2929   } catch (SALOME_Exception& ex) {
2930     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
2931   }
2932 }
2933
2934
2935 void BLSURFPlugin_Hypothesis_i::AddPreCadFacesPeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry,
2936     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
2937     throw (SALOME::SALOME_Exception)
2938 {
2939
2940   ASSERT(myBaseImpl);
2941
2942   // Convert BLSURFPlugin::TEntryList to vector<string>
2943   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
2944   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
2945       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
2946       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
2947   }
2948
2949   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
2950
2951   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << listEntriesTxt.c_str() << ")");
2952
2953   this->GetImpl()->AddPreCadFacesPeriodicity(theFace1Entry, theFace2Entry,
2954       theSourceVerticesEntries, theTargetVerticesEntries);
2955
2956   SMESH::TPythonDump pd;
2957   if (!theSourceVerticesEntries.empty())
2958     {
2959       pd << _this() << ".AddPreCadFacesPeriodicityWithVertices(" << theFace1Entry << ", " << theFace2Entry;
2960       pd << listEntriesTxt.c_str();
2961       pd << ")";
2962     }
2963   else
2964     pd << _this() << ".AddPreCadFacesPeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
2965   MESSAGE("IDL : AddPreCadFacesPeriodicityEntry END");
2966 }
2967
2968 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2)
2969       throw (SALOME::SALOME_Exception)
2970 {
2971   ASSERT(myBaseImpl);
2972   const GEOM::ListOfGO theSourceVertices;
2973   const GEOM::ListOfGO theTargetVertices;
2974   AddPreCadEdgesPeriodicityWithVertices(theEdge1, theEdge2, theSourceVertices, theTargetVertices);
2975 }
2976
2977 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theEdge2,
2978     const GEOM::ListOfGO& theSourceVertices, const GEOM::ListOfGO& theTargetVertices)
2979       throw (SALOME::SALOME_Exception)
2980 {
2981   MESSAGE("BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityWithVertices");
2982   ASSERT(myBaseImpl);
2983
2984   size_t theLength = theSourceVertices.length();
2985   if (theLength != theTargetVertices.length())
2986     THROW_SALOME_CORBA_EXCEPTION( "The sizes of theSourceVertices and theTargetVertices must be the same" ,SALOME::BAD_PARAM );
2987
2988   std::vector<GEOM::shape_type> allowedShapeTypes;
2989   allowedShapeTypes.push_back(GEOM::EDGE);
2990   allowedShapeTypes.push_back(GEOM::COMPOUND);
2991
2992   string prefix1 = "Source_edge_";
2993   CheckShapeTypes(theEdge1, allowedShapeTypes);
2994   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix1);
2995
2996   string prefix2 = "Target_edge_";
2997   CheckShapeTypes(theEdge2, allowedShapeTypes);
2998   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix2);
2999
3000   string prefix3 = "Source_vertex_";
3001   BLSURFPlugin::TEntryList_var theSourceVerticesEntries = new BLSURFPlugin::TEntryList();
3002   theSourceVerticesEntries->length(theLength);
3003   GEOM::GEOM_Object_ptr theVtx_i;
3004   string theEntry_i;
3005   for (size_t ind = 0; ind < theLength; ind++) {
3006       theVtx_i = theSourceVertices[ind];
3007       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix3);
3008       theSourceVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3009   }
3010
3011   string prefix4 = "Target_vertex_";
3012   BLSURFPlugin::TEntryList_var theTargetVerticesEntries = new BLSURFPlugin::TEntryList();
3013   theTargetVerticesEntries->length(theLength);
3014   for (size_t ind = 0; ind < theLength; ind++) {
3015       theVtx_i = theTargetVertices[ind];
3016       theEntry_i = PublishIfNeeded(theVtx_i, GEOM::VERTEX, prefix4);
3017       theTargetVerticesEntries[ind] = CORBA::string_dup(theEntry_i.c_str());
3018   }
3019
3020   string theEdge2Name = theEdge2->GetName();
3021   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3022   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3023   MESSAGE("IDL : AddPreCadEdgesPeriodicity( "<< theEdge1Entry << ", " << theEdge2Entry << ")");
3024   try {
3025       AddPreCadEdgesPeriodicityEntry(theEdge1Entry.c_str(), theEdge2Entry.c_str(),
3026           theSourceVerticesEntries, theTargetVerticesEntries);
3027   } catch (SALOME_Exception& ex) {
3028     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3029   }
3030 }
3031
3032
3033 void BLSURFPlugin_Hypothesis_i::AddPreCadEdgesPeriodicityEntry(const char* theEdge1Entry, const char* theEdge2Entry,
3034     const BLSURFPlugin::TEntryList& theSourceVerticesEntriesCorba, const BLSURFPlugin::TEntryList& theTargetVerticesEntriesCorba)
3035     throw (SALOME::SALOME_Exception)
3036 {
3037
3038   ASSERT(myBaseImpl);
3039
3040   // Convert BLSURFPlugin::TEntryList to vector<string>
3041   vector<string> theSourceVerticesEntries, theTargetVerticesEntries;
3042   for (size_t ind = 0; ind < theSourceVerticesEntriesCorba.length(); ind++) {
3043       theSourceVerticesEntries.push_back(theSourceVerticesEntriesCorba[ind].in());
3044       theTargetVerticesEntries.push_back(theTargetVerticesEntriesCorba[ind].in());
3045   }
3046
3047   string listEntriesTxt = FormatVerticesEntries(theSourceVerticesEntries, theTargetVerticesEntries);
3048
3049   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry(" << theEdge1Entry << ", " << theEdge2Entry << listEntriesTxt.c_str() << ")");
3050   this->GetImpl()->AddPreCadEdgesPeriodicity(theEdge1Entry, theEdge2Entry,
3051       theSourceVerticesEntries, theTargetVerticesEntries);
3052
3053   SMESH::TPythonDump pd;
3054   if (!theSourceVerticesEntries.empty())
3055     {
3056       pd << _this() << ".AddPreCadEdgesPeriodicityWithVertices(" << theEdge1Entry << ", " << theEdge2Entry;
3057       pd << listEntriesTxt.c_str();
3058       pd << ")";
3059     }
3060   else
3061     pd << _this() << ".AddPreCadEdgesPeriodicity(" << theEdge1Entry << ", " << theEdge2Entry << ")";
3062
3063   MESSAGE("IDL : AddPreCadEdgesPeriodicityEntry END");
3064 }
3065
3066 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theFace2)
3067     throw (SALOME::SALOME_Exception)
3068 {
3069   ASSERT(myBaseImpl);
3070
3071   string prefix1 = "Source_face_";
3072   CheckShapeType(theFace1, GEOM::FACE);
3073   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix1);
3074   string prefix2 = "Target_face_";
3075   CheckShapeType(theFace2, GEOM::FACE);
3076   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix2);
3077
3078   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3079   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3080   MESSAGE("IDL : AddFacePeriodicity( "<< theFace1Entry << ", " << theFace2Entry << ")");
3081   try {
3082       AddFacePeriodicityEntry(theFace1Entry.c_str(), theFace2Entry.c_str());
3083   } catch (SALOME_Exception& ex) {
3084     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3085   }
3086
3087
3088 }
3089
3090 void BLSURFPlugin_Hypothesis_i::AddFacePeriodicityEntry(const char* theFace1Entry, const char* theFace2Entry)
3091     throw (SALOME::SALOME_Exception){
3092
3093   ASSERT(myBaseImpl);
3094
3095   MESSAGE("IDL : AddFacePeriodicityEntry(" << theFace1Entry << ", " << theFace2Entry << ")");
3096   this->GetImpl()->AddFacePeriodicity(theFace1Entry, theFace2Entry);
3097   SMESH::TPythonDump pd;
3098   pd << _this() << ".AddFacePeriodicity(" << theFace1Entry << ", " << theFace2Entry << ")";
3099   MESSAGE("IDL : AddFacePeriodicityEntry END");
3100 }
3101
3102
3103 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicity(GEOM::GEOM_Object_ptr theFace1, GEOM::GEOM_Object_ptr theEdge1,
3104                                                    GEOM::GEOM_Object_ptr theFace2, GEOM::GEOM_Object_ptr theEdge2,
3105                                                    CORBA::Long edge_orientation)
3106     throw (SALOME::SALOME_Exception){
3107   ASSERT(myBaseImpl);
3108
3109   string prefix_theFace1 = "Source_face_";
3110   CheckShapeType(theFace1, GEOM::FACE);
3111   string theFace1Entry = PublishIfNeeded(theFace1, GEOM::FACE, prefix_theFace1);
3112   string prefix_theFace2 = "Target_face_";
3113   CheckShapeType(theFace2, GEOM::FACE);
3114   string theFace2Entry = PublishIfNeeded(theFace2, GEOM::FACE, prefix_theFace2);
3115
3116   string prefix_theEdge1 = "Source_edge_";
3117   CheckShapeType(theEdge1, GEOM::EDGE);
3118   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3119   string prefix_theEdge2 = "Target_edge_";
3120   CheckShapeType(theEdge2, GEOM::EDGE);
3121   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3122
3123   MESSAGE("IDL : theFace1->GetName : " << theFace1->GetName());
3124   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3125   MESSAGE("IDL : theFace2->GetName : " << theFace2->GetName());
3126   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3127   MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
3128   try {
3129       AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3130   } catch (SALOME_Exception& ex) {
3131     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3132   }
3133
3134
3135 }
3136
3137 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityWithoutFaces(GEOM::GEOM_Object_ptr theEdge1,
3138                                                                GEOM::GEOM_Object_ptr theEdge2,
3139                                                                CORBA::Long edge_orientation)
3140     throw (SALOME::SALOME_Exception){
3141   ASSERT(myBaseImpl);
3142
3143   string theFace1Entry = "";
3144   string theFace2Entry = "";
3145
3146   string prefix_theEdge1 = "Source_edge_";
3147   CheckShapeType(theEdge1, GEOM::EDGE);
3148   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3149   string prefix_theEdge2 = "Target_edge_";
3150   CheckShapeType(theEdge2, GEOM::EDGE);
3151   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3152
3153   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3154   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3155   MESSAGE("IDL : AddEdgePeriodicity( "<< theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
3156   try {
3157       AddEdgePeriodicityEntry(theFace1Entry.c_str(), theEdge1Entry.c_str(), theFace2Entry.c_str(), theEdge2Entry.c_str(), edge_orientation);
3158   } catch (SALOME_Exception& ex) {
3159     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3160   }
3161
3162
3163 }
3164
3165 void BLSURFPlugin_Hypothesis_i::AddEdgePeriodicityEntry(const char* theFace1Entry, const char* theEdge1Entry, const char* theFace2Entry, const char* theEdge2Entry, const long edge_orientation)
3166     throw (SALOME::SALOME_Exception){
3167
3168   ASSERT(myBaseImpl);
3169
3170   MESSAGE("IDL : AddEdgePeriodicityEntry(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation << ")");
3171   this->GetImpl()->AddEdgePeriodicity(theFace1Entry, theEdge1Entry, theFace2Entry, theEdge2Entry, edge_orientation);
3172   SMESH::TPythonDump pd;
3173   if (theFace1Entry)
3174     pd << _this() << ".AddEdgePeriodicity(" << theFace1Entry << ", " << theEdge1Entry << ", " << theFace2Entry << ", "  << theEdge2Entry << ", " << edge_orientation <<")";
3175   else
3176     pd << _this() << ".AddEdgePeriodicityWithoutFaces(" << theEdge1Entry << ", " << theEdge2Entry << ", " << edge_orientation <<")";
3177   MESSAGE("IDL : AddEdgePeriodicityEntry END");
3178 }
3179
3180 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicity(GEOM::GEOM_Object_ptr theEdge1, GEOM::GEOM_Object_ptr theVertex1,
3181     GEOM::GEOM_Object_ptr theEdge2, GEOM::GEOM_Object_ptr theVertex2)
3182     throw (SALOME::SALOME_Exception){
3183   ASSERT(myBaseImpl);
3184
3185   string prefix_theEdge1 = "Source_edge_";
3186   CheckShapeType(theEdge1, GEOM::EDGE);
3187   string theEdge1Entry = PublishIfNeeded(theEdge1, GEOM::EDGE, prefix_theEdge1);
3188   string prefix_theEdge2 = "Target_edge_";
3189   CheckShapeType(theEdge2, GEOM::EDGE);
3190   string theEdge2Entry = PublishIfNeeded(theEdge2, GEOM::EDGE, prefix_theEdge2);
3191
3192   string prefix_theVertex1 = "Source_vertex_";
3193   CheckShapeType(theVertex1, GEOM::VERTEX);
3194   string theVertex1Entry = PublishIfNeeded(theVertex1, GEOM::VERTEX, prefix_theVertex1);
3195   string prefix_theVertex2 = "Target_vertex_";
3196   CheckShapeType(theVertex2, GEOM::VERTEX);
3197   string theVertex2Entry = PublishIfNeeded(theVertex2, GEOM::VERTEX, prefix_theVertex2);
3198
3199   MESSAGE("IDL : theEdge1->GetName : " << theEdge1->GetName());
3200   MESSAGE("IDL : theVertex1->GetName : " << theVertex1->GetName());
3201   MESSAGE("IDL : theEdge2->GetName : " << theEdge2->GetName());
3202   MESSAGE("IDL : theVertex2->GetName : " << theVertex2->GetName());
3203   MESSAGE("IDL : AddVertexPeriodicity( "<< theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")");
3204   try {
3205       AddVertexPeriodicityEntry(theEdge1Entry.c_str(), theVertex1Entry.c_str(), theEdge2Entry.c_str(), theVertex2Entry.c_str());
3206   } catch (SALOME_Exception& ex) {
3207     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3208   }
3209
3210
3211 }
3212
3213 void BLSURFPlugin_Hypothesis_i::AddVertexPeriodicityEntry(const char* theEdge1Entry, const char* theVertex1Entry, const char* theEdge2Entry, const char* theVertex2Entry)
3214     throw (SALOME::SALOME_Exception){
3215
3216   ASSERT(myBaseImpl);
3217
3218   MESSAGE("IDL : AddVertexPeriodicityEntry(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")");
3219   this->GetImpl()->AddVertexPeriodicity(theEdge1Entry, theVertex1Entry, theEdge2Entry, theVertex2Entry);
3220   SMESH::TPythonDump pd;
3221   pd << _this() << ".AddVertexPeriodicity(" << theEdge1Entry << ", " << theVertex1Entry << ", " << theEdge2Entry << ", "  << theVertex2Entry << ")";
3222   MESSAGE("IDL : AddVertexPeriodicityEntry END");
3223 }
3224
3225
3226 //================================================================================
3227 /*!
3228  * \brief Sets the file for export resulting mesh in GMF format
3229  * \param theFileName - full name of the file (.mesh, .meshb)
3230  * 
3231  * After compute, export the resulting mesh in the given file with the GMF format (.mesh)
3232  */
3233 //================================================================================  
3234 // void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName, CORBA::Boolean isBinary) {
3235 void BLSURFPlugin_Hypothesis_i::SetGMFFile(const char* theFileName) {
3236   ASSERT(myBaseImpl);
3237   MESSAGE("IDL : SetGMFFile(" << theFileName << ")");
3238   bool valueChanged/*, modeChanged*/ = false;
3239   try {
3240     valueChanged = (this->GetImpl()->GetGMFFile() != theFileName);
3241 //     modeChanged = (this->GetImpl()->GetGMFFileMode() != isBinary);
3242     if (valueChanged)// or (!valueChanged && modeChanged))
3243       this->GetImpl()->SetGMFFile(theFileName);// ,isBinary);
3244   } catch (const std::exception& ex) {
3245     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
3246   }
3247   if (valueChanged)// or (!valueChanged && modeChanged))
3248     SMESH::TPythonDump() << _this() << ".SetGMFFile(\"" << theFileName << "\")"; //", " << isBinary << ")";
3249   MESSAGE("IDL : SetGMFFile END ");
3250 }
3251
3252 //================================================================================
3253 /*!
3254  * \brief Gets the file name for export resulting mesh in GMF format
3255  * \retval char* - The file name
3256  * 
3257  * Returns the GMF file name
3258  */
3259 //================================================================================  
3260 char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
3261   ASSERT(myBaseImpl);
3262 //   MESSAGE("IDL : GetGMFFile()");
3263   return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
3264 }
3265
3266 // //================================================================================
3267 // /*!
3268 //  * \brief Gets the file mode for export resulting mesh in GMF format
3269 //  * \retval CORBA::Boolean - TRUE if binary mode, FALSE if ascii mode
3270 //  * 
3271 //  * Returns the GMF file mode
3272 //  */
3273 // //================================================================================  
3274 // CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetGMFFileMode() {
3275 //   ASSERT(myBaseImpl);
3276 //   MESSAGE("IDL : GetGMFFileMode()");
3277 //   return this->GetImpl()->GetGMFFileMode();
3278 // }
3279
3280 //=============================================================================
3281 /*!
3282  *  BLSURFPlugin_Hypothesis_i::GetImpl
3283  *
3284  *  Get implementation
3285  */
3286 //=============================================================================
3287 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() {
3288   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
3289   return (::BLSURFPlugin_Hypothesis*) myBaseImpl;
3290 }
3291
3292 //================================================================================
3293 /*!
3294  * \brief Verify whether hypothesis supports given entity type 
3295  * \param type - dimension (see SMESH::Dimension enumeration)
3296  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
3297  * 
3298  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
3299  */
3300 //================================================================================  
3301 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
3302   return type == SMESH::DIM_2D;
3303 }
3304
3305 //
3306 // Obsolete methods - To be removed in V7
3307 //
3308
3309 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
3310   this->SetMinSize(theMinSize);
3311 }
3312 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
3313   return this->GetMinSize();
3314 }
3315 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
3316   this->SetMaxSize(theMaxSize);
3317 }
3318 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
3319   return this->GetMaxSize();
3320 }
3321 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
3322   this->SetMinSize(theMinSize);
3323 }
3324 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
3325   return this->GetMinSize();
3326 }
3327 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
3328   this->SetMaxSize(theMaxSize);
3329 }
3330 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
3331   return this->GetMaxSize();
3332 }
3333 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
3334   this->SetAngleMesh(theValue);
3335 }
3336 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
3337   return this->GetAngleMesh();
3338 }
3339 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
3340   this->SetAngleMesh(theValue);
3341 }
3342 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
3343   return this->GetAngleMesh();
3344 }
3345 void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
3346   std::string theValueStr = theValue ? "1" : "0";
3347   this->SetOptionValue("respect_geometry",theValueStr.c_str());
3348 }
3349 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
3350   std::string theValueStr = this->GetOptionValue("respect_geometry");
3351   if (theValueStr.empty() || theValueStr == "respect")
3352       return true;
3353   return false;
3354 }
3355 void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
3356   std::string theValueStr = theValue ? "1" : "0";
3357   this->SetPreCADOptionValue("remove_tiny_edges",theValueStr.c_str());
3358 }
3359 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
3360   std::string theValueStr = this->GetPreCADOptionValue("remove_tiny_edges");
3361   if (theValueStr == "1")
3362       return true;
3363   return false;
3364 }
3365 void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
3366   std::ostringstream theValueStr;
3367   theValueStr << theValue;
3368   this->SetPreCADOptionValue("tiny_edge_length",theValueStr.str().c_str());
3369 }
3370 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
3371   std::istringstream theValueStr(this->GetPreCADOptionValue("tiny_edge_length"));
3372   double result;
3373   theValueStr >> result;
3374   return result;
3375 }