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 <map>
13 #include "util/file_version.hpp"
14 
15 namespace horizon {
16 using json = nlohmann::json;
17 
18 class Frame : public ObjectProvider, public LayerProvider {
19 public:
20  Frame(const UUID &uu, const json &j);
21  Frame(const UUID &uu);
22  static Frame new_from_file(const std::string &filename);
23  static unsigned int get_app_version();
24  std::pair<Coordi, Coordi> get_bbox(bool all = false) const;
25  Junction *get_junction(const UUID &uu) override;
26  UUID get_uuid() const;
27 
28  json serialize() const;
29 
30  void expand();
31  Frame(const Frame &sym);
32  void operator=(Frame const &sym);
33 
34  UUID uuid;
35  std::string name;
36  std::map<UUID, Junction> junctions;
37  std::map<UUID, Line> lines;
38  std::map<UUID, Arc> arcs;
39  std::map<UUID, Text> texts;
40  std::map<UUID, Polygon> polygons;
41 
42  int64_t width = 297_mm;
43  int64_t height = 210_mm;
44 
45  FileVersion version;
46 
47 private:
48  void update_refs();
49 };
50 } // namespace horizon
Definition: file_version.hpp:9
Definition: frame.hpp:18
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:177
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62