2013-09-18 21:16:19 +02:00
|
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2013 Valentina project All Rights Reserved.
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Valentina.
|
|
|
|
|
**
|
|
|
|
|
** Tox 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.
|
|
|
|
|
**
|
|
|
|
|
** Tox 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/>.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2013-08-09 08:49:34 +02:00
|
|
|
|
#ifndef VSPLINEPATH_H
|
|
|
|
|
#define VSPLINEPATH_H
|
|
|
|
|
|
|
|
|
|
#include "vsplinepoint.h"
|
|
|
|
|
#include "vspline.h"
|
2013-09-30 18:29:03 +02:00
|
|
|
|
#include <QCoreApplication>
|
2013-08-09 08:49:34 +02:00
|
|
|
|
|
|
|
|
|
namespace SplinePoint{
|
2013-09-30 18:29:03 +02:00
|
|
|
|
enum Position { FirstPoint, LastPoint };
|
|
|
|
|
Q_DECLARE_FLAGS(Positions, Position)
|
2013-08-09 08:49:34 +02:00
|
|
|
|
}
|
2013-09-30 18:29:03 +02:00
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS( SplinePoint::Positions )
|
2013-08-09 08:49:34 +02:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The VSplinePath клас, що розраховує шлях сплайнів.
|
|
|
|
|
*/
|
|
|
|
|
class VSplinePath{
|
2013-09-30 18:29:03 +02:00
|
|
|
|
Q_DECLARE_TR_FUNCTIONS(VSplinePath)
|
2013-08-09 08:49:34 +02:00
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* @brief VSplinePath конструктор по замовчуванню.
|
|
|
|
|
*/
|
|
|
|
|
VSplinePath();
|
|
|
|
|
/**
|
|
|
|
|
* @brief VSplinePath конструктор по замовчуванню.
|
|
|
|
|
*/
|
2013-10-04 13:32:42 +02:00
|
|
|
|
VSplinePath(const QHash<qint64, VPointF> *points, qreal kCurve = 1,
|
2013-09-27 11:17:00 +02:00
|
|
|
|
Draw::Draws mode = Draw::Calculation, qint64 idObject = 0);
|
2013-08-20 12:26:02 +02:00
|
|
|
|
VSplinePath(const VSplinePath& splPath);
|
2013-08-09 08:49:34 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief append додає точку сплайну до шляху.
|
|
|
|
|
* @param point точка.
|
|
|
|
|
*/
|
|
|
|
|
void append(VSplinePoint point);
|
|
|
|
|
qint32 Count() const;
|
|
|
|
|
qint32 CountPoint() const;
|
|
|
|
|
VSpline GetSpline(qint32 index) const;
|
|
|
|
|
QPainterPath GetPath() const;
|
2013-08-28 10:55:11 +02:00
|
|
|
|
QVector<QPointF> GetPathPoints() const;
|
2013-08-09 08:49:34 +02:00
|
|
|
|
QVector<VSplinePoint> GetSplinePath() const;
|
|
|
|
|
qreal GetLength() const;
|
2013-10-10 20:45:58 +02:00
|
|
|
|
QHash<qint64, VPointF> GetDataPoints() const;
|
2013-08-09 08:49:34 +02:00
|
|
|
|
void UpdatePoint(qint32 indexSpline, SplinePoint::Position pos, VSplinePoint point);
|
2013-09-12 15:25:24 +02:00
|
|
|
|
VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePoint::Position pos) const;
|
2013-08-09 08:49:34 +02:00
|
|
|
|
/**
|
|
|
|
|
* @brief Clear очищає шлях сплайнів.
|
|
|
|
|
*/
|
|
|
|
|
void Clear();
|
|
|
|
|
qreal getKCurve() const;
|
|
|
|
|
void setKCurve(const qreal &value);
|
|
|
|
|
const QVector<VSplinePoint> *GetPoint() const;
|
|
|
|
|
VSplinePath& operator=(const VSplinePath &path);
|
|
|
|
|
VSplinePoint & operator[](int indx);
|
2013-09-27 11:17:00 +02:00
|
|
|
|
Draw::Draws getMode() const;
|
|
|
|
|
void setMode(const Draw::Draws &value);
|
2013-08-28 10:55:11 +02:00
|
|
|
|
|
|
|
|
|
qint64 getIdObject() const;
|
|
|
|
|
void setIdObject(const qint64 &value);
|
|
|
|
|
|
2013-08-09 08:49:34 +02:00
|
|
|
|
protected:
|
|
|
|
|
/**
|
|
|
|
|
* @brief path вектор з точок сплайна.
|
|
|
|
|
*/
|
|
|
|
|
QVector<VSplinePoint> path;
|
|
|
|
|
qreal kCurve;
|
2013-09-27 11:17:00 +02:00
|
|
|
|
Draw::Draws mode;
|
2013-10-10 20:45:58 +02:00
|
|
|
|
QHash<qint64, VPointF> points;
|
2013-08-28 10:55:11 +02:00
|
|
|
|
qint64 idObject;
|
2013-08-09 08:49:34 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // VSPLINEPATH_H
|