void ViewProviderFemMeshPy::setNodeColor(Py::Dict arg) { long size = arg.size(); if(size == 0) this->getViewProviderFemMeshPtr()->resetColorByNodeId(); else { Base::TimeInfo Start; Base::Console().Log("Start: ViewProviderFemMeshPy::setNodeColor() =================================\n"); //std::map<long,App::Color> NodeColorMap; //for( Py::Dict::iterator it = arg.begin(); it!= arg.end();++it){ // Py::Int id((*it).first); // Py::Tuple color((*it).second); // NodeColorMap[id] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); //} std::vector<long> NodeIds(size); std::vector<App::Color> NodeColors(size); long i = 0; for( Py::Dict::iterator it = arg.begin(); it!= arg.end(); ++it,i++) { Py::Int id((*it).first); Py::Tuple color((*it).second); NodeIds[i] = id; NodeColors[i] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); } Base::Console().Log(" %f: Start ViewProviderFemMeshPy::setNodeColor() call \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo())); //this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeColorMap); this->getViewProviderFemMeshPtr()->setColorByNodeId(NodeIds,NodeColors); Base::Console().Log(" %f: Finish ViewProviderFemMeshPy::setNodeColor() call \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo())); } }
void ViewProviderFemMeshPy::setElementColor(Py::Dict arg) { if(arg.size() == 0) this->getViewProviderFemMeshPtr()->resetColorByNodeId(); else { std::map<long,App::Color> NodeColorMap; for( Py::Dict::iterator it = arg.begin(); it!= arg.end(); ++it) { Py::Int id((*it).first); Py::Tuple color((*it).second); NodeColorMap[id] = App::Color(Py::Float(color[0]),Py::Float(color[1]),Py::Float(color[2]),0); } this->getViewProviderFemMeshPtr()->setColorByElementId(NodeColorMap); } }
void ViewProviderFemMeshPy::setNodeDisplacement(Py::Dict arg) { if(arg.size() == 0) this->getViewProviderFemMeshPtr()->resetColorByNodeId(); else { std::map<long,Base::Vector3d> NodeDispMap; union PyType_Object pyType = {&(Base::VectorPy::Type)}; Py::Type vType(pyType.o); for( Py::Dict::iterator it = arg.begin(); it!= arg.end(); ++it) { Py::Int id((*it).first); if ((*it).second.isType(vType)) { Py::Vector p((*it).second); NodeDispMap[id] = p.toVector(); } } this->getViewProviderFemMeshPtr()->setDisplacementByNodeId(NodeDispMap); } }