Horizon
core_package.hpp
1 #pragma once
2 #include "common/layer.hpp"
3 #include "core.hpp"
4 #include "pool/package.hpp"
5 #include "pool/pool.hpp"
6 #include <deque>
7 #include <iostream>
8 #include <memory>
9 
10 namespace horizon {
11 class CorePackage : public Core {
12 public:
13  CorePackage(const std::string &filename, Pool &pool);
14  bool has_object_type(ObjectType ty) override;
15 
16  Package *get_package(bool work = true);
17 
18  /*Polygon *insert_polygon(const UUID &uu, bool work = true);
19  Polygon *get_polygon(const UUID &uu, bool work=true);
20  void delete_polygon(const UUID &uu, bool work = true);
21  Hole *insert_hole(const UUID &uu, bool work = true);
22  Hole *get_hole(const UUID &uu, bool work=true);
23  void delete_hole(const UUID &uu, bool work = true);*/
24 
25  class LayerProvider *get_layer_provider() override;
26 
27  bool set_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
28  const class PropertyValue &value) override;
29  bool get_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
30  class PropertyValue &value) override;
31  bool get_property_meta(ObjectType type, const UUID &uu, ObjectProperty::ID property,
32  class PropertyMeta &meta) override;
33 
34  std::string get_display_name(ObjectType type, const UUID &uu) override;
35  class Rules *get_rules() override;
36 
37  void rebuild(bool from_undo = false) override;
38  void commit() override;
39  void revert() override;
40  void save() override;
41 
42  const Package *get_canvas_data();
43  std::pair<Coordi, Coordi> get_bbox() override;
44  json get_meta() override;
45 
46 private:
47  std::map<UUID, Junction> *get_junction_map(bool work = true) override;
48  std::map<UUID, Line> *get_line_map(bool work = true) override;
49  std::map<UUID, Arc> *get_arc_map(bool work = true) override;
50  std::map<UUID, Text> *get_text_map(bool work = true) override;
51  std::map<UUID, Polygon> *get_polygon_map(bool work = true) override;
52  std::map<UUID, Hole> *get_hole_map(bool work = true) override;
53 
54  Package package;
55  std::string m_filename;
56 
57  PackageRules rules;
58 
59  class HistoryItem : public Core::HistoryItem {
60  public:
61  HistoryItem(const Package &k) : package(k)
62  {
63  }
64  Package package;
65  };
66  void history_push() override;
67  void history_load(unsigned int i) override;
68 
69 public:
70  std::string parameter_program_code;
71  ParameterSet parameter_set;
72 
73  std::map<UUID, Package::Model> models;
74  UUID default_model;
75 };
76 } // namespace horizon
a class to store JSON values
Definition: json.hpp:161
Definition: core_properties.hpp:7
Definition: rules.hpp:41
Definition: package.hpp:25
void rebuild(bool from_undo=false) override
Expands the non-working document.
Definition: core_package.cpp:194
json get_meta() override
Definition: core_package.cpp:227
Where Tools and and documents meet.
Definition: core.hpp:249
Definition: package_rules.hpp:10
Definition: layer_provider.hpp:7
Definition: core_properties.hpp:77
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: core_package.hpp:11
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:18
Definition: block.cpp:7
Definition: core.hpp:439