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 vtoolsplinepath.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-09 08:49:34 +02:00
|
|
|
#ifndef VTOOLSPLINEPATH_H
|
|
|
|
#define VTOOLSPLINEPATH_H
|
|
|
|
|
2014-03-04 17:50:54 +01:00
|
|
|
#include "vabstractspline.h"
|
2013-08-09 08:49:34 +02:00
|
|
|
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 11:16:20 +01:00
|
|
|
* @brief The VToolSplinePath class tool for creation spline path.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-03-04 17:50:54 +01:00
|
|
|
class VToolSplinePath:public VAbstractSpline
|
2013-11-04 21:35:15 +01:00
|
|
|
{
|
2013-08-09 08:49:34 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-06-18 19:23:24 +02:00
|
|
|
VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint32 id, const QString &color,
|
|
|
|
const Source &typeCreation,
|
2014-06-13 19:02:41 +02:00
|
|
|
QGraphicsItem * parent = nullptr);
|
2015-04-29 19:02:03 +02:00
|
|
|
virtual ~VToolSplinePath();
|
|
|
|
virtual void setDialog();
|
2015-06-18 19:23:24 +02:00
|
|
|
static VToolSplinePath *Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
|
|
|
VContainer *data);
|
2015-04-29 19:02:03 +02:00
|
|
|
static VToolSplinePath *Create(const quint32 _id, VSplinePath *path, const QString &color,
|
2015-06-18 19:23:24 +02:00
|
|
|
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
|
|
|
|
const Document &parse,
|
|
|
|
const Source &typeCreation);
|
2015-04-29 19:02:03 +02:00
|
|
|
static const QString ToolType;
|
2015-06-16 10:30:25 +02:00
|
|
|
static void UpdatePathPoint(VAbstractPattern *doc, QDomNode& node, const VSplinePath &path);
|
2015-04-29 19:02:03 +02:00
|
|
|
virtual int type() const {return Type;}
|
|
|
|
enum { Type = UserType + static_cast<int>(Tool::SplinePath)};
|
2014-09-01 18:39:16 +02:00
|
|
|
|
2015-04-29 19:02:03 +02:00
|
|
|
VSplinePath getSplinePath()const;
|
|
|
|
void setSplinePath(const VSplinePath &splPath);
|
2014-09-03 15:52:16 +02:00
|
|
|
|
2015-04-29 19:02:03 +02:00
|
|
|
virtual void ShowVisualization(bool show);
|
2013-08-09 08:49:34 +02:00
|
|
|
signals:
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 11:16:20 +01:00
|
|
|
* @brief RefreshLine refresh control line.
|
|
|
|
* @param indexSpline position spline in spline list.
|
2014-06-02 09:43:27 +02:00
|
|
|
* @param pos position point in spline.
|
2014-01-27 11:16:20 +01:00
|
|
|
* @param controlPoint new position control point.
|
|
|
|
* @param splinePoint new position spline point.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-06-13 19:02:41 +02:00
|
|
|
void RefreshLine(const qint32 &indexSpline, SplinePointPosition pos, const QPointF &controlPoint,
|
|
|
|
const QPointF &splinePoint);
|
2013-11-19 21:56:49 +01:00
|
|
|
/**
|
2014-01-27 11:16:20 +01:00
|
|
|
* @brief setEnabledPoint disable control points.
|
|
|
|
* @param enable enable or diasable points.
|
2013-11-19 21:56:49 +01:00
|
|
|
*/
|
2014-06-13 19:02:41 +02:00
|
|
|
void setEnabledPoint(bool enable);
|
2013-08-09 08:49:34 +02:00
|
|
|
public slots:
|
2014-06-13 19:02:41 +02:00
|
|
|
|
|
|
|
void ControlPointChangePosition(const qint32 &indexSpline, const SplinePointPosition &position,
|
|
|
|
const QPointF &pos);
|
2015-02-12 17:10:47 +01:00
|
|
|
virtual void EnableToolMove(bool move);
|
2013-08-09 08:49:34 +02:00
|
|
|
protected:
|
2014-06-13 19:02:41 +02:00
|
|
|
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event );
|
|
|
|
virtual void RefreshDataInFile();
|
|
|
|
virtual void RemoveReferens();
|
|
|
|
virtual void SaveDialog(QDomElement &domElement);
|
2014-08-30 21:58:31 +02:00
|
|
|
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
2015-02-12 16:42:44 +01:00
|
|
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
|
|
|
|
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event );
|
|
|
|
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
|
|
|
|
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event );
|
|
|
|
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event );
|
2015-05-23 13:40:43 +02:00
|
|
|
virtual void SetVisualization();
|
2014-02-06 14:57:23 +01:00
|
|
|
private:
|
2015-02-12 16:42:44 +01:00
|
|
|
QPointF oldPosition;
|
|
|
|
|
2014-06-13 19:02:41 +02:00
|
|
|
void RefreshGeometry();
|
2015-06-16 10:30:25 +02:00
|
|
|
static void AddPathPoint(VAbstractPattern *doc, QDomElement &domElement, const VSplinePoint &splPoint);
|
2014-06-13 19:02:41 +02:00
|
|
|
void UpdateControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline) const;
|
|
|
|
void RefreshSplinePath(VSplinePath &splPath);
|
2013-08-09 08:49:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // VTOOLSPLINEPATH_H
|