2017-02-14 16:33:30 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 14 2, 2017
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2017-02-14 16:33:30 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2017 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/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
#include "vispiecespecialpoints.h"
|
2017-02-14 16:33:30 +01:00
|
|
|
#include "../vwidgets/vsimplepoint.h"
|
|
|
|
#include "../vgeometry/vpointf.h"
|
2017-07-01 13:43:16 +02:00
|
|
|
#include "../vpatterndb/vcontainer.h"
|
2017-02-14 16:33:30 +01:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-10-15 11:25:20 +02:00
|
|
|
VisPieceSpecialPoints::VisPieceSpecialPoints(const VContainer *data, QGraphicsItem *parent)
|
2017-02-14 16:33:30 +01:00
|
|
|
: VisPath(data, parent),
|
|
|
|
m_points(),
|
2017-10-15 11:25:20 +02:00
|
|
|
m_spoints()
|
2017-02-14 16:33:30 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-10-15 11:25:20 +02:00
|
|
|
void VisPieceSpecialPoints::RefreshGeometry()
|
2017-02-14 16:33:30 +01:00
|
|
|
{
|
|
|
|
HideAllItems();
|
|
|
|
|
2017-10-15 11:25:20 +02:00
|
|
|
for (int i = 0; i < m_spoints.size(); ++i)
|
2017-02-14 16:33:30 +01:00
|
|
|
{
|
|
|
|
VSimplePoint *point = GetPoint(static_cast<quint32>(i), supportColor);
|
|
|
|
point->SetOnlyPoint(false);
|
2017-10-15 11:25:20 +02:00
|
|
|
const QSharedPointer<VPointF> p = Visualization::data->GeometricObject<VPointF>(m_spoints.at(i));
|
2017-06-16 13:53:08 +02:00
|
|
|
point->RefreshPointGeometry(*p);
|
2017-02-14 16:33:30 +01:00
|
|
|
point->setVisible(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-10-15 11:25:20 +02:00
|
|
|
void VisPieceSpecialPoints::SetPoints(const QVector<quint32> &pins)
|
2017-02-14 16:33:30 +01:00
|
|
|
{
|
2017-10-15 11:25:20 +02:00
|
|
|
m_spoints = pins;
|
2017-02-14 16:33:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-10-15 11:25:20 +02:00
|
|
|
VSimplePoint *VisPieceSpecialPoints::GetPoint(quint32 i, const QColor &color)
|
2017-02-14 16:33:30 +01:00
|
|
|
{
|
|
|
|
return VisPath::GetPoint(m_points, i, color);
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------------------------------------
|
2017-10-15 11:25:20 +02:00
|
|
|
void VisPieceSpecialPoints::HideAllItems()
|
2017-02-14 16:33:30 +01:00
|
|
|
{
|
|
|
|
for (int i=0; i < m_points.size(); ++i)
|
|
|
|
{
|
|
|
|
if (QGraphicsEllipseItem *item = m_points.at(i))
|
|
|
|
{
|
|
|
|
item->setVisible(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|