Visualization for VToolPointOfIntersection.
--HG-- branch : develop
This commit is contained in:
parent
8d1b68d448
commit
16fa925021
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
#include "../../geometry/vpointf.h"
|
#include "../../geometry/vpointf.h"
|
||||||
#include "../../container/vcontainer.h"
|
#include "../../container/vcontainer.h"
|
||||||
|
#include "../../visualization/vistoolpointofintersection.h"
|
||||||
|
#include "../../widgets/vmaingraphicsscene.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +42,7 @@
|
||||||
*/
|
*/
|
||||||
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, const quint32 &toolId, QWidget *parent)
|
||||||
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
|
:DialogTool(data, toolId, parent), ui(new Ui::DialogPointOfIntersection), number(0), pointName(QString()),
|
||||||
firstPointId(0), secondPointId(0)
|
firstPointId(0), secondPointId(0), line(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
labelEditNamePoint = ui->labelEditNamePoint;
|
labelEditNamePoint = ui->labelEditNamePoint;
|
||||||
|
@ -57,11 +59,14 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, con
|
||||||
this, &DialogPointOfIntersection::PointNameChanged);
|
this, &DialogPointOfIntersection::PointNameChanged);
|
||||||
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
connect(ui->comboBoxSecondPoint, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentIndexChanged),
|
||||||
this, &DialogPointOfIntersection::PointNameChanged);
|
this, &DialogPointOfIntersection::PointNameChanged);
|
||||||
|
|
||||||
|
line = new VisToolPointOfIntersection(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DialogPointOfIntersection::~DialogPointOfIntersection()
|
DialogPointOfIntersection::~DialogPointOfIntersection()
|
||||||
{
|
{
|
||||||
|
delete line;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,6 +78,7 @@ DialogPointOfIntersection::~DialogPointOfIntersection()
|
||||||
void DialogPointOfIntersection::setSecondPointId(const quint32 &value)
|
void DialogPointOfIntersection::setSecondPointId(const quint32 &value)
|
||||||
{
|
{
|
||||||
setPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
setPointId(ui->comboBoxSecondPoint, secondPointId, value);
|
||||||
|
line->setPoint2Id(secondPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -93,6 +99,7 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
|
||||||
{ // -1 for not found
|
{ // -1 for not found
|
||||||
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
ui->comboBoxFirstPoint->setCurrentIndex(index);
|
||||||
number++;
|
number++;
|
||||||
|
line->VisualMode(id);
|
||||||
emit ToolTip(tr("Select point horizontally"));
|
emit ToolTip(tr("Select point horizontally"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +111,9 @@ void DialogPointOfIntersection::ChosenObject(quint32 id, const SceneObject &type
|
||||||
{ // -1 for not found
|
{ // -1 for not found
|
||||||
ui->comboBoxSecondPoint->setCurrentIndex(index);
|
ui->comboBoxSecondPoint->setCurrentIndex(index);
|
||||||
number = 0;
|
number = 0;
|
||||||
|
line->setPoint2Id(id);
|
||||||
|
line->RefreshGeometry();
|
||||||
|
prepare = true;
|
||||||
emit ToolTip("");
|
emit ToolTip("");
|
||||||
}
|
}
|
||||||
if (isInitialized == false)
|
if (isInitialized == false)
|
||||||
|
@ -121,6 +131,10 @@ void DialogPointOfIntersection::SaveData()
|
||||||
pointName = ui->lineEditNamePoint->text();
|
pointName = ui->lineEditNamePoint->text();
|
||||||
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
firstPointId = getCurrentObjectId(ui->comboBoxFirstPoint);
|
||||||
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
secondPointId = getCurrentObjectId(ui->comboBoxSecondPoint);
|
||||||
|
|
||||||
|
line->setPoint1Id(firstPointId);
|
||||||
|
line->setPoint2Id(secondPointId);
|
||||||
|
line->RefreshGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -151,6 +165,18 @@ void DialogPointOfIntersection::UpdateList()
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void DialogPointOfIntersection::ShowVisualization()
|
||||||
|
{
|
||||||
|
if (prepare == false)
|
||||||
|
{
|
||||||
|
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||||
|
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||||
|
scene->addItem(line);
|
||||||
|
line->RefreshGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* @brief setFirstPointId set id of first point
|
* @brief setFirstPointId set id of first point
|
||||||
|
@ -159,6 +185,7 @@ void DialogPointOfIntersection::UpdateList()
|
||||||
void DialogPointOfIntersection::setFirstPointId(const quint32 &value)
|
void DialogPointOfIntersection::setFirstPointId(const quint32 &value)
|
||||||
{
|
{
|
||||||
setPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
setPointId(ui->comboBoxFirstPoint, firstPointId, value);
|
||||||
|
line->setPoint1Id(firstPointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -36,6 +36,8 @@ namespace Ui
|
||||||
class DialogPointOfIntersection;
|
class DialogPointOfIntersection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VisToolPointOfIntersection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The DialogPointOfIntersection class dialog for ToolPointOfIntersection. Help create point and edit option.
|
* @brief The DialogPointOfIntersection class dialog for ToolPointOfIntersection. Help create point and edit option.
|
||||||
*/
|
*/
|
||||||
|
@ -59,6 +61,7 @@ public slots:
|
||||||
virtual void PointNameChanged();
|
virtual void PointNameChanged();
|
||||||
virtual void UpdateList();
|
virtual void UpdateList();
|
||||||
protected:
|
protected:
|
||||||
|
virtual void ShowVisualization();
|
||||||
/**
|
/**
|
||||||
* @brief SaveData Put dialog data in local variables
|
* @brief SaveData Put dialog data in local variables
|
||||||
*/
|
*/
|
||||||
|
@ -80,6 +83,7 @@ private:
|
||||||
|
|
||||||
/** @brief secondPointId id second point of line */
|
/** @brief secondPointId id second point of line */
|
||||||
quint32 secondPointId;
|
quint32 secondPointId;
|
||||||
|
VisToolPointOfIntersection *line;
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -591,9 +591,11 @@ void MainWindow::ToolTriangle(bool checked)
|
||||||
*/
|
*/
|
||||||
void MainWindow::ToolPointOfIntersection(bool checked)
|
void MainWindow::ToolPointOfIntersection(bool checked)
|
||||||
{
|
{
|
||||||
SetToolButton<DialogPointOfIntersection>(checked, Tool::PointOfIntersection,
|
SetToolButtonWithApply<DialogPointOfIntersection>(checked, Tool::PointOfIntersection,
|
||||||
":/cursor/pointofintersect_cursor.png", tr("Select point vertically"),
|
":/cursor/pointofintersect_cursor.png",
|
||||||
&MainWindow::ClosedDialog<VToolPointOfIntersection>);
|
tr("Select point vertically"),
|
||||||
|
&MainWindow::ClosedDialogWithApply<VToolPointOfIntersection>,
|
||||||
|
&MainWindow::ApplyDialog<VToolPointOfIntersection>);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -81,8 +81,9 @@ void VToolPointOfIntersection::setDialog()
|
||||||
* @param scene pointer to scene.
|
* @param scene pointer to scene.
|
||||||
* @param doc dom document container.
|
* @param doc dom document container.
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
VToolPointOfIntersection *VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
VContainer *data)
|
VContainer *data)
|
||||||
{
|
{
|
||||||
SCASSERT(dialog != nullptr);
|
SCASSERT(dialog != nullptr);
|
||||||
|
@ -91,7 +92,14 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc
|
||||||
const quint32 firstPointId = dialogTool->getFirstPointId();
|
const quint32 firstPointId = dialogTool->getFirstPointId();
|
||||||
const quint32 secondPointId = dialogTool->getSecondPointId();
|
const quint32 secondPointId = dialogTool->getSecondPointId();
|
||||||
const QString pointName = dialogTool->getPointName();
|
const QString pointName = dialogTool->getPointName();
|
||||||
Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Source::FromGui);
|
VToolPointOfIntersection *point = nullptr;
|
||||||
|
point = Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse,
|
||||||
|
Source::FromGui);
|
||||||
|
if (point != nullptr)
|
||||||
|
{
|
||||||
|
point->dialog=dialogTool;
|
||||||
|
}
|
||||||
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -108,11 +116,13 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
|
VToolPointOfIntersection *VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName,
|
||||||
const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
const quint32 &firstPointId, const quint32 &secondPointId,
|
||||||
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
||||||
const Document &parse, const Source &typeCreation)
|
VPattern *doc, VContainer *data, const Document &parse,
|
||||||
|
const Source &typeCreation)
|
||||||
{
|
{
|
||||||
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
const VPointF *firstPoint = data->GeometricObject<const VPointF *>(firstPointId);
|
||||||
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
const VPointF *secondPoint = data->GeometricObject<const VPointF *>(secondPointId);
|
||||||
|
@ -143,7 +153,9 @@ void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointNam
|
||||||
doc->AddTool(id, point);
|
doc->AddTool(id, point);
|
||||||
doc->IncrementReferens(firstPointId);
|
doc->IncrementReferens(firstPointId);
|
||||||
doc->IncrementReferens(secondPointId);
|
doc->IncrementReferens(secondPointId);
|
||||||
|
return point;
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -42,11 +42,12 @@ public:
|
||||||
const quint32 &secondPointId, const Source &typeCreation,
|
const quint32 &secondPointId, const Source &typeCreation,
|
||||||
QGraphicsItem * parent = nullptr);
|
QGraphicsItem * parent = nullptr);
|
||||||
virtual void setDialog();
|
virtual void setDialog();
|
||||||
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data);
|
static VToolPointOfIntersection *Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
static void Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
|
VContainer *data);
|
||||||
const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene,
|
static VToolPointOfIntersection *Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId,
|
||||||
VPattern *doc, VContainer *data, const Document &parse,
|
const quint32 &secondPointId, const qreal &mx, const qreal &my,
|
||||||
const Source &typeCreation);
|
VMainGraphicsScene *scene, VPattern *doc, VContainer *data,
|
||||||
|
const Document &parse, const Source &typeCreation);
|
||||||
static const QString ToolType;
|
static const QString ToolType;
|
||||||
public slots:
|
public slots:
|
||||||
virtual void FullUpdateFromFile();
|
virtual void FullUpdateFromFile();
|
||||||
|
|
|
@ -125,6 +125,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li
|
||||||
* @param scene pointer to scene.
|
* @param scene pointer to scene.
|
||||||
* @param doc dom document container.
|
* @param doc dom document container.
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc,
|
||||||
VContainer *data)
|
VContainer *data)
|
||||||
|
@ -165,6 +166,7 @@ VToolShoulderPoint* VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphics
|
||||||
* @param data container with variables.
|
* @param data container with variables.
|
||||||
* @param parse parser file mode.
|
* @param parse parser file mode.
|
||||||
* @param typeCreation way we create this tool.
|
* @param typeCreation way we create this tool.
|
||||||
|
* @return the created tool
|
||||||
*/
|
*/
|
||||||
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
|
VToolShoulderPoint* VToolShoulderPoint::Create(const quint32 _id, QString &formula, const quint32 &p1Line,
|
||||||
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
|
const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine,
|
||||||
|
|
|
@ -59,7 +59,6 @@ void VisToolPointOfIntersection::RefreshGeometry()
|
||||||
QLineF axisL2;
|
QLineF axisL2;
|
||||||
if (point2Id <= 0)
|
if (point2Id <= 0)
|
||||||
{
|
{
|
||||||
DrawPoint(axisP2, scenePos, supportColor);
|
|
||||||
axisL2 = Axis(scenePos, 180);
|
axisL2 = Axis(scenePos, 180);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -67,9 +66,9 @@ void VisToolPointOfIntersection::RefreshGeometry()
|
||||||
const VPointF *second = data->GeometricObject<const VPointF *>(point2Id);
|
const VPointF *second = data->GeometricObject<const VPointF *>(point2Id);
|
||||||
DrawPoint(axisP2, second->toQPointF(), supportColor);
|
DrawPoint(axisP2, second->toQPointF(), supportColor);
|
||||||
axisL2 = Axis(second->toQPointF(), 180);
|
axisL2 = Axis(second->toQPointF(), 180);
|
||||||
|
ShowIntersection(axisL1, axisL2);
|
||||||
}
|
}
|
||||||
DrawLine(axis2, axisL2, supportColor, Qt::DashLine);
|
DrawLine(axis2, axisL2, supportColor, Qt::DashLine);
|
||||||
ShowIntersection(axisL1, axisL2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +98,6 @@ void VisToolPointOfIntersection::ShowIntersection(const QLineF &axis1, const QLi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
point->setVisible(true);
|
point->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user