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 <fstream>
13 #include <map>
14 #include <set>
15 #include <vector>
16 #include "util/file_version.hpp"
17 
18 namespace horizon {
19 using json = nlohmann::json;
20 
21 class Frame : public ObjectProvider, public LayerProvider {
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;
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  FileVersion version;
48 
49 private:
50  void update_refs();
51 };
52 } // namespace horizon
horizon::FileVersion
Definition: file_version.hpp:8
horizon::LayerProvider
Definition: layer_provider.hpp:7
libzip::int64_t
zip_int64_t int64_t
zip_int64_t typedef.
Definition: zip.hpp:103
horizon::Junction
A Junction is a point in 2D-Space.
Definition: junction.hpp:22
horizon::Frame
Definition: frame.hpp:21
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