rework projection code

- make use of osmium's proj wrapper class CRS
- use virtual functions instead of switching over projection
- remove duplicate code (mainly WSG84 to mercator transformation)
- use custom projections also with --proj 4326 and 900913 (fixes #514)
This commit is contained in:
Sarah Hoffmann
2016-01-12 00:01:07 +01:00
parent ccd4ebe9a6
commit 0a6238da51
18 changed files with 184 additions and 280 deletions

View File

@ -134,21 +134,21 @@ void test_outputs()
int get_random_proj(std::vector<std::string>& args)
{
int proj = rand() % (PROJ_COUNT + 1);
int proj = rand() % 3;
switch(proj)
{
case PROJ_LATLONG:
case PROJ_SPHERE_MERC:
args.push_back(reprojection(proj).project_getprojinfo()->option);
break;
default:
args.push_back("--proj");
//nice contiguous block of valid epsgs here randomly use one of those..
proj = (rand() % (2962 - 2308)) + 2308;
args.push_back((boost::format("%1%") % proj).str());
proj = -proj;
break;
case 1:
args.push_back("-l");
return PROJ_LATLONG;
case 2:
args.push_back("-m");
return PROJ_SPHERE_MERC;
}
args.push_back("--proj");
//nice contiguous block of valid epsgs here randomly use one of those..
proj = (rand() % (2962 - 2308)) + 2308;
args.push_back((boost::format("%1%") % proj).str());
return proj;
}
@ -206,7 +206,7 @@ void test_random_perms()
args.push_back("osm2pgsql");
//pick a projection
options.projection.reset(new reprojection(get_random_proj(args)));
options.projection.reset(reprojection::create_projection(get_random_proj(args)));
//pick a style file
std::string style = get_random_string(15);