Visualization for VToolShoulderPoint.
--HG-- branch : develop
This commit is contained in:
parent
b8f6629dd1
commit
2ff611b923
|
@ -158,7 +158,6 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
if (isInitialized == false)
|
if (isInitialized == false)
|
||||||
{
|
{
|
||||||
line->setPoint2Id(id);
|
line->setPoint2Id(id);
|
||||||
line->setMainColor(Qt::red);
|
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
|
|
||||||
prepare = true;
|
prepare = true;
|
||||||
|
|
|
@ -186,7 +186,6 @@ void DialogBisector::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
ui->comboBoxThirdPoint->setCurrentIndex(index);
|
ui->comboBoxThirdPoint->setCurrentIndex(index);
|
||||||
number = 0;
|
number = 0;
|
||||||
line->setPoint3Id(id);
|
line->setPoint3Id(id);
|
||||||
line->setMainColor(Qt::red);
|
|
||||||
line->RefreshGeometry();
|
line->RefreshGeometry();
|
||||||
prepare = true;
|
prepare = true;
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
|
|
|
@ -207,7 +207,6 @@ void DialogEndLine::ShowDialog(bool click)
|
||||||
}
|
}
|
||||||
this->setModal(true);
|
this->setModal(true);
|
||||||
this->setAngle(line->Angle());//Show in dialog angle what user choose
|
this->setAngle(line->Angle());//Show in dialog angle what user choose
|
||||||
line->setMainColor(Qt::red);//Now linw will be red
|
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
this->show();
|
this->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
|
|
||||||
#include "../../geometry/vpointf.h"
|
#include "../../geometry/vpointf.h"
|
||||||
#include "../../container/vcontainer.h"
|
#include "../../container/vcontainer.h"
|
||||||
|
#include "../../visualization/vistoolshoulderpoint.h"
|
||||||
|
#include "../../widgets/vmaingraphicsscene.h"
|
||||||
|
#include "../../tools/vabstracttool.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +43,8 @@
|
||||||
*/
|
*/
|
||||||
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent)
|
DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent)
|
||||||
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
:DialogTool(data, parent), ui(new Ui::DialogShoulderPoint), number(0), pointName(QString()),
|
||||||
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0)
|
typeLine(QString()), formula(QString()), p1Line(0), p2Line(0), pShoulder(0), formulaBaseHeight(0), line (nullptr),
|
||||||
|
prepare(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
InitVariables(ui);
|
InitVariables(ui);
|
||||||
|
@ -70,6 +74,8 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent
|
||||||
this, &DialogShoulderPoint::PointNameChanged);
|
this, &DialogShoulderPoint::PointNameChanged);
|
||||||
connect(ui->comboBoxPShoulder, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxPShoulder, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogShoulderPoint::PointNameChanged);
|
this, &DialogShoulderPoint::PointNameChanged);
|
||||||
|
|
||||||
|
line = new VisToolShoulderPoint(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -103,6 +109,19 @@ void DialogShoulderPoint::PointNameChanged()
|
||||||
CheckState();
|
CheckState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogShoulderPoint::ShowVisualization()
|
||||||
|
{
|
||||||
|
if (prepare == false)
|
||||||
|
{
|
||||||
|
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
|
scene->addItem(line);
|
||||||
|
line->RefreshGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void DialogShoulderPoint::DeployFormulaTextEdit()
|
void DialogShoulderPoint::DeployFormulaTextEdit()
|
||||||
{
|
{
|
||||||
|
@ -112,6 +131,7 @@ void DialogShoulderPoint::DeployFormulaTextEdit()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogShoulderPoint::~DialogShoulderPoint()
|
DialogShoulderPoint::~DialogShoulderPoint()
|
||||||
{
|
{
|
||||||
|
delete line;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,44 +143,59 @@ DialogShoulderPoint::~DialogShoulderPoint()
|
||||||
*/
|
*/
|
||||||
void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
|
void DialogShoulderPoint::ChosenObject(quint32 id, const SceneObject &type)
|
||||||
{
|
{
|
||||||
if (type == SceneObject::Point)
|
if (prepare == false)
|
||||||
{
|
{
|
||||||
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
if (type == SceneObject::Point)
|
||||||
if (number == 0)
|
|
||||||
{
|
{
|
||||||
qint32 index = ui->comboBoxP1Line->findText(point->name());
|
const VPointF *point = data->GeometricObject<const VPointF *>(id);
|
||||||
if ( index != -1 )
|
if (number == 0)
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxP1Line->setCurrentIndex(index);
|
|
||||||
number++;
|
|
||||||
emit ToolTip(tr("Select second point of line"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (number == 1)
|
|
||||||
{
|
|
||||||
qint32 index = ui->comboBoxP2Line->findText(point->name());
|
|
||||||
if ( index != -1 )
|
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxP2Line->setCurrentIndex(index);
|
|
||||||
number++;
|
|
||||||
emit ToolTip(tr("Select point of shoulder"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (number == 2)
|
|
||||||
{
|
|
||||||
qint32 index = ui->comboBoxPShoulder->findText(point->name());
|
|
||||||
if ( index != -1 )
|
|
||||||
{ // -1 for not found
|
|
||||||
ui->comboBoxPShoulder->setCurrentIndex(index);
|
|
||||||
number = 0;
|
|
||||||
emit ToolTip("");
|
|
||||||
}
|
|
||||||
if (isInitialized == false)
|
|
||||||
{
|
{
|
||||||
this->setModal(true);
|
qint32 index = ui->comboBoxPShoulder->findText(point->name());
|
||||||
this->show();
|
if ( index != -1 )
|
||||||
|
{ // -1 for not found
|
||||||
|
ui->comboBoxPShoulder->setCurrentIndex(index);
|
||||||
|
number++;
|
||||||
|
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||||
|
SCASSERT(scene != nullptr);
|
||||||
|
line->VisualMode(id, scene->getScenePos());
|
||||||
|
scene->addItem(line);
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolShoulderPoint::SetFactor);
|
||||||
|
connect(scene, &VMainGraphicsScene::mouseMove, line, &VisToolShoulderPoint::MousePos);
|
||||||
|
emit ToolTip(tr("Select first point of line"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (number == 1)
|
||||||
|
{
|
||||||
|
qint32 index = ui->comboBoxP1Line->findText(point->name());
|
||||||
|
if ( index != -1 )
|
||||||
|
{ // -1 for not found
|
||||||
|
ui->comboBoxP1Line->setCurrentIndex(index);
|
||||||
|
number++;
|
||||||
|
line->setLineP1Id(id);
|
||||||
|
line->RefreshGeometry();
|
||||||
|
emit ToolTip(tr("Select second point of line"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (number == 2)
|
||||||
|
{
|
||||||
|
qint32 index = ui->comboBoxP2Line->findText(point->name());
|
||||||
|
|
||||||
|
if ( index != -1 )
|
||||||
|
{ // -1 for not found
|
||||||
|
ui->comboBoxP2Line->setCurrentIndex(index);
|
||||||
|
number = 0;
|
||||||
|
line->setLineP2Id(id);
|
||||||
|
line->RefreshGeometry();
|
||||||
|
prepare = true;
|
||||||
|
emit ToolTip("");
|
||||||
|
}
|
||||||
|
if (isInitialized == false)
|
||||||
|
{
|
||||||
|
this->setModal(true);
|
||||||
|
this->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -192,6 +227,13 @@ void DialogShoulderPoint::SaveData()
|
||||||
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
p1Line = getCurrentObjectId(ui->comboBoxP1Line);
|
||||||
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
p2Line = getCurrentObjectId(ui->comboBoxP2Line);
|
||||||
pShoulder = getCurrentObjectId(ui->comboBoxPShoulder);
|
pShoulder = getCurrentObjectId(ui->comboBoxPShoulder);
|
||||||
|
|
||||||
|
line->setPoint1Id(pShoulder);
|
||||||
|
line->setLineP1Id(p1Line);
|
||||||
|
line->setLineP2Id(p2Line);
|
||||||
|
line->setLength(formula);
|
||||||
|
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||||
|
line->RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -203,6 +245,7 @@ void DialogShoulderPoint::SaveData()
|
||||||
void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id)
|
void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id)
|
||||||
{
|
{
|
||||||
setPointId(ui->comboBoxPShoulder, pShoulder, value, id);
|
setPointId(ui->comboBoxPShoulder, pShoulder, value, id);
|
||||||
|
line->setPoint1Id(pShoulder);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -214,6 +257,7 @@ void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id)
|
||||||
void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id)
|
void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id)
|
||||||
{
|
{
|
||||||
setPointId(ui->comboBoxP2Line, p2Line, value, id);
|
setPointId(ui->comboBoxP2Line, p2Line, value, id);
|
||||||
|
line->setLineP2Id(p2Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -225,6 +269,7 @@ void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id)
|
||||||
void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id)
|
void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id)
|
||||||
{
|
{
|
||||||
setPointId(ui->comboBoxP1Line, p1Line, value, id);
|
setPointId(ui->comboBoxP1Line, p1Line, value, id);
|
||||||
|
line->setLineP1Id(p1Line);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -241,6 +286,7 @@ void DialogShoulderPoint::setFormula(const QString &value)
|
||||||
this->DeployFormulaTextEdit();
|
this->DeployFormulaTextEdit();
|
||||||
}
|
}
|
||||||
ui->plainTextEditFormula->setPlainText(formula);
|
ui->plainTextEditFormula->setPlainText(formula);
|
||||||
|
line->setLength(formula);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -252,6 +298,7 @@ void DialogShoulderPoint::setTypeLine(const QString &value)
|
||||||
{
|
{
|
||||||
typeLine = value;
|
typeLine = value;
|
||||||
SetupTypeLine(ui->comboBoxLineType, value);
|
SetupTypeLine(ui->comboBoxLineType, value);
|
||||||
|
line->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -36,6 +36,8 @@ namespace Ui
|
||||||
class DialogShoulderPoint;
|
class DialogShoulderPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VisToolShoulderPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The DialogShoulderPoint class dialog for ToolShoulderPoint. Help create point and edit option.
|
* @brief The DialogShoulderPoint class dialog for ToolShoulderPoint. Help create point and edit option.
|
||||||
*/
|
*/
|
||||||
|
@ -79,6 +81,8 @@ public slots:
|
||||||
*/
|
*/
|
||||||
void FormulaTextChanged();
|
void FormulaTextChanged();
|
||||||
virtual void PointNameChanged();
|
virtual void PointNameChanged();
|
||||||
|
protected:
|
||||||
|
virtual void ShowVisualization();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(DialogShoulderPoint)
|
Q_DISABLE_COPY(DialogShoulderPoint)
|
||||||
|
|
||||||
|
@ -108,6 +112,8 @@ private:
|
||||||
|
|
||||||
/** @brief formulaBaseHeight base height defined by dialogui */
|
/** @brief formulaBaseHeight base height defined by dialogui */
|
||||||
int formulaBaseHeight;
|
int formulaBaseHeight;
|
||||||
|
VisToolShoulderPoint *line;
|
||||||
|
bool prepare;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SaveData Put dialog data in local variables
|
* @brief SaveData Put dialog data in local variables
|
||||||
|
|
|
@ -481,7 +481,7 @@ void MainWindow::ClosedDialogAlongLine(int result)
|
||||||
void MainWindow::ToolShoulderPoint(bool checked)
|
void MainWindow::ToolShoulderPoint(bool checked)
|
||||||
{
|
{
|
||||||
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
SetToolButtonWithApply<DialogShoulderPoint>(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png",
|
||||||
tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint,
|
tr("Select point of shoulder"), &MainWindow::ClosedDialogShoulderPoint,
|
||||||
&MainWindow::ApplyDialogShoulderPoint);
|
&MainWindow::ApplyDialogShoulderPoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ VisLine::VisLine(const VContainer *data, QGraphicsItem *parent)
|
||||||
mainColor(Qt::red), supportColor(Qt::magenta), lineStyle(Qt::SolidLine), point1Id(0), toolTip(QString())
|
mainColor(Qt::red), supportColor(Qt::magenta), lineStyle(Qt::SolidLine), point1Id(0), toolTip(QString())
|
||||||
{
|
{
|
||||||
this->setZValue(1);// Show on top real tool
|
this->setZValue(1);// Show on top real tool
|
||||||
|
this->setPen(QPen(mainColor, qApp->toPixel(qApp->widthHairLine())/factor, lineStyle));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -232,7 +233,6 @@ void VisLine::setScenePos(const QPointF &value)
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VisLine::VisualMode(const quint32 &pointId, const QPointF &scenePos)
|
void VisLine::VisualMode(const quint32 &pointId, const QPointF &scenePos)
|
||||||
{
|
{
|
||||||
this->mainColor = Qt::black;
|
|
||||||
this->point1Id = pointId;
|
this->point1Id = pointId;
|
||||||
this->scenePos = scenePos;
|
this->scenePos = scenePos;
|
||||||
RefreshGeometry();
|
RefreshGeometry();
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
void setLineStyle(const Qt::PenStyle &value);
|
void setLineStyle(const Qt::PenStyle &value);
|
||||||
virtual void RefreshGeometry()=0;
|
virtual void RefreshGeometry()=0;
|
||||||
void setScenePos(const QPointF &value);
|
void setScenePos(const QPointF &value);
|
||||||
virtual void VisualMode(const quint32 &pointId, const QPointF &scenePos);
|
void VisualMode(const quint32 &pointId, const QPointF &scenePos);
|
||||||
void setMainColor(const QColor &value);
|
void setMainColor(const QColor &value);
|
||||||
signals:
|
signals:
|
||||||
void ToolTip(const QString &toolTip);
|
void ToolTip(const QString &toolTip);
|
||||||
|
|
|
@ -76,16 +76,6 @@ void VisToolEndLine::RefreshGeometry()
|
||||||
"<b>Enter</b> - finish creation")).arg(this->line().angle());
|
"<b>Enter</b> - finish creation")).arg(this->line().angle());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
void VisToolEndLine::VisualMode(const quint32 &pointId, const QPointF &scenePos)
|
|
||||||
{
|
|
||||||
this->mainColor = Qt::black;
|
|
||||||
this->point1Id = pointId;
|
|
||||||
this->scenePos = scenePos;
|
|
||||||
RefreshGeometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
qreal VisToolEndLine::Angle() const
|
qreal VisToolEndLine::Angle() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,7 +41,6 @@ public:
|
||||||
virtual ~VisToolEndLine();
|
virtual ~VisToolEndLine();
|
||||||
|
|
||||||
virtual void RefreshGeometry();
|
virtual void RefreshGeometry();
|
||||||
void VisualMode(const quint32 &pointId, const QPointF &scenePos);
|
|
||||||
qreal Angle() const;
|
qreal Angle() const;
|
||||||
void setAngle(const qreal &value);
|
void setAngle(const qreal &value);
|
||||||
void setLength(const QString &expression);
|
void setLength(const QString &expression);
|
||||||
|
|
121
src/app/visualization/vistoolshoulderpoint.cpp
Normal file
121
src/app/visualization/vistoolshoulderpoint.cpp
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vistoolshoulderpoint.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 7, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#include "vistoolshoulderpoint.h"
|
||||||
|
#include "../tools/drawTools/vtoolshoulderpoint.h"
|
||||||
|
#include "../geometry/vpointf.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VisToolShoulderPoint::VisToolShoulderPoint(const VContainer *data, QGraphicsItem *parent)
|
||||||
|
:VisLine(data, parent), lineP1Id(0), lineP2Id(0), point(nullptr), line1P1(nullptr), line1P2(nullptr),
|
||||||
|
line1(nullptr), line2P2(nullptr), line2(nullptr), line3(nullptr), length(0)
|
||||||
|
{
|
||||||
|
line1P1 = InitPoint(supportColor);
|
||||||
|
line1P2 = InitPoint(supportColor);
|
||||||
|
line1 = InitLine(supportColor);
|
||||||
|
|
||||||
|
line2P2 = InitPoint(supportColor);
|
||||||
|
line2 = InitLine(supportColor);
|
||||||
|
line3 = InitLine(supportColor);
|
||||||
|
|
||||||
|
point = InitPoint(mainColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
VisToolShoulderPoint::~VisToolShoulderPoint()
|
||||||
|
{}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolShoulderPoint::RefreshGeometry()
|
||||||
|
{
|
||||||
|
if (point1Id > 0)
|
||||||
|
{
|
||||||
|
const VPointF *first = data->GeometricObject<const VPointF *>(point1Id);
|
||||||
|
DrawPoint(line1P1, first->toQPointF(), supportColor);
|
||||||
|
|
||||||
|
if (lineP1Id <= 0)
|
||||||
|
{
|
||||||
|
DrawLine(line1, QLineF(first->toQPointF(), scenePos), supportColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const VPointF *second = data->GeometricObject<const VPointF *>(lineP1Id);
|
||||||
|
DrawPoint(line1P2, second->toQPointF(), supportColor);
|
||||||
|
|
||||||
|
DrawLine(line1, QLineF(first->toQPointF(), second->toQPointF()), supportColor);
|
||||||
|
|
||||||
|
if (lineP2Id <= 0)
|
||||||
|
{
|
||||||
|
DrawLine(line2, QLineF(second->toQPointF(), scenePos), supportColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const VPointF *third = data->GeometricObject<const VPointF *>(lineP2Id);
|
||||||
|
DrawPoint(line2P2, third->toQPointF(), supportColor);
|
||||||
|
|
||||||
|
DrawLine(line2, QLineF(second->toQPointF(), third->toQPointF()), supportColor);
|
||||||
|
|
||||||
|
if (qFuzzyCompare(1 + length, 1 + 0) == false)
|
||||||
|
{
|
||||||
|
QPointF fPoint = VToolShoulderPoint::FindPoint(second->toQPointF(), third->toQPointF(),
|
||||||
|
first->toQPointF(), length);
|
||||||
|
QLineF mainLine = QLineF(second->toQPointF(), fPoint);
|
||||||
|
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||||
|
|
||||||
|
DrawPoint(point, mainLine.p2(), mainColor);
|
||||||
|
DrawLine(line3, QLineF(first->toQPointF(), mainLine.p2()), supportColor, Qt::DashLine);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qreal angle = QLineF(second->toQPointF(), third->toQPointF()).angle();
|
||||||
|
QPointF endRay = Ray(second->toQPointF(), angle);
|
||||||
|
QLineF mainLine = Line(second->toQPointF(), QLineF(second->toQPointF(), endRay).length(), angle);
|
||||||
|
DrawLine(this, mainLine, mainColor, lineStyle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolShoulderPoint::setLineP1Id(const quint32 &value)
|
||||||
|
{
|
||||||
|
lineP1Id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolShoulderPoint::setLineP2Id(const quint32 &value)
|
||||||
|
{
|
||||||
|
lineP2Id = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VisToolShoulderPoint::setLength(const QString &expression)
|
||||||
|
{
|
||||||
|
length = FindLength(expression);
|
||||||
|
}
|
59
src/app/visualization/vistoolshoulderpoint.h
Normal file
59
src/app/visualization/vistoolshoulderpoint.h
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file vistoolshoulderpoint.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 25 7, 2014
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentine project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2014 Valentina project
|
||||||
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
|
||||||
|
#ifndef VISTOOLSHOULDERPOINT_H
|
||||||
|
#define VISTOOLSHOULDERPOINT_H
|
||||||
|
|
||||||
|
#include "visline.h"
|
||||||
|
|
||||||
|
class VisToolShoulderPoint : public VisLine
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
VisToolShoulderPoint(const VContainer *data, QGraphicsItem *parent = 0);
|
||||||
|
virtual ~VisToolShoulderPoint();
|
||||||
|
|
||||||
|
virtual void RefreshGeometry();
|
||||||
|
void setLineP1Id(const quint32 &value);
|
||||||
|
void setLineP2Id(const quint32 &value);
|
||||||
|
void setLength(const QString &expression);
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(VisToolShoulderPoint)
|
||||||
|
quint32 lineP1Id;
|
||||||
|
quint32 lineP2Id;
|
||||||
|
QGraphicsEllipseItem *point;
|
||||||
|
QGraphicsEllipseItem *line1P1;
|
||||||
|
QGraphicsEllipseItem *line1P2;
|
||||||
|
QGraphicsLineItem *line1;
|
||||||
|
QGraphicsEllipseItem *line2P2;
|
||||||
|
QGraphicsLineItem *line2;
|
||||||
|
QGraphicsLineItem *line3;
|
||||||
|
qreal length;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VISTOOLSHOULDERPOINT_H
|
|
@ -7,7 +7,8 @@ HEADERS += \
|
||||||
visualization/vistoolline.h \
|
visualization/vistoolline.h \
|
||||||
visualization/vistoolendline.h \
|
visualization/vistoolendline.h \
|
||||||
visualization/vistoolalongline.h \
|
visualization/vistoolalongline.h \
|
||||||
visualization/vistoolbisector.h
|
visualization/vistoolbisector.h \
|
||||||
|
visualization/vistoolshoulderpoint.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
visualization/vgraphicssimpletextitem.cpp \
|
visualization/vgraphicssimpletextitem.cpp \
|
||||||
|
@ -18,4 +19,5 @@ SOURCES += \
|
||||||
visualization/vistoolline.cpp \
|
visualization/vistoolline.cpp \
|
||||||
visualization/vistoolendline.cpp \
|
visualization/vistoolendline.cpp \
|
||||||
visualization/vistoolalongline.cpp \
|
visualization/vistoolalongline.cpp \
|
||||||
visualization/vistoolbisector.cpp
|
visualization/vistoolbisector.cpp \
|
||||||
|
visualization/vistoolshoulderpoint.cpp
|
||||||
|
|
Loading…
Reference in New Issue
Block a user