2015-05-27 12:48:21 +02:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @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"
|
2015-06-18 19:23:24 +02:00
|
|
|
#include "../../vgeometry/varc.h"
|
|
|
|
#include "../../vpatterndb/vcontainer.h"
|
2015-05-27 12:48:21 +02:00
|
|
|
#include "../tools/drawTools/vtoolpointofintersectionarcs.h"
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
VisToolPointOfIntersectionArcs::VisToolPointOfIntersectionArcs(const VContainer *data, QGraphicsItem *parent)
|
2015-06-18 19:23:24 +02:00
|
|
|
: VisLine(data, parent), arc1Id(NULL_ID), arc2Id(NULL_ID), crossPoint(CrossCirclesPoint::FirstPoint),
|
|
|
|
point(nullptr),
|
2015-05-27 12:48:21 +02:00
|
|
|
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);
|
2015-05-27 20:23:50 +02:00
|
|
|
DrawPath(arc1Path, arc1->GetPath(PathDirection::Show), Qt::darkGreen, Qt::SolidLine, Qt::RoundCap);
|
2015-05-27 12:48:21 +02:00
|
|
|
|
|
|
|
if (arc2Id > NULL_ID)
|
|
|
|
{
|
|
|
|
const QSharedPointer<VArc> arc2 = Visualization::data->GeometricObject<VArc>(arc2Id);
|
2015-05-27 20:23:50 +02:00
|
|
|
DrawPath(arc2Path, arc2->GetPath(PathDirection::Show), Qt::darkRed, Qt::SolidLine, Qt::RoundCap);
|
2015-05-27 12:48:21 +02:00
|
|
|
|
|
|
|
const QPointF fPoint = VToolPointOfIntersectionArcs::FindPoint(arc1.data(), arc2.data(), crossPoint);
|
|
|
|
DrawPoint(point, fPoint, mainColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-27 18:24:20 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2015-05-27 12:48:21 +02:00
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VisToolPointOfIntersectionArcs::setArc1Id(const quint32 &value)
|
|
|
|
{
|
|
|
|
arc1Id = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
|
|
|
void VisToolPointOfIntersectionArcs::setArc2Id(const quint32 &value)
|
|
|
|
{
|
|
|
|
arc2Id = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2015-05-30 12:02:20 +02:00
|
|
|
void VisToolPointOfIntersectionArcs::setCrossPoint(const CrossCirclesPoint &value)
|
2015-05-27 12:48:21 +02:00
|
|
|
{
|
|
|
|
crossPoint = value;
|
|
|
|
}
|