Fixed issue #415. Line appears between the point and mark in the detail mode

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2015-12-07 07:48:51 +02:00
parent 0e60b20ace
commit d057d336f7

View File

@ -278,18 +278,26 @@ void VNodePoint::RefreshPointGeometry(const VPointF &point)
* @brief RefreshLine refresh label line on scene.
*/
void VNodePoint::RefreshLine()
{
QRectF nameRec = namePoint->sceneBoundingRect();
QPointF p1, p2;
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - scenePos()));
if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm))
{
lineName->setVisible(false);
}
else
{
lineName->setVisible(true);
}
{ QRectF nRec = namePoint->sceneBoundingRect();
nRec.translate(- scenePos());
if (this->rect().intersects(nRec) == false)
{
QRectF nameRec = namePoint->sceneBoundingRect();
QPointF p1, p2;
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2);
QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center()));
lineName->setLine(QLineF(p1, pRec - scenePos()));
if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm))
{
lineName->setVisible(false);
}
else
{
lineName->setVisible(true);
}
}
else
{
lineName->setVisible(false);
}
}