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