55 #include "../ifc/ifcdef.h"
56 #include "../ifc/exception/vexception.h"
57 #include "../vgeometry/vpointf.h"
58 #include "../vmisc/vabstractapplication.h"
59 #include "../vmisc/vcommonsettings.h"
60 #include "../vpatterndb/vcontainer.h"
61 #include "../vpatterndb/vtranslatevars.h"
62 #include "../vwidgets/vmaingraphicsscene.h"
63 #include "../../../vdrawtool.h"
64 #include "../../../../vabstracttool.h"
65 #include "../../../../../dialogs/tools/dialogtool.h"
66 #include "../../../../../dialogs/tools/dialoglineintersectaxis.h"
67 #include "../../../../../visualization/visualization.h"
68 #include "../../../../../visualization/line/vistoollineintersectaxis.h"
71 #include <QMessageBox>
72 #include <QSharedPointer>
73 #include <QStaticStringData>
74 #include <QStringData>
75 #include <QStringDataPtr>
84 const QString &lineType,
const QString &lineWeight,
85 const QString &lineColor,
86 const QString &formulaAngle,
const quint32 &basePointId,
87 const quint32 &firstPointId,
const quint32 &secondPointId,
88 const Source &typeCreation, QGraphicsItem *parent)
89 :
VToolLinePoint(doc, data, id, lineType, lineWeight, lineColor, QString()
90 , basePointId, 0, parent)
91 , formulaAngle(formulaAngle)
92 , firstPointId(firstPointId)
93 , secondPointId(secondPointId)
113 dialogTool->SetPointName(p->name());
123 const QString pointName = dialogTool->getPointName();
124 const QString lineType = dialogTool->getLineType();
125 const QString lineWeight = dialogTool->getLineWeight();
126 const QString
lineColor = dialogTool->getLineColor();
128 const quint32
basePointId = dialogTool->GetBasePointId();
129 const quint32
firstPointId = dialogTool->GetFirstPointId();
130 const quint32
secondPointId = dialogTool->GetSecondPointId();
135 if (point !=
nullptr)
144 const QString &lineType,
const QString &lineWeight,
145 const QString &lineColor,
146 QString &formulaAngle, quint32 basePointId,
147 quint32 firstPointId, quint32 secondPointId,
150 const Source &typeCreation)
153 QLineF axis = QLineF(
static_cast<QPointF
>(*basePoint), QPointF(basePoint->x()+100, basePoint->y()));
158 QLineF line(
static_cast<QPointF
>(*firstPoint),
static_cast<QPointF
>(*secondPoint));
162 if (fPoint == QPointF())
164 const QString msg = tr(
"<b><big>Can't find intersection point %1 of</big></b><br>"
165 "<b><big>Line and Axis</big></b><br><br>"
166 "Using origin point as a place holder until pattern is corrected.")
169 QMessageBox msgBox(
qApp->getMainWindow());
170 msgBox.setWindowTitle(tr(
"Intersect Line and Axis"));
171 msgBox.setWindowFlags(msgBox.windowFlags() & ~Qt::WindowContextHelpButtonHint);
172 msgBox.setWindowIcon(QIcon(
":/toolicon/32x32/line_intersect_axis.png"));
173 msgBox.setIcon(QMessageBox::Warning);
175 msgBox.setStandardButtons(QMessageBox::Ok);
208 scene->addItem(point);
223 QLineF::IntersectType intersect = axis.intersects(line, &fPoint);
224 if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection)
267 if (value.
error() ==
false)
315 ShowToolVisualization<VisToolLineIntersectAxis>(show);
323 ContextMenu<DialogLineIntersectAxis>(event,
id);
375 if (not
vis.isNull())
398 const QLineF curLine(
static_cast<QPointF
>(*basePoint),
static_cast<QPointF
>(*current));
399 const QLineF firstToCur(
static_cast<QPointF
>(*firstPoint),
static_cast<QPointF
>(*current));
400 const QLineF curToSecond(
static_cast<QPointF
>(*current),
static_cast<QPointF
>(*secondPoint));
402 const QString toolTip = QString(
"<table>"
403 "<tr> <td><b> %10:</b> %11</td> </tr>"
404 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
405 "<tr> <td><b> %4:</b> %5°</td> </tr>"
406 "<tr> <td><b>%6:</b> %7 %3</td> </tr>"
407 "<tr> <td><b>%8:</b> %9 %3</td> </tr>"
410 .arg(
qApp->fromPixel(curLine.length()))
413 .arg(curLine.angle())
414 .arg(QString(
"%1->%2").arg(firstPoint->name(), current->name()))
415 .arg(
qApp->fromPixel(firstToCur.length()))
416 .arg(QString(
"%1->%2").arg(current->name(), secondPoint->name()))
417 .arg(
qApp->fromPixel(curToSecond.length()))
419 .arg(current->name());
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.
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 ".".
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)
const QString degreeSymbol
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
static Q_REQUIRED_RESULT bool VFuzzyComparePossibleNulls(double p1, double p2)
const QString AttrBasePoint
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.