Skip to content
Snippets Groups Projects
Commit f50b611c authored by Raphael Grimm's avatar Raphael Grimm
Browse files

The graph displayed in the scene is not mirrored anymore.

parent 39faf2f2
No related branches found
No related tags found
No related merge requests found
......@@ -215,8 +215,8 @@ void GraphVisualizerWidget::addEdge(const std::string& node1, const std::string&
ui.tableWidgetEdges->setItem(row,1,new QTableWidgetItem{QString::fromStdString(node2)});
//debug layer will be done later
//scene
auto graphicsItem= scene->addLine(node1dat.pos->x,node1dat.pos->y,
node2dat.pos->x,node2dat.pos->y);
auto graphicsItem= scene->addLine(node1dat.pos->x,-node1dat.pos->y,
node2dat.pos->x,-node2dat.pos->y);
graphicsItem->setToolTip(QString{"Edge:"}+QString::fromStdString(node1)+QChar{2194}+QString::fromStdString(node2));
//data
EdgeData data{graphicsItem,row,false,false};
......@@ -240,7 +240,7 @@ void GraphVisualizerWidget::addNode(const ::armarx::FramedVector3BasePtr& node,
ui.tableWidgetNodes->setItem(oldNode.tableWidgetNodesIndex,2,new QTableWidgetItem{QString::number(node->y)});
ui.tableWidgetNodes->setItem(oldNode.tableWidgetNodesIndex,3,new QTableWidgetItem{QString::number(node->z)});
//scene
oldNode.graphicsItem->setPos(node->x,node->y);
oldNode.graphicsItem->setPos(node->x,-node->y);
//data
::armarx::Vector3Ptr pos{new ::armarx::Vector3{Eigen::Vector3f{node->x,node->y,node->z}}};
......@@ -257,7 +257,7 @@ void GraphVisualizerWidget::addNode(const ::armarx::FramedVector3BasePtr& node,
ui.tableWidgetNodes->setItem(row,2,new QTableWidgetItem{QString::number(node->y)});
ui.tableWidgetNodes->setItem(row,3,new QTableWidgetItem{QString::number(node->z)});
//scene
auto graphicsItem= scene->addEllipse(node->x,node->y,0,0);
auto graphicsItem= scene->addEllipse(node->x,-node->y,0,0);
graphicsItem->setZValue(std::numeric_limits<qreal>::max());
graphicsItem->setToolTip(QString{"Node:"}+QString::fromStdString(node->frame));
......@@ -382,7 +382,7 @@ void GraphVisualizerWidget::updateNode(const NodeId& id)
data.graphicsItem->setPen(QPen{qColor});
data.graphicsItem->setBrush(QBrush{qColor});
data.graphicsItem->setRect(data.pos->x-lineWidth*SCENE_NODES_SCALE_FACTOR/2,
data.pos->y-lineWidth*SCENE_NODES_SCALE_FACTOR/2,
-data.pos->y-lineWidth*SCENE_NODES_SCALE_FACTOR/2,
lineWidth*SCENE_NODES_SCALE_FACTOR,
lineWidth*SCENE_NODES_SCALE_FACTOR);
//table
......
......@@ -287,6 +287,10 @@ namespace armarx
/**
* @brief The scene displayed in the widget.
*
* For y coordinates -pos->y is used to mirror the scene on the y axis.
* If pos->y would be used the graph displayed in the scene would not
* match the graph drawn to the debug layer.
*/
QPointer<QGraphicsScene> scene;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment