* for the topology processing.
*/
void SetPreCADEpsNano(in double epsNano);
- boolean GetPreCADEpsNano();
+ double GetPreCADEpsNano();
/*!
* Sets advanced option value
*/
void SetOptionValue(in string optionName,
in string optionValue) raises (SALOME::SALOME_Exception);
+ void SetPreCADOptionValue(in string optionName,
+ in string optionValue) raises (SALOME::SALOME_Exception);
string GetOptionValue(in string optionName) raises (SALOME::SALOME_Exception);
+ string GetPreCADOptionValue(in string optionName) raises (SALOME::SALOME_Exception);
/*!
* Unsets advanced option
*/
void UnsetOption(in string optionName);
+ void UnsetPreCADOption(in string optionName);
/*!
* Return array of strings each of which is option name concatenated
* Note: the method is mostly for interaction with GUI.
*/
string_array GetOptionValues();
+ string_array GetPreCADOptionValues();
/*!
* Set option values each in the form "option_name[:option_value]".
* Note: the method is mostly for interaction with GUI.
*/
void SetOptionValues(in string_array options);
+ void SetPreCADOptionValues(in string_array options);
/*!
* SizeMap
const BLSURFPlugin_Hypothesis::TOptionValues & opts = hyp->GetOptionValues();
BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt;
- std::string preCADOptName;
- size_t preCADstr_found;
for ( opIt = opts.begin(); opIt != opts.end(); ++opIt )
if ( !opIt->second.empty() ) {
- preCADstr_found = opIt->first.find("PRECAD_");
- if (preCADstr_found !=std::string::npos && int(preCADstr_found) == 0 && _topology == BLSURFPlugin_Hypothesis::PreCAD) {
- preCADOptName = opIt->first.substr(preCADstr_found+7);
- MESSAGE("precad_set_param(): " << preCADOptName << " = " << opIt->second);
- blsurf_set_param(bls, preCADOptName.c_str(), opIt->second.c_str());
- }
- else {
- MESSAGE("blsurf_set_param(): " << opIt->first << " = " << opIt->second);
+ MESSAGE("blsurf_set_param(): " << opIt->first << " = " << opIt->second);
+ blsurf_set_param(bls, opIt->first.c_str(), opIt->second.c_str());
+ }
+
+ const BLSURFPlugin_Hypothesis::TOptionValues & preCADopts = hyp->GetPreCADOptionValues();
+ for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt )
+ if ( !opIt->second.empty() ) {
+ if (_topology == BLSURFPlugin_Hypothesis::PreCAD) {
+ MESSAGE("precad_set_param(): " << opIt->first << " = " << opIt->second);
blsurf_set_param(bls, opIt->first.c_str(), opIt->second.c_str());
}
}
};
const char* charOptionNames[] = { "export_format", "export_option", "import_option", "prefix", "" // mark of end
};
+
+ // PreCAD advanced options
+ const char* preCADintOptionNames[] = { "closed_geometry", "debug", "manifold_geometry", "create_tag_on_collision","" // mark of end
+ };
+ const char* preCADdoubleOptionNames[] = { "eps_nano_relative", "eps_sewing", "eps_sewing_relative", "periodic_tolerance",
+ "periodic_tolerance_relative", "periodic_split_tolerance", "periodic_split_tolerance_relative", "" // mark of end
+ };
int i = 0;
while (intOptionNames[i][0])
_option2value[intOptionNames[i++]].clear();
+
+ i = 0;
+ while (preCADintOptionNames[i][0])
+ _preCADoption2value[preCADintOptionNames[i++]].clear();
i = 0;
while (doubleOptionNames[i][0]) {
_option2value[doubleOptionNames[i++]].clear();
}
i = 0;
+ while (preCADdoubleOptionNames[i][0]) {
+ _preCADdoubleOptions.insert(preCADdoubleOptionNames[i]);
+ _preCADoption2value[preCADdoubleOptionNames[i++]].clear();
+ }
+ i = 0;
while (charOptionNames[i][0]) {
_charOptions.insert(charOptionNames[i]);
_option2value[charOptionNames[i++]].clear();
}
-
- // PreCAD advanced options
- const char* preCADintOptionNames[] = { "PRECAD_closed_geometry", "PRECAD_debug", "PRECAD_manifold_geometry", "PRECAD_create_tag_on_collision","" // mark of end
- };
- const char* preCADdoubleOptionNames[] = { "PRECAD_eps_nano_relative", "PRECAD_eps_sewing", "PRECAD_eps_sewing_relative", "PRECAD_periodic_tolerance",
- "PRECAD_periodic_tolerance_relative", "PRECAD_periodic_split_tolerance", "PRECAD_periodic_split_tolerance_relative", "" // mark of end
- };
- i = 0;
- while (preCADintOptionNames[i][0])
- _option2value[preCADintOptionNames[i++]].clear();
- i = 0;
- while (preCADdoubleOptionNames[i][0]) {
- _doubleOptions.insert(preCADdoubleOptionNames[i]);
- _option2value[preCADdoubleOptionNames[i++]].clear();
- }
_sizeMap.clear();
_attractors.clear();
}
}
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetPreCADOptionValue(const std::string& optionName, const std::string& optionValue)
+ throw (std::invalid_argument) {
+ TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
+ if (op_val == _preCADoption2value.end()) {
+ std::string msg = "Unknown BLSURF option: '" + optionName + "'";
+ throw std::invalid_argument(msg);
+ }
+ if (op_val->second != optionValue) {
+ const char* ptr = optionValue.c_str();
+ // strip white spaces
+ while (ptr[0] == ' ')
+ ptr++;
+ int i = strlen(ptr);
+ while (i != 0 && ptr[i - 1] == ' ')
+ i--;
+ // check value type
+ bool typeOk = true;
+ std::string typeName;
+ if (i == 0) {
+ // empty string
+ } else if (_preCADdoubleOptions.find(optionName) != _preCADdoubleOptions.end()) {
+ // check if value is double
+ char * endPtr;
+ strtod(ptr, &endPtr);
+ typeOk = (ptr != endPtr);
+ typeName = "real";
+ } else {
+ // check if value is int
+ char * endPtr;
+ strtol(ptr, &endPtr, 10);
+ typeOk = (ptr != endPtr);
+ typeName = "integer";
+ }
+ if (!typeOk) {
+ std::string msg = "PreCAD advanced option '" + optionName + "' = '" + optionValue + "' but must be " + typeName;
+ throw std::invalid_argument(msg);
+ }
+ op_val->second = optionValue;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
//=============================================================================
std::string BLSURFPlugin_Hypothesis::GetOptionValue(const std::string& optionName) throw (std::invalid_argument) {
TOptionValues::iterator op_val = _option2value.find(optionName);
return op_val->second;
}
+//=============================================================================
+std::string BLSURFPlugin_Hypothesis::GetPreCADOptionValue(const std::string& optionName) throw (std::invalid_argument) {
+ TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
+ if (op_val == _preCADoption2value.end()) {
+ std::string msg = "Unknown PRECAD option: <";
+ msg += optionName + ">";
+ throw std::invalid_argument(msg);
+ }
+ return op_val->second;
+}
+
//=============================================================================
void BLSURFPlugin_Hypothesis::ClearOption(const std::string& optionName) {
TOptionValues::iterator op_val = _option2value.find(optionName);
op_val->second.clear();
}
+//=============================================================================
+void BLSURFPlugin_Hypothesis::ClearPreCADOption(const std::string& optionName) {
+ TOptionValues::iterator op_val = _preCADoption2value.find(optionName);
+ if (op_val != _preCADoption2value.end())
+ op_val->second.clear();
+}
+
//=======================================================================
//function : SetSizeMapEntry
//=======================================================================
}
save << " " << "__OPTIONS_END__";
}
+
+ op_val = _preCADoption2value.begin();
+ if (op_val != _preCADoption2value.end()) {
+ save << " " << "__PRECAD_OPTIONS_BEGIN__";
+ for (; op_val != _preCADoption2value.end(); ++op_val) {
+ if (!op_val->second.empty())
+ save << " " << op_val->first << " " << op_val->second << "%#"; // "%#" is a mark of value end
+ }
+ save << " " << "__PRECAD_OPTIONS_END__";
+ }
TSizeMap::iterator it_sm = _sizeMap.begin();
if (it_sm != _sizeMap.end()) {
std::string option_or_sm;
bool hasOptions = false;
+ bool hasPreCADOptions = false;
bool hasSizeMap = false;
bool hasAttractor = false;
bool hasNewAttractor = false;
if (isOK)
if (option_or_sm == "__OPTIONS_BEGIN__")
hasOptions = true;
+ else if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
+ hasPreCADOptions = true;
else if (option_or_sm == "__SIZEMAP_BEGIN__")
hasSizeMap = true;
else if (option_or_sm == "__ATTRACTORS_BEGIN__")
if (hasOptions) {
isOK = (load >> option_or_sm);
if (isOK)
- if (option_or_sm == "__SIZEMAP_BEGIN__")
+ if (option_or_sm == "__PRECAD_OPTIONS_BEGIN__")
+ hasPreCADOptions = true;
+ else if (option_or_sm == "__SIZEMAP_BEGIN__")
hasSizeMap = true;
else if (option_or_sm == "__ATTRACTORS_BEGIN__")
hasAttractor = true;
hasEnforcedVertex = true;
}
+ while (isOK && hasPreCADOptions) {
+ isOK = (load >> optName);
+ if (isOK) {
+ if (optName == "__PRECAD_OPTIONS_END__")
+ break;
+ isOK = (load >> optValue);
+ }
+ if (isOK) {
+ std::string & value = _preCADoption2value[optName];
+ value = optValue;
+ int len = value.size();
+ // continue reading until "%#" encountered
+ while (value[len - 1] != '#' || value[len - 2] != '%') {
+ isOK = (load >> optValue);
+ if (isOK) {
+ value += " ";
+ value += optValue;
+ len = value.size();
+ } else {
+ break;
+ }
+ }
+ value[len - 2] = '\0'; //cut off "%#"
+ }
+ }
+
+ if (hasPreCADOptions) {
+ isOK = (load >> option_or_sm);
+ if (isOK)
+ if (option_or_sm == "__SIZEMAP_BEGIN__")
+ hasSizeMap = true;
+ else if (option_or_sm == "__ATTRACTORS_BEGIN__")
+ hasAttractor = true;
+ else if (option_or_sm == "__NEW_ATTRACTORS_BEGIN__")
+ hasNewAttractor = true;
+ else if (option_or_sm == "__ENFORCED_VERTICES_BEGIN__")
+ hasEnforcedVertex = true;
+ }
+
std::string smEntry, smValue;
while (isOK && hasSizeMap) {
isOK = (load >> smEntry);
void SetOptionValue(const std::string& optionName,
const std::string& optionValue) throw (std::invalid_argument);
+ void SetPreCADOptionValue(const std::string& optionName,
+ const std::string& optionValue) throw (std::invalid_argument);
std::string GetOptionValue(const std::string& optionName) throw (std::invalid_argument);
+ std::string GetPreCADOptionValue(const std::string& optionName) throw (std::invalid_argument);
void ClearOption(const std::string& optionName);
+ void ClearPreCADOption(const std::string& optionName);
const TOptionValues& GetOptionValues() const { return _option2value; }
+ const TOptionValues& GetPreCADOptionValues() const { return _preCADoption2value; }
/*!
* Sets the file for export resulting mesh in GMF format
bool _preCADMergeEdges;
bool _preCADRemoveNanoEdges;
bool _preCADDiscardInput;
- bool _preCADEpsNano;
+ double _preCADEpsNano;
- TOptionValues _option2value;
- TOptionNames _doubleOptions, _charOptions;
+ TOptionValues _option2value, _preCADoption2value;
+ TOptionNames _doubleOptions, _charOptions, _preCADdoubleOptions, _preCADcharOptions;
TSizeMap _sizeMap;
TSizeMap _attractors;
TAttractorMap _classAttractors;
*/
//=============================================================================
void BLSURFPlugin_Hypothesis_i::SetPhySize(CORBA::Double theValue) {
- MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
+// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize");
ASSERT(myBaseImpl);
this->GetImpl()->SetPhySize(theValue);
SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )";
*/
//=============================================================================
CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() {
- MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
+// MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize");
ASSERT(myBaseImpl);
return this->GetImpl()->GetPhySize();
}
* Get length of nano edges
*/
//=============================================================================
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
+CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
// MESSAGE("BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano");
ASSERT(myBaseImpl);
return this->GetImpl()->GetPreCADEpsNano();
//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValue(const char* optionName, const char* optionValue)
+ throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ bool valueChanged = false;
+ try {
+ valueChanged = (this->GetImpl()->GetPreCADOptionValue(optionName) != optionValue);
+ if (valueChanged)
+ this->GetImpl()->SetPreCADOptionValue(optionName, optionValue);
+ } catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetPreCADOptionValue(name,value)";
+ ExDescription.lineNumber = 0;
+ throw SALOME::SALOME_Exception(ExDescription);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ if (valueChanged)
+ SMESH::TPythonDump() << _this() << ".SetPreCADOptionValue( '" << optionName << "', '" << optionValue << "' )";
+}
+
+//=============================================================================
+
char* BLSURFPlugin_Hypothesis_i::GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
try {
//=============================================================================
+char* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception) {
+ ASSERT(myBaseImpl);
+ try {
+ return CORBA::string_dup(this->GetImpl()->GetPreCADOptionValue(optionName).c_str());
+ } catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::GetPreCADOptionValue(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::UnsetOption(const char* optionName) {
ASSERT(myBaseImpl);
this->GetImpl()->ClearOption(optionName);
//=============================================================================
+void BLSURFPlugin_Hypothesis_i::UnsetPreCADOption(const char* optionName) {
+ ASSERT(myBaseImpl);
+ this->GetImpl()->ClearPreCADOption(optionName);
+ SMESH::TPythonDump() << _this() << ".UnsetPreCADOption( '" << optionName << "' )";
+}
+
+//=============================================================================
+
BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetOptionValues() {
ASSERT(myBaseImpl);
BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
//=============================================================================
+BLSURFPlugin::string_array* BLSURFPlugin_Hypothesis_i::GetPreCADOptionValues() {
+ ASSERT(myBaseImpl);
+ BLSURFPlugin::string_array_var result = new BLSURFPlugin::string_array();
+
+ const ::BLSURFPlugin_Hypothesis::TOptionValues & opts = this->GetImpl()->GetPreCADOptionValues();
+ result->length(opts.size());
+
+ ::BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt = opts.begin();
+ for (int i = 0; opIt != opts.end(); ++opIt, ++i) {
+ string name_value = opIt->first;
+ if (!opIt->second.empty()) {
+ name_value += ":";
+ name_value += opIt->second;
+ }
+ result[i] = CORBA::string_dup(name_value.c_str());
+ }
+ return result._retn();
+}
+
+//=============================================================================
+
void BLSURFPlugin_Hypothesis_i::SetOptionValues(const BLSURFPlugin::string_array& options)
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetPreCADOptionValues(const BLSURFPlugin::string_array& options)
+ 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;
+ if (colonPos == string::npos) // ':' not found
+ name = name_value;
+ else {
+ name = name_value.substr(0, colonPos);
+ if (colonPos < name_value.size() - 1 && name_value[colonPos] != ' ')
+ value = name_value.substr(colonPos + 1);
+ }
+ SetPreCADOptionValue(name.c_str(), value.c_str());
+ }
+}
+
+//=============================================================================
+
void BLSURFPlugin_Hypothesis_i::SetSizeMapEntry(const char* entry, const char* sizeMap)
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
//================================================================================
char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
ASSERT(myBaseImpl);
- MESSAGE("IDL : GetGMFFile()");
+// MESSAGE("IDL : GetGMFFile()");
return CORBA::string_dup(this->GetImpl()->GetGMFFile().c_str());
}
CORBA::Boolean GetPreCADDiscardInput();
void SetPreCADEpsNano(CORBA::Double theValue);
- CORBA::Boolean GetPreCADEpsNano();
+ CORBA::Double GetPreCADEpsNano();
void SetOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
+ void SetPreCADOptionValue(const char* optionName, const char* optionValue) throw (SALOME::SALOME_Exception);
char* GetOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
+ char* GetPreCADOptionValue(const char* optionName) throw (SALOME::SALOME_Exception);
void UnsetOption(const char* optionName);
+ void UnsetPreCADOption(const char* optionName);
BLSURFPlugin::string_array* GetOptionValues();
+ BLSURFPlugin::string_array* GetPreCADOptionValues();
void SetOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
+ void SetPreCADOptionValues(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
void SetSizeMapEntry(const char* entry, const char* sizeMap) throw (SALOME::SALOME_Exception);
BLSURFPlugin::string_array* GetSizeMapEntries();
- void SetSizeMapEntries(const BLSURFPlugin::string_array& options) throw (SALOME::SALOME_Exception);
+ void SetSizeMapEntries(const BLSURFPlugin::string_array& sizeMaps) throw (SALOME::SALOME_Exception);
void SetSizeMap(GEOM::GEOM_Object_ptr GeomObj, const char* sizeMap);
SMP_TAB,
ENF_TAB,
OPTION_ID_COLUMN = 0,
+ OPTION_TYPE_COLUMN,
OPTION_NAME_COLUMN,
OPTION_VALUE_COLUMN,
NB_COLUMNS,
QString value = myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed();
if ( !value.isEmpty() ) {
try {
- h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
+ QString optionType = myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().trimmed();
+ if (optionType == "PRECAD")
+ h->SetPreCADOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
+ else if (optionType == "BLSURF")
+ h->SetOptionValue( name.toLatin1().constData(), value.toLatin1().constData() );
}
catch ( const SALOME::SALOME_Exception& ex )
{
}
}
h->SetOptionValues( myOptions ); // restore values
+ h->SetPreCADOptionValues( myPreCADOptions ); // restore values
}
// SizeMap and attractors
myOptionTable = new QTableWidget( 0, NB_COLUMNS, myAdvGroup );
QStringList headers;
- headers << tr( "OPTION_ID_COLUMN" ) << tr( "OPTION_NAME_COLUMN" ) << tr( "OPTION_VALUE_COLUMN" );
+ headers << tr( "OPTION_ID_COLUMN" )<< tr( "OPTION_TYPE_COLUMN" ) << tr( "OPTION_NAME_COLUMN" ) << tr( "OPTION_VALUE_COLUMN" );
myOptionTable->setHorizontalHeaderLabels( headers );
myOptionTable->horizontalHeader()->hideSection( OPTION_ID_COLUMN );
+// myOptionTable->horizontalHeader()->hideSection( OPTION_TYPE_COLUMN );
myOptionTable->horizontalHeader()->setStretchLastSection(true);
myOptionTable->horizontalHeader()->setDefaultAlignment(Qt::AlignLeft);
//myOptionTable->setColumnReadOnly( OPTION_NAME_COLUMN, TRUE );//////
connect( addMapButton, SIGNAL( clicked()), this, SLOT( onAddMap() ) );
connect( removeMapButton, SIGNAL( clicked()), this, SLOT( onRemoveMap() ) );
connect( modifyMapButton, SIGNAL( clicked()), this, SLOT( onModifyMap() ) );
- connect( mySizeMapTable, SIGNAL( cellChanged ( int, int )), this, SLOT( onSetSizeMap(int,int ) ) );
+// connect( mySizeMapTable, SIGNAL( cellChanged ( int, int )), this, SLOT( onSetSizeMap(int,int ) ) );
connect( mySizeMapTable, SIGNAL( itemClicked (QTreeWidgetItem *, int)),this, SLOT( onSmpItemClicked(QTreeWidgetItem *, int) ) );
connect( myGeomSelWdg2, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
connect( myGeomSelWdg1, SIGNAL( contentModified() ), this, SLOT( onMapGeomContentModified() ) );
- connect( myAttractorGroup, SIGNAL( clicked(bool) ), this, SLOT( onAttractorGroupClicked(bool) ) );
+// connect( myAttractorGroup, SIGNAL( clicked(bool) ), this, SLOT( onAttractorGroupClicked(bool) ) );
connect( mySizeMapTable, SIGNAL( itemChanged (QTreeWidgetItem *, int)),this, SLOT( onSetSizeMap(QTreeWidgetItem *, int) ) );
connect( myAttractorCheck, SIGNAL( stateChanged ( int )), this, SLOT( onAttractorClicked( int ) ) );
connect( myConstSizeCheck, SIGNAL( stateChanged ( int )), this, SLOT( onConstSizeClicked( int ) ) );
// Enforced vertices
connect( myEnforcedTreeWidget,SIGNAL( itemClicked(QTreeWidgetItem *, int)), this, SLOT( synchronizeCoords() ) );
connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( updateEnforcedVertexValues(QTreeWidgetItem *, int) ) );
- connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( update(QTreeWidgetItem *, int) ) );
+// connect( myEnforcedTreeWidget,SIGNAL( itemChanged(QTreeWidgetItem *, int)), this, SLOT( update(QTreeWidgetItem *, int) ) );
connect( myEnforcedTreeWidget,SIGNAL( itemSelectionChanged() ), this, SLOT( synchronizeCoords() ) );
connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertices() ) );
connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
myOptionTable->setRowCount( row+1 );
myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
+ myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "BLSURF" ) );
+ myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
+ myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) );
+ myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
+ myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) );
+ myOptionTable->item( row, OPTION_VALUE_COLUMN )->setFlags( Qt::ItemIsSelectable |
+ Qt::ItemIsEditable |
+ Qt::ItemIsEnabled );
+ }
+ }
+ }
+ if ( myPreCADOptions.operator->() ) {
+// MESSAGE("retrieveParams():myPreCADOptions->length() = " << myPreCADOptions->length());
+ for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i ) {
+ QString option = that->myPreCADOptions[i].in();
+ QStringList name_value = option.split( ":", QString::KeepEmptyParts );
+ if ( name_value.count() > 1 ) {
+ QString idStr = QString("%1").arg( i );
+ int row = myOptionTable->rowCount();
+ myOptionTable->setRowCount( row+1 );
+ myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
+ myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
+ myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( "PRECAD" ) );
+ myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( name_value[0] ) );
myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( name_value[1] ) );
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
that->myOptions = h->GetOptionValues();
+ that->myPreCADOptions = h->GetPreCADOptionValues();
h_data.myGMFFileName = h->GetGMFFile();
// h_data.myGMFFileMode = h->GetGMFFileMode();
#endif
h->SetOptionValues( myOptions ); // is set in checkParams()
+ h->SetPreCADOptionValues( myPreCADOptions ); // is set in checkParams()
if ( h->GetGMFFile() != h_data.myGMFFileName )
// || ( h->GetGMFFileMode() != h_data.myGMFFileMode ) )
for ( ; row < nbRows; ++row )
{
int id = myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
- if ( id >= 0 && id < myOptions->length() )
+ std::string optionType = myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString();
+ if ( id >= 0 && ( ( optionType == "BLSURF" && id < myOptions->length() ) || ( optionType == "PRECAD" && id < myPreCADOptions->length() ) ) )
{
QString name = myOptionTable->item( row, OPTION_NAME_COLUMN )->text();
QString value = myOptionTable->item( row, OPTION_VALUE_COLUMN )->text().trimmed();
if ( value.isNull() )
value = "";
- that->myOptions[ id ] = ( name + ":" + value).toLatin1().constData();
- if ( value != "" )
+ if (optionType == "PRECAD")
+ that->myPreCADOptions[ id ] = ( name + ":" + value).toLatin1().constData();
+ else
+ that->myOptions[ id ] = ( name + ":" + value).toLatin1().constData();
+
+ if ( value != "" ) {
+ if (optionType == "PRECAD")
+ guiHyp += "PRECAD_";
guiHyp += name + " = " + value + "; ";
+ }
}
}
QMenu* menu = (QMenu*)sender();
// fill popup with option names
menu->clear();
+ QString name_value, name;
if ( myOptions.operator->() ) {
+ QMenu* blsurfMenu = menu->addMenu(tr("OPTION_MENU_BLSURF"));
for ( int i = 0, nb = myOptions->length(); i < nb; ++i ) {
- QString name_value = myOptions[i].in();
- QString name = name_value.split( ":", QString::KeepEmptyParts )[0];
- menu->addAction( name );
+ name_value = myOptions[i].in();
+ name = name_value.split( ":", QString::KeepEmptyParts )[0];
+ blsurfMenu->addAction( name );
+ }
+ }
+ if ( myPreCADOptions.operator->() ) {
+ QMenu* preCADmenu = menu->addMenu(tr("OPTION_MENU_PRECAD"));
+ for ( int i = 0, nb = myPreCADOptions->length(); i < nb; ++i ) {
+ name_value = myPreCADOptions[i].in();
+ name = name_value.split( ":", QString::KeepEmptyParts )[0];
+ preCADmenu->addAction( name );
}
}
}
int idx = menu->actions().indexOf( a );
QString idStr = QString("%1").arg( idx );
- QString option = myOptions[idx].in();
+ QString option, optionType;
+ if (menu->title() == tr("OPTION_MENU_BLSURF")) {
+ option = myOptions[idx].in();
+ optionType = "BLSURF";
+ }
+ else if (menu->title() == tr("OPTION_MENU_PRECAD")) {
+ option = myPreCADOptions[idx].in();
+ optionType = "PRECAD";
+ }
QString optionName = option.split( ":", QString::KeepEmptyParts )[0];
// look for a row with optionName
int row = 0, nbRows = myOptionTable->rowCount();
for ( ; row < nbRows; ++row )
if ( myOptionTable->item( row, OPTION_ID_COLUMN )->text() == idStr )
- break;
+ if ( myOptionTable->item( row, OPTION_TYPE_COLUMN )->text() == optionType )
+ break;
// add a row if not found
if ( row == nbRows ) {
myOptionTable->setRowCount( row+1 );
myOptionTable->setItem( row, OPTION_ID_COLUMN, new QTableWidgetItem( idStr ) );
myOptionTable->item( row, OPTION_ID_COLUMN )->setFlags( 0 );
+ myOptionTable->setItem( row, OPTION_TYPE_COLUMN, new QTableWidgetItem( optionType ) );
+ myOptionTable->item( row, OPTION_TYPE_COLUMN )->setFlags( 0 );
myOptionTable->setItem( row, OPTION_NAME_COLUMN, new QTableWidgetItem( optionName ) );
myOptionTable->item( row, OPTION_NAME_COLUMN )->setFlags( 0 );
myOptionTable->setItem( row, OPTION_VALUE_COLUMN, new QTableWidgetItem( "" ) );
if ( !selectedRows.contains( row ) ) {
selectedRows.append( row );
int id = myOptionTable->item( row, OPTION_ID_COLUMN )->text().toInt();
- if ( id >= 0 && id < myOptions->length() )
- myOptions[ id ] = myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData();
+ std::string optionType = myOptionTable->item( row, OPTION_TYPE_COLUMN )->text().toStdString();
+ if ( id >= 0 )
+ if (optionType == "BLSURF" && id < myOptions->length() )
+ myOptions[ id ] = myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData();
+ else if (optionType == "PRECAD" && id < myPreCADOptions->length() )
+ myPreCADOptions[ id ] = myOptionTable->item( row, OPTION_NAME_COLUMN )->text().toLatin1().constData();
}
}
qSort( selectedRows );
double myAngleMeshS, myAngleMeshC, myGradation;
double myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex;
- bool myPreCADMergeEdges, myPreCADRemoveNanoEdges, myPreCADDiscardInput, myPreCADEpsNano;
+ bool myPreCADMergeEdges, myPreCADRemoveNanoEdges, myPreCADDiscardInput;
+ double myPreCADEpsNano;
// bool myGMFFileMode;
std::string myGMFFileName;
TEnfVertexList enfVertexList;
GeomSelectionTools* GeomToolSelected;
LightApp_SelectionMgr* aSel;
- BLSURFPlugin::string_array_var myOptions;
+ BLSURFPlugin::string_array_var myOptions, myPreCADOptions;
PyObject * main_mod;
PyObject * main_dict;
<source>OBLIGATORY_VALUE</source>
<translation>(Obligatory value)</translation>
</message>
+ <message>
+ <source>OPTION_TYPE_COLUMN</source>
+ <translation>Type</translation>
+ </message>
<message>
<source>OPTION_NAME_COLUMN</source>
<translation>Option</translation>
<source>OPTION_VALUE_COLUMN</source>
<translation>Value</translation>
</message>
+ <message>
+ <source>OPTION_MENU_BLSURF</source>
+ <translation>BLSURF</translation>
+ </message>
+ <message>
+ <source>OPTION_MENU_PRECAD</source>
+ <translation>PreCAD</translation>
+ </message>
<message>
<source>REMOVE_OPTION</source>
<translation>Clear option</translation>
<source>OBLIGATORY_VALUE</source>
<translation>(Valeur obligatoire)</translation>
</message>
+ <message>
+ <source>OPTION_TYPE_COLUMN</source>
+ <translation>Type</translation>
+ </message>
<message>
<source>OPTION_NAME_COLUMN</source>
<translation>Option</translation>
<source>OPTION_VALUE_COLUMN</source>
<translation>Valeur</translation>
</message>
+ <message>
+ <source>OPTION_MENU_BLSURF</source>
+ <translation>BLSURF</translation>
+ </message>
+ <message>
+ <source>OPTION_MENU_PRECAD</source>
+ <translation>PreCAD</translation>
+ </message>
<message>
<source>REMOVE_OPTION</source>
<translation>Effacer l'option</translation>