00001 #include "SIGEL_Visualisation/SIG_RobotVisualisation.h" 00002 00003 namespace SIGEL_Visualisation 00004 { 00005 00006 SIG_RobotVisualisation::SIG_RobotVisualisation(SIGEL_Robot::SIG_Robot const &robot) 00007 : SIG_Visualisation(), robotRenderer(robot) 00008 { 00009 QDictIterator<SIGEL_Robot::SIG_Link> iter = robot.getLinkIter(); 00010 00011 while (iter.current()) 00012 { 00013 SIGEL_Robot::SIG_Link &actLink = *iter.current(); 00014 00015 int number = actLink.getNumber(); 00016 00017 DL_vector position; 00018 DL_matrix rotation; 00019 actLink.getInitialLocation( position, rotation ); 00020 00021 robotRenderer.sceneObjects[number]->setPosition(position); 00022 robotRenderer.sceneObjects[number]->setRotation(rotation); 00023 00024 ++iter; 00025 }; 00026 00027 for (int i = iter.count(); i < robotRenderer.sceneObjects.size(); i++) 00028 { 00029 int linkNumber = robotRenderer.sceneObjects[ i ]->getNumber(); 00030 00031 DL_vector position = robotRenderer.sceneObjects[ linkNumber ]->getPosition(); 00032 DL_matrix rotation = robotRenderer.sceneObjects[ linkNumber ]->getRotation(); 00033 00034 robotRenderer.sceneObjects[ i ]->setPosition( position ); 00035 robotRenderer.sceneObjects[ i ]->setRotation( rotation ); 00036 }; 00037 00038 }; 00039 00040 SIG_RobotVisualisation::~SIG_RobotVisualisation() 00041 { }; 00042 00043 void SIG_RobotVisualisation::visualize() 00044 { 00045 SIG_Visualisation::visualize(); 00046 00047 robotRenderer.render(); 00048 }; 00049 00050 }