Resolved issue #366. Update 'Point from Distance and Angle' tool to read

distance and angle between points.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-03-19 17:45:57 +02:00
parent bd783d4df1
commit baddba9e43
4 changed files with 28 additions and 4 deletions

View File

@ -1,4 +1,5 @@
# Version 0.5.0 # Version 0.5.0
- [#366] Update 'Point from Distance and Angle' tool to read distance and angle between points.
- [#395] Create Curve tool which uses point as control handle. - [#395] Create Curve tool which uses point as control handle.
- pdftops updated to version 3.04. - pdftops updated to version 3.04.
- [#306] Layout generator optimization. Divide into strips. - [#306] Layout generator optimization. Divide into strips.

View File

@ -286,7 +286,7 @@ void DialogEndLine::ShowDialog(bool click)
QLineF line = QLineF(point->toQPointF(), scene->getScenePos()); QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
//Radius of point circle, but little bigger. Need handle with hover sizes. //Radius of point circle, but little bigger. Need handle with hover sizes.
qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5; const qreal radius = ToPixel(DefPointRadius/*mm*/, Unit::Mm)*1.5;
if (line.length() <= radius) if (line.length() <= radius)
{ {
return; return;
@ -298,6 +298,7 @@ void DialogEndLine::ShowDialog(bool click)
SCASSERT(line != nullptr); SCASSERT(line != nullptr);
this->SetAngle(line->Angle());//Show in dialog angle what user choose this->SetAngle(line->Angle());//Show in dialog angle what user choose
this->SetFormula(line->Length());
emit ToolTip(""); emit ToolTip("");
timerFormula->start(); timerFormula->start();
this->show(); this->show();

View File

@ -53,7 +53,15 @@ void VisToolEndLine::RefreshGeometry()
QLineF line; QLineF line;
if (qFuzzyIsNull(length)) if (qFuzzyIsNull(length))
{ {
line = QLineF(first->toQPointF(), Ray(first->toQPointF())); if (QGuiApplication::keyboardModifiers() == Qt::ShiftModifier)
{
line = QLineF(first->toQPointF(), Visualization::scenePos);
line.setAngle(CorrectAngle(line.angle()));
}
else
{
line = QLineF(first->toQPointF(), Visualization::scenePos);
}
} }
else else
{ {
@ -61,8 +69,12 @@ void VisToolEndLine::RefreshGeometry()
DrawPoint(point, line.p2(), mainColor); DrawPoint(point, line.p2(), mainColor);
} }
DrawLine(this, line, mainColor, lineStyle); DrawLine(this, line, mainColor, lineStyle);
Visualization::toolTip = QString(tr("<b>Point at distance and angle</b>: angle = %1°; <b>Shift</b> - " static const QString prefix = VDomDocument::UnitsToStr(qApp->patternUnit(), true);
"sticking angle, <b>Enter</b> - finish creation")).arg(this->line().angle()); Visualization::toolTip = QString(tr("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; "
"<b>Shift</b> - sticking angle, <b>Enter</b> - finish creation"))
.arg(this->line().angle())
.arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length()))))
.arg(prefix);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -77,6 +89,12 @@ void VisToolEndLine::SetAngle(const QString &expression)
angle = FindVal(expression, Visualization::data->PlainVariables()); angle = FindVal(expression, Visualization::data->PlainVariables());
} }
//---------------------------------------------------------------------------------------------------------------------
QString VisToolEndLine::Length() const
{
return QString::number(qApp->fromPixel(this->line().length()));
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VisToolEndLine::setLength(const QString &expression) void VisToolEndLine::setLength(const QString &expression)
{ {

View File

@ -41,9 +41,13 @@ public:
virtual ~VisToolEndLine() Q_DECL_OVERRIDE; virtual ~VisToolEndLine() Q_DECL_OVERRIDE;
virtual void RefreshGeometry() Q_DECL_OVERRIDE; virtual void RefreshGeometry() Q_DECL_OVERRIDE;
QString Angle() const; QString Angle() const;
void SetAngle(const QString &expression); void SetAngle(const QString &expression);
QString Length() const;
void setLength(const QString &expression); void setLength(const QString &expression);
virtual int type() const Q_DECL_OVERRIDE {return Type;} virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Vis::ToolEndLine)}; enum { Type = UserType + static_cast<int>(Vis::ToolEndLine)};
private: private: