Debian Codegraph @

src/editor/trackdata.hpp

raw symbols SCIP
1 // This file is part of Dust Racing 2D.
2 // Copyright (C) 2015 Jussi Lind <[email protected]>
3 //
4 // Dust Racing 2D is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 // Dust Racing 2D is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with Dust Racing 2D. If not, see <http://www.gnu.org/licenses/>.
15
16 #ifndef TRACKDATA_HPP
17 #define TRACKDATA_HPP
18
19 #include <QString>
20
21 #include "../common/mapbase.hpp"
22 #include "../common/objects.hpp"
23 #include "../common/route.hpp"
24 #include "../common/trackdatabase.hpp"
25
26 #include "map.hpp"
27
28 class ObjectModelLoader;
29
30 class TrackData : public TrackDataBase
31 {
32 public:
33 //! Constructor.
34 TrackData(QString name, bool isUserTrack, size_t cols, size_t rows);
35
36 //! Copy constructor
37 TrackData(const TrackData & other);
38
39 //! Destructor.
40 virtual ~TrackData();
41
42 //! Get file name.
43 QString fileName() const;
44
45 //! Set file name.
46 void setFileName(QString fileName);
47
48 //! Get map object.
49 MapBase & map();
50
51 //! Get map object.
52 const MapBase & map() const;
53
54 //! Get route object.
55 Route & route();
56
57 //! Get route object.
58 const Route & route() const;
59
60 //! Get objects object.
61 Objects & objects();
62
63 //! Get objects object.
64 const Objects & objects() const;
65
66 //! Insert tile column at given index and move objects.
67 void insertColumn(size_t at, MapBase::InsertDirection insertDirection);
68
69 //! Insert tile row at given index and move objects.
70 void insertRow(size_t at, MapBase::InsertDirection insertDirection);
71
72 //! Delete tile column at given index and move objects.
73 std::vector<TrackTileBasePtr> deleteColumn(size_t at);
74
75 //! Delete tile row at given index and move objects.
76 std::vector<TrackTileBasePtr> deleteRow(size_t at);
77
78 private:
79 void copyObjects(const TrackData & other);
80
81 void copyRoute(const TrackData & other);
82
83 void moveObjectsAfterColumnInsertion(size_t at);
84
85 void moveObjectsAfterRowInsertion(size_t at);
86
87 void moveTargetNodesAfterColumnInsertion(size_t at);
88
89 void moveTargetNodesAfterRowInsertion(size_t at);
90
91 void moveObjectsAfterColumnDeletion(size_t at);
92
93 void moveObjectsAfterRowDeletion(size_t at);
94
95 void moveTargetNodesAfterColumnDeletion(size_t at);
96
97 void moveTargetNodesAfterRowDeletion(size_t at);
98
99 QString m_fileName;
100
101 Map m_map;
102
103 Objects m_objects;
104
105 Route m_route;
106 };
107
108 typedef std::shared_ptr<TrackData> TrackDataPtr;
109
110 #endif // TRACKDATA_HPP