30 #include "video/renderbackend.h"
31 #include "util/math/fife_math.h"
32 #include "util/log/logger.h"
33 #include "model/metamodel/grids/cellgrid.h"
34 #include "model/structures/instance.h"
35 #include "model/structures/layer.h"
36 #include "model/structures/location.h"
38 #include "view/camera.h"
39 #include "cellselectionrenderer.h"
43 static Logger _log(LM_VIEWVIEW);
55 m_color(old.m_color) {
76 std::vector<Location>::const_iterator it = m_locations.begin();
77 for (; it != m_locations.end(); it++) {
78 if (*it == *loc)
return;
81 m_locations.push_back(Location(*loc));
87 std::vector<Location>::iterator it = m_locations.begin();
88 for (; it != m_locations.end(); it++) {
90 m_locations.erase(it);
98 if (m_locations.empty()) {
102 std::vector<Location>::const_iterator locit = m_locations.begin();
103 for (; locit != m_locations.end(); locit++) {
104 const Location loc = *locit;
105 if (layer != loc.getLayer()) {
111 FL_WARN(_log,
"No cellgrid assigned to layer, cannot draw selection");
115 std::vector<ExactModelCoordinate> vertices;
116 cg->getVertices(vertices, loc.getLayerCoordinates());
117 std::vector<ExactModelCoordinate>::const_iterator it = vertices.begin();
119 Point pt1(firstpt.x, firstpt.y);
122 for (; it != vertices.end(); it++) {
124 pt2.x = pts.x; pt2.y = pts.y;
127 m_renderbackend->
drawLine(cpt1, cpt2, m_color.r, m_color.g, m_color.b);
130 m_renderbackend->
drawLine(pt2,
Point(firstpt.x, firstpt.y), m_color.r, m_color.g, m_color.b);
134 void CellSelectionRenderer::setColor(uint8_t r, uint8_t g, uint8_t b) {