Bugfix + better performance.
This commit is contained in:
parent
eec4864f41
commit
8f8903baa5
4 changed files with 13 additions and 14 deletions
|
@ -81,6 +81,7 @@ class metawriter
|
|||
metawriter_properties const& properties = metawriter_properties())=0;
|
||||
virtual void start(metawriter_property_map const& properties) {};
|
||||
virtual void stop() {};
|
||||
metawriter_properties const& get_default_properties() const { return dflt_properties_;}
|
||||
protected:
|
||||
metawriter_properties dflt_properties_;
|
||||
};
|
||||
|
|
|
@ -59,11 +59,13 @@ class MAPNIK_DECL symbolizer_base {
|
|||
/** Get properties needed for metawriter.
|
||||
* \note This function is a helperfunction for class attribute_collector.
|
||||
*/
|
||||
metawriter_properties const& get_metawriter_properties() const { return properties_;}
|
||||
metawriter_properties const& get_metawriter_properties() const {return properties_complete_;};
|
||||
private:
|
||||
metawriter_properties properties_;
|
||||
metawriter_properties properties_complete_;
|
||||
std::string writer_name_;
|
||||
metawriter_ptr writer_ptr_;
|
||||
|
||||
};
|
||||
|
||||
typedef boost::array<double,6> transform_type;
|
||||
|
|
|
@ -83,18 +83,7 @@ void metawriter_json_stream::add_box(box2d<double> box, Feature const &feature,
|
|||
proj_transform const& prj_trans, CoordTransform const &t,
|
||||
const metawriter_properties& properties)
|
||||
{
|
||||
metawriter_properties props(properties);
|
||||
if (props.empty())
|
||||
{
|
||||
props = dflt_properties_;
|
||||
}
|
||||
|
||||
#ifdef MAPNIK_DEBUG
|
||||
if (props.empty())
|
||||
{
|
||||
std::cerr << "WARNING: No properties available for GeoJSON metawriter.\n";
|
||||
}
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
std::cerr << "WARNING: Metawriter not started before using it.\n";
|
||||
|
@ -134,7 +123,7 @@ void metawriter_json_stream::add_box(box2d<double> box, Feature const &feature,
|
|||
"\n \"properties\": {";
|
||||
std::map<std::string, value> fprops = feature.props();
|
||||
int i = 0;
|
||||
BOOST_FOREACH(std::string p, props)
|
||||
BOOST_FOREACH(std::string p, properties)
|
||||
{
|
||||
std::map<std::string, value>::const_iterator itr = fprops.find(p);
|
||||
std::string text;
|
||||
|
|
|
@ -36,11 +36,18 @@ void symbolizer_base::add_metawriter(std::string const& name, metawriter_propert
|
|||
void symbolizer_base::cache_metawriters(Map const &m)
|
||||
{
|
||||
writer_ptr_ = m.find_metawriter(writer_name_);
|
||||
if (writer_ptr_) {
|
||||
properties_complete_ = writer_ptr_->get_default_properties();
|
||||
properties_complete_.insert(properties_.begin(), properties_.end());
|
||||
} else {
|
||||
properties_complete_.clear();
|
||||
std::cerr << "WARNING: Metawriter '" << writer_name_ << "' used but not defined.\n";
|
||||
}
|
||||
}
|
||||
|
||||
metawriter_with_properties symbolizer_base::get_metawriter() const
|
||||
{
|
||||
return metawriter_with_properties(writer_ptr_, properties_);
|
||||
return metawriter_with_properties(writer_ptr_, properties_complete_);
|
||||
}
|
||||
|
||||
symbolizer_with_image::symbolizer_with_image(path_expression_ptr file)
|
||||
|
|
Loading…
Reference in a new issue