21 #ifndef ophidian_FLOORPLAN_H
22 #define ophidian_FLOORPLAN_H
24 #include <boost/geometry/index/rtree.hpp>
25 #include <entity_system.h>
28 #include <unordered_map>
38 using point = geometry::point<double>;
39 using box = geometry::box<point>;
40 using rtree_node = std::pair<box, entity_system::entity>;
41 using rtree = boost::geometry::index::rtree<rtree_node, boost::geometry::index::rstar<16>>;
50 point m_chip_boundaries;
52 std::unordered_map<std::string, entity_system::entity> m_name2site;
58 point chip_origin()
const {
61 void chip_origin(point chip_origin);
68 return m_chip_boundaries;
80 entity_system::entity
site_insert(std::string name, point dimensions);
94 return m_sites_system.
size();
103 std::string
site_name(entity_system::entity site)
const {
104 return m_sites.
name(site);
133 entity_system::entity
row_insert(entity_system::entity site,
unsigned number_of_sites, point origin);
134 entity_system::entity
row_insert(std::string site,
unsigned number_of_sites, point origin);
149 entity_system::entity
find_row(point point);
165 return m_rows_system.
size();
174 entity_system::entity
row_site(entity_system::entity row)
const {
175 return m_rows.
site(row);
193 return m_rows.
origin(row);
212 return m_rows_system;
218 const char * what()
const throw() {
219 return "No row found in the given coordinate";
227 #endif //ophidian_FLOORPLAN_H
const sites & sites_properties() const
Sites properties getter.
Definition: floorplan.h:120
point dimensions(entity_system::entity site) const
Dimensions getter.
Definition: sites.h:66
unsigned number_of_sites(entity_system::entity row) const
Number of sites getter.
Definition: rows.h:66
void row_destroy(entity_system::entity row)
Destroys a row.
Definition: floorplan.cpp:64
entity_system::entity row_insert(entity_system::entity site, unsigned number_of_sites, point origin)
Inserts a new row.
Definition: floorplan.cpp:52
std::size_t site_count() const
Returns the number of sites.
Definition: floorplan.h:93
std::string name(entity_system::entity site) const
Name getter.
Definition: sites.h:56
point chip_boundaries() const
Chip boundaries getter.
Definition: floorplan.h:67
std::string site_name(entity_system::entity site) const
Site name getter.
Definition: floorplan.h:103
const rows & rows_properties() const
Rows properties getter.
Definition: floorplan.h:207
Rows class.
Definition: rows.h:34
Definition: floorplan.h:216
void site_destroy(entity_system::entity site)
Destroys a site.
Definition: floorplan.cpp:43
Sites class.
Definition: sites.h:34
point site_dimensions(entity_system::entity site) const
Site dimensions getter.
Definition: floorplan.h:112
point row_origin(entity_system::entity row) const
Row origin getter.
Definition: floorplan.h:192
entity_system::entity site_insert(std::string name, point dimensions)
Inserts a new site.
Definition: floorplan.cpp:31
std::size_t row_count() const
Returns the number of rows.
Definition: floorplan.h:164
entity_system::entity find_row(point point)
Finds a row.
Definition: floorplan.cpp:72
entity_system::entity row_site(entity_system::entity row) const
Row site getter.
Definition: floorplan.h:174
point row_dimensions(entity_system::entity row) const
Row dimensions getter.
Definition: floorplan.cpp:91
point origin(entity_system::entity row) const
Row origin getter.
Definition: rows.h:75
entity_system::entity site(entity_system::entity row) const
Site getter.
Definition: rows.h:57
entity_system class.
Definition: entity_system.h:40
entity_system::entity find_closest_row(point point)
Finds closest row to a point.
Definition: floorplan.cpp:83
std::size_t size() const
Returns the size of the system.
Definition: entity_system.h:82
Floorplan class.
Definition: floorplan.h:37
unsigned row_number_of_sites(entity_system::entity row) const
Row number of sites getter.
Definition: floorplan.h:183