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