forked from CCOMJHC/camp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroup.cpp
49 lines (39 loc) · 994 Bytes
/
group.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "group.h"
#include<QJsonObject>
#include<QJsonArray>
#include"autonomousvehicleproject.h"
Group::Group(MissionItem* parent):MissionItem(parent)
{
}
void Group::write(QJsonObject& json) const
{
MissionItem::write(json);
json["type"] = "Group";
QJsonArray childrenArray;
for(MissionItem *item: childMissionItems())
{
QJsonObject miObject;
item->write(miObject);
childrenArray.append(miObject);
}
json["children"] = childrenArray;
}
void Group::writeToMissionPlan(QJsonArray& navArray) const
{
for(MissionItem *item: childMissionItems())
item->writeToMissionPlan(navArray);
}
void Group::read(const QJsonObject& json)
{
MissionItem::read(json);
readChildren(json["children"].toArray());
}
void Group::updateProjectedPoints()
{
for(auto child: childMissionItems())
child->updateProjectedPoints();
}
bool Group::canAcceptChildType(const std::string& childType) const
{
return true;
}