#include "BLSURFPlugin_Hypothesis_i.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_PythonDump.hxx"
+#include "GEOM_Object.hxx"
#include "Utils_CorbaException.hxx"
#include "utilities.h"
}
}
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry,const char* sizeMap)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ std::cout << "ENGINE : SETSIZEMAP START ENTRY : " << entry << std::endl;
+ bool valueChanged = false;
+ try {
+ valueChanged = ( this->GetImpl()->GetSizeMapEntry(entry) != sizeMap );
+ if ( valueChanged )
+ this->GetImpl()->SetSizeMapEntry(entry, sizeMap);
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetSizeMapEntry(entry,sizemap)";
+ ExDescription.lineNumber = 0;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ std::cout << "ENGINE : SETSIZEMAP END ENTRY : " << entry << std::endl;
+ if ( valueChanged )
+ SMESH::TPythonDump() << _this() << ".SetSizeMap("
+ << entry << ", '" << sizeMap << "' )";
+}
+
+//=============================================================================
+
+char* BLSURFPlugin_Hypothesis_i::GetSizeMapEntry(const char* entry)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ try {
+ return CORBA::string_dup( this->GetImpl()->GetSizeMapEntry(entry).c_str());
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetSizeMapEntry(name)";
+ ExDescription.lineNumber = 0;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ return 0;
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::UnsetEntry(const char* entry)
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->ClearEntry(entry);
+ SMESH::TPythonDump() << _this() << ".UnsetSizeMap( " << entry << " )";
+}
+
+//=============================================================================
+
+BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetSizeMapEntries()
+{
+ ASSERT(myBaseImpl);
+ BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
+
+ const ::BLSURFPlugin_Hypothesis::TSizeMap & sizeMaps= this->GetImpl()->GetSizeMapEntries();
+ result->length( sizeMaps.size() );
+
+ ::BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin();
+ for ( int i = 0 ; smIt != sizeMaps.end(); ++smIt, ++i ) {
+ string entry_sizemap = smIt->first;
+ if ( !smIt->second.empty() ) {
+ entry_sizemap += "|";
+ entry_sizemap += smIt->second;
+ }
+ result[i] = CORBA::string_dup(entry_sizemap.c_str());
+ }
+ return result._retn();
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ for (int i = 0; i < sizeMaps.length(); ++i)
+ {
+ string entry_sizemap = sizeMaps[i].in();
+ int colonPos = entry_sizemap.find( '|' );
+ string entry, sizemap;
+ if ( colonPos == string::npos ) // '|' separator not found
+ entry = entry_sizemap;
+ else {
+ entry = entry_sizemap.substr( 0, colonPos);
+ if ( colonPos < entry_sizemap.size()-1 && entry_sizemap[colonPos] != ' ')
+ sizemap = entry_sizemap.substr( colonPos+1 );
+ }
+ this->GetImpl()->SetSizeMapEntry( entry.c_str(), sizemap.c_str() );
+ }
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::ClearSizeMaps()
+{
+ ASSERT(myBaseImpl);
+ this->GetImpl()->ClearSizeMaps();
+}
+
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj,const char* sizeMap)
+{
+ ASSERT(myBaseImpl);
+ string entry;
+ entry=GeomObj->GetStudyEntry();
+ std::cout << "IDL : GetName : " << GeomObj->GetName() << std::endl;
+ std::cout << "IDL : SETSIZEMAP ( "<< entry << " , " << sizeMap << ")" << std::endl;
+ SetSizeMapEntry( entry.c_str(),sizeMap);
+}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::UnsetSizeMap(const GEOM::GEOM_Object_ptr GeomObj)
+{
+ ASSERT(myBaseImpl);
+ string entry;
+ entry=GeomObj->GetStudyEntry();
+ std::cout << "IDL : GetName : " << GeomObj->GetName() << std::endl;
+ std::cout << "IDL : UNSETSIZEMAP ( "<< entry << ")" << std::endl;
+ UnsetEntry( entry.c_str());
+}
+
+
+
//=============================================================================
/*!
* BLSURFPlugin_Hypothesis_i::GetImpl