2013-11-15 13:41:26 +01:00
|
|
|
/************************************************************************
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:50:05 +01:00
|
|
|
** @file vtoolspline.h
|
2014-04-30 07:38:52 +02:00
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
2013-11-15 13:50:05 +01:00
|
|
|
** @date November 15, 2013
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** @brief
|
|
|
|
** @copyright
|
|
|
|
** This source code is part of the Valentine project, a pattern making
|
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
2015-02-27 11:27:48 +01:00
|
|
|
** Copyright (C) 2013-2015 Valentina project
|
2013-11-15 13:41:26 +01:00
|
|
|
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
2013-09-18 21:16:19 +02:00
|
|
|
**
|
2013-11-15 13:41:26 +01:00
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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.
|
|
|
|
**
|
2013-10-27 13:36:29 +01:00
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
2013-09-18 21:16:19 +02:00
|
|
|
** 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-11-15 13:41:26 +01:00
|
|
|
*************************************************************************/
|
2013-09-18 21:16:19 +02:00
|
|
|
|
2013-08-05 10:37:56 +02:00
|
|
|
#ifndef VTOOLSPLINE_H
|
|
|
|
#define VTOOLSPLINE_H
|
|
|
|
|
2014-03-04 17:50:54 +01:00
|
|
|
#include "vabstractspline.h"
|
2013-08-05 10:37:56 +02:00
|
|
|
|
2016-02-12 19:10:01 +01:00
|
|
|
class VSpline;
|
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 10:54:33 +01:00
|
|
|
* @brief The VToolSpline class tool for creation spline. I mean bezier curve.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-03-04 17:50:54 +01:00
|
|
|
class VToolSpline:public VAbstractSpline
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-08-05 10:37:56 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-06-18 19:23:24 +02:00
|
|
|
VToolSpline (VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
|
2014-10-04 08:37:19 +02:00
|
|
|
QGraphicsItem * parent = nullptr );
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual ~VToolSpline() Q_DECL_OVERRIDE;
|
|
|
|
virtual void setDialog() Q_DECL_OVERRIDE;
|
2016-02-15 10:02:55 +01:00
|
|
|
static VToolSpline *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
|
2016-02-26 15:38:42 +01:00
|
|
|
static VToolSpline *Create(const quint32 _id, VSpline *spline, const QString &color, VMainGraphicsScene *scene,
|
2016-02-15 10:02:55 +01:00
|
|
|
VAbstractPattern *doc, VContainer *data, const Document &parse,
|
|
|
|
const Source &typeCreation);
|
2016-02-26 15:38:42 +01:00
|
|
|
static VToolSpline *Create(const quint32 _id, quint32 point1, quint32 point4, QString &a1, QString &a2, QString &l1,
|
2016-02-27 15:49:10 +01:00
|
|
|
QString &l2, quint32 duplicate, const QString &color,
|
2016-02-26 15:38:42 +01:00
|
|
|
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
|
|
|
const Document &parse, const Source &typeCreation);
|
2013-10-29 14:45:07 +01:00
|
|
|
static const QString ToolType;
|
2016-02-26 15:38:42 +01:00
|
|
|
static const QString OldToolType;
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual int type() const Q_DECL_OVERRIDE {return Type;}
|
2014-08-26 20:31:28 +02:00
|
|
|
enum { Type = UserType + static_cast<int>(Tool::Spline)};
|
2014-09-01 18:36:15 +02:00
|
|
|
|
|
|
|
VSpline getSpline()const;
|
|
|
|
void setSpline(const VSpline &spl);
|
2014-09-03 15:52:16 +02:00
|
|
|
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
|
2013-08-05 10:37:56 +02:00
|
|
|
public slots:
|
2014-06-13 19:02:41 +02:00
|
|
|
void ControlPointChangePosition (const qint32 &indexSpline, const SplinePointPosition &position,
|
|
|
|
const QPointF &pos);
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE;
|
2013-08-05 10:37:56 +02:00
|
|
|
protected:
|
2015-07-03 15:36:54 +02:00
|
|
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
|
|
|
virtual void RemoveReferens() Q_DECL_OVERRIDE;
|
|
|
|
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
|
|
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
|
|
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
|
|
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
|
|
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
|
|
|
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
|
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
|
|
|
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
2014-02-06 14:57:23 +01:00
|
|
|
private:
|
2014-10-04 08:37:19 +02:00
|
|
|
Q_DISABLE_COPY(VToolSpline)
|
2015-02-12 11:55:09 +01:00
|
|
|
QPointF oldPosition;
|
2016-02-26 15:38:42 +01:00
|
|
|
|
2016-03-05 22:06:54 +01:00
|
|
|
bool IsMovable() const;
|
2016-02-26 15:38:42 +01:00
|
|
|
void RefreshGeometry ();
|
|
|
|
void SetSplineAttributes(QDomElement &domElement, const VSpline &spl);
|
2013-08-05 10:37:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTOOLSPLINE_H
|