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