Horizon
decal.hpp
1 #pragma once
2 #include "common/common.hpp"
3 #include "common/layer_provider.hpp"
4 #include "common/polygon.hpp"
5 #include "common/line.hpp"
6 #include "common/arc.hpp"
7 #include "common/text.hpp"
8 #include "nlohmann/json_fwd.hpp"
9 #include "util/uuid.hpp"
10 #include "common/object_provider.hpp"
11 #include "util/file_version.hpp"
12 
13 namespace horizon {
14 using json = nlohmann::json;
15 
16 class Decal : public ObjectProvider, public LayerProvider {
17 public:
18  Decal(const UUID &uu, const json &j);
19  Decal(const UUID &uu);
20  static Decal new_from_file(const std::string &filename);
21 
22  json serialize() const;
23 
24  Decal(const Decal &other);
25  void operator=(Decal const &other);
26 
27  UUID uuid;
28  std::string name;
29  std::map<UUID, Junction> junctions;
30  std::map<UUID, Polygon> polygons;
31  std::map<UUID, Line> lines;
32  std::map<UUID, Arc> arcs;
33  std::map<UUID, Text> texts;
34 
35  FileVersion version;
36 
37  UUID get_uuid() const;
38  std::pair<Coordi, Coordi> get_bbox() const;
39  const std::map<int, Layer> &get_layers() const override;
40  Junction *get_junction(const UUID &uu) override;
41 
42 
43 private:
44  void update_refs();
45 };
46 } // namespace horizon
horizon::Decal
Definition: decal.hpp:16
horizon::FileVersion
Definition: file_version.hpp:8
horizon::LayerProvider
Definition: layer_provider.hpp:7
horizon::Junction
A Junction is a point in 2D-Space.
Definition: junction.hpp:22
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:166
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::ObjectProvider
Interface for classes that store objects identified by UUID (e.g. Line or Junction)
Definition: object_provider.hpp:10