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  static unsigned int get_app_version();
27  std::pair<Coordi, Coordi> get_bbox(bool all = false) const;
28  Junction *get_junction(const UUID &uu) override;
29  UUID get_uuid() const;
30 
31  json serialize() const;
32 
33  void expand();
34  Frame(const Frame &sym);
35  void operator=(Frame const &sym);
36 
37  UUID uuid;
38  std::string name;
39  std::map<UUID, Junction> junctions;
40  std::map<UUID, Line> lines;
41  std::map<UUID, Arc> arcs;
42  std::map<UUID, Text> texts;
43  std::map<UUID, Polygon> polygons;
44 
45  int64_t width = 297_mm;
46  int64_t height = 210_mm;
47 
48  FileVersion version;
49 
50 private:
51  void update_refs();
52 };
53 } // namespace horizon
Definition: file_version.hpp:9
Definition: frame.hpp:21
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
zip_int64_t int64_t
zip_int64_t typedef.
Definition: zip.hpp:103
basic_json<> json
default JSON class
Definition: json_fwd.hpp:62