c++ style

This commit is contained in:
artemp 2014-07-22 15:58:37 +01:00
parent 8cc9b06e12
commit f12b5e06dd
2 changed files with 81 additions and 85 deletions

View file

@ -45,27 +45,25 @@ namespace mapnik {
class proj_transform; class proj_transform;
/* General: // General:
*
* The approach here is to run the normal symbolizers, but in // The approach here is to run the normal symbolizers, but in
* a 'virtual' blank environment where the changes that they // a 'virtual' blank environment where the changes that they
* make are recorded (the detector, the render_* calls). // make are recorded (the detector, the render_* calls).
* //
* The recorded boxes are then used to lay out the items and // The recorded boxes are then used to lay out the items and
* the offsets from old to new positions can be used to perform // the offsets from old to new positions can be used to perform
* the actual rendering calls. // the actual rendering calls.
*
* This should allow us to re-use as much as possible of the // This should allow us to re-use as much as possible of the
* existing symbolizer layout and rendering code while still // existing symbolizer layout and rendering code while still
* being able to interpose our own decisions about whether // being able to interpose our own decisions about whether
* a collision has occured or not. // a collision has occured or not.
*/
// Thunk for rendering a particular instance of a point - this
// stores all the arguments necessary to re-render this point
// symbolizer at a later time.
/**
* Thunk for rendering a particular instance of a point - this
* stores all the arguments necessary to re-render this point
* symbolizer at a later time.
*/
struct point_render_thunk struct point_render_thunk
{ {
pixel_position pos_; pixel_position pos_;
@ -95,22 +93,20 @@ struct text_render_thunk
halo_rasterizer_enum halo_rasterizer); halo_rasterizer_enum halo_rasterizer);
}; };
/** // Variant type for render thunks to allow us to re-render them
* Variant type for render thunks to allow us to re-render them // via a static visitor later.
* via a static visitor later.
*/
using render_thunk = boost::variant<point_render_thunk, using render_thunk = boost::variant<point_render_thunk,
text_render_thunk>; text_render_thunk>;
using render_thunk_ptr = std::shared_ptr<render_thunk>; using render_thunk_ptr = std::shared_ptr<render_thunk>;
using render_thunk_list = std::list<render_thunk_ptr>; using render_thunk_list = std::list<render_thunk_ptr>;
/** // Base class for extracting the bounding boxes associated with placing
* Base class for extracting the bounding boxes associated with placing // a symbolizer at a fake, virtual point - not real geometry.
* a symbolizer at a fake, virtual point - not real geometry. //
* // The bounding boxes can be used for layout, and the thunks are
* The bounding boxes can be used for layout, and the thunks are // used to re-render at locations according to the group layout.
* used to re-render at locations according to the group layout.
*/
struct render_thunk_extractor : public boost::static_visitor<> struct render_thunk_extractor : public boost::static_visitor<>
{ {
render_thunk_extractor(box2d<double> & box, render_thunk_extractor(box2d<double> & box,
@ -319,7 +315,8 @@ void render_group_symbolizer(group_symbolizer const &sym,
// evalute the repeat key with the matched sub feature if we have one // evalute the repeat key with the matched sub feature if we have one
if (rpt_key_expr) if (rpt_key_expr)
{ {
rpt_key_value = boost::apply_visitor(evaluate<Feature,value_type,attributes>(*match_feature,common.vars_), *rpt_key_expr).to_unicode(); rpt_key_value = boost::apply_visitor(evaluate<Feature,value_type,attributes>(*match_feature,common.vars_),
*rpt_key_expr).to_unicode();
} }
helper.add_box_element(layout_manager.offset_box_at(i), rpt_key_value); helper.add_box_element(layout_manager.offset_box_at(i), rpt_key_value);
} }
@ -334,9 +331,8 @@ void render_group_symbolizer(group_symbolizer const &sym,
{ {
for (size_t layout_i = 0; layout_i < num_layout_thunks; ++layout_i) for (size_t layout_i = 0; layout_i < num_layout_thunks; ++layout_i)
{ {
const pixel_position &offset = layout_manager.offset_at(layout_i); pixel_position const& offset = layout_manager.offset_at(layout_i);
pixel_position render_offset = pos + offset; pixel_position render_offset = pos + offset;
render_thunks(layout_thunks[layout_i], render_offset); render_thunks(layout_thunks[layout_i], render_offset);
} }
} }