55 #include <QSharedPointer>
56 #include <QStaticStringData>
57 #include <QStringData>
58 #include <QStringDataPtr>
61 #include "../../../../../dialogs/tools/dialogcutarc.h"
62 #include "../../../../../dialogs/tools/dialogtool.h"
63 #include "../../../../../visualization/visualization.h"
64 #include "../../../../../visualization/path/vistoolcutarc.h"
65 #include "../ifc/exception/vexception.h"
66 #include "../ifc/ifcdef.h"
67 #include "../vgeometry/varc.h"
68 #include "../vgeometry/vpointf.h"
69 #include "../vmisc/vabstractapplication.h"
70 #include "../vmisc/vcommonsettings.h"
71 #include "../vpatterndb/vcontainer.h"
72 #include "../vpatterndb/vtranslatevars.h"
73 #include "../vwidgets/vmaingraphicsscene.h"
74 #include "../../../../vabstracttool.h"
75 #include "../../../vdrawtool.h"
94 const quint32 &arcId,
const Source &typeCreation, QGraphicsItem * parent)
95 :
VToolCut(doc, data, id, formula, arcId, parent)
110 dialogTool->SetFormula(
formula);
112 dialogTool->SetPointName(point->name());
129 const QString pointName = dialogTool->getPointName();
130 QString
formula = dialogTool->GetFormula();
131 const quint32 arcId = dialogTool->getArcId();
132 VToolCutArc* point =
Create(0, pointName,
formula, arcId, 5, 10,
true, scene,
doc,
data,
Document::FullParse,
134 if (point !=
nullptr)
166 QPointF point = arc->CutArc(
qApp->toPixel(result), arc1, arc2);
200 scene->addItem(point);
212 ShowToolVisualization<VisToolCutArc>(show);
224 ContextMenu<DialogCutArc>(event,
id);
267 if (not
vis.isNull())
287 const QString expression =
qApp->TrVars()->FormulaToUser(
formula,
qApp->Settings()->GetOsSeparator());
290 const QString arcStr = tr(
"Arc");
291 const QString lengthStr = tr(
"length");
292 const QString startAngleStr = tr(
"start angle");
293 const QString endAngleStr = tr(
"end angle");
294 const QString radiusStr = tr(
"radius");
298 arc->CutArc(
qApp->toPixel(length), ar1, ar2);
300 auto ArcToolTip = [arcStr, lengthStr, startAngleStr, endAngleStr, radiusStr](QString toolTip,
const VArc &arc,
301 const QString &arcNumber)
303 toolTip += QString(
"<tr> <td><b>%10:</b> %11</td> </tr>"
304 "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
305 "<tr> <td><b>%4:</b> %5 %3</td> </tr>"
306 "<tr> <td><b>%6:</b> %7°</td> </tr>"
307 "<tr> <td><b>%8:</b> %9°</td> </tr>")
308 .arg(arcStr + arcNumber + QLatin1String(
" ") + lengthStr)
309 .arg(
qApp->fromPixel(arc.GetLength()))
311 .arg(arcStr + arcNumber + QLatin1String(
" ") + radiusStr)
312 .arg(
qApp->fromPixel(arc.GetRadius()))
313 .arg(arcStr + arcNumber + QLatin1String(
" ") + startAngleStr)
314 .arg(arc.GetStartAngle())
315 .arg(arcStr + arcNumber + QLatin1String(
" ") + endAngleStr)
316 .arg(arc.GetEndAngle())
317 .arg(arcStr + arcNumber + QLatin1String(
" ") + tr(
"label"))
322 return ArcToolTip(ArcToolTip(
"<table>", ar1,
"1"), ar2,
"2") + QLatin1String(
"</table>");
The DialogCutArc class dialog for ToolCutArc.
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)
VArc class for anticlockwise arc.
The VContainer class container of all variables.
void AddArc(const QSharedPointer< VAbstractCurve > &arc, const quint32 &id, const quint32 &parentId=null_id)
static quint32 getNextId()
getNextId generate next unique 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 setObject1Id(const quint32 &value)
void setLineStyle(const Qt::PenStyle &value)
static qreal FindVal(const QString &expression, const QHash< QString, QSharedPointer< VInternalVariable > > *vars)
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.