Horizon
core_symbol.hpp
1 #pragma once
2 #include "core.hpp"
3 #include "pool/pool.hpp"
4 #include "pool/symbol.hpp"
5 #include <deque>
6 #include <iostream>
7 #include <memory>
8 
9 namespace horizon {
10 class CoreSymbol : public Core {
11 public:
12  CoreSymbol(const std::string &filename, Pool &pool);
13  bool has_object_type(ObjectType ty) override;
14  Symbol *get_symbol(bool work = true);
15 
16  Junction *get_junction(const UUID &uu, bool work = true) override;
17  Line *get_line(const UUID &uu, bool work = true) override;
18  SymbolPin *get_symbol_pin(const UUID &uu, bool work = true);
19  Arc *get_arc(const UUID &uu, bool work = true) override;
20 
21  Junction *insert_junction(const UUID &uu, bool work = true) override;
22  void delete_junction(const UUID &uu, bool work = true) override;
23  Line *insert_line(const UUID &uu, bool work = true) override;
24  void delete_line(const UUID &uu, bool work = true) override;
25  Arc *insert_arc(const UUID &uu, bool work = true) override;
26  void delete_arc(const UUID &uu, bool work = true) override;
27 
28  SymbolPin *insert_symbol_pin(const UUID &uu, bool work = true);
29  void delete_symbol_pin(const UUID &uu, bool work = true);
30 
31  class LayerProvider *get_layer_provider() override;
32 
33  std::vector<Line *> get_lines(bool work = true) override;
34  std::vector<Arc *> get_arcs(bool work = true) override;
35  std::vector<const Pin *> get_pins(bool work = true);
36 
37  void rebuild(bool from_undo = false) override;
38  void commit() override;
39  void revert() override;
40  void save() override;
41 
42  bool set_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
43  const class PropertyValue &value) override;
44  bool get_property(ObjectType type, const UUID &uu, ObjectProperty::ID property,
45  class PropertyValue &value) override;
46  bool get_property_meta(ObjectType type, const UUID &uu, ObjectProperty::ID property,
47  class PropertyMeta &meta) override;
48 
49  std::string get_display_name(ObjectType type, const UUID &uu) override;
50 
51  const Symbol *get_canvas_data();
52  std::pair<Coordi, Coordi> get_bbox() override;
53 
54  void reload_pool() override;
55 
56 private:
57  std::map<UUID, Text> *get_text_map(bool work = true) override;
58  std::map<UUID, Polygon> *get_polygon_map(bool work = true) override;
59 
60  Symbol sym;
61  std::string m_filename;
62 
63  class HistoryItem : public Core::HistoryItem {
64  public:
65  HistoryItem(const Symbol &s) : sym(s)
66  {
67  }
68  Symbol sym;
69  };
70  void history_push() override;
71  void history_load(unsigned int i) override;
72 };
73 } // namespace horizon
Definition: symbol.hpp:22
Graphical line.
Definition: line.hpp:19
Definition: core_properties.hpp:7
void rebuild(bool from_undo=false) override
Expands the non-working document.
Definition: core_symbol.cpp:255
Where Tools and and documents meet.
Definition: core.hpp:232
Definition: core_symbol.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: symbol.hpp:74
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:19
Definition: block.cpp:9
Definition: core.hpp:449
A Junction is a point in 2D-Space.
Definition: junction.hpp:25
Graphical arc.
Definition: arc.hpp:20