21 #ifndef RENDERER_PRIVATE_HPP 22 #define RENDERER_PRIVATE_HPP 24 #include <boost/unordered_map.hpp> 28 #define RENDERER_SHIELD_DISTANCE 128.0 29 #define RENDERER_SHIELD_OVERLAP 0.1 30 #define RENDERER_LABEL_OVERLAP 0.1 32 #define COLOR2RGBA(_X) _X.r, _X.g, _X.b, _X.a 39 boost::unordered_map<string, cairo_surface_t*>
images;
44 for (
auto& pair : images)
45 cairo_surface_destroy(pair.second);
50 auto it = images.find(path);
51 if (it != images.end())
54 cairo_surface_t* image = cairo_image_surface_create_from_png(path.c_str());
55 images.insert(std::make_pair(path, image));
93 :
Label(box, owner, text, s, origin),
void translate(double dx, double dy)
used by the placement algorith to move the shield
boost::unordered_map< string, cairo_surface_t * > images
Represents a string which could be cached into an internal cache.
void translate(double dx, double dy)
used by the placement algorith to move the label
Stores bounding box and style of a label that needs to be placed.
Shield(const FloatRect &box, const FloatRect &owner, const MaybeCachedString &text, const Style *s, const FloatPoint &origin, const FloatRect &shield)
A Style stores the MapCSS properties for a single Node or Way, or a Relation of type multipolygon...
const Style * style
Style that is used to paint the label.
const MaybeCachedString & text
The text that should be used (don't use the style text to make it generic)
FloatRect shield
Dimensions of the shield that should be painted.
basic_rect< T > translate(T dx, T dy) const
FloatRect owner
bounding box of the object owing the label in device-space coordinates
FloatRect box
bounding box in device-space coordinates
cairo_surface_t * getImage(string path)
FloatPoint origin
Origin of the label.
Label(const FloatRect &box, const FloatRect &owner, const MaybeCachedString &text, const Style *s, const FloatPoint &origin)