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