/************************************************************************ ** ** @file vistoolpointofintersectionarcs.cpp ** @author Roman Telezhynskyi ** @date 27 5, 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 "vistoolpointofintersectionarcs.h" #include "../libs/vgeometry/varc.h" #include "../container/vcontainer.h" #include "../tools/drawTools/vtoolpointofintersectionarcs.h" //--------------------------------------------------------------------------------------------------------------------- VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent) : VisLine(data, parent), arc1Id(NULL_ID), arc2Id(NULL_ID), crossPoint(CrossArcsPoint::FirstPoint), point(nullptr), arc1Path(nullptr), arc2Path(nullptr) { arc1Path = InitItem(Qt::darkGreen, this); arc1Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false); arc2Path = InitItem(Qt::darkRed, this); arc2Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false); point = InitPoint(mainColor, this); point->setZValue(2); point->setFlag(QGraphicsItem::ItemStacksBehindParent, false); } //--------------------------------------------------------------------------------------------------------------------- VisToolPointOfIntersectionArcs::~VisToolPointOfIntersectionArcs() {} //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionArcs::RefreshGeometry() { if (arc1Id > NULL_ID) { const QSharedPointer arc1 = Visualization::data->GeometricObject(arc1Id); DrawPath(arc1Path, arc1->GetPath(PathDirection::Hide), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap); if (arc2Id > NULL_ID) { const QSharedPointer arc2 = Visualization::data->GeometricObject(arc2Id); DrawPath(arc2Path, arc2->GetPath(PathDirection::Hide), Qt::darkRed, Qt::SolidLine, Qt::RoundCap); const QPointF fPoint = VToolPointOfIntersectionArcs::FindPoint(arc1.data(), arc2.data(), crossPoint); DrawPoint(point, fPoint, mainColor); } } } //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionArcs::VisualMode(const quint32 &id) { VMainGraphicsScene *scene = qobject_cast(qApp->getCurrentScene()); SCASSERT(scene != nullptr); this->arc1Id = id; Visualization::scenePos = scene->getScenePos(); RefreshGeometry(); AddOnScene(); } //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionArcs::setArc1Id(const quint32 &value) { arc1Id = value; } //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionArcs::setArc2Id(const quint32 &value) { arc2Id = value; } //--------------------------------------------------------------------------------------------------------------------- void VisToolPointOfIntersectionArcs::setCrossPoint(const CrossArcsPoint &value) { crossPoint = value; }