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