0097d67865
--HG-- branch : feature
103 lines
4.3 KiB
C++
103 lines
4.3 KiB
C++
/************************************************************************
|
|
**
|
|
** @file vistoolpointofintersectionarcs.cpp
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
** @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
|
|
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
|
**
|
|
*************************************************************************/
|
|
|
|
#include "vistoolpointofintersectionarcs.h"
|
|
#include "../vgeometry/varc.h"
|
|
#include "../vpatterndb/vcontainer.h"
|
|
#include "../tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.h"
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent)
|
|
: VisLine(data, parent), arc1Id(NULL_ID), arc2Id(NULL_ID), crossPoint(CrossCirclesPoint::FirstPoint),
|
|
point(nullptr),
|
|
arc1Path(nullptr), arc2Path(nullptr)
|
|
{
|
|
arc1Path = InitItem<QGraphicsPathItem>(Qt::darkGreen, this);
|
|
arc1Path->setFlag(QGraphicsItem::ItemStacksBehindParent, false);
|
|
arc2Path = InitItem<QGraphicsPathItem>(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<VArc> arc1 = Visualization::data->GeometricObject<VArc>(arc1Id);
|
|
DrawPath(arc1Path, arc1->GetPath(PathDirection::Show), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
|
|
|
|
if (arc2Id > NULL_ID)
|
|
{
|
|
const QSharedPointer<VArc> arc2 = Visualization::data->GeometricObject<VArc>(arc2Id);
|
|
DrawPath(arc2Path, arc2->GetPath(PathDirection::Show), 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<VMainGraphicsScene *>(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 CrossCirclesPoint &value)
|
|
{
|
|
crossPoint = value;
|
|
}
|