88 return "CellRenderer";
94 FL_WARN(
_log,
"No cellgrid assigned to layer, cannot draw grid");
99 FL_WARN(
_log,
"No cellcache on layer created, cannot draw cells");
108 std::vector<Cell*>::iterator cit = cells.begin();
109 for (; cit != cells.end(); ++cit) {
112 std::vector<ExactModelCoordinate> vertices;
113 cg->
getVertices(vertices, (*cit)->getLayerCoordinates());
114 std::vector<ExactModelCoordinate>::const_iterator it = vertices.begin();
115 int32_t halfind = vertices.size() / 2;
117 Point pt1(firstpt.
x, firstpt.
y);
120 for (; it != vertices.end(); it++) {
139 std::set<std::string>::iterator cost_it =
m_visualCosts.begin();
141 std::vector<std::string> cell_costs = cache->
getCellCosts(*cit);
142 std::vector<std::string>::iterator cc_it = cell_costs.begin();
143 for (; cc_it != cell_costs.end(); ++cc_it) {
144 if (*cc_it == *cost_it) {
146 cost = cache->
getCost(*cost_it);
159 std::stringstream stream;
185 Route* route = (*it)->getRoute();
189 Path::iterator pit = path.begin();
190 for (; pit != path.end(); ++pit) {
191 if ((*pit).getLayer() != layer) {
194 std::vector<ExactModelCoordinate> vertices;
195 cg->
getVertices(vertices, (*pit).getLayerCoordinates());
196 std::vector<ExactModelCoordinate>::const_iterator it = vertices.begin();
197 int32_t halfind = vertices.size() / 2;
199 Point pt1(firstpt.
x, firstpt.
y);
202 for (; it != vertices.end(); it++) {
258 for (std::vector<Instance*>::iterator it =
m_visualPaths.begin();
261 if (*it == instance) {
277 std::set<std::string>::iterator it =
m_visualCosts.find(costId);
std::vector< Instance * > m_visualPaths
#define FL_WARN(logger, msg)
Abstract interface for all the renderbackends.
static CellRenderer * getInstance(IRendererContainer *cnt)
Gets instance for interface access.
void addPathVisual(Instance *instance)
Adds a instance to path visualization.
void setLayerCoordinates(const ModelCoordinate &coordinates)
Sets "cell precise" layer coordinates to this location.
std::vector< RenderItem * > RenderList
std::list< Location > Path
A path is a list with locations. Each location holds the coordinate for one cell. ...
T h
Height of the rectangle.
std::vector< std::string > getCellCosts(Cell *cell)
Returns cost identifiers for cell.
std::set< std::string > m_visualCosts
std::vector< Cell * > getCellsInRect(const Rect &rec)
Returns all cells in the rect.
A CellCache is an abstract depiction of one or a few layers and contains additional information...
CellCache * getCellCache()
Returns the CellCache of this layer.
Interface to class owning the renderers Used to get correct subclass of renderer in scripting side (v...
virtual Image * getAsImage(const std::string &text)=0
Gets given text as Image The rsulting image is pooled, so it's not that time critical.
static Logger _log(LM_AUDIO)
IFont * getFont()
Returns the font.
virtual RendererBase * getRenderer(const std::string &renderername)=0
Returns renderer with given name.
Camera describes properties of a view port shown in the main screen Main screen can have multiple cam...
virtual void getVertices(std::vector< ExactModelCoordinate > &vtx, const ModelCoordinate &cell)=0
Fills given point vector with vertices from selected cell.
void setBlockerColor(uint8_t r, uint8_t g, uint8_t b)
Sets color that is used to visualize blocker.
RenderBackend * m_renderbackend
PointType2D< int32_t > Point
uint32_t getHeight() const
static bool Equal(T _val1, T _val2)
Base class for all view renderers View renderer renders one aspect of the view shown on screen...
void removePathVisual(Instance *instance)
Removes a instance from path visualization.
bool isEnabledCost(const std::string &costId)
Gets whether a cost visualization is enabled.
CellRenderer(RenderBackend *renderbackend, int32_t position)
Constructor.
void setEnabledCost(const std::string &costId, bool enabled)
Enables cost visualization.
virtual void drawLine(const Point &p1, const Point &p2, uint8_t r, uint8_t g, uint8_t b, uint8_t a=255)=0
Draws line between given points with given RGBA.
virtual void setEnabled(bool enabled)
Enables renderer.
void setEnabledPathVisual(bool enabled)
Enables path visualization.
void setEnabledBlocking(bool enabled)
Enables blocking visualization.
double getZoom() const
Gets camera zoom.
Path getPath()
Returns the path.
CellGrid * getCellGrid() const
Get the Cellgrid.
Pure abstract Font interface.
void setPathColor(uint8_t r, uint8_t g, uint8_t b)
Sets color that is used to visualize paths.
virtual void render(const Rect &rect, uint8_t alpha=255, uint8_t const *rgb=0)=0
Renders itself to the current render target (main screen or attached destination image) at the rectan...
ScreenPoint toScreenCoordinates(const ExactModelCoordinate &map_coords)
Transforms given point from map coordinates to screen coordinates.
void render(Camera *cam, Layer *layer, RenderList &instances)
This method is called by the view to ask renderer to draw its rendering aspect based on given paramet...
void setFont(IFont *font)
Sets the font.
std::string getName()
Returns the renderer name.
bool isEnabledBlocking()
Gets whether blocking visualization is enabled.
ExactModelCoordinate getMapCoordinates() const
Gets map coordinates set to this location.
RendererBase * clone()
Makes copy of this renderer.
double getCost(const std::string &costId)
Returns the cost value for the given id.
ExactModelCoordinate toMapCoordinates(const ModelCoordinate &layer_coords)
Transforms given point from layer coordinates to map coordinates.
T w
Width of the rectangle.
An Instance is an "instantiation" of an Object at a Location.
bool isEnabledPathVisual()
Gets whether path visualization is enabled.
uint32_t getWidth() const
Rect getLayerViewPort(Layer *layer)
Gets the viewport for camera in layer coordinates.
virtual ~CellRenderer()
Destructor.