fixes 0003618: FEM, GUI, mesh view provider, highlighted node show wrong node number on selection

This commit is contained in:
wmayer
2018-09-26 19:59:32 +02:00
parent 483060cc90
commit 1fb55d8d0a
3 changed files with 38 additions and 10 deletions

View File

@@ -219,21 +219,26 @@ void ViewProviderFemMeshPy::setNodeDisplacement(Py::Dict arg)
Py::List ViewProviderFemMeshPy::getHighlightedNodes(void) const
{
//return Py::List();
throw Py::AttributeError("Not yet implemented");
Py::List list;
ViewProviderFemMesh* vp = this->getViewProviderFemMeshPtr();
std::set<long> nodeIds = vp->getHighlightNodes();
for (auto it : nodeIds) {
list.append(Py::Long(it));
}
return list;
}
void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg)
void ViewProviderFemMeshPy::setHighlightedNodes(Py::List arg)
{
ViewProviderFemMesh* vp = this->getViewProviderFemMeshPtr();
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>((static_cast<Fem::FemMeshObject*>
(vp->getObject())->FemMesh).getValue().getSMesh())->GetMeshDS();
std::set<long> res;
for(Py::List::iterator it = arg.begin(); it!= arg.end();++it){
for (Py::List::iterator it = arg.begin(); it!= arg.end();++it) {
long id = static_cast<long>(Py::Long(*it));
const SMDS_MeshNode *node = data->FindNode(id);
if(node)
if (node)
res.insert(id);
}