1 /************************************************************************
2  **
3  **  @file   movesplinepath.h
4  **  @author Roman Telezhynskyi <dismine(at)gmail.com>
5  **  @date   11 6, 2014
6  **
7  **  @brief
8  **  @copyright
9  **  This source code is part of the Valentina project, a pattern making
10  **  program, whose allow create and modeling patterns of clothing.
11  **  Copyright (C) 2013-2015 Valentina project
12  **  <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13  **
14  **  Valentina is free software: you can redistribute it and/or modify
15  **  it under the terms of the GNU General Public License as published by
16  **  the Free Software Foundation, either version 3 of the License, or
17  **  (at your option) any later version.
18  **
19  **  Valentina is distributed in the hope that it will be useful,
20  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  **  GNU General Public License for more details.
23  **
24  **  You should have received a copy of the GNU General Public License
25  **  along with Valentina.  If not, see <http://www.gnu.org/licenses/>.
26  **
27  *************************************************************************/
28 
29 #ifndef MOVESPLINEPATH_H
30 #define MOVESPLINEPATH_H
31 
32 #include <qcompilerdetection.h>
33 #include <QMetaObject>
34 #include <QObject>
35 #include <QString>
36 #include <QtGlobal>
37 
38 #include "../vgeometry/vsplinepath.h"
39 #include "vundocommand.h"
40 
41 class QGraphicsScene;
42 
43 class MoveSplinePath : public VUndoCommand
44 {
45     Q_OBJECT
46 public:
47     MoveSplinePath(VAbstractPattern *doc, const VSplinePath &oldSplPath, const VSplinePath &newSplPath,
48                    const quint32 &id, QUndoCommand *parent = nullptr);
49     virtual ~MoveSplinePath() =default;
50     virtual void undo() override;
51     virtual void redo() override;
52     virtual bool mergeWith(const QUndoCommand *command) override;
53     virtual int  id() const override;
54     quint32      getSplinePathId() const;
55     VSplinePath  getNewSplinePath() const;
56 private:
57     Q_DISABLE_COPY(MoveSplinePath)
58     VSplinePath oldSplinePath;
59     VSplinePath newSplinePath;
60     QGraphicsScene *scene;
61     void         Do(const VSplinePath &splPath);
62 };
63 
64 //---------------------------------------------------------------------------------------------------------------------
getSplinePathId()65 inline quint32 MoveSplinePath::getSplinePathId() const
66 {
67     return nodeId;
68 }
69 
70 //---------------------------------------------------------------------------------------------------------------------
getNewSplinePath()71 inline VSplinePath MoveSplinePath::getNewSplinePath() const
72 {
73     return newSplinePath;
74 }
75 
76 #endif // MOVESPLINEPATH_H
77