55 #include <QMessageLogger>
56 #include <QSharedPointer>
57 #include <QStaticStringData>
58 #include <QStringData>
59 #include <QStringDataPtr>
63 #include "../../../../../dialogs/tools/dialogshoulderpoint.h"
64 #include "../../../../../dialogs/tools/dialogtool.h"
65 #include "../../../../../visualization/visualization.h"
66 #include "../../../../../visualization/line/vistoolshoulderpoint.h"
67 #include "../ifc/exception/vexception.h"
68 #include "../ifc/ifcdef.h"
69 #include "../vgeometry/vgobject.h"
70 #include "../vgeometry/vpointf.h"
71 #include "../vmisc/vabstractapplication.h"
72 #include "../vmisc/vcommonsettings.h"
73 #include "../vpatterndb/vcontainer.h"
74 #include "../vpatterndb/vtranslatevars.h"
75 #include "../vwidgets/vmaingraphicsscene.h"
76 #include "../../../../vabstracttool.h"
77 #include "../../../vdrawtool.h"
101 const QString &lineType,
const QString &lineWeight,
102 const QString &lineColor,
const QString &formula,
const quint32 &p1Line,
103 const quint32 &p2Line,
const quint32 &pShoulder,
const Source &typeCreation,
104 QGraphicsItem * parent)
105 :
VToolLinePoint(doc, data, id, lineType, lineWeight, lineColor, formula, p1Line, 0, parent), p2Line(p2Line)
106 , pShoulder(pShoulder)
125 dialogTool->SetP2Line(
p2Line);
127 dialogTool->SetPointName(p->name());
142 QPointF shoulderPoint =
p2Line;
145 return shoulderPoint;
148 QLineF line = QLineF(p1Line,
p2Line);
149 const qreal baseLength = line.length();
150 const int baseAngle = qRound(line.angle());
151 line.setLength(length*2);
158 if (res == 1 || res == 2)
160 const QLineF line1 = QLineF(p1Line, p1);
161 const QLineF line2 = QLineF(p1Line, p2);
162 if (line1.length() > baseLength && baseAngle == qRound(line1.angle()))
166 else if (res == 2 && line2.length() > baseLength && baseAngle == qRound(line2.angle()))
172 return shoulderPoint;
190 QString formula = dialogTool->GetFormula();
191 const quint32 p1Line = dialogTool->GetP1Line();
192 const quint32
p2Line = dialogTool->GetP2Line();
193 const quint32
pShoulder = dialogTool->GetP3();
194 const QString lineType = dialogTool->getLineType();
195 const QString lineWeight = dialogTool->getLineWeight();
196 const QString
lineColor = dialogTool->getLineColor();
197 const QString pointName = dialogTool->getPointName();
200 if (point !=
nullptr)
230 quint32 p2Line, quint32 pShoulder,
const QString &lineType,
231 const QString &lineWeight,
232 const QString &lineColor,
const QString &pointName, qreal mx, qreal my,
243 static_cast<QPointF
>(*secondPoint),
244 static_cast<QPointF
>(*shoulderPoint),
qApp->toPixel(result));
272 scene->addItem(point);
304 ContextMenu<DialogShoulderPoint>(event,
id);
373 if (not
vis.isNull())
395 const QLineF firstToCur(
static_cast<QPointF
>(*first),
static_cast<QPointF
>(*current));
396 const QLineF secondToCur(
static_cast<QPointF
>(*second),
static_cast<QPointF
>(*current));
398 const QString toolTip = QString(
"<table>"
399 "<tr> <td><b> %8:</b> %9</td> </tr>"
400 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
401 "<tr> <td><b> %4:</b> %5°</td> </tr>"
402 "<tr> <td><b>%6:</b> %7 %3</td> </tr>"
405 .arg(
qApp->fromPixel(firstToCur.length()))
408 .arg(firstToCur.angle())
409 .arg(QString(
"%1->%2").arg(second->name(), current->name()))
410 .arg(
qApp->fromPixel(secondToCur.length()))
412 .arg(current->name());
440 ShowToolVisualization<VisToolShoulderPoint>(show);
The DialogShoulderPoint class dialog for ToolShoulderPoint. Help create point and edit option.
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 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 setLineWeight(const QString &value)
void setObject1Id(const quint32 &value)
void setLineStyle(const Qt::PenStyle &value)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
const QString AttrPShoulder
const QString AttrLineType
const QString LineTypeSolidLine
const QString AttrLineWeight
const QString AttrLineColor
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.