projVertex.push_back((double)xyz[0]);
projVertex.push_back((double)xyz[1]);
projVertex.push_back((double)xyz[2]);
-// std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexCoords >::const_iterator projIt = EnfVertexCoords2ProjVertex.find(projVertex);
-// if (projIt != EnfVertexCoords2ProjVertex.end()) {
-// BLSURFPlugin_Hypothesis::TEnfVertexCoords enfVertexCoords = projIt->second;
-
-// BLSURFPlugin_Hypothesis::TEnfVertexGroupNameMap groupNameMap = _hypothesis->_GetEnforcedVertexGroupNameMap();
-// BLSURFPlugin_Hypothesis::TEnfVertexGroupNameMap::const_iterator groupNameMapIt = groupNameMap.find(enfVertexCoords);
- std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex);
- if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) {
- MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2])
-// BLSURFPlugin_Hypothesis::TEnfGroupName groupName = groupNameMapIt->second;
-// if (groupName != "") {
- BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin();
- BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
- for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) {
- currentEnfVertex = (*enfListIt);
- if (currentEnfVertex->grpName != "") {
- bool groupDone = false;
- const set<SMESHDS_GroupBase*>& allGroups = meshDS->GetGroups();
- set<SMESHDS_GroupBase*>::const_iterator grIt;
- MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName);
- MESSAGE("Parsing the groups of the mesh");
- for ( grIt = allGroups.begin(); grIt != allGroups.end(); ++grIt ) {
- SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *grIt );
- if (group) {
- MESSAGE("Group: " << group->GetStoreName());
- MESSAGE("group->SMDSGroup().GetType(): " << (group->SMDSGroup().GetType()));
- MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (group->SMDSGroup().GetType()==SMDSAbs_Node));
- MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetStoreName())==0));
- }
- if ( group && (group->SMDSGroup().GetType()==SMDSAbs_Node || group->SMDSGroup().GetType()==SMDSAbs_All)
- && currentEnfVertex->grpName.compare(group->GetStoreName())==0) {
- group->SMDSGroup().Add(nodes[iv]);
- // int id = // recuperer l'id SMESH du noeud
- // _hypothesis->AddEnfVertexIDs(groupName,id)
- groupDone = true;
- MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName);
- break;
- }
- }
- if (!groupDone)
- {
- int groupId;
- SMESH_Group* aGroup = aMesh.AddGroup(SMDSAbs_Node, currentEnfVertex->grpName.c_str(), groupId);
- if ( aGroup ) {
- SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
- if ( aGroupDS ) {
- aGroupDS->SetType( SMDSAbs_Node );
- aGroupDS->SetStoreName( currentEnfVertex->grpName.c_str() );
- aGroupDS->SMDSGroup().Add(nodes[iv]);
- MESSAGE("Successfully created enforced vertex group " << currentEnfVertex->grpName);
- groupDone = true;
- }
- }
+ std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex);
+ if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) {
+ MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2])
+ BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin();
+ BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex;
+ for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) {
+ currentEnfVertex = (*enfListIt);
+ if (currentEnfVertex->grpName != "") {
+ bool groupDone = false;
+ SMESH_Mesh::GroupIteratorPtr grIt = aMesh.GetGroups();
+ MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName);
+ MESSAGE("Parsing the groups of the mesh");
+ while (grIt->more()) {
+ SMESH_Group * group = grIt->next();
+ if ( !group ) continue;
+ MESSAGE("Group: " << group->GetName());
+ SMESHDS_GroupBase* groupDS = group->GetGroupDS();
+ if ( !groupDS ) continue;
+ MESSAGE("group->SMDSGroup().GetType(): " << (groupDS->GetType()));
+ MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (groupDS->GetType()==SMDSAbs_Node));
+ MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetName())==0));
+ if ( groupDS->GetType()==SMDSAbs_Node && currentEnfVertex->grpName.compare(group->GetName())==0) {
+ SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( groupDS );
+ aGroupDS->SMDSGroup().Add(nodes[iv]);
+ MESSAGE("Node ID: " << nodes[iv]->GetID());
+ // How can I inform the hypothesis ?
+// _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID());
+ groupDone = true;
+ MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName);
+ break;
}
- if (!groupDone)
- throw SALOME_Exception(LOCALIZED("A enforced vertex node was not added to a group"));
}
- else
- MESSAGE("Group name is empty: '"<<currentEnfVertex->grpName<<"' => group is not created");
+ if (!groupDone)
+ {
+ int groupId;
+ SMESH_Group* aGroup = aMesh.AddGroup(SMDSAbs_Node, currentEnfVertex->grpName.c_str(), groupId);
+ aGroup->SetName( currentEnfVertex->grpName.c_str() );
+ SMESHDS_Group* aGroupDS = static_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
+ aGroupDS->SMDSGroup().Add(nodes[iv]);
+ MESSAGE("Successfully created enforced vertex group " << currentEnfVertex->grpName);
+ groupDone = true;
+ }
+ if (!groupDone)
+ throw SALOME_Exception(LOCALIZED("A enforced vertex node was not added to a group"));
}
+ else
+ MESSAGE("Group name is empty: '"<<currentEnfVertex->grpName<<"' => group is not created");
}
-// else
-// MESSAGE("No group name for projected vertex ("<<projVertex[0]<<","<<projVertex[1]<<","<<projVertex[2]<<")")
-// }
-// else
-// MESSAGE("No group name for vertex ("<<xyz[0]<<","<<xyz[1]<<","<<xyz[2]<<")")
+ }
}
_faceEntryCoordsListMap(GetDefaultFaceEntryCoordsListMap()),
_coordsEnfVertexMap(GetDefaultCoordsEnfVertexMap()),
_faceEntryEnfVertexEntryListMap(GetDefaultFaceEntryEnfVertexEntryListMap()),
- _enfVertexEntryEnfVertexMap(GetDefaultEnfVertexEntryEnfVertexMap())
+ _enfVertexEntryEnfVertexMap(GetDefaultEnfVertexEntryEnfVertexMap()),
+ _groupNameNodeIDMap(GetDefaultGroupNameNodeIDMap())
/* TODO GROUPS
_groupNameEnfVertexListMap(GetDefaultGroupNameEnfVertexListMap()),
_coordsEnfVertexMap.clear();
_faceEntryEnfVertexEntryListMap.clear();
_enfVertexEntryEnfVertexMap.clear();
+ _groupNameNodeIDMap.clear();
/* TODO GROUPS
_groupNameEnfVertexListMap.clear();
return hyp ? hyp->_GetAllEnforcedVerticesByEnfVertexEntry() : GetDefaultEnfVertexEntryEnfVertexMap();
}
+std::set<int> BLSURFPlugin_Hypothesis::GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument)
+{
+ TGroupNameNodeIDMap::const_iterator it = _groupNameNodeIDMap.find(theGroupName);
+ if (it != _groupNameNodeIDMap.end()) {
+ return it->second;
+ }
+ std::ostringstream msg;
+ msg << "No group " << theGroupName;
+ throw std::invalid_argument(msg.str());
+}
+
+void BLSURFPlugin_Hypothesis::AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID)
+{
+ _groupNameNodeIDMap[theGroupName].insert(theNodeID);
+}
+
+void BLSURFPlugin_Hypothesis::RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument)
+{
+ TGroupNameNodeIDMap::iterator it = _groupNameNodeIDMap.find(theGroupName);
+ if (it != _groupNameNodeIDMap.end()) {
+ std::set<int>::iterator IDit = it->second.find(theNodeID);
+ if (IDit != it->second.end())
+ it->second.erase(IDit);
+ std::ostringstream msg;
+ msg << "No node IDs " << theNodeID << " for group " << theGroupName;
+ throw std::invalid_argument(msg.str());
+ }
+ std::ostringstream msg;
+ msg << "No group " << theGroupName;
+ throw std::invalid_argument(msg.str());
+}
+
//=============================================================================
std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " "
// Map Vertex entry / Enforced vertex
typedef std::map< TEntry, TEnfVertex* > TEnfVertexEntryEnfVertexMap;
+ typedef std::map< TEnfGroupName, std::set<int> > TGroupNameNodeIDMap;
/* TODO GROUPS
// Map Group Name / List of enforced vertices
typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
TEntryList GetEnfVertexEntryList (const TEntry& theFaceEntry) throw (std::invalid_argument);
TEnfVertex* GetEnfVertex(TEnfVertexCoords coords) throw (std::invalid_argument);
TEnfVertex* GetEnfVertex(const TEntry& theEnfVertexEntry) throw (std::invalid_argument);
+ void AddEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID);
+ std::set<int> GetEnfVertexNodeIDs(TEnfGroupName theGroupName) throw (std::invalid_argument);
+ void RemoveEnfVertexNodeID(TEnfGroupName theGroupName,int theNodeID) throw (std::invalid_argument);
bool ClearEnforcedVertex(const TEntry& theFaceEntry, double x = 0.0, double y = 0.0, double z = 0.0, const TEntry& theVertexEntry="") throw (std::invalid_argument);
bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
static TCoordsEnfVertexMap GetDefaultCoordsEnfVertexMap() { return TCoordsEnfVertexMap(); }
static TFaceEntryEnfVertexEntryListMap GetDefaultFaceEntryEnfVertexEntryListMap() { return TFaceEntryEnfVertexEntryListMap(); }
static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
+ static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
/* TODO GROUPS
static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
// maps to get "geom" enf vertex (through their geom entries)
TFaceEntryEnfVertexEntryListMap _faceEntryEnfVertexEntryListMap;
TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
+ TGroupNameNodeIDMap _groupNameNodeIDMap;
/* TODO GROUPS
TGroupNameEnfVertexListMap _groupNameEnfVertexListMap;
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
MESSAGE("IDL : SetEnforcedVertex( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- if (theVertexEntry == "") {
+ if (theVertexEntry.empty()) {
if (theVertex->GetShapeType() == GEOM::VERTEX)
aName = "Vertex_";
if (theVertex->GetShapeType() == GEOM::COMPOUND)
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
- if (theVertexEntry == "")
+ if (theVertexEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
string theVertexName = theVertex->GetName();
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
MESSAGE("IDL : SetEnforcedVertexWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theGroupName << ")");
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
MESSAGE("IDL : SetEnforcedVertexNamedWithGroup( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theGroupName << ")");
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- if (theVertexEntry == "") {
+ if (theVertexEntry.empty()) {
if (theVertex->GetShapeType() == GEOM::VERTEX)
aName = "Vertex_";
if (theVertex->GetShapeType() == GEOM::COMPOUND)
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
- if (theVertexEntry == "")
+ if (theVertexEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
string theVertexName = theVertex->GetName();
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
MESSAGE("IDL : UnsetEnforcedVertex ( "<< theFaceEntry << ", " << x << ", " << y << ", " << z << ")");
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
if (theFace->GetShapeType() == GEOM::FACE)
aName = "Face_";
if (theFace->GetShapeType() == GEOM::COMPOUND)
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
- if (theVertexEntry == "") {
+ if (theVertexEntry.empty()) {
if (theVertex->GetShapeType() == GEOM::VERTEX)
aName = "Vertex_";
if (theVertex->GetShapeType() == GEOM::COMPOUND)
if (!theSVertex->_is_nil())
theVertexEntry = theSVertex->GetID();
}
- if (theVertexEntry == "")
+ if (theVertexEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : UnsetEnforcedVertexGeom ( "<< theFaceEntry << ", " << theVertexEntry << ")");
string theFaceEntry = theFace->GetStudyEntry();
- if (theFaceEntry == "") {
+ if (theFaceEntry.empty()) {
GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
string aName;
if (!theSFace->_is_nil())
theFaceEntry = theSFace->GetID();
}
- if (theFaceEntry == "")
+ if (theFaceEntry.empty())
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
CORBA::Double z, const char* theVertexName, const char* theVertexEntry, const char* theGroupName)
throw (SALOME::SALOME_Exception) {
ASSERT(myBaseImpl);
- MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", \"" << theVertexName << "\"," << theVertexEntry << ", \"" << theGroupName << "\")");
+ MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")");
bool newValue = false;
- if (theVertexEntry == "") {
+ if (string(theVertexEntry).empty()) {
try {
::BLSURFPlugin_Hypothesis::TEnfVertexCoordsList coordsList =
this->GetImpl()->GetEnfVertexCoordsList(theFaceEntry);
// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
newValue = true;
}
- else
+ else {
MESSAGE("The names are identical");
+ }
}
} catch (const std::invalid_argument& ex) {
// no enforced vertex for entry
newValue = true;
}
if (newValue)
- if (theVertexName == "")
- if (theGroupName == "")
+ if (string(theVertexName).empty())
+ if (string(theGroupName).empty())
SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")";
else
SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")";
else
- if (theGroupName == "")
+ if (string(theGroupName).empty())
SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")";
else
SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \""
- << theVertexName << ", \"" << theGroupName << "\")";
+ << theVertexName << "\", \"" << theGroupName << "\")";
} else {
try {
::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry);
- if (enfVertexEntryList.find(theVertexEntry) == enfVertexEntryList.end()) {
+ ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry);
+ if ( it == enfVertexEntryList.end()) {
MESSAGE("Geom entry not found: add it in enfVertexEntryList");
newValue = true;
- } else
- MESSAGE("Geom entry already found");
+ }
+ else {
+ MESSAGE("Geom entry already found, compare names");
+ ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it));
+ if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) {
+ MESSAGE("The names are different: update");
+// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z);
+ newValue = true;
+ }
+ else {
+ MESSAGE("The names are identical");
+ }
+ }
} catch (const std::invalid_argument& ex) {
// no enforced vertex for entry
MESSAGE("Face entry not found : add it to the list");
newValue = true;
}
if (newValue)
- if (theGroupName == "")
+ if (string(theGroupName).empty())
SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")";
else
SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")";
try {
this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry);
- if (theVertexEntry == "")
+ if (string(theVertexEntry).empty())
SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z
<< ")";
else
const QStyleOptionViewItem & option ,
const QModelIndex & index ) const
{
-// QModelIndex father = index.parent();
-// QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data(Qt::EditRole).toString();
+ QModelIndex father = index.parent();
+ QString entry = father.child(index.row(), ENF_VER_ENTRY_COLUMN).data(Qt::EditRole).toString();
if (index.column() == ENF_VER_X_COLUMN || \
index.column() == ENF_VER_Y_COLUMN || \
{
SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
-// editor->setEnabled(entry.isEmpty());
+ editor->setReadOnly(!entry.isEmpty());
+ editor->setDisabled(!entry.isEmpty());
return editor;
}
else
{
QLineEdit *editor = new QLineEdit(parent);
-// if (index.column() != ENF_VER_GROUP_COLUMN)
-// editor->setEnabled(entry.isEmpty());
+ if (index.column() != ENF_VER_GROUP_COLUMN) {
+ editor->setReadOnly(!entry.isEmpty());
+ editor->setDisabled(!entry.isEmpty());
+ }
return editor;
}
myEnforcedTreeWidget->resizeColumnToContents(column);
}
myEnforcedTreeWidget->hideColumn(ENF_VER_FACE_ENTRY_COLUMN);
-// myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
+ myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
// FACE AND VERTEX SELECTION
childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble();
childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble();
childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble();
- if (((childValueX == x) && (childValueY == y) && (childValueZ == z)) || (childEntry.toStdString() == geomEntry)) {
+ if (((childValueX == x) && (childValueY == y) && (childValueZ == z)) || ( (childEntry.toStdString() != "") && (childEntry.toStdString() == geomEntry))) {
// update group name
if (childGroupName.toStdString() != groupName) {
MESSAGE("Group is updated from \"" << childGroupName.toStdString() << "\" to \"" << groupName << "\"");
} // for
} // if
if (!okToCreate) {
- if (geomEntry == "") {
+ if (geomEntry.empty()) {
MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
}
else {
return;
}
- if (geomEntry == "") {
+ if (geomEntry.empty()) {
MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z<< " is created");
}
else {
QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
QSize iconSize = iconSelect.size()*0.7;
- int vertexIndex=1;
+ int vertexIndex=myEnforcedTreeWidget->indexOfTopLevelItem(theItem);
QString myVertexName;
- int indexRef = 0;
+ int indexRef = -1;
while(indexRef != vertexIndex) {
indexRef = vertexIndex;
- if (vertexName == "")
+ if (vertexName.empty())
myVertexName = QString("Vertex #%1").arg(vertexIndex);
else
myVertexName = QString(vertexName.c_str());
}
}
vertexItem->setData( ENF_VER_NAME_COLUMN, Qt::EditRole, myVertexName );
- if (geomEntry == "") {
+ if (geomEntry.empty()) {
vertexItem->setData( ENF_VER_X_COLUMN, Qt::EditRole, QVariant(x) );
vertexItem->setData( ENF_VER_Y_COLUMN, Qt::EditRole, QVariant(y) );
vertexItem->setData( ENF_VER_Z_COLUMN, Qt::EditRole, QVariant(z) );
vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
QString toolTip = QString(theFaceName.c_str())+QString(": ")+myVertexName;
- if (geomEntry == "") {
+ if (geomEntry.empty()) {
toolTip += QString(" (%1, ").arg(x);
toolTip += QString("%1, ").arg(y);
toolTip += QString("%1)").arg(z);
if (makeGroupsCheck->isChecked())
groupName = myGlobalGroupName->text().toStdString();
- if (boost::trim_copy(groupName) == "")
+ if (boost::trim_copy(groupName).empty())
groupName = "";
if (selEnfVertex <= 1)
enfVertexFromHyp.clear();
for (int i =0 ; i<hypNbVertex ; i++) {
TEnfVertex *_enfVertex = new TEnfVertex();
+ _enfVertex->name = string("");
_enfVertex->name = CORBA::string_dup(hypEnfVertexList[i].name.in());
+ _enfVertex->geomEntry = string("");
_enfVertex->geomEntry = CORBA::string_dup(hypEnfVertexList[i].geomEntry.in());
+ _enfVertex->grpName = string("");
_enfVertex->grpName = CORBA::string_dup(hypEnfVertexList[i].grpName.in());
for (int j=0 ; j< hypEnfVertexList[i].coords.length() ; j++)
_enfVertex->coords.push_back(hypEnfVertexList[i].coords[j]);
TEnfVertex *enfVertex = new TEnfVertex();
enfVertex->name = childName;
- if (vertexEntry == "") {
+ if (vertexEntry.empty()) {
enfVertex->coords.push_back(childValueX);
enfVertex->coords.push_back(childValueY);
enfVertex->coords.push_back(childValueZ);