Merge branch 'master' into boost_1_67

This commit is contained in:
Artem Pavlenko 2018-07-20 11:53:47 +01:00
commit 5fe0dda890
2 changed files with 43 additions and 32 deletions

View file

@ -87,7 +87,7 @@ namespace mapnik { namespace grammar {
auto do_attribute = [] (auto const& ctx)
{
auto & attr = _attr(ctx);
auto const& attr = _attr(ctx);
if (attr == "mapnik::geometry_type")
{
_val(ctx) = std::move(geometry_type_attribute());

View file

@ -25,20 +25,23 @@ SECTION("Test bounding box transforms - 4326 to 3857")
double maxy = 75.0;
mapnik::box2d<double> bbox(minx, miny, maxx, maxy);
prj_trans.forward(bbox);
INFO(bbox.to_string());
CHECKED_IF(prj_trans.forward(bbox))
{
CHECK(bbox.minx() == Approx(-5009377.085697311));
CHECK(bbox.miny() == Approx(7361866.1130511891));
CHECK(bbox.maxx() == Approx(-4452779.631730943));
CHECK(bbox.maxy() == Approx(12932243.1119920239));
}
prj_trans.backward(bbox);
CHECKED_IF(prj_trans.backward(bbox))
{
CHECK(bbox.minx() == Approx(minx));
CHECK(bbox.miny() == Approx(miny));
CHECK(bbox.maxx() == Approx(maxx));
CHECK(bbox.maxy() == Approx(maxy));
}
}
@ -145,22 +148,26 @@ SECTION("Test proj antimeridian bbox")
{
mapnik::box2d<double> ext(274000, 3087000, 3327000, 7173000);
prj_trans_fwd.forward(ext, PROJ_ENVELOPE_POINTS);
CHECKED_IF(prj_trans_fwd.forward(ext, PROJ_ENVELOPE_POINTS))
{
CHECK(ext.minx() == Approx(better.minx()));
CHECK(ext.miny() == Approx(better.miny()));
CHECK(ext.maxx() == Approx(better.maxx()));
CHECK(ext.maxy() == Approx(better.maxy()));
}
}
{
// check the same logic works for .backward()
mapnik::box2d<double> ext(274000, 3087000, 3327000, 7173000);
prj_trans_rev.backward(ext, PROJ_ENVELOPE_POINTS);
CHECKED_IF(prj_trans_rev.backward(ext, PROJ_ENVELOPE_POINTS))
{
CHECK(ext.minx() == Approx(better.minx()));
CHECK(ext.miny() == Approx(better.miny()));
CHECK(ext.maxx() == Approx(better.maxx()));
CHECK(ext.maxy() == Approx(better.maxy()));
}
}
// reference values taken from proj4 command line tool:
//
@ -177,22 +184,26 @@ SECTION("Test proj antimeridian bbox")
{
// checks for not being snapped (ie. not antimeridian)
mapnik::box2d<double> ext(274000, 3087000, 276000, 7173000);
prj_trans_fwd.forward(ext, PROJ_ENVELOPE_POINTS);
CHECKED_IF(prj_trans_fwd.forward(ext, PROJ_ENVELOPE_POINTS))
{
CHECK(ext.minx() == Approx(normal.minx()));
CHECK(ext.miny() == Approx(normal.miny()));
CHECK(ext.maxx() == Approx(normal.maxx()));
CHECK(ext.maxy() == Approx(normal.maxy()));
}
}
{
// check the same logic works for .backward()
mapnik::box2d<double> ext(274000, 3087000, 276000, 7173000);
prj_trans_rev.backward(ext, PROJ_ENVELOPE_POINTS);
CHECKED_IF(prj_trans_rev.backward(ext, PROJ_ENVELOPE_POINTS))
{
CHECK(ext.minx() == Approx(normal.minx()));
CHECK(ext.miny() == Approx(normal.miny()));
CHECK(ext.maxx() == Approx(normal.maxx()));
CHECK(ext.maxy() == Approx(normal.maxy()));
}
}
}
}