Show tool visualization when selected.
--HG-- branch : feature
This commit is contained in:
parent
f59009c5fc
commit
6fb280663a
|
@ -31,6 +31,7 @@
|
|||
#include "../../dialogs/tools/dialogalongline.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "exception/vexceptionobjecterror.h"
|
||||
#include "../../visualization/vistoolalongline.h"
|
||||
|
||||
const QString VToolAlongLine::ToolType = QStringLiteral("alongLine");
|
||||
|
||||
|
@ -79,6 +80,16 @@ void VToolAlongLine::FullUpdateFromFile()
|
|||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolAlongLine * visual = qobject_cast<VisToolAlongLine *>(vis);
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -175,6 +186,41 @@ void VToolAlongLine::setSecondPointId(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolAlongLine::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolAlongLine *visual = new VisToolAlongLine(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolAlongLine * visual = qobject_cast<VisToolAlongLine *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief setDialog set dialog when user want change tool option.
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void SetFactor(qreal factor);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "../../dialogs/tools/dialogarc.h"
|
||||
#include "../../geometry/varc.h"
|
||||
#include "../container/vformula.h"
|
||||
#include "../../visualization/vistoolarc.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
|
@ -271,12 +272,40 @@ void VToolArc::setFormulaF2(const VFormula &value)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
*/
|
||||
void VToolArc::FullUpdateFromFile()
|
||||
void VToolArc::ShowVisualization(bool show)
|
||||
{
|
||||
RefreshGeometry();
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolArc * visual = new VisToolArc(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
|
||||
visual->setPoint1Id(arc->GetCenter().id());
|
||||
visual->setRadius(arc->GetFormulaRadius());
|
||||
visual->setF1(arc->GetFormulaF1());
|
||||
visual->setF2(arc->GetFormulaF2());
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -336,4 +365,16 @@ void VToolArc::RefreshGeometry()
|
|||
{
|
||||
this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor));
|
||||
this->setPath(ToolPath());
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
const QSharedPointer<VArc> arc = VAbstractTool::data.GeometricObject<VArc>(id);
|
||||
VisToolArc *visual = qobject_cast<VisToolArc *>(vis);
|
||||
|
||||
visual->setPoint1Id(arc->GetCenter().id());
|
||||
visual->setRadius(arc->GetFormulaRadius());
|
||||
visual->setF1(arc->GetFormulaF1());
|
||||
visual->setF2(arc->GetFormulaF2());
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ public:
|
|||
|
||||
VFormula getFormulaF2() const;
|
||||
void setFormulaF2(const VFormula &value);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
protected:
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
||||
virtual void RemoveReferens();
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../../container/calculator.h"
|
||||
#include "../../dialogs/tools/dialogbisector.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistoolbisector.h"
|
||||
|
||||
const QString VToolBisector::ToolType = QStringLiteral("bisector");
|
||||
|
||||
|
@ -230,6 +231,17 @@ void VToolBisector::FullUpdateFromFile()
|
|||
thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt();
|
||||
}
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis);
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(basePointId);
|
||||
visual->setPoint3Id(thirdPointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -328,6 +340,42 @@ void VToolBisector::setThirdPointId(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolBisector::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolBisector * visual = new VisToolBisector(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(basePointId);
|
||||
visual->setPoint3Id(thirdPointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolBisector *visual = qobject_cast<VisToolBisector *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolBisector::getFirstPointId() const
|
||||
{
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
quint32 getThirdPointId() const;
|
||||
void setThirdPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void SetFactor(qreal factor);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "../../dialogs/tools/dialogcutarc.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../geometry/varc.h"
|
||||
#include "../../visualization/vistoolcutarc.h"
|
||||
|
||||
const QString VToolCutArc::ToolType = QStringLiteral("cutArc");
|
||||
const QString VToolCutArc::AttrArc = QStringLiteral("arc");
|
||||
|
@ -180,6 +181,39 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutArc::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolCutArc * visual = new VisToolCutArc(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(curveCutId);
|
||||
visual->setLength(formula);
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
@ -187,6 +221,14 @@ VToolCutArc* VToolCutArc::Create(const quint32 _id, const QString &pointName, QS
|
|||
void VToolCutArc::FullUpdateFromFile()
|
||||
{
|
||||
FullUpdateCurveFromFile(AttrArc);
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolCutArc *visual = qobject_cast<VisToolCutArc *>(vis);
|
||||
visual->setPoint1Id(curveCutId);
|
||||
visual->setLength(formula);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
static const QString AttrArc;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::CutArc)};
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void CurveChoosed(quint32 id);
|
||||
|
|
|
@ -187,6 +187,38 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSpline::ShowVisualization(bool show)
|
||||
{
|
||||
// if (show)
|
||||
// {
|
||||
// if (vis == nullptr)
|
||||
// {
|
||||
// VisTool * visual = new VisTool(getData());
|
||||
// VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
// connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
// scene->addItem(visual);
|
||||
|
||||
// // add options
|
||||
// visual->RefreshGeometry();
|
||||
// vis = visual;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// VisTool * visual = qobject_cast<VisTool *>(vis);
|
||||
// if (visual != nullptr)
|
||||
// {
|
||||
// visual->show();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// delete vis;
|
||||
// vis = nullptr;
|
||||
// }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
static const QString AttrSpline;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::CutSpline)};
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void CurveChoosed(quint32 id);
|
||||
|
|
|
@ -242,6 +242,38 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolCutSplinePath::ShowVisualization(bool show)
|
||||
{
|
||||
// if (show)
|
||||
// {
|
||||
// if (vis == nullptr)
|
||||
// {
|
||||
// VisTool * visual = new VisTool(getData());
|
||||
// VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
// connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
// scene->addItem(visual);
|
||||
|
||||
// // add options
|
||||
// visual->RefreshGeometry();
|
||||
// vis = visual;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// VisTool * visual = qobject_cast<VisTool *>(vis);
|
||||
// if (visual != nullptr)
|
||||
// {
|
||||
// visual->show();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// delete vis;
|
||||
// vis = nullptr;
|
||||
// }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
static const QString AttrSplinePath;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::CutSplinePath)};
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void CurveChoosed(quint32 id);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "../../dialogs/tools/dialogendline.h"
|
||||
#include "../../dialogs/tools/dialogeditwrongformula.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "./../visualization/vistoolendline.h"
|
||||
|
||||
const QString VToolEndLine::ToolType = QStringLiteral("endLine");
|
||||
|
||||
|
@ -185,6 +186,16 @@ void VToolEndLine::FullUpdateFromFile()
|
|||
formulaAngle = domElement.attribute(AttrAngle, "");
|
||||
}
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setAngle(formulaAngle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -262,3 +273,38 @@ void VToolEndLine::setFormulaAngle(const VFormula &value)
|
|||
SaveOption(obj);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolEndLine::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolEndLine * visual = new VisToolEndLine(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setAngle(formulaAngle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolEndLine *visual = qobject_cast<VisToolEndLine *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
|
||||
VFormula getFormulaAngle() const;
|
||||
void setFormulaAngle(const VFormula &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "vtoolheight.h"
|
||||
#include "../../dialogs/tools/dialogheight.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistoolheight.h"
|
||||
|
||||
const QString VToolHeight::ToolType = QStringLiteral("height");
|
||||
|
||||
|
@ -202,6 +203,15 @@ void VToolHeight::FullUpdateFromFile()
|
|||
}
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis);
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setLineP1Id(p1LineId);
|
||||
visual->setLineP2Id(p2LineId);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -276,6 +286,41 @@ void VToolHeight::setP2LineId(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolHeight::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolHeight * visual = new VisToolHeight(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setLineP1Id(p1LineId);
|
||||
visual->setLineP2Id(p2LineId);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolHeight *visual = qobject_cast<VisToolHeight *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolHeight::getP1LineId() const
|
||||
{
|
||||
|
|
|
@ -59,6 +59,7 @@ public:
|
|||
quint32 getP2LineId() const;
|
||||
void setP2LineId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <QKeyEvent>
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../dialogs/tools/dialogline.h"
|
||||
#include "../../visualization/vistoolline.h"
|
||||
|
||||
const QString VToolLine::TagName = QStringLiteral("line");
|
||||
|
||||
|
@ -189,6 +190,15 @@ QString VToolLine::getTagName() const
|
|||
void VToolLine::FullUpdateFromFile()
|
||||
{
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
|
||||
visual->setPoint1Id(firstPoint);
|
||||
visual->setPoint2Id(secondPoint);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -401,6 +411,40 @@ void VToolLine::setSecondPoint(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLine::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolLine * visual = new VisToolLine(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(firstPoint);
|
||||
visual->setPoint2Id(secondPoint);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLine::getFirstPoint() const
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
quint32 getSecondPoint() const;
|
||||
void setSecondPoint(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "vtoollineintersect.h"
|
||||
#include "../../dialogs/tools/dialoglineintersect.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistoollineintersect.h"
|
||||
|
||||
const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect");
|
||||
|
||||
|
@ -201,6 +202,16 @@ void VToolLineIntersect::FullUpdateFromFile()
|
|||
p2Line2 = domElement.attribute(AttrP2Line2, "").toUInt();
|
||||
}
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis);
|
||||
visual->setPoint1Id(p1Line1);
|
||||
visual->setLine1P2Id(p2Line1);
|
||||
visual->setLine2P1Id(p1Line2);
|
||||
visual->setLine2P2Id(p2Line2);
|
||||
vis->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -298,6 +309,41 @@ void VToolLineIntersect::setP2Line2(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolLineIntersect::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolLineIntersect * visual = new VisToolLineIntersect(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(p1Line1);
|
||||
visual->setLine1P2Id(p2Line1);
|
||||
visual->setLine2P1Id(p1Line2);
|
||||
visual->setLine2P2Id(p2Line2);
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolLineIntersect *visual = qobject_cast<VisToolLineIntersect *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolLineIntersect::getP1Line2() const
|
||||
{
|
||||
|
|
|
@ -63,6 +63,7 @@ public:
|
|||
quint32 getP2Line2() const;
|
||||
void setP2Line2(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void SetFactor(qreal factor);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../../container/calculator.h"
|
||||
#include "../../dialogs/tools/dialognormal.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistoolnormal.h"
|
||||
|
||||
const QString VToolNormal::ToolType = QStringLiteral("normal");
|
||||
|
||||
|
@ -209,6 +210,17 @@ void VToolNormal::FullUpdateFromFile()
|
|||
angle = domElement.attribute(AttrAngle, "").toDouble();
|
||||
}
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis);
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setAngle(angle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -306,3 +318,39 @@ void VToolNormal::setSecondPointId(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolNormal::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolNormal * visual = new VisToolNormal(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(basePointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setAngle(angle);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolNormal *visual = qobject_cast<VisToolNormal *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,6 +56,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void SetFactor(qreal factor);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "../../dialogs/tools/dialogpointofcontact.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../container/vformula.h"
|
||||
#include "../../visualization/vistoolpointofcontact.h"
|
||||
|
||||
const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact");
|
||||
|
||||
|
@ -228,6 +229,16 @@ void VToolPointOfContact::FullUpdateFromFile()
|
|||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(id));
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis);
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setLineP2Id(secondPointId);
|
||||
visual->setRadiusId(center);
|
||||
visual->setRadius(arcRadius);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -318,6 +329,41 @@ void VToolPointOfContact::setSecondPointId(const quint32 &value)
|
|||
secondPointId = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfContact::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolPointOfContact * visual = new VisToolPointOfContact(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setLineP2Id(secondPointId);
|
||||
visual->setRadiusId(center);
|
||||
visual->setRadius(arcRadius);
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolPointOfContact *visual = qobject_cast<VisToolPointOfContact *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolPointOfContact::getFirstPointId() const
|
||||
{
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void SetFactor(qreal factor);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "vtoolpointofintersection.h"
|
||||
#include "../../dialogs/tools/dialogpointofintersection.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistoolpointofintersection.h"
|
||||
|
||||
const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection");
|
||||
|
||||
|
@ -171,6 +172,14 @@ void VToolPointOfIntersection::FullUpdateFromFile()
|
|||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -251,6 +260,39 @@ void VToolPointOfIntersection::setSecondPointId(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolPointOfIntersection::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolPointOfIntersection * visual = new VisToolPointOfIntersection(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(firstPointId);
|
||||
visual->setPoint2Id(secondPointId);
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolPointOfIntersection *visual = qobject_cast<VisToolPointOfIntersection *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolPointOfIntersection::getFirstPointId() const
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../../container/calculator.h"
|
||||
#include "../../dialogs/tools/dialogshoulderpoint.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistoolshoulderpoint.h"
|
||||
|
||||
const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder");
|
||||
|
||||
|
@ -234,6 +235,17 @@ void VToolShoulderPoint::FullUpdateFromFile()
|
|||
pShoulder = domElement.attribute(AttrPShoulder, "").toUInt();
|
||||
}
|
||||
RefreshGeometry();
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||
visual->setPoint1Id(pShoulder);
|
||||
visual->setLineP1Id(basePointId);
|
||||
visual->setLineP2Id(p2Line);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -332,6 +344,42 @@ void VToolShoulderPoint::setPShoulder(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolShoulderPoint::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolShoulderPoint * visual = new VisToolShoulderPoint(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(pShoulder);
|
||||
visual->setLineP1Id(basePointId);
|
||||
visual->setLineP2Id(p2Line);
|
||||
visual->setLength(formulaLength);
|
||||
visual->setLineStyle(VAbstractTool::LineStyle(typeLine));
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolShoulderPoint *visual = qobject_cast<VisToolShoulderPoint *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolShoulderPoint::getP2Line() const
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
quint32 getPShoulder() const;
|
||||
void setPShoulder(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void SetFactor(qreal factor);
|
||||
|
|
|
@ -82,6 +82,12 @@ void VToolSinglePoint::setDialog()
|
|||
dialogTool->setData(p->name(), p->toQPointF());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSinglePoint::ShowVisualization(bool show)
|
||||
{
|
||||
Q_UNUSED(show); //don't have any visualization for base point yet
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief AddToFile add tag with informations about tool into file.
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
static const QString ToolType;
|
||||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::SinglePoint)};
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ChangedActivDraw(const QString &newName);
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "../../geometry/vspline.h"
|
||||
#include "../../dialogs/tools/dialogspline.h"
|
||||
#include "../../undocommands/movespline.h"
|
||||
#include "../../visualization/vistoolspline.h"
|
||||
|
||||
const QString VToolSpline::ToolType = QStringLiteral("simple");
|
||||
|
||||
|
@ -204,6 +205,45 @@ void VToolSpline::setSpline(const VSpline &spl)
|
|||
SaveOption(obj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSpline::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolSpline *visual = new VisToolSpline(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
visual->setPoint1Id(spl->GetP1().id());
|
||||
visual->setPoint4Id(spl->GetP4().id());
|
||||
visual->setAngle1(spl->GetAngle1());
|
||||
visual->setAngle2(spl->GetAngle2());
|
||||
visual->setKAsm1(spl->GetKasm1());
|
||||
visual->setKAsm2(spl->GetKasm2());
|
||||
visual->setKCurve(spl->GetKcurve());
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolSpline *visual = qobject_cast<VisToolSpline *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ControlPointChangePosition handle change position control point.
|
||||
|
@ -336,4 +376,17 @@ void VToolSpline::RefreshGeometry()
|
|||
|
||||
controlPoints[0]->blockSignals(false);
|
||||
controlPoints[1]->blockSignals(false);
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolSpline *visual = qobject_cast<VisToolSpline *>(vis);
|
||||
visual->setPoint1Id(spl->GetP1().id());
|
||||
visual->setPoint4Id(spl->GetP4().id());
|
||||
visual->setAngle1(spl->GetAngle1());
|
||||
visual->setAngle2(spl->GetAngle2());
|
||||
visual->setKAsm1(spl->GetKasm1());
|
||||
visual->setKAsm2(spl->GetKasm2());
|
||||
visual->setKCurve(spl->GetKcurve());
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ public:
|
|||
|
||||
VSpline getSpline()const;
|
||||
void setSpline(const VSpline &spl);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
|
||||
const QPointF &pos);
|
||||
|
|
|
@ -280,6 +280,38 @@ void VToolSplinePath::setSplinePath(const VSplinePath &splPath)
|
|||
SaveOption(obj);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSplinePath::ShowVisualization(bool show)
|
||||
{
|
||||
// if (show)
|
||||
// {
|
||||
// if (vis == nullptr)
|
||||
// {
|
||||
// VisTool * visual = new VisTool(getData());
|
||||
// VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
// connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
// scene->addItem(visual);
|
||||
|
||||
// // add options
|
||||
// visual->RefreshGeometry();
|
||||
// vis = visual;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// VisTool * visual = qobject_cast<VisTool *>(vis);
|
||||
// if (visual != nullptr)
|
||||
// {
|
||||
// visual->show();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// delete vis;
|
||||
// vis = nullptr;
|
||||
// }
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief contextMenuEvent handle context menu events.
|
||||
|
|
|
@ -51,6 +51,8 @@ public:
|
|||
|
||||
VSplinePath getSplinePath()const;
|
||||
void setSplinePath(const VSplinePath &splPath);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
signals:
|
||||
/**
|
||||
* @brief RefreshLine refresh control line.
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "vtooltriangle.h"
|
||||
#include "../../dialogs/tools/dialogtriangle.h"
|
||||
#include "../../geometry/vpointf.h"
|
||||
#include "../../visualization/vistooltriangle.h"
|
||||
|
||||
#include <QtMath>
|
||||
|
||||
|
@ -229,6 +230,16 @@ void VToolTriangle::FullUpdateFromFile()
|
|||
secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt();
|
||||
}
|
||||
VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject<VPointF>(id));
|
||||
|
||||
if (vis != nullptr)
|
||||
{
|
||||
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis);
|
||||
visual->setPoint1Id(axisP1Id);
|
||||
visual->setPoint2Id(axisP2Id);
|
||||
visual->setHypotenuseP1Id(firstPointId);
|
||||
visual->setHypotenuseP2Id(secondPointId);
|
||||
visual->RefreshGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -315,6 +326,41 @@ void VToolTriangle::setSecondPointId(const quint32 &value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolTriangle::ShowVisualization(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
if (vis == nullptr)
|
||||
{
|
||||
VisToolTriangle * visual = new VisToolTriangle(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
visual->setPoint1Id(axisP1Id);
|
||||
visual->setPoint2Id(axisP2Id);
|
||||
visual->setHypotenuseP1Id(firstPointId);
|
||||
visual->setHypotenuseP2Id(secondPointId);
|
||||
visual->RefreshGeometry();
|
||||
vis = visual;
|
||||
}
|
||||
else
|
||||
{
|
||||
VisToolTriangle * visual = qobject_cast<VisToolTriangle *>(vis);
|
||||
if (visual != nullptr)
|
||||
{
|
||||
visual->show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete vis;
|
||||
vis = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 VToolTriangle::getFirstPointId() const
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
quint32 getSecondPointId() const;
|
||||
void setSecondPointId(const quint32 &value);
|
||||
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile();
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
|
|
|
@ -69,6 +69,12 @@ void VAbstractNode::RestoreNode()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractNode::ShowVisualization(bool show)
|
||||
{
|
||||
Q_UNUSED(show)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief AddToModeling add tag to modeling tag current pattern peace.
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
static const QString AttrIdTool;
|
||||
virtual void DeleteNode();
|
||||
virtual void RestoreNode();
|
||||
virtual void ShowVisualization(bool show);
|
||||
protected:
|
||||
/** @brief idNodenode id. */
|
||||
quint32 idNode;
|
||||
|
|
|
@ -84,7 +84,8 @@ const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDot
|
|||
* @param parent parent object.
|
||||
*/
|
||||
VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent)
|
||||
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine)
|
||||
:VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine),
|
||||
vis(nullptr)
|
||||
{
|
||||
SCASSERT(doc != nullptr);
|
||||
connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange);
|
||||
|
@ -92,6 +93,12 @@ VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObjec
|
|||
connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VPattern::LiteParseTree);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractTool::~VAbstractTool()
|
||||
{
|
||||
delete vis;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view.
|
||||
|
|
|
@ -39,6 +39,7 @@ class QGraphicsScene;
|
|||
class QGraphicsView;
|
||||
class QGraphicsItem;
|
||||
class QRectF;
|
||||
class Visualization;
|
||||
|
||||
/**
|
||||
* @brief The VAbstractTool abstract class for all tools.
|
||||
|
@ -48,7 +49,7 @@ class VAbstractTool: public VDataTool
|
|||
Q_OBJECT
|
||||
public:
|
||||
VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr);
|
||||
virtual ~VAbstractTool(){}
|
||||
virtual ~VAbstractTool();
|
||||
static void NewSceneRect(QGraphicsScene *sc, QGraphicsView *view);
|
||||
static QPointF LineIntersectRect(QRectF rec, QLineF line);
|
||||
static qint32 LineIntersectCircle(const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1,
|
||||
|
@ -105,7 +106,7 @@ public:
|
|||
void setTypeLine(const QString &value);
|
||||
QMap<QString, quint32> PointsList() const;
|
||||
virtual QString getTagName() const =0;
|
||||
|
||||
virtual void ShowVisualization(bool show) =0;
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
@ -142,6 +143,8 @@ protected:
|
|||
/** @brief typeLine line type. */
|
||||
QString typeLine;
|
||||
|
||||
Visualization *vis;
|
||||
|
||||
/**
|
||||
* @brief AddToFile add tag with informations about tool into file.
|
||||
*/
|
||||
|
|
|
@ -487,6 +487,12 @@ QString VToolDetail::getTagName() const
|
|||
return VToolDetail::TagName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolDetail::ShowVisualization(bool show)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief RefreshGeometry refresh item on scene.
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
virtual int type() const {return Type;}
|
||||
enum { Type = UserType + static_cast<int>(Tool::Detail)};
|
||||
virtual QString getTagName() const;
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
virtual void FullUpdateFromFile ();
|
||||
virtual void FullUpdateFromGuiOk(int result);
|
||||
|
|
|
@ -441,6 +441,12 @@ QString VToolUnionDetails::getTagName() const
|
|||
return VToolUnionDetails::TagName;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolUnionDetails::ShowVisualization(bool show)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Create help create tool from GUI.
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate,
|
||||
const qreal &angle);
|
||||
virtual QString getTagName() const;
|
||||
virtual void ShowVisualization(bool show);
|
||||
public slots:
|
||||
/**
|
||||
* @brief FullUpdateFromFile update tool data form file.
|
||||
|
|
|
@ -308,10 +308,16 @@ void VToolOptionsPropertyBrowser::itemClicked(QGraphicsItem *item)
|
|||
propertyToId.clear();
|
||||
idToProperty.clear();
|
||||
|
||||
currentItem = item;
|
||||
VAbstractTool *previousTool = dynamic_cast<VAbstractTool *>(currentItem);
|
||||
if (previousTool != nullptr)
|
||||
{
|
||||
previousTool->ShowVisualization(false); // hide for previous tool
|
||||
}
|
||||
|
||||
currentItem = item;
|
||||
if (currentItem == nullptr)
|
||||
{
|
||||
formView->setTitle("");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -835,6 +841,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolTriangle(VProperty *property)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item)
|
||||
{
|
||||
VToolSinglePoint *i = qgraphicsitem_cast<VToolSinglePoint *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Base point"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -848,6 +855,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolEndLine(QGraphicsItem *item)
|
||||
{
|
||||
VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Point at distance and angle"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -860,6 +868,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolEndLine(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolAlongLine(QGraphicsItem *item)
|
||||
{
|
||||
VToolAlongLine *i = qgraphicsitem_cast<VToolAlongLine *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Point at distance along line"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -871,6 +880,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolAlongLine(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
|
||||
{
|
||||
VToolArc *i = qgraphicsitem_cast<VToolArc *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Arc"));
|
||||
|
||||
AddPropertyFormula(tr("Radius"), i->getFormulaRadius(), VAbstractTool::AttrRadius);
|
||||
|
@ -882,6 +892,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolArc(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolBisector(QGraphicsItem *item)
|
||||
{
|
||||
VToolBisector *i = qgraphicsitem_cast<VToolBisector *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Point along bisector"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -893,6 +904,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolBisector(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolCutArc(QGraphicsItem *item)
|
||||
{
|
||||
VToolCutArc *i = qgraphicsitem_cast<VToolCutArc *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Cut arc tool"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -903,6 +915,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutArc(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolCutSpline(QGraphicsItem *item)
|
||||
{
|
||||
VToolCutSpline *i = qgraphicsitem_cast<VToolCutSpline *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool for segmenting a curve"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -913,6 +926,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSpline(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolCutSplinePath(QGraphicsItem *item)
|
||||
{
|
||||
VToolCutSplinePath *i = qgraphicsitem_cast<VToolCutSplinePath *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool segment a pathed curve"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -923,6 +937,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCutSplinePath(QGraphicsItem *it
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolHeight(QGraphicsItem *item)
|
||||
{
|
||||
VToolHeight *i = qgraphicsitem_cast<VToolHeight *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Perpendicular point along line"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -933,6 +948,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolHeight(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolLine(QGraphicsItem *item)
|
||||
{
|
||||
VToolLine *i = qgraphicsitem_cast<VToolLine *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Line between points"));
|
||||
|
||||
AddPropertyLineType(i, tr("Line type"));
|
||||
|
@ -942,6 +958,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLine(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolLineIntersect(QGraphicsItem *item)
|
||||
{
|
||||
VToolLineIntersect *i = qgraphicsitem_cast<VToolLineIntersect *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Point at line intersection"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -951,6 +968,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolLineIntersect(QGraphicsItem *it
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item)
|
||||
{
|
||||
VToolNormal *i = qgraphicsitem_cast<VToolNormal *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Point along perpendicular"));
|
||||
|
||||
AddPropertyFormula(tr("Length"), i->getFormulaLength(), VAbstractTool::AttrLength);
|
||||
|
@ -969,6 +987,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfContact(QGraphicsItem *item)
|
||||
{
|
||||
VToolPointOfContact *i = qgraphicsitem_cast<VToolPointOfContact *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Point at intersection of arc and line"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -979,6 +998,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfContact(QGraphicsItem *i
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersection(QGraphicsItem *item)
|
||||
{
|
||||
VToolPointOfIntersection *i = qgraphicsitem_cast<VToolPointOfIntersection *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool to make point from x & y of two other points"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -988,6 +1008,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolPointOfIntersection(QGraphicsIt
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *item)
|
||||
{
|
||||
VToolShoulderPoint *i = qgraphicsitem_cast<VToolShoulderPoint *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Special point on shoulder"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
@ -999,6 +1020,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolShoulderPoint(QGraphicsItem *it
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
||||
{
|
||||
VToolSpline *i = qgraphicsitem_cast<VToolSpline *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Curve tool"));
|
||||
|
||||
VDoubleProperty* itemFactor = new VDoubleProperty(tr("Curve factor"));
|
||||
|
@ -1015,6 +1037,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSpline(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item)
|
||||
{
|
||||
VToolSplinePath *i = qgraphicsitem_cast<VToolSplinePath *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool for path curve"));
|
||||
|
||||
VDoubleProperty* itemFactor = new VDoubleProperty(tr("Curve factor"));
|
||||
|
@ -1031,6 +1054,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSplinePath(QGraphicsItem *item)
|
|||
void VToolOptionsPropertyBrowser::ShowOptionsToolTriangle(QGraphicsItem *item)
|
||||
{
|
||||
VToolTriangle *i = qgraphicsitem_cast<VToolTriangle *>(item);
|
||||
i->ShowVisualization(true);
|
||||
formView->setTitle(tr("Tool triangle"));
|
||||
|
||||
AddPropertyPointName(i, tr("Point label"));
|
||||
|
|
Loading…
Reference in New Issue
Block a user