Horizon
frame.hpp
1 #pragma once
2 #include "common/arc.hpp"
3 #include "common/common.hpp"
4 #include "common/junction.hpp"
5 #include "common/layer_provider.hpp"
6 #include "common/line.hpp"
7 #include "common/object_provider.hpp"
8 #include "common/polygon.hpp"
9 #include "common/text.hpp"
10 #include "nlohmann/json_fwd.hpp"
11 #include "util/uuid.hpp"
12 #include "util/uuid_provider.hpp"
13 #include <fstream>
14 #include <map>
15 #include <set>
16 #include <vector>
17 
18 namespace horizon {
19 using json = nlohmann::json;
20 
21 class Frame : public ObjectProvider, public LayerProvider, public UUIDProvider {
22 public:
23  Frame(const UUID &uu, const json &j);
24  Frame(const UUID &uu);
25  static Frame new_from_file(const std::string &filename);
26  std::pair<Coordi, Coordi> get_bbox(bool all = false) const;
27  Junction *get_junction(const UUID &uu) override;
28  UUID get_uuid() const override;
29 
30  json serialize() const;
31 
32  void expand();
33  Frame(const Frame &sym);
34  void operator=(Frame const &sym);
35 
36  UUID uuid;
37  std::string name;
38  std::map<UUID, Junction> junctions;
39  std::map<UUID, Line> lines;
40  std::map<UUID, Arc> arcs;
41  std::map<UUID, Text> texts;
42  std::map<UUID, Polygon> polygons;
43 
44  int64_t width = 297_mm;
45  int64_t height = 210_mm;
46 
47 private:
48  void update_refs();
49 };
50 } // namespace horizon
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::LayerProvider
Definition: layer_provider.hpp:7
horizon::Junction
A Junction is a point in 2D-Space.
Definition: junction.hpp:25
horizon::Frame
Definition: frame.hpp:21
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:161
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
libzip::int64_t
zip_int64_t int64_t
zip_int64_t typedef.
Definition: zip.hpp:103
horizon::UUIDProvider
Interface for objects that have a UUID.
Definition: uuid_provider.hpp:9
horizon::ObjectProvider
Interface for classes that store objects identified by UUID (e.g. Line or Junction)
Definition: object_provider.hpp:10