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  static unsigned int get_app_version();
22 
23  json serialize() const;
24 
25  Decal(const Decal &other);
26  void operator=(Decal const &other);
27 
28  UUID uuid;
29  std::string name;
30  std::map<UUID, Junction> junctions;
31  std::map<UUID, Polygon> polygons;
32  std::map<UUID, Line> lines;
33  std::map<UUID, Arc> arcs;
34  std::map<UUID, Text> texts;
35 
36  FileVersion version;
37 
38  UUID get_uuid() const;
39  std::pair<Coordi, Coordi> get_bbox() const;
40  const std::map<int, Layer> &get_layers() const override;
41  Junction *get_junction(const UUID &uu) override;
42 
43 
44 private:
45  void update_refs();
46 };
47 } // namespace horizon
Definition: decal.hpp:16
Definition: file_version.hpp:8
A Junction is a point in 2D-Space.
Definition: junction.hpp:20
Definition: layer_provider.hpp:7
Interface for classes that store objects identified by UUID (e.g. Line or Junction)
Definition: object_provider.hpp:10
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
a class to store JSON values
Definition: json.hpp:166
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61