55 #include <QMessageLogger>
56 #include <QSharedPointer>
57 #include <QStaticStringData>
58 #include <QStringData>
59 #include <QStringDataPtr>
63 #include "../../../../dialogs/tools/dialogpointofcontact.h"
64 #include "../../../../dialogs/tools/dialogtool.h"
65 #include "../../../../visualization/visualization.h"
66 #include "../../../../visualization/line/vistoolpointofcontact.h"
67 #include "../ifc/exception/vexception.h"
68 #include "../ifc/xml/vdomdocument.h"
69 #include "../ifc/ifcdef.h"
70 #include "../vgeometry/vgobject.h"
71 #include "../vgeometry/vpointf.h"
72 #include "../vmisc/vabstractapplication.h"
73 #include "../vmisc/vcommonsettings.h"
74 #include "../vpatterndb/vcontainer.h"
75 #include "../vpatterndb/vformula.h"
76 #include "../vpatterndb/vtranslatevars.h"
77 #include "../vwidgets/vmaingraphicsscene.h"
78 #include "../../../vabstracttool.h"
79 #include "../../vdrawtool.h"
100 const QString &radius,
const quint32 ¢er,
101 const quint32 &firstPointId,
const quint32 &secondPointId,
102 const Source &typeCreation, QGraphicsItem *parent)
106 , firstPointId(firstPointId)
107 , secondPointId(secondPointId)
123 dialogTool->setCenter(
center);
126 dialogTool->SetPointName(p->name());
139 const QPointF &secondPoint)
153 if ((flagP1 ==
true && flagP2 ==
true) ||
154 (flagP1 ==
false && flagP2 ==
false))
157 if (QLineF(firstPoint, p1).length() <= QLineF(firstPoint, p2).length())
179 qDebug() <<
"Unxpected value" << res;
199 QString radius = dialogTool->getRadius();
200 const quint32
center = dialogTool->getCenter();
201 const quint32
firstPointId = dialogTool->GetFirstPoint();
203 const QString pointName = dialogTool->getPointName();
204 VToolPointOfContact *point =
Create(0, radius,
center,
firstPointId,
secondPointId, pointName, 5, 10,
true, scene,
doc,
206 if (point !=
nullptr)
231 const quint32 &firstPointId,
const quint32 &secondPointId,
232 const QString &pointName, qreal mx, qreal my,
bool showPointName,
243 static_cast<QPointF
>(*firstP),
static_cast<QPointF
>(*secondP));
273 scene->addItem(point);
311 ContextMenu<DialogPointOfContact>(event,
id);
375 if (not
vis.isNull())
396 const QLineF p1ToCur(
static_cast<QPointF
>(*p1),
static_cast<QPointF
>(*current));
397 const QLineF p2ToCur(
static_cast<QPointF
>(*p2),
static_cast<QPointF
>(*current));
398 const QLineF centerToCur(
static_cast<QPointF
>(*centerP),
static_cast<QPointF
>(*current));
400 const QString toolTip = QString(
"<table>"
401 "<tr> <td><b>%10:</b> %11</td> </tr>"
402 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
403 "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
404 "<tr> <td><b>%6:</b> %7 %3</td> </tr>"
405 "<tr> <td><b>%8:</b> %9°</td> </tr>"
407 .arg(QString(
"%1->%2").arg(p1->name(), current->name()))
408 .arg(
qApp->fromPixel(p1ToCur.length()))
410 .arg(QString(
"%1->%2").arg(p2->name(), current->name()))
411 .arg(
qApp->fromPixel(p2ToCur.length()))
412 .arg(QString(
"%1 %2->%3").arg(tr(
"Length"), centerP->name(), current->name()))
413 .arg(
qApp->fromPixel(centerToCur.length()))
414 .arg(QString(
"%1 %2->%3").arg(tr(
"Angle"), centerP->name(), current->name()))
415 .arg(centerToCur.angle())
417 .arg(current->name());
443 ShowToolVisualization<VisToolPointOfContact>(show);
496 if (value.
error() ==
false)
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
virtual void IncrementReferens(quint32 id) const =0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
virtual void DecrementReferens(quint32 id) const =0
static void InitToolConnections(VMainGraphicsScene *scene, T *tool)
The VContainer class container of all variables.
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
AddLine add line to container.
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
const QSharedPointer< T > GeometricObject(const quint32 &id) const
quint32 AddGObject(VGObject *obj)
AddGObject add new GObject to container.
void UpdateGObject(quint32 id, T *obj)
UpdateGObject update GObject by id.
static QString GetParametrString(const QDomElement &domElement, const QString &name, const QString &defValue=QString())
Returns the string value of the given attribute. RENAME: see above.
static quint32 GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue)
Returns the long long value of the given attribute. RENAME: GetParameterLongLong?
void SetAttribute(QDomElement &domElement, const QString &name, const T &value) const
SetAttribute set attribute in pattern file. Replace "," by ".".
static bool IsPointOnLineSegment(const QPointF &t, const QPointF &p1, const QPointF &p2)
IsPointOnLineSegment Check if the point is on the line segment.
static qint32 LineIntersectCircle(const QPointF ¢er, qreal radius, const QLineF &line, QPointF &p1, QPointF &p2)
LineIntersectCircle find point intersection line and circle.
The VMainGraphicsScene class main scene.
The VPointF class keep data of point.
void setShowPointName(bool show)
void setObject1Id(const quint32 &value)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
const QString AttrSecondPoint
const QString AttrFirstPoint