Compare commits

...

1 commit

Author SHA1 Message Date
Dane Springmeyer
1890d12534 [wip] on #3116 2015-10-07 14:06:49 -07:00
5 changed files with 20 additions and 5 deletions

View file

@ -36,12 +36,15 @@ namespace mapnik {
struct attribute
{
std::string name_;
bool is_id_;
explicit attribute(std::string const& name)
: name_(name) {}
: name_(name),
is_id_(name == "__id__") {}
template <typename V ,typename F>
V const& value(F const& f) const
{
if (is_id_) return f.id();
return f.get(name_);
}

View file

@ -62,7 +62,7 @@ struct expression_attributes
void operator() (attribute const& attr) const
{
names_.emplace(attr.name());
if (attr.name() != "__id__") names_.emplace(attr.name());
}
template <typename Tag>

View file

@ -77,6 +77,10 @@ struct evaluate
value_type operator() (global_attribute const& attr) const
{
if (attr.name == "@id")
{
return feature_.id();
}
auto itr = vars_.find(attr.name);
if (itr != vars_.end())
{

View file

@ -67,8 +67,16 @@ namespace path_processor_detail
void operator() (attribute const& attr) const
{
// convert mapnik::value to std::string
value const& val = feature_.get(attr.name());
filename_ += val.to_string();
std::string const& name = attr.name();
if (name == "__id__")
{
std::clog << "TODO\n";
}
else
{
value const& val = feature_.get(name);
filename_ += val.to_string();
}
}
std::string & filename_;

View file

@ -177,7 +177,7 @@ struct grid_renderer : renderer_base<mapnik::image_rgba8>
}
if (val < 0)
{
throw std::runtime_error("grid renderer: feature id is negative.");
val = std::abs(val);
}
val *= 100;