/************************************************************************ ** ** @file vistooltruedarts.cpp ** @author Roman Telezhynskyi ** @date 23 6, 2015 ** ** @brief ** @copyright ** This source code is part of the Valentine project, a pattern making ** program, whose allow create and modeling patterns of clothing. ** Copyright (C) 2015 Valentina project ** All Rights Reserved. ** ** Valentina is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** Valentina is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with Valentina. If not, see . ** *************************************************************************/ #include "vistooltruedarts.h" #include #include #include #include #include #include #include "../../tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.h" #include "../ifc/ifcdef.h" #include "../vgeometry/vpointf.h" #include "../vpatterndb/vcontainer.h" #include "../visualization.h" #include "visline.h" //--------------------------------------------------------------------------------------------------------------------- VisToolTrueDarts::VisToolTrueDarts(const VContainer *data, QGraphicsItem *parent) :VisLine(data, parent), baseLineP2Id(NULL_ID), dartP1Id(NULL_ID), dartP2Id(NULL_ID), dartP3Id(NULL_ID), point1(nullptr), point2(nullptr), baseLineP1(nullptr), baseLineP2(nullptr), dartP1(nullptr), dartP2(nullptr), dartP3(nullptr), lineblP1P1(nullptr), lineblP2P2(nullptr), p1d2(nullptr), d2p2(nullptr) { baseLineP1 = InitPoint(supportColor, this); baseLineP2 = InitPoint(supportColor, this); dartP1 = InitPoint(supportColor, this); dartP2 = InitPoint(supportColor, this); dartP3 = InitPoint(supportColor, this); lineblP1P1 = InitItem(supportColor, this); lineblP2P2 = InitItem(supportColor, this); p1d2 = InitItem(supportColor, this); d2p2 = InitItem(supportColor, this); point1 = InitPoint(mainColor, this); point2 = InitPoint(mainColor, this); //-V656 } //--------------------------------------------------------------------------------------------------------------------- VisToolTrueDarts::~VisToolTrueDarts() {} //--------------------------------------------------------------------------------------------------------------------- void VisToolTrueDarts::RefreshGeometry() { if (object1Id > NULL_ID) { const QSharedPointer blP1 = Visualization::data->GeometricObject(object1Id); DrawPoint(baseLineP1, *blP1, supportColor); if (baseLineP2Id <= NULL_ID) { DrawLine(this, QLineF(*blP1, Visualization::scenePos), supportColor, Qt::DashLine); } else { const QSharedPointer blP2 = Visualization::data->GeometricObject(baseLineP2Id); DrawPoint(baseLineP2, *blP2, supportColor); DrawLine(this, QLineF(*blP1, *blP2), supportColor, Qt::DashLine); if (dartP1Id > NULL_ID) { const QSharedPointer d1 = Visualization::data->GeometricObject(dartP1Id); DrawPoint(dartP1, *d1, supportColor); if (dartP2Id <= NULL_ID) { DrawLine(p1d2, QLineF(*d1, Visualization::scenePos), supportColor); } else { const QSharedPointer d2 = Visualization::data->GeometricObject(dartP2Id); DrawPoint(dartP2, *d2, supportColor); DrawLine(p1d2, QLineF(*d1, *d2), supportColor); if (dartP3Id <= NULL_ID) { DrawLine(d2p2, QLineF(*d2, Visualization::scenePos), supportColor); } else { const QSharedPointer d3 = Visualization::data->GeometricObject(dartP3Id); DrawPoint(dartP3, *d3, supportColor); DrawLine(d2p2, QLineF(*d2, *d3), supportColor); QPointF p1; QPointF p2; VToolTrueDarts::FindPoint(*blP1, *blP2, *d1, *d2, *d3, p1, p2); DrawLine(lineblP1P1, QLineF(*blP1, p1), supportColor); DrawLine(lineblP2P2, QLineF(*blP2, p2), supportColor); DrawLine(p1d2, QLineF(p1, *d2), supportColor); DrawLine(d2p2, QLineF(*d2, p2), supportColor); DrawPoint(point1, p1, mainColor); DrawPoint(point2, p2, mainColor); } } } } } } //--------------------------------------------------------------------------------------------------------------------- void VisToolTrueDarts::setObject2Id(const quint32 &value) { baseLineP2Id = value; } //--------------------------------------------------------------------------------------------------------------------- void VisToolTrueDarts::setD1PointId(const quint32 &value) { dartP1Id = value; } //--------------------------------------------------------------------------------------------------------------------- void VisToolTrueDarts::setD2PointId(const quint32 &value) { dartP2Id = value; } //--------------------------------------------------------------------------------------------------------------------- void VisToolTrueDarts::setD3PointId(const quint32 &value) { dartP3Id = value; }