Optimization. No need to refresh a pattern when move a label.
--HG-- branch : develop
This commit is contained in:
parent
2e83967caf
commit
0c9b8453bf
|
@ -165,20 +165,16 @@ void VToolDoublePoint::UpdateNamePosition(quint32 id)
|
||||||
{
|
{
|
||||||
if (id == p1id)
|
if (id == p1id)
|
||||||
{
|
{
|
||||||
VPointF *p1 = VAbstractTool::data.GeometricObject<VPointF>(p1id).data();
|
const VPointF *p1 = VAbstractTool::data.GeometricObject<VPointF>(p1id).data();
|
||||||
|
|
||||||
MoveDoubleLabel *moveLabel = new MoveDoubleLabel(doc, p1->mx(), p1->my(), DoublePoint::FirstPoint, this->id,
|
auto moveLabel = new MoveDoubleLabel(doc, p1->mx(), p1->my(), DoublePoint::FirstPoint, this->id, scene());
|
||||||
this->scene());
|
|
||||||
connect(moveLabel, &MoveDoubleLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
|
||||||
qApp->getUndoStack()->push(moveLabel);
|
qApp->getUndoStack()->push(moveLabel);
|
||||||
}
|
}
|
||||||
else if (id == p2id)
|
else if (id == p2id)
|
||||||
{
|
{
|
||||||
VPointF *p2 = VAbstractTool::data.GeometricObject<VPointF>(p2id).data();
|
const VPointF *p2 = VAbstractTool::data.GeometricObject<VPointF>(p2id).data();
|
||||||
|
|
||||||
MoveDoubleLabel *moveLabel = new MoveDoubleLabel(doc, p2->mx(), p2->my(), DoublePoint::SecondPoint, this->id,
|
auto moveLabel = new MoveDoubleLabel(doc, p2->mx(), p2->my(), DoublePoint::SecondPoint, this->id, scene());
|
||||||
this->scene());
|
|
||||||
connect(moveLabel, &MoveDoubleLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
|
||||||
qApp->getUndoStack()->push(moveLabel);
|
qApp->getUndoStack()->push(moveLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,8 +128,7 @@ void VToolSinglePoint::NameChangePosition(const QPointF &pos)
|
||||||
void VToolSinglePoint::UpdateNamePosition(quint32 id)
|
void VToolSinglePoint::UpdateNamePosition(quint32 id)
|
||||||
{
|
{
|
||||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
|
||||||
MoveLabel *moveLabel = new MoveLabel(doc, point->mx(), point->my(), id, this->scene());
|
auto moveLabel = new MoveLabel(doc, point->mx(), point->my(), id, scene());
|
||||||
connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
|
|
||||||
qApp->getUndoStack()->push(moveLabel);
|
qApp->getUndoStack()->push(moveLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,7 +248,8 @@ void VToolSinglePoint::RefreshLine(quint32 id)
|
||||||
{
|
{
|
||||||
Q_UNUSED(id)
|
Q_UNUSED(id)
|
||||||
VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
|
VAbstractTool::RefreshLine(this, namePoint, lineName, radius);
|
||||||
lineName->setPen(QPen(CorrectColor(Qt::black), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
lineName->setPen(QPen(CorrectColor(Qt::black),
|
||||||
|
qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -323,8 +323,8 @@ void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractP
|
||||||
/**
|
/**
|
||||||
* @brief RefreshLine refresh line to label on scene.
|
* @brief RefreshLine refresh line to label on scene.
|
||||||
*/
|
*/
|
||||||
void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint, QGraphicsLineItem *lineName,
|
void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleTextItem *namePoint,
|
||||||
const qreal radius)
|
QGraphicsLineItem *lineName, const qreal radius)
|
||||||
{
|
{
|
||||||
SCASSERT(point != nullptr);
|
SCASSERT(point != nullptr);
|
||||||
SCASSERT(namePoint != nullptr);
|
SCASSERT(namePoint != nullptr);
|
||||||
|
@ -336,7 +336,8 @@ void VAbstractTool::RefreshLine(QGraphicsEllipseItem *point, VGraphicsSimpleText
|
||||||
{
|
{
|
||||||
const QRectF nameRec = namePoint->sceneBoundingRect();
|
const QRectF nameRec = namePoint->sceneBoundingRect();
|
||||||
QPointF p1, p2;
|
QPointF p1, p2;
|
||||||
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - point->scenePos()), p1, p2);
|
VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - point->scenePos()), p1,
|
||||||
|
p2);
|
||||||
const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(point->scenePos(), nameRec.center()));
|
const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(point->scenePos(), nameRec.center()));
|
||||||
lineName->setLine(QLineF(p1, pRec - point->scenePos()));
|
lineName->setLine(QLineF(p1, pRec - point->scenePos()));
|
||||||
|
|
||||||
|
|
|
@ -176,8 +176,6 @@ void MoveDoubleLabel::Do(double mx, double my)
|
||||||
doc->SetAttribute(domElement, AttrMx2, QString().setNum(qApp->fromPixel(mx)));
|
doc->SetAttribute(domElement, AttrMx2, QString().setNum(qApp->fromPixel(mx)));
|
||||||
doc->SetAttribute(domElement, AttrMy2, QString().setNum(qApp->fromPixel(my)));
|
doc->SetAttribute(domElement, AttrMy2, QString().setNum(qApp->fromPixel(my)));
|
||||||
}
|
}
|
||||||
|
|
||||||
emit NeedLiteParsing(Document::LitePPParse);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -119,8 +119,6 @@ void MoveLabel::Do(double mx, double my)
|
||||||
{
|
{
|
||||||
doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(mx)));
|
doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(mx)));
|
||||||
doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(my)));
|
doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(my)));
|
||||||
|
|
||||||
emit NeedLiteParsing(Document::LitePPParse);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user