예제 #1
0
    void operator() (mapnik::geometry::multi_point<T> const& mp1, mapnik::geometry::multi_point<T> const& mp2)
    {
        if (mp1.size() != mp2.size())
        {
            REQUIRE(false);
        }

        for(auto const& p : zip_crange(mp1, mp2))
        {
            REQUIRE(p.template get<0>().x == Approx(p.template get<1>().x));
            REQUIRE(p.template get<0>().y == Approx(p.template get<1>().y));
        }
    }
inline bool encode_geometry(mapnik::geometry::multi_point<std::int64_t> const& geom,
                            vector_tile::Tile_Feature & current_feature,
                            int32_t & start_x,
                            int32_t & start_y)
{
    std::size_t geom_size = geom.size();
    if (geom_size <= 0)
    {
        return false;
    }
    current_feature.add_geometry(1u | (geom_size << 3)); // move_to | (len << 3)
    for (auto const& pt : geom)
    {
        int32_t dx = pt.x - start_x;
        int32_t dy = pt.y - start_y;
        // Manual zigzag encoding.
        current_feature.add_geometry(protozero::encode_zigzag32(dx));
        current_feature.add_geometry(protozero::encode_zigzag32(dy));
        start_x = pt.x;
        start_y = pt.y;
    }
    return true;
}