mapbox / mapnik-vector-tile

Mapnik implemention of Mapbox Vector Tile specification
BSD 3-Clause "New" or "Revised" License
553 stars 117 forks source link

encoder_visitor only encodes nonconst points, skipping encoding const& points #100

Closed springmeyer closed 9 years ago

springmeyer commented 9 years ago

The move to simplifying in integer space (https://github.com/mapbox/mapnik-vector-tile/commit/e75bcfcc74ff1bc0908b320129671c7081563a8e#diff-2f08898bf55283bb72b03127f87d076fL883) flipped the signature for the encoder_visitor for points from mapnik::geometry::point<double> const& geom to mapnik::geometry::point<std::int64_t> & geom. The double->int64 is not the problem but rather the dropping of const because then the encoder hits this no-op: https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_processor.ipp#L1199-L1202 (which is intended only to catch geometry_empty and geometry_collection).

I think the best solution to this is to have encoder_visitor only accept const& geom and to avoid mutating the underlying geometries that are passed in.