apply mapnik_format.el formatting
This commit is contained in:
parent
2f10469c8d
commit
93995d7c4b
22 changed files with 202 additions and 202 deletions
|
@ -63,7 +63,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
|||
|
||||
agg::rendering_buffer buf(pixmap_.raw_data(),width_,height_, width_ * 4);
|
||||
agg::pixfmt_rgba32_plain pixf(buf);
|
||||
|
||||
|
||||
box2d<double> ext = query_extent_ * 1.1;
|
||||
if (sym.get_rasterizer() == RASTERIZER_FAST)
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
|
|||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(ext.minx(),ext.miny(),ext.maxx(),ext.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
|
||||
|
||||
if (stroke_.has_dash())
|
||||
{
|
||||
agg::conv_dash<path_type> dash(path);
|
||||
|
|
|
@ -253,7 +253,7 @@ void agg_renderer<T>::process(markers_symbolizer const& sym,
|
|||
|
||||
if (marker_type == ARROW)
|
||||
marker.concat_path(arrow_);
|
||||
|
||||
|
||||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
|
|
|
@ -134,7 +134,7 @@ void agg_renderer<T>::process(polygon_pattern_symbolizer const& sym,
|
|||
if (align == LOCAL_ALIGNMENT)
|
||||
{
|
||||
double x0=0,y0=0;
|
||||
if (num_geometries>0) // FIXME: hmm...?
|
||||
if (num_geometries>0) // FIXME: hmm...?
|
||||
{
|
||||
clipped_geometry_type clipped(feature->get_geometry(0));
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
|
|
|
@ -63,7 +63,7 @@ void agg_renderer<T>::process(polygon_symbolizer const& sym,
|
|||
unsigned a=fill_.alpha();
|
||||
//renb.clip_box(0,0,width_,height_);
|
||||
renderer ren(renb);
|
||||
|
||||
|
||||
ras_ptr->reset();
|
||||
switch (sym.get_gamma_method())
|
||||
{
|
||||
|
|
|
@ -256,7 +256,7 @@ cairo_face_ptr cairo_face_manager::get_face(face_ptr face)
|
|||
entry = boost::make_shared<cairo_face>(font_engine_, face);
|
||||
cache_.insert(std::make_pair(face, entry));
|
||||
}
|
||||
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
@ -712,7 +712,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
}
|
||||
query_extent_ = query_extent;
|
||||
}
|
||||
|
||||
|
||||
void cairo_renderer_base::end_layer_processing(layer const&)
|
||||
{
|
||||
#ifdef MAPNIK_DEBUG
|
||||
|
@ -739,13 +739,13 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
{
|
||||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
context.add_path(path);
|
||||
context.fill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void cairo_renderer_base::process(building_symbolizer const& sym,
|
||||
mapnik::feature_ptr const& feature,
|
||||
proj_transform const& prj_trans)
|
||||
|
@ -862,7 +862,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
|
||||
cairo_context context(context_);
|
||||
mapnik::stroke const& stroke_ = sym.get_stroke();
|
||||
|
||||
|
@ -1065,7 +1065,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
1.0 /*scale_factor*/,
|
||||
t_, font_manager_, detector_, query_extent_);
|
||||
cairo_context context(context_);
|
||||
|
||||
|
||||
while (helper.next()) {
|
||||
placements_type &placements = helper.placements();
|
||||
for (unsigned int ii = 0; ii < placements.size(); ++ii)
|
||||
|
@ -1085,7 +1085,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
{
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
|
||||
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
|
||||
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance()->find(filename,true);
|
||||
if (!marker && !(*marker)->is_bitmap()) return;
|
||||
|
@ -1109,7 +1109,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
|
||||
|
||||
double length(0);
|
||||
double x0(0), y0(0);
|
||||
double x, y;
|
||||
|
@ -1158,7 +1158,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
{
|
||||
typedef agg::conv_clip_polygon<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
|
||||
|
||||
cairo_context context(context_);
|
||||
std::string filename = path_processor_type::evaluate( *sym.get_filename(), *feature);
|
||||
boost::optional<mapnik::marker_ptr> marker = mapnik::marker_cache::instance()->find(filename,true);
|
||||
|
@ -1178,7 +1178,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
{
|
||||
clipped_geometry_type clipped(geom);
|
||||
clipped.clip_box(query_extent_.minx(),query_extent_.miny(),query_extent_.maxx(),query_extent_.maxy());
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
path_type path(t_,clipped,prj_trans);
|
||||
context.add_path(path);
|
||||
context.fill();
|
||||
}
|
||||
|
@ -1247,9 +1247,9 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
|||
|
||||
if (geom.num_points() > 1)
|
||||
{
|
||||
|
||||
|
||||
path_type path(t_, geom, prj_trans);
|
||||
|
||||
|
||||
markers_placement<path_type, label_collision_detector4> placement(path, arrow_.extent(), detector_, sym.get_spacing(), sym.get_max_error(), sym.get_allow_overlap());
|
||||
|
||||
double x, y, angle;
|
||||
|
|
|
@ -137,7 +137,7 @@ void color_factory::init_from_string(color & c, std::string const& css_color)
|
|||
}
|
||||
|
||||
bool color_factory::parse_from_string(color & c, std::string const& css_color,
|
||||
mapnik::css_color_grammar<std::string::const_iterator> const& g)
|
||||
mapnik::css_color_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
std::string::const_iterator first = css_color.begin();
|
||||
std::string::const_iterator last = css_color.end();
|
||||
|
|
|
@ -22,7 +22,7 @@ config_error::config_error(std::string const& what, unsigned line_number, std::s
|
|||
|
||||
}
|
||||
|
||||
char const* config_error::what() const throw()
|
||||
char const* config_error::what() const throw()
|
||||
{
|
||||
std::stringstream s;
|
||||
s << file_;
|
||||
|
@ -34,10 +34,10 @@ config_error::config_error(std::string const& what, unsigned line_number, std::s
|
|||
return msg_.c_str();
|
||||
}
|
||||
|
||||
void config_error::append_context(std::string const& ctx) const
|
||||
{
|
||||
what_ += " " + ctx;
|
||||
}
|
||||
void config_error::append_context(std::string const& ctx) const
|
||||
{
|
||||
what_ += " " + ctx;
|
||||
}
|
||||
|
||||
void config_error::append_context(std::string const& ctx, xml_node const& node) const
|
||||
{
|
||||
|
|
|
@ -23,14 +23,14 @@
|
|||
// boost
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
|
||||
#define BOOST_SPIRIT_AUTO(domain_, name, expr) \
|
||||
typedef boost::proto::result_of:: \
|
||||
deep_copy<BOOST_TYPEOF(expr)>::type name##_expr_type; \
|
||||
BOOST_SPIRIT_ASSERT_MATCH( \
|
||||
boost::spirit::domain_::domain, name##_expr_type); \
|
||||
BOOST_AUTO(name, boost::proto::deep_copy(expr)); \
|
||||
|
||||
|
||||
#define BOOST_SPIRIT_AUTO(domain_, name, expr) \
|
||||
typedef boost::proto::result_of:: \
|
||||
deep_copy<BOOST_TYPEOF(expr)>::type name##_expr_type; \
|
||||
BOOST_SPIRIT_ASSERT_MATCH( \
|
||||
boost::spirit::domain_::domain, name##_expr_type); \
|
||||
BOOST_AUTO(name, boost::proto::deep_copy(expr)); \
|
||||
\
|
||||
\
|
||||
namespace mapnik { namespace conversions {
|
||||
|
||||
using namespace boost::spirit;
|
||||
|
|
|
@ -51,8 +51,8 @@ expression_ptr expression_factory::compile(std::string const& str,transcoder con
|
|||
}
|
||||
|
||||
bool expression_factory::parse_from_string(expression_ptr const& expr,
|
||||
std::string const& str,
|
||||
mapnik::expression_grammar<std::string::const_iterator> const& g)
|
||||
std::string const& str,
|
||||
mapnik::expression_grammar<std::string::const_iterator> const& g)
|
||||
{
|
||||
std::string::const_iterator itr = str.begin();
|
||||
std::string::const_iterator end = str.end();
|
||||
|
|
|
@ -203,7 +203,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(RENDERING_STATS)
|
||||
progress_timer layer_timer(std::clog, "rendering total for layer: '" + lay.name() + "'");
|
||||
|
@ -270,7 +270,7 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
|||
m_.height()/qh);
|
||||
|
||||
query q(layer_ext,res,scale_denom,unbuffered_extent);
|
||||
p.start_layer_processing(lay, query_ext);
|
||||
p.start_layer_processing(lay, query_ext);
|
||||
std::vector<feature_type_style*> active_styles;
|
||||
attribute_collector collector(names);
|
||||
double filt_factor = 1;
|
||||
|
|
|
@ -85,25 +85,25 @@ void expression_format::apply(char_properties const& p, const Feature &feature,
|
|||
{
|
||||
char_properties new_properties = p;
|
||||
if (face_name) new_properties.face_name =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *face_name).to_string();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *face_name).to_string();
|
||||
if (text_size) new_properties.text_size =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *text_size).to_double();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *text_size).to_double();
|
||||
if (character_spacing) new_properties.character_spacing =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *character_spacing).to_double();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *character_spacing).to_double();
|
||||
if (line_spacing) new_properties.line_spacing =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *line_spacing).to_double();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *line_spacing).to_double();
|
||||
if (text_opacity) new_properties.text_opacity =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *text_opacity).to_double();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *text_opacity).to_double();
|
||||
if (wrap_before) new_properties.wrap_before =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *wrap_before).to_bool();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *wrap_before).to_bool();
|
||||
if (wrap_char) new_properties.wrap_char =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *character_spacing).to_unicode()[0];
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *character_spacing).to_unicode()[0];
|
||||
// if (fill) new_properties.fill =
|
||||
// boost::apply_visitor(evaluate<Feature,value_type>(feature), *fill).to_color();
|
||||
// if (halo_fill) new_properties.halo_fill =
|
||||
// boost::apply_visitor(evaluate<Feature,value_type>(feature), *halo_fill).to_color();
|
||||
if (halo_radius) new_properties.halo_radius =
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *halo_radius).to_double();
|
||||
boost::apply_visitor(evaluate<Feature,value_type>(feature), *halo_radius).to_double();
|
||||
|
||||
if (child_) {
|
||||
child_->apply(new_properties, feature, output);
|
||||
|
|
|
@ -33,29 +33,29 @@ namespace mapnik { namespace json {
|
|||
|
||||
#if BOOST_VERSION >= 104700
|
||||
|
||||
template <typename Iterator>
|
||||
feature_collection_parser<Iterator>::feature_collection_parser(mapnik::context_ptr const& ctx, mapnik::transcoder const& tr)
|
||||
: grammar_(new feature_collection_grammar<iterator_type,feature_type>(ctx,tr)) {}
|
||||
template <typename Iterator>
|
||||
feature_collection_parser<Iterator>::feature_collection_parser(mapnik::context_ptr const& ctx, mapnik::transcoder const& tr)
|
||||
: grammar_(new feature_collection_grammar<iterator_type,feature_type>(ctx,tr)) {}
|
||||
|
||||
template <typename Iterator>
|
||||
feature_collection_parser<Iterator>::~feature_collection_parser() {}
|
||||
template <typename Iterator>
|
||||
feature_collection_parser<Iterator>::~feature_collection_parser() {}
|
||||
#endif
|
||||
|
||||
template <typename Iterator>
|
||||
bool feature_collection_parser<Iterator>::parse(iterator_type first, iterator_type last, std::vector<mapnik::feature_ptr> & features)
|
||||
{
|
||||
template <typename Iterator>
|
||||
bool feature_collection_parser<Iterator>::parse(iterator_type first, iterator_type last, std::vector<mapnik::feature_ptr> & features)
|
||||
{
|
||||
#if BOOST_VERSION >= 104700
|
||||
using namespace boost::spirit;
|
||||
return qi::phrase_parse(first, last, *grammar_, standard_wide::space, features);
|
||||
using namespace boost::spirit;
|
||||
return qi::phrase_parse(first, last, *grammar_, standard_wide::space, features);
|
||||
#else
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
throw std::runtime_error("mapnik::feature_collection_parser::parse() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||
return false;
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
throw std::runtime_error("mapnik::feature_collection_parser::parse() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
template class feature_collection_parser<std::string::const_iterator> ;
|
||||
template class feature_collection_parser<boost::spirit::multi_pass<std::istreambuf_iterator<char> > >;
|
||||
}}
|
||||
template class feature_collection_parser<std::string::const_iterator> ;
|
||||
template class feature_collection_parser<boost::spirit::multi_pass<std::istreambuf_iterator<char> > >;
|
||||
}}
|
||||
|
||||
|
|
|
@ -32,30 +32,30 @@
|
|||
|
||||
namespace mapnik { namespace json {
|
||||
|
||||
feature_generator::feature_generator()
|
||||
: grammar_(new feature_generator_grammar<sink_type>()) {}
|
||||
|
||||
feature_generator::~feature_generator() {}
|
||||
feature_generator::feature_generator()
|
||||
: grammar_(new feature_generator_grammar<sink_type>()) {}
|
||||
|
||||
bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f)
|
||||
{
|
||||
sink_type sink(geojson);
|
||||
return karma::generate(sink, *grammar_,f);
|
||||
}
|
||||
feature_generator::~feature_generator() {}
|
||||
|
||||
bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f)
|
||||
{
|
||||
sink_type sink(geojson);
|
||||
return karma::generate(sink, *grammar_,f);
|
||||
}
|
||||
|
||||
|
||||
geometry_generator::geometry_generator()
|
||||
: grammar_(new multi_geometry_generator_grammar<sink_type>()) {}
|
||||
geometry_generator::geometry_generator()
|
||||
: grammar_(new multi_geometry_generator_grammar<sink_type>()) {}
|
||||
|
||||
geometry_generator::~geometry_generator() {}
|
||||
geometry_generator::~geometry_generator() {}
|
||||
|
||||
bool geometry_generator::generate(std::string & geojson, mapnik::geometry_container const& g)
|
||||
{
|
||||
sink_type sink(geojson);
|
||||
return karma::generate(sink, *grammar_,g);
|
||||
}
|
||||
bool geometry_generator::generate(std::string & geojson, mapnik::geometry_container const& g)
|
||||
{
|
||||
sink_type sink(geojson);
|
||||
return karma::generate(sink, *grammar_,g);
|
||||
}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
||||
#else
|
||||
|
||||
|
@ -65,22 +65,22 @@ bool geometry_generator::generate(std::string & geojson, mapnik::geometry_contai
|
|||
|
||||
namespace mapnik { namespace json {
|
||||
|
||||
bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f)
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
throw std::runtime_error("feature_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||
return false;
|
||||
}
|
||||
bool feature_generator::generate(std::string & geojson, mapnik::Feature const& f)
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
throw std::runtime_error("feature_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||
return false;
|
||||
}
|
||||
|
||||
bool geometry_generator::generate(std::string & geojson, mapnik::geometry_container const& g)
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
throw std::runtime_error("geometry_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||
return false;
|
||||
}
|
||||
bool geometry_generator::generate(std::string & geojson, mapnik::geometry_container const& g)
|
||||
{
|
||||
std::ostringstream s;
|
||||
s << BOOST_VERSION/100000 << "." << BOOST_VERSION/100 % 1000 << "." << BOOST_VERSION % 100;
|
||||
throw std::runtime_error("geometry_generator::generate() requires at least boost 1.47 while your build was compiled against boost " + s.str());
|
||||
return false;
|
||||
}
|
||||
|
||||
}}
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -191,7 +191,7 @@ private:
|
|||
}
|
||||
break;
|
||||
case XML_COMMENT_NODE:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
|
162
src/load_map.cpp
162
src/load_map.cpp
|
@ -85,7 +85,7 @@ public:
|
|||
filename_( filename ),
|
||||
relative_to_xml_(true),
|
||||
font_manager_(font_engine_)
|
||||
{}
|
||||
{}
|
||||
|
||||
void parse_map(Map & map, xml_node const& sty, std::string const& base_path);
|
||||
private:
|
||||
|
@ -121,7 +121,7 @@ private:
|
|||
|
||||
std::string ensure_relative_to_xml(boost::optional<std::string> opt_path);
|
||||
boost::optional<color> get_opt_color_attr(boost::property_tree::ptree const& node,
|
||||
std::string const& name);
|
||||
std::string const& name);
|
||||
|
||||
bool strict_;
|
||||
std::string filename_;
|
||||
|
@ -306,93 +306,93 @@ void map_parser::parse_map_include(Map & map, xml_node const& include)
|
|||
{
|
||||
try
|
||||
{
|
||||
xml_node::const_iterator itr = include.begin();
|
||||
xml_node::const_iterator end = include.end();
|
||||
xml_node::const_iterator itr = include.begin();
|
||||
xml_node::const_iterator end = include.end();
|
||||
|
||||
for (; itr != end; ++itr)
|
||||
{
|
||||
if (itr->is_text()) continue;
|
||||
if (itr->is("Include"))
|
||||
for (; itr != end; ++itr)
|
||||
{
|
||||
parse_map_include(map, *itr);
|
||||
}
|
||||
else if (itr->is("Style"))
|
||||
{
|
||||
parse_style(map, *itr);
|
||||
}
|
||||
else if (itr->is("Layer"))
|
||||
{
|
||||
parse_layer(map, *itr);
|
||||
}
|
||||
else if (itr->is("FontSet"))
|
||||
{
|
||||
parse_fontset(map, *itr);
|
||||
}
|
||||
else if (itr->is("MetaWriter"))
|
||||
{
|
||||
parse_metawriter(map, *itr);
|
||||
}
|
||||
else if (itr->is("FileSource"))
|
||||
{
|
||||
std::string name = itr->get_attr<std::string>("name");
|
||||
std::string value = itr->get_text();
|
||||
file_sources_[name] = value;
|
||||
}
|
||||
else if (itr->is("Datasource"))
|
||||
{
|
||||
std::string name = itr->get_attr("name", std::string("Unnamed"));
|
||||
parameters params;
|
||||
xml_node::const_iterator paramIter = itr->begin();
|
||||
xml_node::const_iterator endParam = itr->end();
|
||||
for (; paramIter != endParam; ++paramIter)
|
||||
if (itr->is_text()) continue;
|
||||
if (itr->is("Include"))
|
||||
{
|
||||
if (paramIter->is("Parameter"))
|
||||
{
|
||||
std::string name = paramIter->get_attr<std::string>("name");
|
||||
std::string value = paramIter->get_text();
|
||||
params[name] = value;
|
||||
}
|
||||
parse_map_include(map, *itr);
|
||||
}
|
||||
datasource_templates_[name] = params;
|
||||
}
|
||||
else if (itr->is("Parameters"))
|
||||
{
|
||||
std::string name = itr->get_attr("name", std::string("Unnamed"));
|
||||
parameters & params = map.get_extra_parameters();
|
||||
xml_node::const_iterator paramIter = itr->begin();
|
||||
xml_node::const_iterator endParam = itr->end();
|
||||
for (; paramIter != endParam; ++paramIter)
|
||||
else if (itr->is("Style"))
|
||||
{
|
||||
if (paramIter->is("Parameter"))
|
||||
parse_style(map, *itr);
|
||||
}
|
||||
else if (itr->is("Layer"))
|
||||
{
|
||||
parse_layer(map, *itr);
|
||||
}
|
||||
else if (itr->is("FontSet"))
|
||||
{
|
||||
parse_fontset(map, *itr);
|
||||
}
|
||||
else if (itr->is("MetaWriter"))
|
||||
{
|
||||
parse_metawriter(map, *itr);
|
||||
}
|
||||
else if (itr->is("FileSource"))
|
||||
{
|
||||
std::string name = itr->get_attr<std::string>("name");
|
||||
std::string value = itr->get_text();
|
||||
file_sources_[name] = value;
|
||||
}
|
||||
else if (itr->is("Datasource"))
|
||||
{
|
||||
std::string name = itr->get_attr("name", std::string("Unnamed"));
|
||||
parameters params;
|
||||
xml_node::const_iterator paramIter = itr->begin();
|
||||
xml_node::const_iterator endParam = itr->end();
|
||||
for (; paramIter != endParam; ++paramIter)
|
||||
{
|
||||
std::string name = paramIter->get_attr<std::string>("name");
|
||||
bool is_string = true;
|
||||
boost::optional<std::string> type = paramIter->get_opt_attr<std::string>("type");
|
||||
if (type)
|
||||
{
|
||||
if (*type == "int")
|
||||
{
|
||||
is_string = false;
|
||||
int value = paramIter->get_value<int>();
|
||||
params[name] = value;
|
||||
}
|
||||
else if (*type == "float")
|
||||
{
|
||||
is_string = false;
|
||||
double value = paramIter->get_value<double>();
|
||||
params[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_string)
|
||||
if (paramIter->is("Parameter"))
|
||||
{
|
||||
std::string name = paramIter->get_attr<std::string>("name");
|
||||
std::string value = paramIter->get_text();
|
||||
params[name] = value;
|
||||
}
|
||||
}
|
||||
datasource_templates_[name] = params;
|
||||
}
|
||||
else if (itr->is("Parameters"))
|
||||
{
|
||||
std::string name = itr->get_attr("name", std::string("Unnamed"));
|
||||
parameters & params = map.get_extra_parameters();
|
||||
xml_node::const_iterator paramIter = itr->begin();
|
||||
xml_node::const_iterator endParam = itr->end();
|
||||
for (; paramIter != endParam; ++paramIter)
|
||||
{
|
||||
if (paramIter->is("Parameter"))
|
||||
{
|
||||
std::string name = paramIter->get_attr<std::string>("name");
|
||||
bool is_string = true;
|
||||
boost::optional<std::string> type = paramIter->get_opt_attr<std::string>("type");
|
||||
if (type)
|
||||
{
|
||||
if (*type == "int")
|
||||
{
|
||||
is_string = false;
|
||||
int value = paramIter->get_value<int>();
|
||||
params[name] = value;
|
||||
}
|
||||
else if (*type == "float")
|
||||
{
|
||||
is_string = false;
|
||||
double value = paramIter->get_value<double>();
|
||||
params[name] = value;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_string)
|
||||
{
|
||||
std::string value = paramIter->get_text();
|
||||
params[name] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (const config_error & ex) {
|
||||
ex.append_context(include);
|
||||
throw;
|
||||
|
@ -1060,7 +1060,7 @@ void map_parser::parse_text_symbolizer( rule & rule, xml_node const& sym )
|
|||
placement_finder->defaults.from_xml(sym, fontsets_);
|
||||
}
|
||||
if (strict_ &&
|
||||
!placement_finder->defaults.format.fontset.size())
|
||||
!placement_finder->defaults.format.fontset.size())
|
||||
ensure_font_face(placement_finder->defaults.format.face_name);
|
||||
|
||||
text_symbolizer text_symbol = text_symbolizer(placement_finder);
|
||||
|
@ -1087,7 +1087,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym )
|
|||
}
|
||||
placement_finder->defaults.from_xml(sym, fontsets_);
|
||||
if (strict_ &&
|
||||
!placement_finder->defaults.format.fontset.size())
|
||||
!placement_finder->defaults.format.fontset.size())
|
||||
ensure_font_face(placement_finder->defaults.format.face_name);
|
||||
|
||||
shield_symbolizer shield_symbol = shield_symbolizer(placement_finder);
|
||||
|
@ -1447,7 +1447,7 @@ void map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc,
|
|||
maximumValue = *value;
|
||||
|
||||
optional<std::string> label =
|
||||
stopIter->get_opt_attr<std::string>("label");
|
||||
stopIter->get_opt_attr<std::string>("label");
|
||||
|
||||
//append the stop
|
||||
colorizer_stop tmpStop;
|
||||
|
@ -1532,8 +1532,8 @@ void map_parser::find_unused_nodes_recursive(xml_node const& node, std::stringst
|
|||
if (!aitr->second.processed)
|
||||
{
|
||||
error_message << "\n* attribute '" << aitr->first <<
|
||||
"' with value '" << aitr->second.value <<
|
||||
"' in line " << node.line();
|
||||
"' with value '" << aitr->second.value <<
|
||||
"' in line " << node.line();
|
||||
}
|
||||
}
|
||||
xml_node::const_iterator itr = node.begin();
|
||||
|
|
|
@ -588,7 +588,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const
|
|||
featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y));
|
||||
if (fs)
|
||||
return boost::make_shared<filter_featureset<hit_test_filter> >(fs,
|
||||
hit_test_filter(x,y,tol));
|
||||
hit_test_filter(x,y,tol));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
@ -634,7 +634,7 @@ featureset_ptr Map::query_map_point(unsigned index, double x, double y) const
|
|||
featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y));
|
||||
if (fs)
|
||||
return boost::make_shared<filter_featureset<hit_test_filter> >(fs,
|
||||
hit_test_filter(x,y,tol));
|
||||
hit_test_filter(x,y,tol));
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
|
|
|
@ -269,9 +269,9 @@ void placement_finder<DetectorT>::find_line_breaks()
|
|||
// wrap text at first wrap_char after (default) the wrap width or immediately before the current word
|
||||
if ((c == '\n') ||
|
||||
(line_width > 0 &&
|
||||
((line_width > wrap_at && !ci.format->wrap_before) ||
|
||||
((line_width > wrap_at && !ci.format->wrap_before) ||
|
||||
((line_width + last_wrap_char_width + word_width) > wrap_at && ci.format->wrap_before)) )
|
||||
)
|
||||
)
|
||||
{
|
||||
add_line(line_width, line_height, first_line);
|
||||
line_breaks_.push_back(last_wrap_char_pos);
|
||||
|
@ -440,8 +440,8 @@ void placement_finder<DetectorT>::find_point_placement(double label_x,
|
|||
|
||||
if (!detector_.extent().intersects(e) ||
|
||||
(!p.allow_overlap &&
|
||||
!detector_.has_point_placement(e, pi.get_actual_minimum_distance())))
|
||||
{
|
||||
!detector_.has_point_placement(e, pi.get_actual_minimum_distance())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -675,10 +675,10 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
|
|||
|
||||
template <typename DetectorT>
|
||||
std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::vector<vertex2d> const& path_positions,
|
||||
std::vector<double> const& path_distances,
|
||||
int & orientation,
|
||||
unsigned index,
|
||||
double distance)
|
||||
std::vector<double> const& path_distances,
|
||||
int & orientation,
|
||||
unsigned index,
|
||||
double distance)
|
||||
{
|
||||
//Check that the given distance is on the given index and find the correct index and distance if not
|
||||
while (distance < 0 && index > 1)
|
||||
|
@ -718,10 +718,10 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::
|
|||
}
|
||||
|
||||
std::auto_ptr<text_path> current_placement(
|
||||
new text_path((old_x + dx*distance/segment_length),
|
||||
(old_y + dy*distance/segment_length)
|
||||
)
|
||||
);
|
||||
new text_path((old_x + dx*distance/segment_length),
|
||||
(old_y + dy*distance/segment_length)
|
||||
)
|
||||
);
|
||||
|
||||
double angle = atan2(-dy, dx);
|
||||
|
||||
|
@ -830,7 +830,7 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::
|
|||
render_angle += M_PI;
|
||||
}
|
||||
current_placement->add_node(&ci,
|
||||
render_x - current_placement->center.x,
|
||||
render_x - current_placement->center.x,
|
||||
-render_y + current_placement->center.y,
|
||||
render_angle);
|
||||
|
||||
|
@ -870,7 +870,7 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::
|
|||
|
||||
template <typename DetectorT>
|
||||
bool placement_finder<DetectorT>::test_placement(std::auto_ptr<text_path> const& current_placement,
|
||||
int orientation)
|
||||
int orientation)
|
||||
{
|
||||
//Create and test envelopes
|
||||
bool status = true;
|
||||
|
@ -909,8 +909,8 @@ bool placement_finder<DetectorT>::test_placement(std::auto_ptr<text_path> const&
|
|||
if (!detector_.extent().intersects(e) ||
|
||||
(!p.allow_overlap &&
|
||||
!detector_.has_placement(e, info_.get_string(), pi.get_actual_minimum_distance())
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
//std::clog << "No Intersects:" << !dimensions_.intersects(e) << ": " << e << " @ " << dimensions_ << std::endl;
|
||||
//std::clog << "No Placements:" << !detector_.has_placement(e, info.get_string(), p.minimum_distance) << std::endl;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
{
|
||||
stream.unsetf(std::ios::skipws);
|
||||
std::vector<char> v(std::istreambuf_iterator<char>(stream.rdbuf()),
|
||||
std::istreambuf_iterator<char>());
|
||||
std::istreambuf_iterator<char>());
|
||||
if (!stream.good())
|
||||
{
|
||||
throw config_error("Could not load map file", 0, filename_);
|
||||
|
@ -83,7 +83,7 @@ public:
|
|||
{
|
||||
// Parse using appropriate flags
|
||||
const int f_tws = rapidxml::parse_normalize_whitespace
|
||||
| rapidxml::parse_trim_whitespace;
|
||||
| rapidxml::parse_trim_whitespace;
|
||||
rapidxml::xml_document<> doc;
|
||||
doc.parse<f_tws>(&v.front());
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ bool text_symbolizer_helper<FaceManagerT, DetectorT>::next_line_placement()
|
|||
geo_itr_ = geometries_to_process_.begin();
|
||||
continue; //Reexecute size check
|
||||
}
|
||||
|
||||
|
||||
typedef agg::conv_clip_polyline<geometry_type> clipped_geometry_type;
|
||||
typedef coord_transform2<CoordTransform,clipped_geometry_type> path_type;
|
||||
clipped_geometry_type clipped(**geo_itr_);
|
||||
|
|
|
@ -64,7 +64,7 @@ text_symbolizer_properties & text_placements_list::get(unsigned i)
|
|||
text_placement_info_ptr text_placements_list::get_placement_info(double scale_factor) const
|
||||
{
|
||||
return text_placement_info_ptr(
|
||||
boost::make_shared<text_placement_info_list>(this, scale_factor));
|
||||
boost::make_shared<text_placement_info_list>(this, scale_factor));
|
||||
}
|
||||
|
||||
text_placements_list::text_placements_list() : text_placements(), list_(0)
|
||||
|
|
|
@ -104,7 +104,7 @@ text_placement_info_ptr text_placements_simple::get_placement_info(
|
|||
double scale_factor) const
|
||||
{
|
||||
return text_placement_info_ptr(
|
||||
boost::make_shared<text_placement_info_simple>(this, scale_factor));
|
||||
boost::make_shared<text_placement_info_simple>(this, scale_factor));
|
||||
}
|
||||
|
||||
/** Position string: [POS][SIZE]
|
||||
|
@ -171,7 +171,7 @@ std::string text_placements_simple::get_positions()
|
|||
text_placements_ptr text_placements_simple::from_xml(xml_node const &xml, fontset_map const & fontsets)
|
||||
{
|
||||
text_placements_ptr ptr = boost::make_shared<text_placements_simple>(
|
||||
xml.get_attr<std::string>("placements", "X"));
|
||||
xml.get_attr<std::string>("placements", "X"));
|
||||
ptr->defaults.from_xml(xml, fontsets);
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ struct name_trait
|
|||
BOOST_STATIC_ASSERT( sizeof(T) == 0 );
|
||||
};
|
||||
|
||||
#define DEFINE_NAME_TRAIT( type, type_name ) \
|
||||
#define DEFINE_NAME_TRAIT( type, type_name ) \
|
||||
template <> \
|
||||
struct name_trait<type> \
|
||||
{ \
|
||||
|
@ -220,8 +220,8 @@ attribute_not_found::attribute_not_found(
|
|||
std::string const& node_name,
|
||||
std::string const& attribute_name)
|
||||
:
|
||||
node_name_(node_name),
|
||||
attribute_name_(attribute_name)
|
||||
node_name_(node_name),
|
||||
attribute_name_(attribute_name)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue