+ make vertex() and rewind() methods const
+ remove unused coord_transforms + rename coord_transform2 to coord_transform
This commit is contained in:
parent
6190cf22f1
commit
500f57cf60
22 changed files with 30 additions and 93 deletions
|
@ -194,7 +194,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
|||
boost::get<1>(*itr).to_string().c_str()));
|
||||
}
|
||||
|
||||
typedef mapnik::coord_transform2<mapnik::CoordTransform,mapnik::geometry_type> path_type;
|
||||
typedef mapnik::coord_transform<mapnik::CoordTransform,mapnik::geometry_type> path_type;
|
||||
|
||||
for (unsigned i=0; i<feat->num_geometries();++i)
|
||||
{
|
||||
|
|
|
@ -38,45 +38,20 @@ namespace mapnik
|
|||
|
||||
typedef coord_array<coord2d> CoordinateArray;
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform
|
||||
{
|
||||
coord_transform(Transform const& t, Geometry& geom)
|
||||
: t_(t), geom_(geom) {}
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x, y);
|
||||
t_.forward(x, y);
|
||||
return command;
|
||||
}
|
||||
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry& geom_;
|
||||
};
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform2
|
||||
{
|
||||
typedef std::size_t size_type;
|
||||
//typedef typename Geometry::value_type value_type;
|
||||
|
||||
coord_transform2(Transform const& t,
|
||||
coord_transform(Transform const& t,
|
||||
Geometry & geom,
|
||||
proj_transform const& prj_trans)
|
||||
: t_(&t),
|
||||
geom_(geom),
|
||||
prj_trans_(&prj_trans) {}
|
||||
|
||||
explicit coord_transform2(Geometry & geom)
|
||||
explicit coord_transform(Geometry & geom)
|
||||
: t_(0),
|
||||
geom_(geom),
|
||||
prj_trans_(0) {}
|
||||
|
@ -91,7 +66,7 @@ struct MAPNIK_DECL coord_transform2
|
|||
t_ = &t;
|
||||
}
|
||||
|
||||
unsigned vertex(double *x, double *y)
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = SEG_MOVETO;
|
||||
bool ok = false;
|
||||
|
@ -113,7 +88,7 @@ struct MAPNIK_DECL coord_transform2
|
|||
return command;
|
||||
}
|
||||
|
||||
void rewind(unsigned pos)
|
||||
void rewind(unsigned pos) const
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
@ -129,44 +104,6 @@ private:
|
|||
proj_transform const* prj_trans_;
|
||||
};
|
||||
|
||||
|
||||
template <typename Transform, typename Geometry>
|
||||
struct MAPNIK_DECL coord_transform3
|
||||
{
|
||||
coord_transform3(Transform const& t,
|
||||
Geometry const& geom,
|
||||
proj_transform const& prj_trans,
|
||||
int dx, int dy)
|
||||
: t_(t),
|
||||
geom_(geom),
|
||||
prj_trans_(prj_trans),
|
||||
dx_(dx), dy_(dy) {}
|
||||
|
||||
unsigned vertex(double *x, double *y) const
|
||||
{
|
||||
unsigned command = geom_.vertex(x, y);
|
||||
double z = 0;
|
||||
prj_trans_.backward(*x, *y, z);
|
||||
t_.forward(x, y);
|
||||
*x += dx_;
|
||||
*y += dy_;
|
||||
return command;
|
||||
}
|
||||
|
||||
void rewind(unsigned pos)
|
||||
{
|
||||
geom_.rewind(pos);
|
||||
}
|
||||
|
||||
private:
|
||||
Transform const& t_;
|
||||
Geometry const& geom_;
|
||||
proj_transform const& prj_trans_;
|
||||
int dx_;
|
||||
int dy_;
|
||||
};
|
||||
|
||||
|
||||
class CoordTransform
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
class metawriter
|
||||
{
|
||||
public:
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
metawriter(metawriter_properties dflt_properties) :
|
||||
dflt_properties_(dflt_properties),
|
||||
width_(0),
|
||||
|
|
|
@ -47,8 +47,8 @@ class string_info;
|
|||
class text_path;
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> ClippedPathType;
|
||||
typedef coord_transform2<CoordTransform,geometry_type> PathType;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> ClippedPathType;
|
||||
typedef coord_transform<CoordTransform,geometry_type> PathType;
|
||||
|
||||
typedef label_collision_detector4 DetectorType;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace mapnik { namespace svg {
|
|||
template <typename OutputIterator>
|
||||
class svg_generator : private boost::noncopyable
|
||||
{
|
||||
typedef coord_transform2<CoordTransform, geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform, geometry_type> path_type;
|
||||
|
||||
typedef svg::svg_root_attributes_grammar<OutputIterator> root_attributes_grammar;
|
||||
typedef svg::svg_rect_attributes_grammar<OutputIterator> rect_attributes_grammar;
|
||||
|
|
|
@ -94,7 +94,7 @@ BOOST_FUSION_ADAPT_STRUCT(
|
|||
*/
|
||||
namespace boost { namespace spirit { namespace traits {
|
||||
|
||||
typedef mapnik::coord_transform2<mapnik::CoordTransform, mapnik::geometry_type> path_type;
|
||||
typedef mapnik::coord_transform<mapnik::CoordTransform, mapnik::geometry_type> path_type;
|
||||
|
||||
template <>
|
||||
struct is_container<path_type const>
|
||||
|
|
|
@ -174,7 +174,7 @@ private:
|
|||
* Each coordinate is stored twice to match the needs of the grammar.
|
||||
*/
|
||||
typedef path_iterator<boost::tuple<unsigned, geometry_type::value_type, geometry_type::value_type>,
|
||||
coord_transform2<CoordTransform, geometry_type> > path_iterator_type;
|
||||
coord_transform<CoordTransform, geometry_type> > path_iterator_type;
|
||||
|
||||
}}
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ template <typename T>
|
|||
struct converter_traits<T,mapnik::transform_tag>
|
||||
{
|
||||
typedef T geometry_type;
|
||||
typedef coord_transform2<CoordTransform, geometry_type> conv_type;
|
||||
typedef coord_transform<CoordTransform, geometry_type> conv_type;
|
||||
|
||||
template <typename Args>
|
||||
static void setup(geometry_type & geom, Args const& args)
|
||||
|
|
|
@ -47,7 +47,7 @@ void agg_renderer<T>::process(building_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base;
|
||||
typedef agg::renderer_scanline_aa_solid<ren_base> renderer;
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef agg::rgba8 color_type;
|
||||
typedef agg::order_rgba order_type;
|
||||
typedef agg::pixel32_type pixel_type;
|
||||
|
|
|
@ -53,7 +53,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
agg::rendering_buffer buf(current_buffer_->raw_data(), width_, height_, width_ * 4);
|
||||
ras_ptr->reset();
|
||||
|
|
|
@ -857,7 +857,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
|
||||
cairo_context context(context_);
|
||||
context.set_operator(sym.comp_op());
|
||||
|
@ -1026,7 +1026,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height());
|
||||
}
|
||||
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
agg::trans_affine transform;
|
||||
mapnik::path_ptr vmarker = *marker.get_vector_data();
|
||||
using namespace mapnik::svg;
|
||||
|
@ -1207,7 +1207,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
|
||||
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance()->find(filename,true);
|
||||
|
@ -1368,7 +1368,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
double scale_factor_ = 1;
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
agg::trans_affine tr;
|
||||
boost::array<double,6> const& m = sym.get_image_transform();
|
||||
|
|
|
@ -104,7 +104,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigne
|
|||
{
|
||||
if (marker.is_vector())
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -46,7 +46,7 @@ void grid_renderer<T>::process(building_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -45,7 +45,7 @@ void grid_renderer<T>::process(line_pattern_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -45,7 +45,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -55,7 +55,7 @@ void grid_renderer<T>::process(markers_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -44,7 +44,7 @@ void grid_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -44,7 +44,7 @@ void grid_renderer<T>::process(polygon_symbolizer const& sym,
|
|||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
{
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base;
|
||||
typedef agg::renderer_scanline_bin_solid<ren_base> renderer;
|
||||
agg::scanline_bin sl;
|
||||
|
|
|
@ -232,8 +232,8 @@ void markers_placement<Locator, Detector>::set_spacing_left(double sl, bool allo
|
|||
}
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> clipped_path_type;
|
||||
typedef coord_transform<CoordTransform,geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> clipped_path_type;
|
||||
|
||||
template class markers_placement<path_type, label_collision_detector4>;
|
||||
template class markers_placement<clipped_path_type, label_collision_detector4>;
|
||||
|
|
|
@ -32,7 +32,7 @@ bool svg_renderer<OutputIterator>::process(rule::symbolizers const& syms,
|
|||
{
|
||||
// svg renderer supports processing of multiple symbolizers.
|
||||
|
||||
typedef coord_transform2<CoordTransform, geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform, geometry_type> path_type;
|
||||
|
||||
// process each symbolizer to collect its (path) information.
|
||||
// path information (attributes from line_ and polygon_ symbolizers)
|
||||
|
|
|
@ -53,7 +53,7 @@ bool text_symbolizer_helper<FaceManagerT, DetectorT>::next_line_placement()
|
|||
}
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
typedef coord_transform<CoordTransform,clipped_geometry_type> path_type;
|
||||
clipped_geometry_type clipped(**geo_itr_);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_, clipped, prj_trans_);
|
||||
|
|
Loading…
Reference in a new issue