nik2img: make params as variables opt-in
This commit is contained in:
parent
76d5bdae8c
commit
c4e4bbf350
1 changed files with 19 additions and 16 deletions
|
@ -115,24 +115,27 @@ int main (int argc,char** argv)
|
|||
mapnik::request req(map.width(),map.height(),map.get_current_extent());
|
||||
req.set_buffer_size(map.buffer_size());
|
||||
mapnik::attributes vars;
|
||||
mapnik::transcoder tr("utf-8");
|
||||
for (auto const& param : map.get_extra_parameters())
|
||||
if (params_as_variables)
|
||||
{
|
||||
std::string const& name = param.first.substr(1);
|
||||
if (!name.empty())
|
||||
mapnik::transcoder tr("utf-8");
|
||||
for (auto const& param : map.get_extra_parameters())
|
||||
{
|
||||
if (param.second.is<mapnik::value_integer>())
|
||||
std::string const& name = param.first.substr(1);
|
||||
if (!name.empty())
|
||||
{
|
||||
vars[name] = param.second.get<mapnik::value_integer>();
|
||||
}
|
||||
else if (param.second.is<mapnik::value_double>())
|
||||
{
|
||||
vars[name] = param.second.get<mapnik::value_double>();
|
||||
}
|
||||
else if (param.second.is<std::string>())
|
||||
{
|
||||
vars[name] = tr.transcode(param.second.get<std::string>().c_str());
|
||||
std::clog << name << " " << param.second.get<std::string>() << "\n";
|
||||
if (param.second.is<mapnik::value_integer>())
|
||||
{
|
||||
vars[name] = param.second.get<mapnik::value_integer>();
|
||||
}
|
||||
else if (param.second.is<mapnik::value_double>())
|
||||
{
|
||||
vars[name] = param.second.get<mapnik::value_double>();
|
||||
}
|
||||
else if (param.second.is<std::string>())
|
||||
{
|
||||
vars[name] = tr.transcode(param.second.get<std::string>().c_str());
|
||||
std::clog << name << " " << param.second.get<std::string>() << "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue