Seamly2D
Code documentation
anchorpoint_visual.cpp
Go to the documentation of this file.
1 /************************************************************************
2  **
3  ** @file anchorpoint_visual.cpp
4  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
5  ** @date 31 1, 2017
6  **
7  ** @brief
8  ** @copyright
9  ** This source code is part of the Valentine project, a pattern making
10  ** program, whose allow create and modeling patterns of clothing.
11  ** Copyright (C) 2017 Seamly2D project
12  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
13  **
14  ** Seamly2D is free software: you can redistribute it and/or modify
15  ** it under the terms of the GNU General Public License as published by
16  ** the Free Software Foundation, either version 3 of the License, or
17  ** (at your option) any later version.
18  **
19  ** Seamly2D is distributed in the hope that it will be useful,
20  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  ** GNU General Public License for more details.
23  **
24  ** You should have received a copy of the GNU General Public License
25  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #include "anchorpoint_visual.h"
30 #include "../vwidgets/vsimplepoint.h"
31 #include "../vgeometry/vpointf.h"
32 #include "../vpatterndb/vcontainer.h"
33 
34 //---------------------------------------------------------------------------------------------------------------------
35 AnchorPointVisual::AnchorPointVisual(const VContainer *data, QGraphicsItem *parent)
36  : VisLine(data, parent)
37  , m_point()
38 {
39  this->mainColor = Qt::red;
40  this->setZValue(2);// Show on top real tool
41 
43  m_point->SetPointHighlight(true);
44  m_point->setParentItem(this);
45  m_point->SetVisualizationMode(true);
46  m_point->setVisible(false);
47 }
48 
49 //---------------------------------------------------------------------------------------------------------------------
51 {
52  if (not m_point.isNull())
53  {
54  delete m_point;
55  }
56 }
57 
58 //---------------------------------------------------------------------------------------------------------------------
60 {
61  if (object1Id > NULL_ID)
62  {
64 
65  m_point->setOnlyPoint(mode == Mode::Creation);
66  m_point->refreshPointGeometry(*point);
67  m_point->setVisible(true);
68  }
69 }
AnchorPointVisual(const VContainer *data, QGraphicsItem *parent=nullptr)
QPointer< VSimplePoint > m_point
virtual void RefreshGeometry() Q_DECL_OVERRIDE
The VContainer class container of all variables.
Definition: vcontainer.h:141
const QSharedPointer< T > GeometricObject(const quint32 &id) const
Definition: vcontainer.h:266
The VPointF class keep data of point.
Definition: vpointf.h:75
QColor mainColor
Definition: visualization.h:99
const VContainer * data
Definition: visualization.h:97
quint32 object1Id
#define NULL_ID
Definition: ifcdef.h:76
@ Creation