+ aligned postgis to use the new box2d::from_string
+ thrash usage of static string for datasource name
This commit is contained in:
parent
0d895b1e59
commit
cffa0a07d6
2 changed files with 2 additions and 36 deletions
|
@ -97,38 +97,7 @@ postgis_datasource::postgis_datasource(parameters const& params, bool bind)
|
||||||
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
|
multiple_geometries_ = *params_.get<mapnik::boolean>("multiple_geometries",false);
|
||||||
|
|
||||||
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
boost::optional<std::string> ext = params_.get<std::string>("extent");
|
||||||
if (ext)
|
if (ext) extent_initialized_ = extent_.from_string(*ext);
|
||||||
{
|
|
||||||
boost::char_separator<char> sep(", ");
|
|
||||||
boost::tokenizer<boost::char_separator<char> > tok(*ext,sep);
|
|
||||||
unsigned i = 0;
|
|
||||||
bool success = false;
|
|
||||||
double d[4];
|
|
||||||
for (boost::tokenizer<boost::char_separator<char> >::iterator beg=tok.begin();
|
|
||||||
beg!=tok.end();++beg)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
d[i] = boost::lexical_cast<double>(boost::trim_copy(*beg));
|
|
||||||
}
|
|
||||||
catch (boost::bad_lexical_cast & ex)
|
|
||||||
{
|
|
||||||
clog << *beg << " : " << ex.what() << "\nAre your coordinates each separated by commas?\n";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (i==3)
|
|
||||||
{
|
|
||||||
success = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
if (success)
|
|
||||||
{
|
|
||||||
extent_.init(d[0],d[1],d[2],d[3]);
|
|
||||||
extent_initialized_ = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bind)
|
if (bind)
|
||||||
{
|
{
|
||||||
|
@ -320,11 +289,9 @@ void postgis_datasource::bind() const
|
||||||
is_bound_ = true;
|
is_bound_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const postgis_datasource::name_="postgis";
|
|
||||||
|
|
||||||
std::string postgis_datasource::name()
|
std::string postgis_datasource::name()
|
||||||
{
|
{
|
||||||
return name_;
|
return "postgis";
|
||||||
}
|
}
|
||||||
|
|
||||||
int postgis_datasource::type() const
|
int postgis_datasource::type() const
|
||||||
|
|
|
@ -70,7 +70,6 @@ class postgis_datasource : public datasource
|
||||||
mutable layer_descriptor desc_;
|
mutable layer_descriptor desc_;
|
||||||
ConnectionCreator<Connection> creator_;
|
ConnectionCreator<Connection> creator_;
|
||||||
bool multiple_geometries_;
|
bool multiple_geometries_;
|
||||||
static const std::string name_;
|
|
||||||
const std::string bbox_token_;
|
const std::string bbox_token_;
|
||||||
const std::string scale_denom_token_;
|
const std::string scale_denom_token_;
|
||||||
bool persist_connection_;
|
bool persist_connection_;
|
||||||
|
|
Loading…
Reference in a new issue