Salome HOME
Issue 0020194: EDF 977 ALL: Get rid of warnings PACKAGE_VERSION already defined
[plugins/blsurfplugin.git] / src / BLSURFPlugin / BLSURFPlugin_Hypothesis_i.cxx
1 //  Copyright (C) 2007-2008  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 // File    : BLSURFPlugin_Hypothesis.cxx
21 // Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA)
22 //           Size maps developement: Nicolas GEIMER (OCC) & Gilles DAVID (EURIWARE)
23 // ---
24 //
25 #include "BLSURFPlugin_Hypothesis_i.hxx"
26 #include "SMESH_Gen.hxx"
27 #include "SMESH_PythonDump.hxx"
28 #include "GEOM_Object.hxx"
29
30 #include "Utils_CorbaException.hxx"
31 #include "utilities.h"
32
33 #include <stdexcept>
34
35 //=============================================================================
36 /*!
37  *  BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i
38  *
39  *  Constructor
40  */
41 //=============================================================================
42 BLSURFPlugin_Hypothesis_i::
43 BLSURFPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA,
44                            int                     theStudyId,
45                            ::SMESH_Gen*            theGenImpl)
46   : SALOME::GenericObj_i( thePOA ), 
47     SMESH_Hypothesis_i( thePOA )
48 {
49   MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" );
50   myBaseImpl = new ::BLSURFPlugin_Hypothesis (theGenImpl->GetANewId(),
51                                               theStudyId,
52                                               theGenImpl);
53 }
54
55 //=============================================================================
56 /*!
57  *  BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i
58  *
59  *  Destructor
60  */
61 //=============================================================================
62 BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i()
63 {
64   MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" );
65 }
66
67 /*!
68  *  BLSURFPlugin_Hypothesis_i::SetTopology
69  *
70  *  Set topology
71  */
72
73 //=============================================================================
74 void BLSURFPlugin_Hypothesis_i::SetTopology (CORBA::Long theValue)
75 {
76   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetTopology");
77   ASSERT(myBaseImpl);
78   this->GetImpl()->SetTopology((::BLSURFPlugin_Hypothesis::Topology)theValue);
79   SMESH::TPythonDump() << _this() << ".SetTopology( " << theValue << " )";
80 }
81
82 //=============================================================================
83 /*!
84  *  BLSURFPlugin_Hypothesis_i::GetTopology
85  *
86  *  Get Topology
87  */
88 //=============================================================================
89 CORBA::Long BLSURFPlugin_Hypothesis_i::GetTopology()
90 {
91   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetTopology");
92   ASSERT(myBaseImpl);
93   return this->GetImpl()->GetTopology();
94 }
95
96 //=============================================================================
97
98 //=============================================================================
99 /*!
100  *  BLSURFPlugin_Hypothesis_i::SetPhysicalMesh
101  *
102  *  Set PhysicalMesh
103  */
104
105 //=============================================================================
106 void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh (CORBA::Long theValue)
107 {
108   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh");
109   ASSERT(myBaseImpl);
110   this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh)theValue);
111   SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )";
112 }
113
114 //=============================================================================
115 /*!
116  *  BLSURFPlugin_Hypothesis_i::GetPhysicalMesh
117  *
118  *  Get PhysicalMesh
119  */
120 //=============================================================================
121 CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh()
122 {
123   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh");
124   ASSERT(myBaseImpl);
125   return this->GetImpl()->GetPhysicalMesh();
126 }
127
128 //=============================================================================
129 /*!
130  *  BLSURFPlugin_Hypothesis_i::SetPhySize
131  *
132  *  Set PhySize
133  */
134 //=============================================================================
135 void BLSURFPlugin_Hypothesis_i::SetPhySize (CORBA::Double theValue)
136 {
137   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
138   ASSERT(myBaseImpl);
139   this->GetImpl()->SetPhySize(theValue);
140   SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
141 }
142
143 //=============================================================================
144 /*!
145  *  BLSURFPlugin_Hypothesis_i::GetPhySize
146  *
147  *  Get PhySize
148  */
149 //=============================================================================
150 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize()
151 {
152   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
153   ASSERT(myBaseImpl);
154   return this->GetImpl()->GetPhySize();
155 }
156
157 //=============================================================================
158 void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize)
159 {
160   ASSERT(myBaseImpl);
161   if ( GetPhyMin() != theMinSize ) {
162     this->GetImpl()->SetPhyMin(theMinSize);
163     SMESH::TPythonDump() << _this() << ".SetPhyMin( " << theMinSize << " )";
164   }
165 }
166
167 //=============================================================================
168 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin()
169 {
170   ASSERT(myBaseImpl);
171   return this->GetImpl()->GetPhyMin();
172 }
173
174
175 //=============================================================================
176 void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize)
177 {
178   ASSERT(myBaseImpl);
179   if ( GetPhyMax() != theMaxSize ) {
180     this->GetImpl()->SetPhyMax(theMaxSize);
181     SMESH::TPythonDump() << _this() << ".SetPhyMax( " << theMaxSize << " )";
182   }
183 }
184
185 //=============================================================================
186 CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax()
187 {
188   ASSERT(myBaseImpl);
189   return this->GetImpl()->GetPhyMax();
190 }
191
192
193 //=============================================================================
194 /*!
195  *  BLSURFPlugin_Hypothesis_i::SetGeometricMesh
196  *
197  *  Set GeometricMesh
198  */
199
200 //=============================================================================
201 void BLSURFPlugin_Hypothesis_i::SetGeometricMesh (CORBA::Long theValue)
202 {
203   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh");
204   ASSERT(myBaseImpl);
205   this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh)theValue);
206   SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )";
207 }
208
209 //=============================================================================
210 /*!
211  *  BLSURFPlugin_Hypothesis_i::GetGeometricMesh
212  *
213  *  Get GeometricMesh
214  */
215 //=============================================================================
216 CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh()
217 {
218   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh");
219   ASSERT(myBaseImpl);
220   return this->GetImpl()->GetGeometricMesh();
221 }
222
223 //=============================================================================
224 /*!
225  *  BLSURFPlugin_Hypothesis_i::SetAngleMeshS
226  *
227  *  Set AngleMeshS
228  */
229 //=============================================================================
230 void BLSURFPlugin_Hypothesis_i::SetAngleMeshS (CORBA::Double theValue)
231 {
232   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMeshS");
233   ASSERT(myBaseImpl);
234   this->GetImpl()->SetAngleMeshS(theValue);
235   SMESH::TPythonDump() << _this() << ".SetAngleMeshS( " << theValue << " )";
236 }
237
238 //=============================================================================
239 /*!
240  *  BLSURFPlugin_Hypothesis_i::GetAngleMeshS
241  *
242  *  Get AngleMeshS
243  */
244 //=============================================================================
245 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS()
246 {
247   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMeshS");
248   ASSERT(myBaseImpl);
249   return this->GetImpl()->GetAngleMeshS();
250 }
251
252 //=============================================================================
253 void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double angle)
254 {
255   ASSERT(myBaseImpl);
256   this->GetImpl()->SetAngleMeshC(angle);
257   SMESH::TPythonDump() << _this() << ".SetAngleMeshC( " << angle << " )";
258 }
259
260 //=============================================================================
261 CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC()
262 {
263   ASSERT(myBaseImpl);
264   return this->GetImpl()->GetAngleMeshC();
265 }
266
267 //=============================================================================
268 void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize)
269 {
270   ASSERT(myBaseImpl);
271   if ( GetGeoMin() != theMinSize ) {
272     this->GetImpl()->SetGeoMin(theMinSize);
273     SMESH::TPythonDump() << _this() << ".SetGeoMin( " << theMinSize << " )";
274   }
275 }
276
277 //=============================================================================
278 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin()
279 {
280   ASSERT(myBaseImpl);
281   return this->GetImpl()->GetGeoMin();
282 }
283
284 //=============================================================================
285 void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize)
286 {
287   ASSERT(myBaseImpl);
288   if ( GetGeoMax() != theMaxSize ) {
289     this->GetImpl()->SetGeoMax(theMaxSize);
290     SMESH::TPythonDump() << _this() << ".SetGeoMax( " << theMaxSize << " )";
291   }
292 }
293
294 //=============================================================================
295 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax()
296 {
297   ASSERT(myBaseImpl);
298   return this->GetImpl()->GetGeoMax();
299 }
300
301 //=============================================================================
302 /*!
303  *  BLSURFPlugin_Hypothesis_i::SetGradation
304  *
305  *  Set Gradation
306  */
307 //=============================================================================
308 void BLSURFPlugin_Hypothesis_i::SetGradation (CORBA::Double theValue)
309 {
310   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation");
311   ASSERT(myBaseImpl);
312   this->GetImpl()->SetGradation(theValue);
313   SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )";
314 }
315
316 //=============================================================================
317 /*!
318  *  BLSURFPlugin_Hypothesis_i::GetGradation
319  *
320  *  Get Gradation
321  */
322 //=============================================================================
323 CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation()
324 {
325   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation");
326   ASSERT(myBaseImpl);
327   return this->GetImpl()->GetGradation();
328 }
329
330 //=============================================================================
331 /*!
332  *  BLSURFPlugin_Hypothesis_i::SetQuadAllowed
333  *
334  *  Set true or false
335  */
336 //=============================================================================
337 void BLSURFPlugin_Hypothesis_i::SetQuadAllowed (CORBA::Boolean theValue)
338 {
339   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
340   ASSERT(myBaseImpl);
341   this->GetImpl()->SetQuadAllowed(theValue);
342   SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )";
343 }
344
345 //=============================================================================
346 /*!
347  *  BLSURFPlugin_Hypothesis_i::GetQuadAllowed
348  *
349  *  Get true or false
350  */
351 //=============================================================================
352 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed()
353 {
354   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed");
355   ASSERT(myBaseImpl);
356   return this->GetImpl()->GetQuadAllowed();
357 }
358
359 //=============================================================================
360 /*!
361  *  BLSURFPlugin_Hypothesis_i::SetDecimesh
362  *
363  *  Set true or false
364  */
365 //=============================================================================
366 void BLSURFPlugin_Hypothesis_i::SetDecimesh (CORBA::Boolean theValue)
367 {
368   // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh");
369   ASSERT(myBaseImpl);
370   this->GetImpl()->SetDecimesh(theValue);
371   SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValue << " )";
372 }
373
374 //=============================================================================
375 /*!
376  *  BLSURFPlugin_Hypothesis_i::GetDecimesh
377  *
378  *  Get true or false
379  */
380 //=============================================================================
381 CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh()
382 {
383   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh");
384   ASSERT(myBaseImpl);
385   return this->GetImpl()->GetDecimesh();
386 }
387
388 //=============================================================================
389 void BLSURFPlugin_Hypothesis_i::SetVerbosity(CORBA::Short theVal)
390   throw (SALOME::SALOME_Exception)
391 {
392   ASSERT(myBaseImpl);
393   if ( theVal < 0 || theVal > 100 )
394     THROW_SALOME_CORBA_EXCEPTION( "Invalid verbosity level",SALOME::BAD_PARAM );
395   this->GetImpl()->SetVerbosity(theVal);
396   SMESH::TPythonDump() << _this() << ".SetVerbosity( " << theVal << " )";
397 }
398
399 //=============================================================================
400
401 CORBA::Short BLSURFPlugin_Hypothesis_i::GetVerbosity()
402 {
403   ASSERT(myBaseImpl);
404   return (CORBA::Short) this->GetImpl()->GetVerbosity();
405 }
406
407 //=============================================================================
408
409 void BLSURFPlugin_Hypothesis_i::SetOptionValue(const char* optionName,
410                                                const char* optionValue)
411   throw (SALOME::SALOME_Exception)
412 {
413   ASSERT(myBaseImpl);
414   bool valueChanged = false;
415   try {
416     valueChanged = ( this->GetImpl()->GetOptionValue(optionName) != optionValue );
417     if ( valueChanged )
418       this->GetImpl()->SetOptionValue(optionName, optionValue);
419   }
420   catch (const std::invalid_argument& ex) {
421     SALOME::ExceptionStruct ExDescription;
422     ExDescription.text = ex.what();
423     ExDescription.type = SALOME::BAD_PARAM;
424     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetOptionValue(name,value)";
425     ExDescription.lineNumber = 0;
426     throw SALOME::SALOME_Exception(ExDescription);
427   }
428   catch (SALOME_Exception& ex) {
429     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
430   }
431   if ( valueChanged )
432     SMESH::TPythonDump() << _this() << ".SetOptionValue( '"
433                          << optionName << "', '" << optionValue << "' )";
434 }
435
436 //=============================================================================
437
438 char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName)
439   throw (SALOME::SALOME_Exception)
440 {
441   ASSERT(myBaseImpl);
442   try {
443     return CORBA::string_dup( this->GetImpl()->GetOptionValue(optionName).c_str() );
444   }
445   catch (const std::invalid_argument& ex) {
446     SALOME::ExceptionStruct ExDescription;
447     ExDescription.text = ex.what();
448     ExDescription.type = SALOME::BAD_PARAM;
449     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetOptionValue(name)";
450     ExDescription.lineNumber = 0;
451     throw SALOME::SALOME_Exception(ExDescription);
452   }
453   catch (SALOME_Exception& ex) {
454     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
455   }
456   return 0;
457 }
458
459 //=============================================================================
460
461 void BLSURFPlugin_Hypothesis_i::UnsetOption(const char* optionName)
462 {
463   ASSERT(myBaseImpl);
464   this->GetImpl()->ClearOption(optionName);
465   SMESH::TPythonDump() << _this() << ".UnsetOption( '" << optionName << "' )";
466 }
467
468 //=============================================================================
469
470 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues()
471 {
472   ASSERT(myBaseImpl);
473   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
474
475   const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
476   result->length( opts.size() );
477
478   ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
479   for ( int i = 0 ; opIt != opts.end(); ++opIt, ++i ) {
480     string name_value = opIt->first;
481     if ( !opIt->second.empty() ) {
482       name_value += ":";
483       name_value += opIt->second;
484     }
485     result[i] = CORBA::string_dup(name_value.c_str());
486   }
487   return result._retn();
488 }
489
490 //=============================================================================
491
492 void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
493   throw (SALOME::SALOME_Exception)
494 {
495   ASSERT(myBaseImpl);
496   for (int i = 0; i < options.length(); ++i)
497   {
498     string name_value = options[i].in();
499     int colonPos = name_value.find( ':' );
500     string name, value;
501     if ( colonPos == string::npos ) // ':' not found
502       name = name_value;
503     else {
504       name = name_value.substr( 0, colonPos);
505       if ( colonPos < name_value.size()-1 && name_value[colonPos] != ' ')
506         value = name_value.substr( colonPos+1 );
507     }
508     SetOptionValue( name.c_str(), value.c_str() );
509   }
510 }
511
512 //=============================================================================
513
514 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry,const char* sizeMap)
515   throw (SALOME::SALOME_Exception)
516 {
517   ASSERT(myBaseImpl);
518   MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry); 
519   bool valueChanged = false;
520   try {
521     valueChanged = ( this->GetImpl()->GetSizeMapEntry(entry) != sizeMap );
522     if ( valueChanged )
523       this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
524   }
525   catch (const std::invalid_argument& ex) {
526     SALOME::ExceptionStruct ExDescription;
527     ExDescription.text = ex.what();
528     ExDescription.type = SALOME::BAD_PARAM;
529     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
530     ExDescription.lineNumber = 0;
531     throw SALOME::SALOME_Exception(ExDescription);
532   }
533   catch (SALOME_Exception& ex) {
534     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
535   }
536   MESSAGE("ENGINE : SETSIZEMAP END ENTRY : " << entry);
537   if ( valueChanged )
538     SMESH::TPythonDump() << _this() << ".SetSizeMap("
539                          << entry << ", '" << sizeMap << "' )";
540 }
541
542 //=============================================================================
543
544 void BLSURFPlugin_Hypothesis_i::SetAttractorEntry(const char* entry,const char* attractor )
545   throw (SALOME::SALOME_Exception)
546 {
547   ASSERT(myBaseImpl);
548   MESSAGE("ENGINE : SETATTRACTOR START ENTRY : " << entry);
549   bool valueChanged = false;
550   try {
551     valueChanged = ( this->GetImpl()->GetAttractorEntry(entry) != attractor );
552     if ( valueChanged )
553       this->GetImpl()->SetAttractorEntry(entry, attractor);
554   }
555   catch (const std::invalid_argument& ex) {
556     SALOME::ExceptionStruct ExDescription;
557     ExDescription.text = ex.what();
558     ExDescription.type = SALOME::BAD_PARAM;
559     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetAttractorEntry(entry,attractor)";
560     ExDescription.lineNumber = 0;
561     throw SALOME::SALOME_Exception(ExDescription);
562   }
563   catch (SALOME_Exception& ex) {
564     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
565   }
566   MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
567   if ( valueChanged )
568     SMESH::TPythonDump() << _this() << ".SetAttractor("
569                          << entry << ", '" << attractor << "' )";
570 }
571
572
573 //=============================================================================
574                                                              
575 char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry) 
576   throw (SALOME::SALOME_Exception)
577 {
578   ASSERT(myBaseImpl);
579   try {
580     return CORBA::string_dup( this->GetImpl()->GetSizeMapEntry(entry).c_str());
581   }
582   catch (const std::invalid_argument& ex) {
583     SALOME::ExceptionStruct ExDescription;
584     ExDescription.text = ex.what();
585     ExDescription.type = SALOME::BAD_PARAM;
586     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
587     ExDescription.lineNumber = 0;
588     throw SALOME::SALOME_Exception(ExDescription);
589   }
590   catch (SALOME_Exception& ex) {
591     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
592   }
593   return 0;
594 }
595
596 //=============================================================================
597
598 char* BLSURFPlugin_Hypothesis_i::GetAttractorEntry(const char* entry)
599   throw (SALOME::SALOME_Exception)
600 {
601   ASSERT(myBaseImpl);
602   try {
603     return CORBA::string_dup( this->GetImpl()->GetAttractorEntry(entry).c_str());
604   }
605   catch (const std::invalid_argument& ex) {
606     SALOME::ExceptionStruct ExDescription;
607     ExDescription.text = ex.what();
608     ExDescription.type = SALOME::BAD_PARAM;
609     ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetAttractorEntry(name)";
610     ExDescription.lineNumber = 0;
611     throw SALOME::SALOME_Exception(ExDescription);
612   }
613   catch (SALOME_Exception& ex) {
614     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
615   }
616   return 0;
617 }
618
619 //=============================================================================
620
621 void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry)
622 {
623   ASSERT(myBaseImpl); 
624   this->GetImpl()->ClearEntry(entry);
625 //  SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
626 }
627
628 //=============================================================================
629
630 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries()
631 {
632   ASSERT(myBaseImpl);
633   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
634
635   const ::BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps= this->GetImpl()->GetSizeMapEntries();
636   result->length( sizeMaps.size() );
637
638   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
639   for ( int i = 0 ; smIt != sizeMaps.end(); ++smIt, ++i ) {
640     string entry_sizemap = smIt->first;
641     if ( !smIt->second.empty() ) {
642       entry_sizemap += "|";
643       entry_sizemap += smIt->second;
644     }
645     result[i] = CORBA::string_dup(entry_sizemap.c_str());
646   }
647   return result._retn();
648 }
649
650 //=============================================================================                   
651
652 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetAttractorEntries()
653 {
654   ASSERT(myBaseImpl);
655   BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
656
657   const ::BLSURFPlugin_Hypothesis::TSizeMap & attractors= this->GetImpl()->GetAttractorEntries();
658   result->length( attractors.size() );
659
660   ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin();
661   for ( int i = 0 ; atIt != attractors.end(); ++atIt, ++i ) {
662     string entry_attractor = atIt->first;
663     if ( !atIt->second.empty() ) {
664       entry_attractor += "|";
665       entry_attractor += atIt->second;
666     }
667     result[i] = CORBA::string_dup(entry_attractor.c_str());
668   }
669   return result._retn();
670 }
671
672 //=============================================================================                   
673                                                                                                   
674 void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)        
675   throw (SALOME::SALOME_Exception)                                                                
676 {                                                                                                 
677   ASSERT(myBaseImpl);                                                                             
678   for (int i = 0; i < sizeMaps.length(); ++i)                                                      
679   {                                                                                               
680     string entry_sizemap = sizeMaps[i].in();                                                          
681     int colonPos = entry_sizemap.find( '|' );                                                        
682     string entry, sizemap;                                                                           
683     if ( colonPos == string::npos ) // '|' separator not found                                              
684       entry = entry_sizemap;                                                                          
685     else {                                                                                        
686       entry = entry_sizemap.substr( 0, colonPos);                                                     
687       if ( colonPos < entry_sizemap.size()-1 && entry_sizemap[colonPos] != ' ')                         
688         sizemap = entry_sizemap.substr( colonPos+1 );                                                  
689     }                                                                                             
690     this->GetImpl()->SetSizeMapEntry( entry.c_str(), sizemap.c_str() );                                                
691   }                                                                                               
692 }                                                                                                 
693
694 //=============================================================================
695
696 void BLSURFPlugin_Hypothesis_i::ClearSizeMaps()
697 {
698   ASSERT(myBaseImpl);
699   this->GetImpl()->ClearSizeMaps();
700 }
701
702
703 //=============================================================================
704
705 void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj,const char* sizeMap)
706 {
707   ASSERT(myBaseImpl);
708   string entry;
709   entry=GeomObj->GetStudyEntry();
710   MESSAGE("IDL : GetName : " << GeomObj->GetName());
711   MESSAGE("IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")"); 
712   SetSizeMapEntry( entry.c_str(),sizeMap);
713 }
714   
715 //=============================================================================
716 void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj)
717 {
718   ASSERT(myBaseImpl);
719   string entry;
720   entry=GeomObj->GetStudyEntry();
721   MESSAGE("IDL : GetName : " << GeomObj->GetName());
722   MESSAGE("IDL : UNSETSIZEMAP ( "<< entry << ")");
723   UnsetEntry( entry.c_str());
724   SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry.c_str() << " )";
725 }
726
727
728 void BLSURFPlugin_Hypothesis_i::SetAttractor(GEOM::GEOM_Object_ptr GeomObj, const char* attractor)
729 {
730   ASSERT(myBaseImpl);
731   string entry;
732   entry=GeomObj->GetStudyEntry();
733   MESSAGE("IDL : GetName : " << GeomObj->GetName());
734   MESSAGE("IDL : SETATTRACTOR ( "<< entry << " , " << attractor << ")");
735   SetAttractorEntry( entry.c_str(),attractor);
736 }
737
738 void BLSURFPlugin_Hypothesis_i::UnsetAttractor(GEOM::GEOM_Object_ptr GeomObj)
739 {
740   ASSERT(myBaseImpl);
741   string entry;
742   entry=GeomObj->GetStudyEntry();
743   MESSAGE("IDL : GetName : " << GeomObj->GetName());
744   MESSAGE("IDL : UNSETATTRACTOR ( "<< entry << ")");
745   UnsetEntry( entry.c_str());
746   SMESH::TPythonDump() << _this() << ".UnsetAttractor( " << entry.c_str() << " )";
747 }
748
749
750
751
752 /*
753 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
754 {}
755
756 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj)
757 {}
758
759 void BLSURFPlugin_Hypothesis_i::SetCustomSizeMapEntry(const char* entry,const char* sizeMap )  throw (SALOME::SALOME_Exception)
760 {}
761
762 char* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntry(const char* entry)  throw (SALOME::SALOME_Exception)
763 {}
764
765 void BLSURFPlugin_Hypothesis_i::UnsetCustomSizeMapEntry(const char* entry)
766 {
767   ASSERT(myBaseImpl);
768   this->GetImpl()->UnsetCustomSizeMap(entry);
769   SMESH::TPythonDump() << _this() << ".UnsetCustomSizeMap( " << entry << " )";
770 }
771
772
773 BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetCustomSizeMapEntries()
774 {}
775
776 */
777
778      
779 //=============================================================================
780 /*!
781  *  BLSURFPlugin_Hypothesis_i::GetImpl
782  *
783  *  Get implementation
784  */
785 //=============================================================================
786 ::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl()
787 {
788   // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl");
789   return (::BLSURFPlugin_Hypothesis*)myBaseImpl;
790 }
791
792 //================================================================================
793 /*!
794  * \brief Verify whether hypothesis supports given entity type 
795   * \param type - dimension (see SMESH::Dimension enumeration)
796   * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
797  * 
798  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
799  */
800 //================================================================================  
801 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
802 {
803   return type == SMESH::DIM_2D;
804 }