-// Copyright (C) 2007-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2007-2015 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySizeRel");
ASSERT(myBaseImpl);
this->GetImpl()->SetPhySize(theValue, true);
- SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << ", isRelative = True )";
+ SMESH::TPythonDump() << _this() << ".SetPhySizeRel( " << theValue << " )";
}
//=============================================================================
ASSERT(myBaseImpl);
if ( !IsMinSizeRel() || (GetMinSize() != theMinSize) ) {
this->GetImpl()->SetMinSize(theMinSize, true);
- SMESH::TPythonDump() << _this() << ".SetMinSize( " << theMinSize << ", isRelative = True )";
+ SMESH::TPythonDump() << _this() << ".SetMinSizeRel( " << theMinSize << " )";
}
}
ASSERT(myBaseImpl);
if ( !IsMaxSizeRel() || (GetMaxSize() != theMaxSize) ) {
this->GetImpl()->SetMaxSize(theMaxSize, true);
- SMESH::TPythonDump() << _this() << ".SetMaxSize( " << theMaxSize << ", isRelative = True )";
+ SMESH::TPythonDump() << _this() << ".SetMaxSizeRel( " << theMaxSize << " )";
}
}
BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetOptionValues();
- result->length(opts.size());
+ const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomOptionValues();
+ result->length(opts.size()+custom_opts.size());
+ int i=0;
::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
- for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
- string name_value = opIt->first;
+ for (; opIt != opts.end(); ++opIt, ++i) {
+ string name_value_type = opIt->first;
if (!opIt->second.empty()) {
- name_value += ":";
- name_value += opIt->second;
+ name_value_type += ":";
+ name_value_type += opIt->second;
+ name_value_type += ":0";
}
- result[i] = CORBA::string_dup(name_value.c_str());
+ result[i] = CORBA::string_dup(name_value_type.c_str());
+ }
+
+ opIt = custom_opts.begin();
+ for (; opIt != custom_opts.end(); ++opIt,++i) {
+ string name_value_type = opIt->first;
+ if (!opIt->second.empty()) {
+ name_value_type += ":";
+ name_value_type += opIt->second;
+ name_value_type += ":1";
+ }
+ result[i] = CORBA::string_dup(name_value_type.c_str());
}
return result._retn();
}
BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
- result->length(opts.size());
+ const ::BLSURFPlugin_Hypothesis::TOptionValues & custom_opts = this->GetImpl()->GetCustomPreCADOptionValues();
+ result->length(opts.size()+custom_opts.size());
+ int i=0;
::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
- for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
- string name_value = opIt->first;
+ for (; opIt != opts.end(); ++opIt, ++i) {
+ string name_value_type = opIt->first;
+ if (!opIt->second.empty()) {
+ name_value_type += ":";
+ name_value_type += opIt->second;
+ name_value_type += ":0";
+ }
+ result[i] = CORBA::string_dup(name_value_type.c_str());
+ }
+
+ opIt = custom_opts.begin();
+ for (; opIt != custom_opts.end(); ++opIt,++i) {
+ string name_value_type = opIt->first;
if (!opIt->second.empty()) {
- name_value += ":";
- name_value += opIt->second;
+ name_value_type += ":";
+ name_value_type += opIt->second;
+ name_value_type += ":1";
}
- result[i] = CORBA::string_dup(name_value.c_str());
+ result[i] = CORBA::string_dup(name_value_type.c_str());
}
return result._retn();
}
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
for (int i = 0; i < options.length(); ++i) {
- string name_value = options[i].in();
- int colonPos = name_value.find(':');
+ string name_value_type = options[i].in();
+ if(name_value_type.empty())
+ continue;
+ int colonPos = name_value_type.find(':');
string name, value;
+ bool custom = false;
if (colonPos == string::npos) // ':' not found
- name = name_value;
+ name = name_value_type;
else {
- name = name_value.substr(0, colonPos);
- if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
- value = name_value.substr(colonPos + 1);
+ name = name_value_type.substr(0, colonPos);
+ if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+ string value_type = name_value_type.substr(colonPos + 1);
+ colonPos = value_type.find(':');
+ value = value_type.substr(0, colonPos);
+ if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
+ custom = atoi((value_type.substr(colonPos + 1)).c_str());
+ }
}
- SetOptionValue(name.c_str(), value.c_str());
+ custom ? AddOption(name.c_str(), value.c_str()) : SetOptionValue(name.c_str(), value.c_str());
}
}
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
for (int i = 0; i < options.length(); ++i) {
- string name_value = options[i].in();
- int colonPos = name_value.find(':');
+ string name_value_type = options[i].in();
+ if(name_value_type.empty())
+ continue;
+ int colonPos = name_value_type.find(':');
string name, value;
+ bool custom = false;
if (colonPos == string::npos) // ':' not found
- name = name_value;
+ name = name_value_type;
else {
- name = name_value.substr(0, colonPos);
- if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
- value = name_value.substr(colonPos + 1);
+ name = name_value_type.substr(0, colonPos);
+ if (colonPos < name_value_type.size() - 1 && name_value_type[colonPos] != ' ') {
+ string value_type = name_value_type.substr(colonPos + 1);
+ colonPos = value_type.find(':');
+ value = value_type.substr(0, colonPos);
+ if (colonPos < value_type.size() - 1 && value_type[colonPos] != ' ')
+ custom = atoi((value_type.substr(colonPos + 1)).c_str());
+ }
}
- SetPreCADOptionValue(name.c_str(), value.c_str());
+ custom ? AddPreCADOption(name.c_str(), value.c_str()) : SetPreCADOptionValue(name.c_str(), value.c_str());
+ }
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::AddOption(const char* optionName, const char* optionValue)
+{
+ ASSERT(myBaseImpl);
+ bool valueChanged = (this->GetImpl()->GetOption(optionName) != optionValue);
+ if (valueChanged) {
+ this->GetImpl()->AddOption(optionName, optionValue);
+ SMESH::TPythonDump() << _this() << ".AddOption( '" << optionName << "', '" << optionValue << "' )";
+ }
+}
+
+//=============================================================================
+
+void BLSURFPlugin_Hypothesis_i::AddPreCADOption(const char* optionName, const char* optionValue)
+{
+ ASSERT(myBaseImpl);
+ bool valueChanged = (this->GetImpl()->GetPreCADOption(optionName) != optionValue);
+ if (valueChanged) {
+ this->GetImpl()->AddPreCADOption(optionName, optionValue);
+ SMESH::TPythonDump() << _this() << ".AddPreCADOption( '" << optionName << "', '" << optionValue << "' )";
}
}
//=============================================================================
+char* BLSURFPlugin_Hypothesis_i::GetOption(const char* optionName)
+{
+ ASSERT(myBaseImpl);
+ return CORBA::string_dup(this->GetImpl()->GetOption(optionName).c_str());
+}
+
+//=============================================================================
+
+char* BLSURFPlugin_Hypothesis_i::GetPreCADOption(const char* optionName)
+{
+ ASSERT(myBaseImpl);
+ return CORBA::string_dup(this->GetImpl()->GetPreCADOption(optionName).c_str());
+}
+
+//=============================================================================
+
void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
MESSAGE("ENGINE : SETSIZEMAP START ENTRY : " << entry);
+ if ( !entry || !entry[0] )
+ THROW_SALOME_CORBA_EXCEPTION( "SetSizeMapEntry(): empty geom entry", SALOME::BAD_PARAM );
bool valueChanged = false;
try {
valueChanged = (this->GetImpl()->GetSizeMapEntry(entry) != sizeMap);
}
MESSAGE("ENGINE : SETATTRACTOR END ENTRY : " << entry);
//if ( valueChanged )
- SMESH::TPythonDump() << _this() << ".SetAttractorGeom("
+ SMESH::TPythonDump() << _this() << ".SetAttractorGeom( "
<< entry << ", " << att_entry << ", "<<StartSize<<", "<<EndSize<<", "<<ActionRadius<<", "<<ConstantRadius<<" )";
}
//=============================================================================
-void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap) {
+void BLSURFPlugin_Hypothesis_i::SetSizeMap(const GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
+ throw (SALOME::SALOME_Exception)
+{
ASSERT(myBaseImpl);
string entry;
entry = GeomObj->GetStudyEntry();
SetClassAttractorEntry( theFaceEntry.c_str(), theAttEntry.c_str(), StartSize, EndSize, ActionRadius, ConstantRadius);
}
-void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace)
+void BLSURFPlugin_Hypothesis_i::UnsetAttractorGeom(GEOM::GEOM_Object_ptr theFace,
+ GEOM::GEOM_Object_ptr theAttractor)
{
ASSERT(myBaseImpl);
- string theFaceEntry;
- theFaceEntry = theFace->GetStudyEntry();
+ CORBA::String_var theFaceEntry = theFace->GetStudyEntry();
+ CORBA::String_var theAttrEntry = theAttractor->GetStudyEntry();
- GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
- SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
- string aName;
+ // GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ // SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ // string aName;
- if (theFaceEntry.empty()) {
- aName = "Face_";
- aName += theFace->GetEntry();
- SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
- if (!theSFace->_is_nil())
- theFaceEntry = theSFace->GetID();
- }
- if (theFaceEntry.empty())
+ // if (theFaceEntry.empty()) {
+ // aName = "Face_";
+ // aName += theFace->GetEntry();
+ // SALOMEDS::SObject_wrap theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ // if (!theSFace->_is_nil())
+ // theFaceEntry = theSFace->GetID();
+ // }
+ if ( !theFaceEntry.in() || !theFaceEntry.in()[0] ||
+ !theAttrEntry.in() || !theAttrEntry.in()[0] )
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
MESSAGE("IDL : UNSETATTRACTOR ( "<< theFaceEntry << ")");
- UnsetEntry( theFaceEntry.c_str());
- SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( " << theFaceEntry.c_str() << " )";
+ GetImpl()->ClearEntry( theFaceEntry.in(), theAttrEntry.in() );
+ SMESH::TPythonDump() << _this() << ".UnsetAttractorGeom( "
+ << theFace << ", " << theAttractor << " )";
+}
+
+void BLSURFPlugin_Hypothesis_i::UnsetAttractorEntry(const char* faceEntry,
+ const char* attractorEntry)
+{
+ GetImpl()->ClearEntry( faceEntry, attractorEntry );
+ SMESH::TPythonDump() << _this() << ".UnsetAttractorEntry( '"
+ << faceEntry << "', '" << attractorEntry << "' )";
}
+
/*
void BLSURFPlugin_Hypothesis_i::SetCustomSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap)
{}