Seamly2D
Code documentation
vtoolline.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  * @file vtoolline.cpp
3  ** @author Douglas S Caskey
4  ** @date 21 Mar, 2023
5  **
6  ** @brief
7  ** @copyright
8  ** This source code is part of the Seamly2D project, a pattern making
9  ** program to create and model patterns of clothing.
10  ** Copyright (C) 2017-2023 Seamly2D project
11  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
12  **
13  ** Seamly2D is free software: you can redistribute it and/or modify
14  ** You should have received a copy of the GNU General Public License
15  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
16  **
17  *****************************************************************************/
18 
19 /************************************************************************
20  **
21  ** @file vtoolline.cpp
22  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
23  ** @date November 15, 2013
24  **
25  ** @brief
26  ** @copyright
27  ** This source code is part of the Valentine project, a pattern making
28  ** program, whose allow create and modeling patterns of clothing.
29  ** Copyright (C) 2013-2015 Seamly2D project
30  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
31  **
32  ** Seamly2D is free software: you can redistribute it and/or modify
33  ** it under the terms of the GNU General Public License as published by
34  ** the Free Software Foundation, either version 3 of the License, or
35  ** (at your option) any later version.
36  **
37  ** Seamly2D is distributed in the hope that it will be useful,
38  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
39  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40  ** GNU General Public License for more details.
41  **
42  ** You should have received a copy of the GNU General Public License
43  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
44  **
45  *************************************************************************/
46 
47 #include "vtoolline.h"
48 
49 #include <QKeyEvent>
50 #include <QLineF>
51 #include <QMessageLogger>
52 #include <QPen>
53 #include <QPointF>
54 #include <QSharedPointer>
55 #include <Qt>
56 #include <QtDebug>
57 #include <new>
58 
59 #include "../../dialogs/tools/dialogline.h"
60 #include "../../dialogs/tools/dialogtool.h"
61 #include "../../visualization/visualization.h"
62 #include "../../visualization/line/vistoolline.h"
63 #include "../ifc/exception/vexception.h"
64 #include "../ifc/ifcdef.h"
65 #include "../vgeometry/vgobject.h"
66 #include "../vgeometry/vpointf.h"
67 #include "../vmisc/vabstractapplication.h"
68 #include "../vpatterndb/vcontainer.h"
69 #include "../vwidgets/vmaingraphicsscene.h"
70 #include "../vabstracttool.h"
71 #include "vdrawtool.h"
72 
73 template <class T> class QSharedPointer;
74 
75 //---------------------------------------------------------------------------------------------------------------------
76 /**
77  * @brief VToolLine constructor.
78  * @param doc dom document container.
79  * @param data container with variables.
80  * @param id object id in container.
81  * @param firstPoint id first line point.
82  * @param secondPoint id second line point.
83  * @param lineType line type.
84  * @param typeCreation way we create this tool.
85  * @param parent parent object.
86  */
87 VToolLine::VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint,
88  const QString &lineType, const QString &lineWeight, const QString &lineColor,
89  const Source &typeCreation, QGraphicsItem *parent)
90  : VDrawTool(doc, data, id)
91  , QGraphicsLineItem(parent)
92  , firstPoint(firstPoint)
93  , secondPoint(secondPoint)
94  , lineColor(lineColor)
95  , m_isHovered(false)
96 {
97  this->m_lineType = lineType;
98  this->m_lineWeight = lineWeight;
99  //Line
100  RefreshGeometry();
101  this->setFlag(QGraphicsItem::ItemStacksBehindParent, true);
102  this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus
103  this->setAcceptHoverEvents(true);
104 
105  ToolCreation(typeCreation);
106 }
107 
108 //---------------------------------------------------------------------------------------------------------------------
109 /**
110  * @brief setDialog set dialog when user want change tool option.
111  */
113 {
114  SCASSERT(not m_dialog.isNull())
115  QSharedPointer<DialogLine> dialogTool = m_dialog.objectCast<DialogLine>();
116  SCASSERT(not dialogTool.isNull())
117  dialogTool->setFirstPoint(firstPoint);
118  dialogTool->setSecondPoint(secondPoint);
119  dialogTool->setLineName();
120  dialogTool->setLineType(m_lineType);
121  dialogTool->setLineWeight(m_lineWeight);
122  dialogTool->setLineColor(lineColor);
123 }
124 
125 //---------------------------------------------------------------------------------------------------------------------
126 /**
127  * @brief Create help create tool form GUI.
128  * @param dialog dialog.
129  * @param scene pointer to scene.
130  * @param doc dom document container.
131  * @param data container with variables.
132  */
134  VContainer *data)
135 {
136  SCASSERT(not dialog.isNull())
137  QSharedPointer<DialogLine> dialogTool = dialog.objectCast<DialogLine>();
138  SCASSERT(not dialogTool.isNull())
139  const quint32 firstPoint = dialogTool->getFirstPoint();
140  const quint32 secondPoint = dialogTool->getSecondPoint();
141  const QString lineType = dialogTool->getLineType();
142  const QString lineWeight = dialogTool->getLineWeight();
143  const QString lineColor = dialogTool->getLineColor();
144 
145  VToolLine *line = Create(0, firstPoint, secondPoint, lineType, lineWeight, lineColor, scene, doc, data, Document::FullParse,
147  if (line != nullptr)
148  {
149  line->m_dialog = dialogTool;
150  }
151  return line;
152 }
153 
154 //---------------------------------------------------------------------------------------------------------------------
155 /**
156  * @brief Create help create tool.
157  * @param _id tool id, 0 if tool doesn't exist yet.
158  * @param firstPoint id first line point.
159  * @param secondPoint id second line point.
160  * @param lineType line type.
161  * @param lineWeight line weight.
162  * @param lineColor line color.
163  * @param scene pointer to scene.
164  * @param doc dom document container.
165  * @param data container with variables.
166  * @param parse parser file mode.
167  * @param typeCreation way we create this tool.
168  */
169 VToolLine * VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint,
170  const QString &lineType, const QString &lineWeight, const QString &lineColor,
171  VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
172  const Document &parse, const Source &typeCreation)
173 {
174  SCASSERT(scene != nullptr)
175  SCASSERT(doc != nullptr)
176  SCASSERT(data != nullptr)
177  quint32 id = _id;
178  if (typeCreation == Source::FromGui)
179  {
180  id = VContainer::getNextId();
182  }
183  else
184  {
187  if (parse != Document::FullParse)
188  {
189  doc->UpdateToolData(id, data);
190  }
191  }
192 
193  if (parse == Document::FullParse)
194  {
196  VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, lineType, lineWeight, lineColor, typeCreation);
197  scene->addItem(line);
198  InitDrawToolConnections(scene, line);
201  VAbstractPattern::AddTool(id, line);
202 
205 
206  doc->IncrementReferens(first->getIdTool());
207  doc->IncrementReferens(second->getIdTool());
208  return line;
209  }
210  return nullptr;
211 }
212 
213 //---------------------------------------------------------------------------------------------------------------------
214 QString VToolLine::getTagName() const
215 {
217 }
218 
219 //---------------------------------------------------------------------------------------------------------------------
220 void VToolLine::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
221 {
222  //const qreal width = scaleWidth(m_isHovered ? widthMainLine : widthHairLine, sceneScale(scene()));
223 
224  const qreal weight = ToPixel(doc->useGroupLineWeight(m_id, m_lineWeight).toDouble(), Unit::Mm);
225  const qreal width = scaleWidth(m_isHovered ? weight + 4 : weight, sceneScale(scene()));
226 
227  setPen(QPen(correctColor(this, doc->useGroupColor(m_id, lineColor)),
229 
230  QGraphicsLineItem::paint(painter, option, widget);
231 }
232 
233 //---------------------------------------------------------------------------------------------------------------------
235 {
236  return VAbstractTool::data.GetGObject(firstPoint)->name();
237 }
238 
239 //---------------------------------------------------------------------------------------------------------------------
241 {
243 }
244 
245 //---------------------------------------------------------------------------------------------------------------------
246 /**
247  * @brief FullUpdateFromFile update tool data form file.
248  */
250 {
251  ReadAttributes();
252  RefreshGeometry();
254 }
255 
256 //---------------------------------------------------------------------------------------------------------------------
257 /**
258  * @brief ShowTool highlight tool.
259  * @param id object id in container
260  * @param enable enable or disable highlight.
261  */
262 void VToolLine::ShowTool(quint32 id, bool enable)
263 {
264  ShowItem(this, id, enable);
265 }
266 
267 //---------------------------------------------------------------------------------------------------------------------
268 void VToolLine::Disable(bool disable, const QString &draftBlockName)
269 {
270  const bool enabled = !CorrectDisable(disable, draftBlockName);
271  this->setEnabled(enabled);
272 }
273 
274 //---------------------------------------------------------------------------------------------------------------------
275 void VToolLine::AllowHover(bool enabled)
276 {
277  setAcceptHoverEvents(enabled);
278 }
279 
280 //---------------------------------------------------------------------------------------------------------------------
281 void VToolLine::AllowSelecting(bool enabled)
282 {
283  setFlag(QGraphicsItem::ItemIsSelectable, enabled);
284 }
285 
286 //---------------------------------------------------------------------------------------------------------------------
287 /**
288  * @brief contextMenuEvent handle context menu events.
289  * @param event context menu event.
290  */
291 void VToolLine::showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id)
292 {
293  Q_UNUSED(id)
294  try
295  {
296  ContextMenu<DialogLine>(event);
297  }
298  catch(const VExceptionToolWasDeleted &e)
299  {
300  Q_UNUSED(e)
301  return;//Leave this method immediately!!!
302  }
303 }
304 
305 //---------------------------------------------------------------------------------------------------------------------
306 /**
307  * @brief contextMenuEvent handle context menu events.
308  * @param event context menu event.
309  */
310 void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
311 {
312  showContextMenu(event);
313 }
314 
315 //---------------------------------------------------------------------------------------------------------------------
316 /**
317  * @brief AddToFile add tag with informations about tool into file.
318  */
320 {
321  QDomElement domElement = doc->createElement(getTagName());
323  SaveOptions(domElement, obj);
324  AddToCalculation(domElement);
325 }
326 
327 //---------------------------------------------------------------------------------------------------------------------
328 /**
329  * @brief hoverEnterEvent handle hover enter events.
330  * @param event hover enter event.
331  */
332 void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
333 {
334  m_isHovered = true;
335  setToolTip(makeToolTip());
336  QGraphicsLineItem::hoverEnterEvent(event);
337 }
338 
339 //---------------------------------------------------------------------------------------------------------------------
340 /**
341  * @brief hoverLeaveEvent handle hover leave events.
342  * @param event hover leave event.
343  */
344 void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
345 {
346  if (vis.isNull())
347  {
348  m_isHovered = false;
349  QGraphicsLineItem::hoverLeaveEvent(event);
350  }
351 }
352 
353 //---------------------------------------------------------------------------------------------------------------------
354 /**
355  * @brief RemoveReferens decrement value of reference.
356  */
358 {
359  const auto p1 = VAbstractTool::data.GetGObject(firstPoint);
360  const auto p2 = VAbstractTool::data.GetGObject(secondPoint);
361 
362  doc->DecrementReferens(p1->getIdTool());
363  doc->DecrementReferens(p2->getIdTool());
364 }
365 
366 //---------------------------------------------------------------------------------------------------------------------
367 /**
368  * @brief itemChange handle item change.
369  * @param change change.
370  * @param value value.
371  * @return value.
372  */
373 QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
374 {
375  if (change == QGraphicsItem::ItemSelectedChange)
376  {
377  emit ChangedToolSelection(value.toBool(), m_id, m_id);
378  }
379 
380  return QGraphicsItem::itemChange(change, value);
381 }
382 
383 //---------------------------------------------------------------------------------------------------------------------
384 /**
385  * @brief keyReleaseEvent handle key realse events.
386  * @param event key realse event.
387  */
388 void VToolLine::keyReleaseEvent(QKeyEvent *event)
389 {
390  switch (event->key())
391  {
392  case Qt::Key_Delete:
393  try
394  {
395  deleteTool();
396  }
397  catch(const VExceptionToolWasDeleted &e)
398  {
399  Q_UNUSED(e)
400  return;//Leave this method immediately!!!
401  }
402  break;
403  default:
404  break;
405  }
406  QGraphicsItem::keyReleaseEvent ( event );
407 }
408 
409 //---------------------------------------------------------------------------------------------------------------------
410 /**
411  * @brief SaveDialog save options into file after change in dialog.
412  */
413 void VToolLine::SaveDialog(QDomElement &domElement)
414 {
415  SCASSERT(not m_dialog.isNull())
416  QSharedPointer<DialogLine> dialogTool = m_dialog.objectCast<DialogLine>();
417  SCASSERT(not dialogTool.isNull())
418  doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint()));
419  doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint()));
420  doc->SetAttribute(domElement, AttrLineType, dialogTool->getLineType());
421  doc->SetAttribute(domElement, AttrLineWeight, dialogTool->getLineWeight());
422  doc->SetAttribute(domElement, AttrLineColor, dialogTool->getLineColor());
423 }
424 
425 //---------------------------------------------------------------------------------------------------------------------
427 {
428  VDrawTool::SaveOptions(tag, obj);
429 
435 }
436 
437 //---------------------------------------------------------------------------------------------------------------------
438 void VToolLine::ReadToolAttributes(const QDomElement &domElement)
439 {
443  m_lineWeight = doc->GetParametrString(domElement, AttrLineWeight, "0.35");
445 }
446 
447 //---------------------------------------------------------------------------------------------------------------------
449 {
450  if (not vis.isNull())
451  {
452  VisToolLine *visual = qobject_cast<VisToolLine *>(vis);
453  SCASSERT(visual != nullptr)
454 
455  visual->setObject1Id(firstPoint);
456  visual->setPoint2Id(secondPoint);
458  visual->setLineWeight(m_lineWeight);
459  visual->RefreshGeometry();
460  }
461 }
462 
463 //---------------------------------------------------------------------------------------------------------------------
464 QString VToolLine::makeToolTip() const
465 {
468 
469  const QLineF line(static_cast<QPointF>(*first), static_cast<QPointF>(*second));
470 
471  const QString toolTip = QString("<table>"
472  "<tr> <td><b>%1:</b> %2 %3</td> </tr>"
473  "<tr> <td><b>%4:</b> %5°</td> </tr>"
474  "</table>")
475  .arg(tr("Length"))
476  .arg(qApp->fromPixel(line.length()))
477  .arg(UnitsToStr(qApp->patternUnit(), true))
478  .arg(tr("Angle"))
479  .arg(line.angle());
480  return toolTip;
481 }
482 
483 //---------------------------------------------------------------------------------------------------------------------
485 {
486  return secondPoint;
487 }
488 
489 //---------------------------------------------------------------------------------------------------------------------
490 void VToolLine::SetSecondPoint(const quint32 &value)
491 {
492  if (value != NULL_ID)
493  {
494  secondPoint = value;
495 
496  QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
497  SaveOption(obj);
498  }
499 }
500 
501 //---------------------------------------------------------------------------------------------------------------------
503 {
504  if (show)
505  {
506  if (vis.isNull())
507  {
508  AddVisualization<VisToolLine>();
510  }
511  else
512  {
513  if (VisToolLine *visual = qobject_cast<VisToolLine *>(vis))
514  {
515  visual->show();
516  }
517  }
518  }
519  else
520  {
521  delete vis;
522  hoverLeaveEvent(nullptr);
523  }
524 }
525 
526 //---------------------------------------------------------------------------------------------------------------------
527 void VToolLine::setLineType(const QString &value)
528 {
529  m_lineType = value;
530 
531  QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
532  SaveOption(obj);
533 }
534 
535 //---------------------------------------------------------------------------------------------------------------------
536 void VToolLine::setLineWeight(const QString &value)
537 {
538  m_lineWeight = value;
539 
540  QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
541  SaveOption(obj);
542 }
543 
544 //---------------------------------------------------------------------------------------------------------------------
545 QString VToolLine::getLineColor() const
546 {
547  return lineColor;
548 }
549 
550 //---------------------------------------------------------------------------------------------------------------------
551 void VToolLine::setLineColor(const QString &value)
552 {
553  lineColor = value;
554 
555  QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
556  SaveOption(obj);
557 }
558 
559 //---------------------------------------------------------------------------------------------------------------------
560 void VToolLine::GroupVisibility(quint32 object, bool visible)
561 {
562  Q_UNUSED(object)
563  setVisible(visible);
564 }
565 
566 //---------------------------------------------------------------------------------------------------------------------
568 {
569  return firstPoint;
570 }
571 
572 //---------------------------------------------------------------------------------------------------------------------
573 void VToolLine::SetFirstPoint(const quint32 &value)
574 {
575  if (value != NULL_ID)
576  {
577  firstPoint = value;
578 
579  QSharedPointer<VGObject> obj;//We don't have object for line in data container. Just will send empty object.
580  SaveOption(obj);
581  }
582 }
583 
584 //---------------------------------------------------------------------------------------------------------------------
585 /**
586  * @brief RefreshGeometry refresh item on scene.
587  */
589 {
592  this->setLine(QLineF(static_cast<QPointF>(*first), static_cast<QPointF>(*second)));
593 }
The DialogLine class dialog for ToolLine. Help create line and edit option.
Definition: dialogline.h:68
virtual void UpdateToolData(const quint32 &id, VContainer *data)=0
QString useGroupColor(quint32 toolId, QString color)
virtual void IncrementReferens(quint32 id) const =0
static void AddTool(quint32 id, VDataTool *tool)
AddTool add tool to list tools.
static const QString TagLine
QString useGroupLineWeight(quint32 toolId, QString weight)
QString useGroupLineType(quint32 toolId, QString type)
virtual void DecrementReferens(quint32 id) const =0
VAbstractPattern * doc
doc dom document container
QPointer< Visualization > vis
virtual void deleteTool(bool ask=true)
deleteTool full delete object form scene and file.
virtual void ToolCreation(const Source &typeCreation)
static void AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc)
AddRecord add record about tool in history.
const quint32 m_id
id object id.
The VContainer class container of all variables.
Definition: vcontainer.h:141
static quint32 getNextId()
getNextId generate next unique id
Definition: vcontainer.cpp:251
void AddLine(const quint32 &firstPointId, const quint32 &secondPointId)
AddLine add line to container.
Definition: vcontainer.cpp:382
static void UpdateId(quint32 newId)
UpdateId update id. If new id bigger when current save new like current.
Definition: vcontainer.cpp:269
const QSharedPointer< VGObject > GetGObject(quint32 id) const
GetGObject returns a point by id.
Definition: vcontainer.cpp:150
const QSharedPointer< T > GeometricObject(const quint32 &id) const
Definition: vcontainer.h:266
VContainer data
data container with data
Definition: vdatatool.h:84
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 ".".
Definition: vdomdocument.h:185
The VDrawTool abstract class for all draw tool.
Definition: vdrawtool.h:68
void ShowItem(Item *item, quint32 id, bool enable)
ShowItem highlight tool.
Definition: vdrawtool.h:332
QString m_lineWeight
typeLine line type.
Definition: vdrawtool.h:104
static void InitDrawToolConnections(VMainGraphicsScene *scene, T *tool)
Definition: vdrawtool.h:364
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj)
Definition: vdrawtool.cpp:163
QString m_lineType
activeBlockName name of tool's pattern peace.
Definition: vdrawtool.h:103
void SaveOption(QSharedPointer< VGObject > &obj)
Definition: vdrawtool.cpp:142
void AddToCalculation(const QDomElement &domElement)
typeLine line weight.
Definition: vdrawtool.cpp:229
bool CorrectDisable(bool disable, const QString &draftBlockName) const
Definition: vdrawtool.cpp:177
void ChangedToolSelection(bool selected, quint32 object, quint32 tool)
void ReadAttributes()
Definition: vdrawtool.cpp:190
QSharedPointer< DialogTool > m_dialog
m_dialog tool's dialog options.
The VMainGraphicsScene class main scene.
void EnableLineItemHover(bool enabled)
void EnableLineItemSelection(bool enable)
The VPointF class keep data of point.
Definition: vpointf.h:75
The VToolLine class tool for creation line.
Definition: vtoolline.h:75
bool m_isHovered
Definition: vtoolline.h:150
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:275
static VToolLine * Create(QSharedPointer< DialogTool > dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data)
Create help create tool form GUI.
Definition: vtoolline.cpp:133
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:560
quint32 GetFirstPoint() const
Definition: vtoolline.cpp:567
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
hoverLeaveEvent handle hover leave events.
Definition: vtoolline.cpp:344
void RefreshGeometry()
RefreshGeometry refresh item on scene.
Definition: vtoolline.cpp:588
quint32 secondPoint
secondPoint id second line point.
Definition: vtoolline.h:145
void SetFirstPoint(const quint32 &value)
Definition: vtoolline.cpp:573
quint32 firstPoint
firstPoint id first line point.
Definition: vtoolline.h:142
void setLineColor(const QString &value)
Definition: vtoolline.cpp:551
virtual void Disable(bool disable, const QString &draftBlockName) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:268
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE
hoverEnterEvent handle hover enter events.
Definition: vtoolline.cpp:332
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:502
virtual void SaveOptions(QDomElement &tag, QSharedPointer< VGObject > &obj) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:426
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE
SaveDialog save options into file after change in dialog.
Definition: vtoolline.cpp:413
virtual void RemoveReferens() Q_DECL_OVERRIDE
RemoveReferens decrement value of reference.
Definition: vtoolline.cpp:357
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:438
void SetSecondPoint(const quint32 &value)
Definition: vtoolline.cpp:490
virtual void SetVisualization() Q_DECL_OVERRIDE
Definition: vtoolline.cpp:448
QString SecondPointName() const
Definition: vtoolline.cpp:240
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE
FullUpdateFromFile update tool data form file.
Definition: vtoolline.cpp:249
virtual void setDialog() Q_DECL_OVERRIDE
setDialog set dialog when user want change tool option.
Definition: vtoolline.cpp:112
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:281
virtual void ShowTool(quint32 id, bool enable) Q_DECL_OVERRIDE
ShowTool highlight tool.
Definition: vtoolline.cpp:262
virtual void showContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE
contextMenuEvent handle context menu events.
Definition: vtoolline.cpp:291
virtual void AddToFile() Q_DECL_OVERRIDE
AddToFile add tag with informations about tool into file.
Definition: vtoolline.cpp:319
virtual void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE
keyReleaseEvent handle key realse events.
Definition: vtoolline.cpp:388
quint32 GetSecondPoint() const
Definition: vtoolline.cpp:484
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:220
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override
contextMenuEvent handle context menu events.
Definition: vtoolline.cpp:310
VToolLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, const QString &typeLine, const QString &lineWeight, const QString &lineColor, const Source &typeCreation, QGraphicsItem *parent=nullptr)
VToolLine constructor.
Definition: vtoolline.cpp:87
virtual QString getTagName() const Q_DECL_OVERRIDE
Definition: vtoolline.cpp:214
void setLineWeight(const QString &value) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:536
QString getLineColor() const
Definition: vtoolline.cpp:545
QString lineColor
lineColor color of a line.
Definition: vtoolline.h:148
QString FirstPointName() const
Definition: vtoolline.cpp:234
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) Q_DECL_OVERRIDE
itemChange handle item change.
Definition: vtoolline.cpp:373
virtual void setLineType(const QString &value) Q_DECL_OVERRIDE
Definition: vtoolline.cpp:527
virtual QString makeToolTip() const Q_DECL_OVERRIDE
Definition: vtoolline.cpp:464
void setPoint2Id(const quint32 &value)
Definition: vistoolline.cpp:93
virtual void RefreshGeometry() Q_DECL_OVERRIDE
Definition: vistoolline.cpp:76
void setLineWeight(const QString &value)
void setObject1Id(const quint32 &value)
void setLineStyle(const Qt::PenStyle &value)
double ToPixel(double val, const Unit &unit)
Definition: def.cpp:231
QString UnitsToStr(const Unit &unit, const bool translate)
UnitsToStr translate unit to string.
Definition: def.cpp:702
#define SCASSERT(cond)
Definition: def.h:317
Source
Definition: def.h:106
qreal sceneScale(QGraphicsScene *scene)
Definition: global.cpp:63
qreal scaleWidth(qreal width, qreal scale)
Definition: global.cpp:130
QColor correctColor(const QGraphicsItem *item, const QColor &color)
Definition: global.cpp:80
const QString AttrLineType
Definition: ifcdef.cpp:90
const QString AttrSecondPoint
Definition: ifcdef.cpp:97
const QString LineTypeSolidLine
Definition: ifcdef.cpp:159
const QString AttrFirstPoint
Definition: ifcdef.cpp:96
const QString AttrLineWeight
Definition: ifcdef.cpp:91
const QString ColorBlack
Definition: ifcdef.cpp:373
const QString AttrLineColor
Definition: ifcdef.cpp:130
Qt::PenStyle lineTypeToPenStyle(const QString &lineType)
LineStyle return pen style for current line style.
Definition: ifcdef.cpp:183
#define NULL_ID
Definition: ifcdef.h:76
#define NULL_ID_STR
Definition: ifcdef.h:77
Document
#define qApp
Definition: vapplication.h:67