Merge branch 'master' into geometry-clipping
Conflicts: SConstruct include/mapnik/symbolizer_helpers.hpp src/placement_finder.cpp
This commit is contained in:
commit
254b3c9fa7
44 changed files with 255 additions and 160 deletions
|
@ -1411,7 +1411,9 @@ if not preconfigured:
|
||||||
pthread = '-pthread'
|
pthread = '-pthread'
|
||||||
|
|
||||||
# Common debugging flags.
|
# Common debugging flags.
|
||||||
|
# http://lists.fedoraproject.org/pipermail/devel/2010-November/144952.html
|
||||||
debug_flags = '-g -fno-omit-frame-pointer -DDEBUG -DMAPNIK_DEBUG'
|
debug_flags = '-g -fno-omit-frame-pointer -DDEBUG -DMAPNIK_DEBUG'
|
||||||
|
|
||||||
ndebug_flags = '-DNDEBUG'
|
ndebug_flags = '-DNDEBUG'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -682,6 +682,7 @@ __all__ = [
|
||||||
'SQLite',
|
'SQLite',
|
||||||
'Osm',
|
'Osm',
|
||||||
'Kismet',
|
'Kismet',
|
||||||
|
'Geos',
|
||||||
# version and environment
|
# version and environment
|
||||||
'mapnik_version_string',
|
'mapnik_version_string',
|
||||||
'mapnik_version',
|
'mapnik_version',
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct map_pickle_suite : boost::python::pickle_suite
|
||||||
Map::const_style_iterator end = m.styles().end();
|
Map::const_style_iterator end = m.styles().end();
|
||||||
for (; it != end; ++it)
|
for (; it != end; ++it)
|
||||||
{
|
{
|
||||||
const std::string & name = it->first;
|
std::string const& name = it->first;
|
||||||
const mapnik::feature_type_style & style = it->second;
|
const mapnik::feature_type_style & style = it->second;
|
||||||
boost::python::tuple style_pair = boost::python::make_tuple(name,style);
|
boost::python::tuple style_pair = boost::python::make_tuple(name,style);
|
||||||
s.append(style_pair);
|
s.append(style_pair);
|
||||||
|
@ -153,7 +153,7 @@ bool has_metawriter(mapnik::Map const& m)
|
||||||
|
|
||||||
// returns empty shared_ptr when the metawriter isn't found, or is
|
// returns empty shared_ptr when the metawriter isn't found, or is
|
||||||
// of the wrong type. empty pointers make it back to Python as a None.
|
// of the wrong type. empty pointers make it back to Python as a None.
|
||||||
mapnik::metawriter_inmem_ptr find_inmem_metawriter(const mapnik::Map &m, const std::string &name) {
|
mapnik::metawriter_inmem_ptr find_inmem_metawriter(const mapnik::Map &m, std::string const&name) {
|
||||||
mapnik::metawriter_ptr metawriter = m.find_metawriter(name);
|
mapnik::metawriter_ptr metawriter = m.find_metawriter(name);
|
||||||
mapnik::metawriter_inmem_ptr inmem;
|
mapnik::metawriter_inmem_ptr inmem;
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,18 @@ If you see bits of code around that do not follow these please don't hesitate to
|
||||||
|
|
||||||
(int)value; // no
|
(int)value; // no
|
||||||
|
|
||||||
|
#### Use const keyword after the type
|
||||||
|
|
||||||
|
std::string const& variable_name // preferred, for consistency
|
||||||
|
|
||||||
|
const std::string & variable_name // no
|
||||||
|
|
||||||
|
#### Pass built-in types by value, all others by const&
|
||||||
|
|
||||||
|
void my_function(int double val); // if int, char, double, etc pass by value
|
||||||
|
|
||||||
|
void my_function(std::string const& val); // if std::string or user type, pass by const&
|
||||||
|
|
||||||
#### Shared pointers should be created with [boost::make_shared](http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/make_shared.html) where possible
|
#### Shared pointers should be created with [boost::make_shared](http://www.boost.org/doc/libs/1_47_0/libs/smart_ptr/make_shared.html) where possible
|
||||||
|
|
||||||
#### Function definitions should not be separated from their arguments:
|
#### Function definitions should not be separated from their arguments:
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
#include <mapnik/font_engine_freetype.hpp>
|
#include <mapnik/font_engine_freetype.hpp>
|
||||||
#include <mapnik/label_collision_detector.hpp>
|
#include <mapnik/label_collision_detector.hpp>
|
||||||
#include <mapnik/map.hpp>
|
#include <mapnik/map.hpp>
|
||||||
//#include <mapnik/marker.hpp>
|
|
||||||
|
|
||||||
// agg
|
|
||||||
//#include "agg_trans_affine.h"
|
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
|
|
|
@ -31,11 +31,24 @@ struct char_properties;
|
||||||
class char_info {
|
class char_info {
|
||||||
public:
|
public:
|
||||||
char_info(unsigned c_, double width_, double ymax_, double ymin_, double line_height_)
|
char_info(unsigned c_, double width_, double ymax_, double ymin_, double line_height_)
|
||||||
: c(c_), width(width_), line_height(line_height_), ymin(ymin_), ymax(ymax_)
|
: c(c_),
|
||||||
|
width(width_),
|
||||||
|
line_height(line_height_),
|
||||||
|
ymin(ymin_),
|
||||||
|
ymax(ymax_),
|
||||||
|
avg_height(ymax_-ymin_),
|
||||||
|
format()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
char_info()
|
char_info()
|
||||||
: c(0), width(0), line_height(0), ymin(0), ymax(0)
|
: c(0),
|
||||||
|
width(0),
|
||||||
|
line_height(0),
|
||||||
|
ymin(0),
|
||||||
|
ymax(0),
|
||||||
|
avg_height(0),
|
||||||
|
format()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,9 +31,10 @@ namespace mapnik {
|
||||||
class config_error : public std::exception
|
class config_error : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
config_error() {}
|
config_error():
|
||||||
|
what_() {}
|
||||||
|
|
||||||
config_error( const std::string & what ) :
|
config_error( std::string const& what ) :
|
||||||
what_( what )
|
what_( what )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -44,7 +45,7 @@ public:
|
||||||
return what_.c_str();
|
return what_.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void append_context(const std::string & ctx) const
|
void append_context(std::string const& ctx) const
|
||||||
{
|
{
|
||||||
what_ += " " + ctx;
|
what_ += " " + ctx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -380,20 +380,27 @@ class CoordTransform
|
||||||
private:
|
private:
|
||||||
int width_;
|
int width_;
|
||||||
int height_;
|
int height_;
|
||||||
double sx_;
|
|
||||||
double sy_;
|
|
||||||
box2d<double> extent_;
|
box2d<double> extent_;
|
||||||
double offset_x_;
|
double offset_x_;
|
||||||
double offset_y_;
|
double offset_y_;
|
||||||
|
double sx_;
|
||||||
|
double sy_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CoordTransform(int width, int height, const box2d<double>& extent,
|
CoordTransform(int width, int height, const box2d<double>& extent,
|
||||||
double offset_x = 0, double offset_y = 0)
|
double offset_x = 0, double offset_y = 0)
|
||||||
: width_(width), height_(height), extent_(extent),
|
: width_(width),
|
||||||
offset_x_(offset_x), offset_y_(offset_y)
|
height_(height),
|
||||||
|
extent_(extent),
|
||||||
|
offset_x_(offset_x),
|
||||||
|
offset_y_(offset_y),
|
||||||
|
sx_(1.0),
|
||||||
|
sy_(1.0)
|
||||||
{
|
{
|
||||||
sx_ = static_cast<double>(width_) / extent_.width();
|
if (extent_.width())
|
||||||
sy_ = static_cast<double>(height_) / extent_.height();
|
sx_ = static_cast<double>(width_) / extent_.width();
|
||||||
|
if (extent_.height())
|
||||||
|
sy_ = static_cast<double>(height_) / extent_.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int width() const
|
inline int width() const
|
||||||
|
|
|
@ -37,9 +37,10 @@ namespace mapnik {
|
||||||
class illegal_enum_value : public std::exception
|
class illegal_enum_value : public std::exception
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
illegal_enum_value() {}
|
illegal_enum_value():
|
||||||
|
what_() {}
|
||||||
|
|
||||||
illegal_enum_value( const std::string & what ) :
|
illegal_enum_value( std::string const& what ) :
|
||||||
what_( what )
|
what_( what )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -138,7 +139,8 @@ template <class ENUM, int THE_MAX>
|
||||||
class MAPNIK_DECL enumeration {
|
class MAPNIK_DECL enumeration {
|
||||||
public:
|
public:
|
||||||
typedef ENUM native_type;
|
typedef ENUM native_type;
|
||||||
enumeration() {};
|
enumeration():
|
||||||
|
value_() {};
|
||||||
enumeration( ENUM v ) : value_(v) {}
|
enumeration( ENUM v ) : value_(v) {}
|
||||||
enumeration( const enumeration & other ) : value_(other.value_) {}
|
enumeration( const enumeration & other ) : value_(other.value_) {}
|
||||||
|
|
||||||
|
@ -171,7 +173,7 @@ public:
|
||||||
/** Converts @p str to an enum.
|
/** Converts @p str to an enum.
|
||||||
* @throw illegal_enum_value @p str is not a legal identifier.
|
* @throw illegal_enum_value @p str is not a legal identifier.
|
||||||
* */
|
* */
|
||||||
void from_string(const std::string & str)
|
void from_string(std::string const& str)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < THE_MAX; ++i)
|
for (unsigned i = 0; i < THE_MAX; ++i)
|
||||||
{
|
{
|
||||||
|
@ -267,7 +269,7 @@ public:
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
static const std::string & get_full_qualified_name()
|
static std::string const& get_full_qualified_name()
|
||||||
{
|
{
|
||||||
return our_name_;
|
return our_name_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,9 @@ public:
|
||||||
feature_impl(context_ptr const& ctx, int id)
|
feature_impl(context_ptr const& ctx, int id)
|
||||||
: id_(id),
|
: id_(id),
|
||||||
ctx_(ctx),
|
ctx_(ctx),
|
||||||
data_(ctx_->mapping_.size())
|
data_(ctx_->mapping_.size()),
|
||||||
|
geom_cont_(),
|
||||||
|
raster_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline int id() const { return id_;}
|
inline int id() const { return id_;}
|
||||||
|
@ -280,9 +282,9 @@ public:
|
||||||
private:
|
private:
|
||||||
int id_;
|
int id_;
|
||||||
context_ptr ctx_;
|
context_ptr ctx_;
|
||||||
|
cont_type data_;
|
||||||
boost::ptr_vector<geometry_type> geom_cont_;
|
boost::ptr_vector<geometry_type> geom_cont_;
|
||||||
raster_ptr raster_;
|
raster_ptr raster_;
|
||||||
cont_type data_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,8 @@ class MAPNIK_DECL font_face_set : private boost::noncopyable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
font_face_set(void)
|
font_face_set(void)
|
||||||
: faces_() {}
|
: faces_(),
|
||||||
|
dimension_cache_() {}
|
||||||
|
|
||||||
void add(face_ptr face)
|
void add(face_ptr face)
|
||||||
{
|
{
|
||||||
|
|
|
@ -147,7 +147,7 @@ inline boost::optional<std::string> type_from_filename(std::string const& filena
|
||||||
return result_type();
|
return result_type();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string guess_type( const std::string & filename )
|
inline std::string guess_type( std::string const& filename )
|
||||||
{
|
{
|
||||||
std::string::size_type idx = filename.find_last_of(".");
|
std::string::size_type idx = filename.find_last_of(".");
|
||||||
if ( idx != std::string::npos ) {
|
if ( idx != std::string::npos ) {
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = false);
|
MAPNIK_DECL void load_map(Map & map, std::string const& filename, bool strict = false);
|
||||||
MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string const& base_path="");
|
MAPNIK_DECL void load_map_string(Map & map, std::string const& str, bool strict = false, std::string base_path="");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // MAPNIK_LOAD_MAP_HPP
|
#endif // MAPNIK_LOAD_MAP_HPP
|
||||||
|
|
|
@ -25,14 +25,7 @@
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/utils.hpp>
|
#include <mapnik/utils.hpp>
|
||||||
#include <mapnik/marker.hpp>
|
|
||||||
#include <mapnik/config.hpp>
|
#include <mapnik/config.hpp>
|
||||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
|
||||||
#include <mapnik/svg/svg_storage.hpp>
|
|
||||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
|
||||||
|
|
||||||
// agg
|
|
||||||
#include "agg_path_storage.h"
|
|
||||||
|
|
||||||
// boost
|
// boost
|
||||||
#include <boost/utility.hpp>
|
#include <boost/utility.hpp>
|
||||||
|
@ -43,7 +36,7 @@
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
|
||||||
using namespace mapnik::svg;
|
class marker;
|
||||||
|
|
||||||
typedef boost::shared_ptr<marker> marker_ptr;
|
typedef boost::shared_ptr<marker> marker_ptr;
|
||||||
|
|
||||||
|
|
|
@ -92,14 +92,14 @@ private:
|
||||||
// otherwise it will autodetect the orientation.
|
// otherwise it will autodetect the orientation.
|
||||||
// If >= 50% of the characters end up upside down, it will be retried the other way.
|
// If >= 50% of the characters end up upside down, it will be retried the other way.
|
||||||
// RETURN: 1/-1 depending which way up the string ends up being.
|
// RETURN: 1/-1 depending which way up the string ends up being.
|
||||||
std::auto_ptr<text_path> get_placement_offset(const std::vector<vertex2d> & path_positions,
|
std::auto_ptr<text_path> get_placement_offset(std::vector<vertex2d> const& path_positions,
|
||||||
const std::vector<double> & path_distances,
|
std::vector<double> const& path_distances,
|
||||||
int & orientation, unsigned index, double distance);
|
int & orientation, unsigned index, double distance);
|
||||||
|
|
||||||
///Tests wether the given text_path be placed without a collision
|
///Tests whether the given text_path be placed without a collision
|
||||||
// Returns true if it can
|
// Returns true if it can
|
||||||
// NOTE: This edits p.envelopes so it can be used afterwards (you must clear it otherwise)
|
// NOTE: This edits p.envelopes so it can be used afterwards (you must clear it otherwise)
|
||||||
bool test_placement(const std::auto_ptr<text_path> & current_placement, const int & orientation);
|
bool test_placement(std::auto_ptr<text_path> const& current_placement, int orientation);
|
||||||
|
|
||||||
///Does a line-circle intersect calculation
|
///Does a line-circle intersect calculation
|
||||||
// NOTE: Follow the strict pre conditions
|
// NOTE: Follow the strict pre conditions
|
||||||
|
@ -107,14 +107,14 @@ private:
|
||||||
// This means there is exactly one intersect point
|
// This means there is exactly one intersect point
|
||||||
// Result is returned in ix, iy
|
// Result is returned in ix, iy
|
||||||
void find_line_circle_intersection(
|
void find_line_circle_intersection(
|
||||||
const double &cx, const double &cy, const double &radius,
|
double cx, double cy, double radius,
|
||||||
const double &x1, const double &y1, const double &x2, const double &y2,
|
double x1, double y1, double x2, double y2,
|
||||||
double &ix, double &iy);
|
double & ix, double & iy);
|
||||||
|
|
||||||
void find_line_breaks();
|
void find_line_breaks();
|
||||||
void init_string_size();
|
void init_string_size();
|
||||||
void init_alignment();
|
void init_alignment();
|
||||||
void adjust_position(text_path *current_placement, double label_x, double label_y);
|
void adjust_position(text_path *current_placement);
|
||||||
void add_line(double width, double height, bool first_line);
|
void add_line(double width, double height, bool first_line);
|
||||||
|
|
||||||
///General Internals
|
///General Internals
|
||||||
|
|
|
@ -93,7 +93,7 @@ operator << ( std::basic_ostream<charT, traits> & s, mapnik::color const& c )
|
||||||
/** Helper for class bool */
|
/** Helper for class bool */
|
||||||
class boolean {
|
class boolean {
|
||||||
public:
|
public:
|
||||||
boolean() {}
|
boolean() : b_(false) {}
|
||||||
boolean(bool b) : b_(b) {}
|
boolean(bool b) : b_(b) {}
|
||||||
boolean(boolean const& b) : b_(b.b_) {}
|
boolean(boolean const& b) : b_(b.b_) {}
|
||||||
|
|
||||||
|
@ -211,7 +211,15 @@ struct name_trait< mapnik::enumeration<ENUM, MAX> >
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline boost::optional<T> fast_cast(std::string const& value)
|
inline boost::optional<T> fast_cast(std::string const& value)
|
||||||
{
|
{
|
||||||
return boost::lexical_cast<T>( value );
|
try
|
||||||
|
{
|
||||||
|
return boost::lexical_cast<T>( value );
|
||||||
|
}
|
||||||
|
catch (boost::bad_lexical_cast const& ex)
|
||||||
|
{
|
||||||
|
return boost::optional<T>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
|
|
@ -51,7 +51,7 @@ struct MAPNIK_DECL shield_symbolizer : public text_symbolizer,
|
||||||
|
|
||||||
bool get_unlock_image() const; // image is not locked to the text placement
|
bool get_unlock_image() const; // image is not locked to the text placement
|
||||||
void set_unlock_image(bool unlock_image);
|
void set_unlock_image(bool unlock_image);
|
||||||
void set_shield_displacement(double shield_dx,double shield_dy);
|
void set_shield_displacement(double shield_dx, double shield_dy);
|
||||||
position const& get_shield_displacement() const;
|
position const& get_shield_displacement() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -53,7 +53,7 @@ public:
|
||||||
unsigned width,
|
unsigned width,
|
||||||
unsigned height,
|
unsigned height,
|
||||||
double scale_factor,
|
double scale_factor,
|
||||||
CoordTransform const &t,
|
CoordTransform const& t,
|
||||||
FaceManagerT &font_manager,
|
FaceManagerT &font_manager,
|
||||||
DetectorT &detector,
|
DetectorT &detector,
|
||||||
box2d<double> const& query_extent)
|
box2d<double> const& query_extent)
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
bool next();
|
bool next();
|
||||||
|
|
||||||
/** Get current placement. next() has to be called before! */
|
/** Get current placement. next() has to be called before! */
|
||||||
placements_type &placements() const;
|
placements_type & placements() const;
|
||||||
protected:
|
protected:
|
||||||
bool next_point_placement();
|
bool next_point_placement();
|
||||||
bool next_line_placement();
|
bool next_line_placement();
|
||||||
|
@ -98,8 +98,8 @@ protected:
|
||||||
Feature const& feature_;
|
Feature const& feature_;
|
||||||
proj_transform const& prj_trans_;
|
proj_transform const& prj_trans_;
|
||||||
CoordTransform const& t_;
|
CoordTransform const& t_;
|
||||||
FaceManagerT &font_manager_;
|
FaceManagerT & font_manager_;
|
||||||
DetectorT &detector_;
|
DetectorT & detector_;
|
||||||
metawriter_with_properties writer_;
|
metawriter_with_properties writer_;
|
||||||
box2d<double> dims_;
|
box2d<double> dims_;
|
||||||
box2d<double> const& query_extent_;
|
box2d<double> const& query_extent_;
|
||||||
|
@ -152,7 +152,7 @@ public:
|
||||||
|
|
||||||
bool next();
|
bool next();
|
||||||
pixel_position get_marker_position(text_path const& p);
|
pixel_position get_marker_position(text_path const& p);
|
||||||
marker &get_marker() const;
|
marker & get_marker() const;
|
||||||
agg::trans_affine const& get_transform() const;
|
agg::trans_affine const& get_transform() const;
|
||||||
protected:
|
protected:
|
||||||
bool next_point_placement();
|
bool next_point_placement();
|
||||||
|
|
|
@ -131,7 +131,9 @@ class text_path : boost::noncopyable
|
||||||
double angle;
|
double angle;
|
||||||
|
|
||||||
character_node(char_info_ptr c_, double x_, double y_, double angle_)
|
character_node(char_info_ptr c_, double x_, double y_, double angle_)
|
||||||
: c(c_), pos(x_, y_), angle(angle_)
|
: c(c_),
|
||||||
|
pos(x_, y_),
|
||||||
|
angle(angle_)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -150,12 +152,13 @@ class text_path : boost::noncopyable
|
||||||
int itr_;
|
int itr_;
|
||||||
public:
|
public:
|
||||||
typedef std::vector<character_node> character_nodes_t;
|
typedef std::vector<character_node> character_nodes_t;
|
||||||
|
pixel_position center;
|
||||||
character_nodes_t nodes_;
|
character_nodes_t nodes_;
|
||||||
|
|
||||||
pixel_position center;
|
text_path(double x, double y)
|
||||||
|
: itr_(0),
|
||||||
text_path()
|
center(x,y),
|
||||||
: itr_(0)
|
nodes_()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct char_properties
|
||||||
/** Construct object from XML. */
|
/** Construct object from XML. */
|
||||||
void from_xml(boost::property_tree::ptree const &sym, fontset_map const & fontsets);
|
void from_xml(boost::property_tree::ptree const &sym, fontset_map const & fontsets);
|
||||||
/** Write object to XML ptree. */
|
/** Write object to XML ptree. */
|
||||||
void to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const &dfl=char_properties()) const;
|
void to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const& dfl=char_properties()) const;
|
||||||
std::string face_name;
|
std::string face_name;
|
||||||
font_set fontset;
|
font_set fontset;
|
||||||
float text_size;
|
float text_size;
|
||||||
|
|
|
@ -33,7 +33,7 @@ class value_error : public std::exception
|
||||||
public:
|
public:
|
||||||
value_error() {}
|
value_error() {}
|
||||||
|
|
||||||
value_error( const std::string & what ) :
|
value_error( std::string const& what ) :
|
||||||
what_( what )
|
what_( what )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ public:
|
||||||
return what_.c_str();
|
return what_.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void append_context(const std::string & ctx) const
|
void append_context(std::string const& ctx) const
|
||||||
{
|
{
|
||||||
what_ += " " + ctx;
|
what_ += " " + ctx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
(source=="api" && hasBbox() && zoom_start>=0 && tiled==true));
|
(source=="api" && hasBbox() && zoom_start>=0 && tiled==true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSource(const std::string & src)
|
void setSource(std::string const& src)
|
||||||
{
|
{
|
||||||
if(src=="api" || src=="osm")
|
if(src=="api" || src=="osm")
|
||||||
{
|
{
|
||||||
|
|
|
@ -423,7 +423,7 @@ std::string postgis_datasource::populate_tokens(const std::string& sql, double s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
boost::shared_ptr<IResultSet> postgis_datasource::get_resultset(boost::shared_ptr<Connection> const &conn, const std::string &sql) const
|
boost::shared_ptr<IResultSet> postgis_datasource::get_resultset(boost::shared_ptr<Connection> const &conn, std::string const& sql) const
|
||||||
{
|
{
|
||||||
if (cursor_fetch_size_ > 0)
|
if (cursor_fetch_size_ > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
std::string populate_tokens(const std::string& sql, double scale_denom, box2d<double> const& env) const;
|
std::string populate_tokens(const std::string& sql, double scale_denom, box2d<double> const& env) const;
|
||||||
std::string populate_tokens(const std::string& sql) const;
|
std::string populate_tokens(const std::string& sql) const;
|
||||||
static std::string unquote(const std::string& sql);
|
static std::string unquote(const std::string& sql);
|
||||||
boost::shared_ptr<IResultSet> get_resultset(boost::shared_ptr<Connection> const &conn, const std::string &sql) const;
|
boost::shared_ptr<IResultSet> get_resultset(boost::shared_ptr<Connection> const &conn, std::string const& sql) const;
|
||||||
postgis_datasource(const postgis_datasource&);
|
postgis_datasource(const postgis_datasource&);
|
||||||
postgis_datasource& operator=(const postgis_datasource&);
|
postgis_datasource& operator=(const postgis_datasource&);
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/agg_renderer.hpp>
|
#include <mapnik/agg_renderer.hpp>
|
||||||
#include <mapnik/agg_rasterizer.hpp>
|
#include <mapnik/agg_rasterizer.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/unicode.hpp>
|
#include <mapnik/unicode.hpp>
|
||||||
#include <mapnik/config_error.hpp>
|
#include <mapnik/config_error.hpp>
|
||||||
|
@ -248,7 +249,7 @@ void agg_renderer<T>::render_marker(pixel_position const& pos, marker const& mar
|
||||||
mtx *= agg::trans_affine_scaling(scale_factor_);
|
mtx *= agg::trans_affine_scaling(scale_factor_);
|
||||||
// render the marker at the center of the marker box
|
// render the marker at the center of the marker box
|
||||||
mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height());
|
mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height());
|
||||||
|
using namespace mapnik::svg;
|
||||||
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
|
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
|
||||||
svg_path_adapter svg_path(stl_storage);
|
svg_path_adapter svg_path(stl_storage);
|
||||||
svg_renderer<svg_path_adapter,
|
svg_renderer<svg_path_adapter,
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <mapnik/agg_rasterizer.hpp>
|
#include <mapnik/agg_rasterizer.hpp>
|
||||||
#include <mapnik/agg_pattern_source.hpp>
|
#include <mapnik/agg_pattern_source.hpp>
|
||||||
#include <mapnik/expression_evaluator.hpp>
|
#include <mapnik/expression_evaluator.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/line_pattern_symbolizer.hpp>
|
#include <mapnik/line_pattern_symbolizer.hpp>
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <mapnik/agg_rasterizer.hpp>
|
#include <mapnik/agg_rasterizer.hpp>
|
||||||
#include <mapnik/expression_evaluator.hpp>
|
#include <mapnik/expression_evaluator.hpp>
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/svg/svg_renderer.hpp>
|
#include <mapnik/svg/svg_renderer.hpp>
|
||||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include <mapnik/agg_rasterizer.hpp>
|
#include <mapnik/agg_rasterizer.hpp>
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
#include <mapnik/metawriter.hpp>
|
#include <mapnik/metawriter.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/expression_evaluator.hpp>
|
#include <mapnik/expression_evaluator.hpp>
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
// mapnik
|
// mapnik
|
||||||
#include <mapnik/agg_renderer.hpp>
|
#include <mapnik/agg_renderer.hpp>
|
||||||
#include <mapnik/agg_rasterizer.hpp>
|
#include <mapnik/agg_rasterizer.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/expression_evaluator.hpp>
|
#include <mapnik/expression_evaluator.hpp>
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <mapnik/arrow.hpp>
|
#include <mapnik/arrow.hpp>
|
||||||
#include <mapnik/config_error.hpp>
|
#include <mapnik/config_error.hpp>
|
||||||
#include <mapnik/parse_path.hpp>
|
#include <mapnik/parse_path.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||||
#include <mapnik/svg/svg_path_attributes.hpp>
|
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||||
|
@ -913,7 +914,7 @@ void cairo_renderer_base::start_map_processing(Map const& map)
|
||||||
|
|
||||||
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
typedef coord_transform2<CoordTransform,geometry_type> path_type;
|
||||||
mapnik::path_ptr vmarker = *marker.get_vector_data();
|
mapnik::path_ptr vmarker = *marker.get_vector_data();
|
||||||
|
using namespace mapnik::svg;
|
||||||
agg::pod_bvector<path_attributes> const & attributes_ = vmarker->attributes();
|
agg::pod_bvector<path_attributes> const & attributes_ = vmarker->attributes();
|
||||||
for(unsigned i = 0; i < attributes_.size(); ++i)
|
for(unsigned i = 0; i < attributes_.size(); ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -264,8 +264,10 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
|
||||||
box2d<double> query_ext = m_.get_current_extent();
|
box2d<double> query_ext = m_.get_current_extent();
|
||||||
box2d<double> unbuffered_extent = m_.get_current_extent();
|
box2d<double> unbuffered_extent = m_.get_current_extent();
|
||||||
prj_trans.forward(query_ext, PROJ_ENVELOPE_POINTS);
|
prj_trans.forward(query_ext, PROJ_ENVELOPE_POINTS);
|
||||||
query::resolution_type res(m_.width()/query_ext.width(),
|
double qw = query_ext.width()>0 ? query_ext.width() : 1;
|
||||||
m_.height()/query_ext.height());
|
double qh = query_ext.height()>0 ? query_ext.height() : 1;
|
||||||
|
query::resolution_type res(m_.width()/qw,
|
||||||
|
m_.height()/qh);
|
||||||
|
|
||||||
query q(layer_ext,res,scale_denom,unbuffered_extent);
|
query q(layer_ext,res,scale_denom,unbuffered_extent);
|
||||||
p.start_layer_processing(lay, query_ext);
|
p.start_layer_processing(lay, query_ext);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <mapnik/grid/grid.hpp>
|
#include <mapnik/grid/grid.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/unicode.hpp>
|
#include <mapnik/unicode.hpp>
|
||||||
#include <mapnik/config_error.hpp>
|
#include <mapnik/config_error.hpp>
|
||||||
|
@ -145,7 +146,7 @@ void grid_renderer<T>::render_marker(mapnik::feature_ptr const& feature, unsigne
|
||||||
mtx *= agg::trans_affine_scaling(scale_factor_*(1.0/step));
|
mtx *= agg::trans_affine_scaling(scale_factor_*(1.0/step));
|
||||||
// render the marker at the center of the marker box
|
// render the marker at the center of the marker box
|
||||||
mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height());
|
mtx.translate(pos.x+0.5 * marker.width(), pos.y+0.5 * marker.height());
|
||||||
|
using namespace mapnik::svg;
|
||||||
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
|
vertex_stl_adapter<svg_path_storage> stl_storage((*marker.get_vector_data())->source());
|
||||||
svg_path_adapter svg_path(stl_storage);
|
svg_path_adapter svg_path(stl_storage);
|
||||||
svg_renderer<svg_path_adapter,
|
svg_renderer<svg_path_adapter,
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <mapnik/grid/grid_pixfmt.hpp>
|
#include <mapnik/grid/grid_pixfmt.hpp>
|
||||||
#include <mapnik/grid/grid_pixel.hpp>
|
#include <mapnik/grid/grid_pixel.hpp>
|
||||||
#include <mapnik/grid/grid.hpp>
|
#include <mapnik/grid/grid.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/markers_symbolizer.hpp>
|
#include <mapnik/markers_symbolizer.hpp>
|
||||||
|
|
||||||
#include <mapnik/expression_evaluator.hpp>
|
#include <mapnik/expression_evaluator.hpp>
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#include <mapnik/grid/grid.hpp>
|
#include <mapnik/grid/grid.hpp>
|
||||||
#include <mapnik/point_symbolizer.hpp>
|
#include <mapnik/point_symbolizer.hpp>
|
||||||
#include <mapnik/expression_evaluator.hpp>
|
#include <mapnik/expression_evaluator.hpp>
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
|
|
||||||
// stl
|
// stl
|
||||||
|
|
|
@ -57,7 +57,6 @@ extern "C"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// agg
|
// agg
|
||||||
//#include "agg_conv_transform.h"
|
|
||||||
#include "agg_image_accessors.h"
|
#include "agg_image_accessors.h"
|
||||||
#include "agg_pixfmt_rgba.h"
|
#include "agg_pixfmt_rgba.h"
|
||||||
#include "agg_rasterizer_scanline_aa.h"
|
#include "agg_rasterizer_scanline_aa.h"
|
||||||
|
|
|
@ -71,7 +71,7 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void load( const std::string & filename, ptree & pt )
|
void load( std::string const& filename, ptree & pt )
|
||||||
{
|
{
|
||||||
boost::filesystem::path path(filename);
|
boost::filesystem::path path(filename);
|
||||||
if ( !boost::filesystem::exists( path ) ) {
|
if ( !boost::filesystem::exists( path ) ) {
|
||||||
|
@ -119,7 +119,7 @@ public:
|
||||||
load(doc, pt);
|
load(doc, pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_string( const std::string & buffer, ptree & pt, std::string const & base_path )
|
void load_string( std::string const& buffer, ptree & pt, std::string const & base_path )
|
||||||
{
|
{
|
||||||
if (!base_path.empty())
|
if (!base_path.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,7 +122,7 @@ private:
|
||||||
void parse_stroke(stroke & strk, ptree const & sym);
|
void parse_stroke(stroke & strk, ptree const & sym);
|
||||||
expression_ptr parse_expr(std::string const& expr);
|
expression_ptr parse_expr(std::string const& expr);
|
||||||
|
|
||||||
void ensure_font_face( const std::string & face_name );
|
void ensure_font_face( std::string const& face_name );
|
||||||
|
|
||||||
std::string ensure_relative_to_xml( boost::optional<std::string> opt_path );
|
std::string ensure_relative_to_xml( boost::optional<std::string> opt_path );
|
||||||
void ensure_attrs( ptree const& sym, std::string name, std::string attrs);
|
void ensure_attrs( ptree const& sym, std::string name, std::string attrs);
|
||||||
|
@ -185,8 +185,13 @@ void load_map(Map & map, std::string const& filename, bool strict)
|
||||||
parser.parse_map(map, pt, base_path);
|
parser.parse_map(map, pt, base_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_map_string(Map & map, std::string const& str, bool strict, std::string const& base_path)
|
void load_map_string(Map & map, std::string const& str, bool strict, std::string base_path)
|
||||||
{
|
{
|
||||||
|
if (str.empty())
|
||||||
|
{
|
||||||
|
throw config_error( "Cannot load map, XML string is empty" ) ;
|
||||||
|
}
|
||||||
|
|
||||||
ptree pt;
|
ptree pt;
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
if (!base_path.empty())
|
if (!base_path.empty())
|
||||||
|
@ -1789,7 +1794,7 @@ void map_parser::parse_raster_colorizer(raster_colorizer_ptr const& rc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void map_parser::ensure_font_face( const std::string & face_name )
|
void map_parser::ensure_font_face( std::string const& face_name )
|
||||||
{
|
{
|
||||||
if ( ! font_manager_.get_face( face_name ) )
|
if ( ! font_manager_.get_face( face_name ) )
|
||||||
{
|
{
|
||||||
|
|
91
src/map.cpp
91
src/map.cpp
|
@ -451,54 +451,57 @@ void Map::zoom_to_box(const box2d<double> &box)
|
||||||
|
|
||||||
void Map::fixAspectRatio()
|
void Map::fixAspectRatio()
|
||||||
{
|
{
|
||||||
double ratio1 = (double) width_ / (double) height_;
|
if (current_extent_.width() > 0 && current_extent_.height() > 0)
|
||||||
double ratio2 = current_extent_.width() / current_extent_.height();
|
|
||||||
if (ratio1 == ratio2) return;
|
|
||||||
|
|
||||||
switch(aspectFixMode_)
|
|
||||||
{
|
{
|
||||||
case ADJUST_BBOX_HEIGHT:
|
double ratio1 = static_cast<double>(width_) / static_cast<double>(height_);
|
||||||
current_extent_.height(current_extent_.width() / ratio1);
|
double ratio2 = current_extent_.width() / current_extent_.height();
|
||||||
break;
|
if (ratio1 == ratio2) return;
|
||||||
case ADJUST_BBOX_WIDTH:
|
|
||||||
current_extent_.width(current_extent_.height() * ratio1);
|
switch(aspectFixMode_)
|
||||||
break;
|
{
|
||||||
case ADJUST_CANVAS_HEIGHT:
|
case ADJUST_BBOX_HEIGHT:
|
||||||
height_ = int (width_ / ratio2 + 0.5);
|
|
||||||
break;
|
|
||||||
case ADJUST_CANVAS_WIDTH:
|
|
||||||
width_ = int (height_ * ratio2 + 0.5);
|
|
||||||
break;
|
|
||||||
case GROW_BBOX:
|
|
||||||
if (ratio2 > ratio1)
|
|
||||||
current_extent_.height(current_extent_.width() / ratio1);
|
current_extent_.height(current_extent_.width() / ratio1);
|
||||||
else
|
break;
|
||||||
|
case ADJUST_BBOX_WIDTH:
|
||||||
current_extent_.width(current_extent_.height() * ratio1);
|
current_extent_.width(current_extent_.height() * ratio1);
|
||||||
break;
|
break;
|
||||||
case SHRINK_BBOX:
|
case ADJUST_CANVAS_HEIGHT:
|
||||||
if (ratio2 < ratio1)
|
|
||||||
current_extent_.height(current_extent_.width() / ratio1);
|
|
||||||
else
|
|
||||||
current_extent_.width(current_extent_.height() * ratio1);
|
|
||||||
break;
|
|
||||||
case GROW_CANVAS:
|
|
||||||
if (ratio2 > ratio1)
|
|
||||||
width_ = (int) (height_ * ratio2 + 0.5);
|
|
||||||
else
|
|
||||||
height_ = int (width_ / ratio2 + 0.5);
|
height_ = int (width_ / ratio2 + 0.5);
|
||||||
break;
|
break;
|
||||||
case SHRINK_CANVAS:
|
case ADJUST_CANVAS_WIDTH:
|
||||||
if (ratio2 > ratio1)
|
width_ = int (height_ * ratio2 + 0.5);
|
||||||
height_ = int (width_ / ratio2 + 0.5);
|
break;
|
||||||
else
|
case GROW_BBOX:
|
||||||
width_ = (int) (height_ * ratio2 + 0.5);
|
if (ratio2 > ratio1)
|
||||||
break;
|
current_extent_.height(current_extent_.width() / ratio1);
|
||||||
default:
|
else
|
||||||
if (ratio2 > ratio1)
|
current_extent_.width(current_extent_.height() * ratio1);
|
||||||
current_extent_.height(current_extent_.width() / ratio1);
|
break;
|
||||||
else
|
case SHRINK_BBOX:
|
||||||
current_extent_.width(current_extent_.height() * ratio1);
|
if (ratio2 < ratio1)
|
||||||
break;
|
current_extent_.height(current_extent_.width() / ratio1);
|
||||||
|
else
|
||||||
|
current_extent_.width(current_extent_.height() * ratio1);
|
||||||
|
break;
|
||||||
|
case GROW_CANVAS:
|
||||||
|
if (ratio2 > ratio1)
|
||||||
|
width_ = static_cast<int>(height_ * ratio2 + 0.5);
|
||||||
|
else
|
||||||
|
height_ = int (width_ / ratio2 + 0.5);
|
||||||
|
break;
|
||||||
|
case SHRINK_CANVAS:
|
||||||
|
if (ratio2 > ratio1)
|
||||||
|
height_ = int (width_ / ratio2 + 0.5);
|
||||||
|
else
|
||||||
|
width_ = static_cast<int>(height_ * ratio2 + 0.5);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if (ratio2 > ratio1)
|
||||||
|
current_extent_.height(current_extent_.width() / ratio1);
|
||||||
|
else
|
||||||
|
current_extent_.width(current_extent_.height() * ratio1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,13 @@
|
||||||
//$Id$
|
//$Id$
|
||||||
|
|
||||||
// mapnik
|
// mapnik
|
||||||
|
#include <mapnik/marker.hpp>
|
||||||
#include <mapnik/marker_cache.hpp>
|
#include <mapnik/marker_cache.hpp>
|
||||||
#include <mapnik/svg/svg_parser.hpp>
|
#include <mapnik/svg/svg_parser.hpp>
|
||||||
#include <mapnik/svg/svg_storage.hpp>
|
#include <mapnik/svg/svg_storage.hpp>
|
||||||
#include <mapnik/svg/svg_path_adapter.hpp>
|
|
||||||
#include <mapnik/svg/svg_converter.hpp>
|
#include <mapnik/svg/svg_converter.hpp>
|
||||||
|
#include <mapnik/svg/svg_path_adapter.hpp>
|
||||||
|
#include <mapnik/svg/svg_path_attributes.hpp>
|
||||||
#include <mapnik/image_util.hpp>
|
#include <mapnik/image_util.hpp>
|
||||||
#include <mapnik/image_reader.hpp>
|
#include <mapnik/image_reader.hpp>
|
||||||
|
|
||||||
|
@ -35,6 +37,7 @@
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
#include <boost/filesystem/operations.hpp>
|
#include <boost/filesystem/operations.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -72,7 +75,7 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri, bool upda
|
||||||
using namespace mapnik::svg;
|
using namespace mapnik::svg;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
path_ptr marker_path(new svg_storage_type);
|
path_ptr marker_path(boost::make_shared<svg_storage_type>());
|
||||||
vertex_stl_adapter<svg_path_storage> stl_storage(marker_path->source());
|
vertex_stl_adapter<svg_path_storage> stl_storage(marker_path->source());
|
||||||
svg_path_adapter svg_path(stl_storage);
|
svg_path_adapter svg_path(stl_storage);
|
||||||
svg_converter_type svg(svg_path, marker_path->attributes());
|
svg_converter_type svg(svg_path, marker_path->attributes());
|
||||||
|
@ -84,7 +87,7 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri, bool upda
|
||||||
svg.bounding_rect(&lox, &loy, &hix, &hiy);
|
svg.bounding_rect(&lox, &loy, &hix, &hiy);
|
||||||
marker_path->set_bounding_box(lox,loy,hix,hiy);
|
marker_path->set_bounding_box(lox,loy,hix,hiy);
|
||||||
|
|
||||||
marker_ptr mark(new marker(marker_path));
|
marker_ptr mark(boost::make_shared<marker>(marker_path));
|
||||||
result.reset(mark);
|
result.reset(mark);
|
||||||
if (update_cache)
|
if (update_cache)
|
||||||
{
|
{
|
||||||
|
@ -107,9 +110,9 @@ boost::optional<marker_ptr> marker_cache::find(std::string const& uri, bool upda
|
||||||
unsigned width = reader->width();
|
unsigned width = reader->width();
|
||||||
unsigned height = reader->height();
|
unsigned height = reader->height();
|
||||||
BOOST_ASSERT(width > 0 && height > 0);
|
BOOST_ASSERT(width > 0 && height > 0);
|
||||||
mapnik::image_ptr image(new mapnik::image_data_32(width,height));
|
mapnik::image_ptr image(boost::make_shared<mapnik::image_data_32>(width,height));
|
||||||
reader->read(0,0,*image);
|
reader->read(0,0,*image);
|
||||||
marker_ptr mark(new marker(image));
|
marker_ptr mark(boost::make_shared<marker>(image));
|
||||||
result.reset(mark);
|
result.reset(mark);
|
||||||
if (update_cache)
|
if (update_cache)
|
||||||
{
|
{
|
||||||
|
|
|
@ -218,9 +218,13 @@ void placement_finder<DetectorT>::find_line_breaks()
|
||||||
if (p.wrap_width && string_width_ > p.wrap_width)
|
if (p.wrap_width && string_width_ > p.wrap_width)
|
||||||
{
|
{
|
||||||
if (p.text_ratio)
|
if (p.text_ratio)
|
||||||
|
{
|
||||||
for (double i = 1.0; ((wrap_at = string_width_/i)/(string_height_*i)) > p.text_ratio && (string_width_/i) > p.wrap_width; i += 1.0) ;
|
for (double i = 1.0; ((wrap_at = string_width_/i)/(string_height_*i)) > p.text_ratio && (string_width_/i) > p.wrap_width; i += 1.0) ;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
wrap_at = p.wrap_width;
|
wrap_at = p.wrap_width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// work out where our line breaks need to be and the resultant width to the 'wrapped' string
|
// work out where our line breaks need to be and the resultant width to the 'wrapped' string
|
||||||
|
@ -264,8 +268,10 @@ void placement_finder<DetectorT>::find_line_breaks()
|
||||||
|
|
||||||
// wrap text at first wrap_char after (default) the wrap width or immediately before the current word
|
// wrap text at first wrap_char after (default) the wrap width or immediately before the current word
|
||||||
if ((c == '\n') ||
|
if ((c == '\n') ||
|
||||||
(line_width > 0 && ((line_width > wrap_at && !ci.format->wrap_before) ||
|
(line_width > 0 &&
|
||||||
((line_width + last_wrap_char_width + word_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);
|
add_line(line_width, line_height, first_line);
|
||||||
line_breaks_.push_back(last_wrap_char_pos);
|
line_breaks_.push_back(last_wrap_char_pos);
|
||||||
|
@ -321,10 +327,9 @@ void placement_finder<DetectorT>::init_alignment()
|
||||||
|
|
||||||
|
|
||||||
template <typename DetectorT>
|
template <typename DetectorT>
|
||||||
void placement_finder<DetectorT>::adjust_position(text_path *current_placement, double label_x, double label_y)
|
void placement_finder<DetectorT>::adjust_position(text_path *current_placement)
|
||||||
{
|
{
|
||||||
// if needed, adjust for desired vertical alignment
|
// if needed, adjust for desired vertical alignment
|
||||||
current_placement->center.y = label_y; // no adjustment, default is MIDDLE
|
|
||||||
if (valign_ == V_TOP)
|
if (valign_ == V_TOP)
|
||||||
{
|
{
|
||||||
current_placement->center.y -= 0.5 * string_height_; // move center up by 1/2 the total height
|
current_placement->center.y -= 0.5 * string_height_; // move center up by 1/2 the total height
|
||||||
|
@ -334,7 +339,6 @@ void placement_finder<DetectorT>::adjust_position(text_path *current_placement,
|
||||||
}
|
}
|
||||||
|
|
||||||
// set horizontal position to middle of text
|
// set horizontal position to middle of text
|
||||||
current_placement->center.x = label_x; // no adjustment, default is MIDDLE
|
|
||||||
if (halign_ == H_LEFT)
|
if (halign_ == H_LEFT)
|
||||||
{
|
{
|
||||||
current_placement->center.x -= 0.5 * string_width_; // move center left by 1/2 the string width
|
current_placement->center.x -= 0.5 * string_width_; // move center left by 1/2 the string width
|
||||||
|
@ -350,7 +354,9 @@ void placement_finder<DetectorT>::adjust_position(text_path *current_placement,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DetectorT>
|
template <typename DetectorT>
|
||||||
void placement_finder<DetectorT>::find_point_placement(double label_x, double label_y, double angle)
|
void placement_finder<DetectorT>::find_point_placement(double label_x,
|
||||||
|
double label_y,
|
||||||
|
double angle)
|
||||||
{
|
{
|
||||||
find_line_breaks();
|
find_line_breaks();
|
||||||
|
|
||||||
|
@ -359,9 +365,9 @@ void placement_finder<DetectorT>::find_point_placement(double label_x, double la
|
||||||
double sina = std::sin(rad);
|
double sina = std::sin(rad);
|
||||||
|
|
||||||
double x, y;
|
double x, y;
|
||||||
std::auto_ptr<text_path> current_placement(new text_path);
|
std::auto_ptr<text_path> current_placement(new text_path(label_x, label_y));
|
||||||
|
|
||||||
adjust_position(current_placement.get(), label_x, label_y);
|
adjust_position(current_placement.get());
|
||||||
|
|
||||||
// presets for first line
|
// presets for first line
|
||||||
unsigned int line_number = 0;
|
unsigned int line_number = 0;
|
||||||
|
@ -440,7 +446,8 @@ void placement_finder<DetectorT>::find_point_placement(double label_x, double la
|
||||||
}
|
}
|
||||||
|
|
||||||
// if avoid_edges test dimensions contains e
|
// if avoid_edges test dimensions contains e
|
||||||
if (p.avoid_edges && !dimensions_.contains(e)) {
|
if (p.avoid_edges && !dimensions_.contains(e))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +561,7 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
|
||||||
//If there is no spacing then just do one label, otherwise calculate how many there should be
|
//If there is no spacing then just do one label, otherwise calculate how many there should be
|
||||||
int num_labels = 1;
|
int num_labels = 1;
|
||||||
if (p.label_spacing > 0)
|
if (p.label_spacing > 0)
|
||||||
num_labels = static_cast<int> (floor(total_distance / (pi.get_actual_label_spacing() + string_width_)));
|
num_labels = static_cast<int>(floor(total_distance / (pi.get_actual_label_spacing() + string_width_)));
|
||||||
|
|
||||||
if (p.force_odd_labels && (num_labels % 2 == 0))
|
if (p.force_odd_labels && (num_labels % 2 == 0))
|
||||||
num_labels--;
|
num_labels--;
|
||||||
|
@ -667,7 +674,11 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DetectorT>
|
template <typename DetectorT>
|
||||||
std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(const std::vector<vertex2d> &path_positions, const std::vector<double> &path_distances, int &orientation, unsigned index, double distance)
|
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)
|
||||||
{
|
{
|
||||||
//Check that the given distance is on the given index and find the correct index and distance if not
|
//Check that the given distance is on the given index and find the correct index and distance if not
|
||||||
while (distance < 0 && index > 1)
|
while (distance < 0 && index > 1)
|
||||||
|
@ -691,8 +702,6 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(const
|
||||||
const unsigned initial_index = index;
|
const unsigned initial_index = index;
|
||||||
const double initial_distance = distance;
|
const double initial_distance = distance;
|
||||||
|
|
||||||
std::auto_ptr<text_path> current_placement(new text_path);
|
|
||||||
|
|
||||||
double old_x = path_positions[index-1].x;
|
double old_x = path_positions[index-1].x;
|
||||||
double old_y = path_positions[index-1].y;
|
double old_y = path_positions[index-1].y;
|
||||||
|
|
||||||
|
@ -708,11 +717,15 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(const
|
||||||
return std::auto_ptr<text_path>(NULL);
|
return std::auto_ptr<text_path>(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_placement->center.x = old_x + dx*distance/segment_length;
|
std::auto_ptr<text_path> current_placement(
|
||||||
current_placement->center.y = 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);
|
double angle = atan2(-dy, dx);
|
||||||
|
|
||||||
bool orientation_forced = (orientation != 0); //Wether the orientation was set by the caller
|
bool orientation_forced = (orientation != 0); // Whether the orientation was set by the caller
|
||||||
if (!orientation_forced)
|
if (!orientation_forced)
|
||||||
orientation = (angle > 0.55*M_PI || angle < -0.45*M_PI) ? -1 : 1;
|
orientation = (angle > 0.55*M_PI || angle < -0.45*M_PI) ? -1 : 1;
|
||||||
|
|
||||||
|
@ -838,7 +851,11 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(const
|
||||||
if (!orientation_forced)
|
if (!orientation_forced)
|
||||||
{
|
{
|
||||||
orientation = -orientation;
|
orientation = -orientation;
|
||||||
current_placement = get_placement_offset(path_positions, path_distances, orientation, initial_index, initial_distance);
|
current_placement = get_placement_offset(path_positions,
|
||||||
|
path_distances,
|
||||||
|
orientation,
|
||||||
|
initial_index,
|
||||||
|
initial_distance);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -852,7 +869,8 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(const
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DetectorT>
|
template <typename DetectorT>
|
||||||
bool placement_finder<DetectorT>::test_placement(const std::auto_ptr<text_path> & current_placement, const int & orientation)
|
bool placement_finder<DetectorT>::test_placement(std::auto_ptr<text_path> const& current_placement,
|
||||||
|
int orientation)
|
||||||
{
|
{
|
||||||
//Create and test envelopes
|
//Create and test envelopes
|
||||||
bool status = true;
|
bool status = true;
|
||||||
|
@ -929,9 +947,9 @@ bool placement_finder<DetectorT>::test_placement(const std::auto_ptr<text_path>
|
||||||
|
|
||||||
template <typename DetectorT>
|
template <typename DetectorT>
|
||||||
void placement_finder<DetectorT>::find_line_circle_intersection(
|
void placement_finder<DetectorT>::find_line_circle_intersection(
|
||||||
const double &cx, const double &cy, const double &radius,
|
double cx, double cy, double radius,
|
||||||
const double &x1, const double &y1, const double &x2, const double &y2,
|
double x1, double y1, double x2, double y2,
|
||||||
double &ix, double &iy)
|
double & ix, double & iy)
|
||||||
{
|
{
|
||||||
double dx = x2 - x1;
|
double dx = x2 - x1;
|
||||||
double dy = y2 - y1;
|
double dy = y2 - y1;
|
||||||
|
|
|
@ -141,9 +141,7 @@ void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_geometries()
|
||||||
largest_box_only = true;
|
largest_box_only = true;
|
||||||
if (sym_.get_minimum_path_length() > 0)
|
if (sym_.get_minimum_path_length() > 0)
|
||||||
{
|
{
|
||||||
// TODO - find less costly method than fetching full envelope
|
|
||||||
box2d<double> gbox = t_.forward(geom.envelope(), prj_trans_);
|
box2d<double> gbox = t_.forward(geom.envelope(), prj_trans_);
|
||||||
|
|
||||||
if (gbox.width() < sym_.get_minimum_path_length())
|
if (gbox.width() < sym_.get_minimum_path_length())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
@ -167,10 +165,13 @@ template <typename FaceManagerT, typename DetectorT>
|
||||||
void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_points()
|
void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_points()
|
||||||
{
|
{
|
||||||
label_placement_enum how_placed = placement_->properties.label_placement;
|
label_placement_enum how_placed = placement_->properties.label_placement;
|
||||||
if (how_placed == LINE_PLACEMENT) {
|
if (how_placed == LINE_PLACEMENT)
|
||||||
|
{
|
||||||
point_placement_ = false;
|
point_placement_ = false;
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
point_placement_ = true;
|
point_placement_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,14 +194,19 @@ void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_points()
|
||||||
t_.forward(&label_x, &label_y);
|
t_.forward(&label_x, &label_y);
|
||||||
points_.push_back(std::make_pair(label_x, label_y));
|
points_.push_back(std::make_pair(label_x, label_y));
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (how_placed == POINT_PLACEMENT)
|
if (how_placed == POINT_PLACEMENT)
|
||||||
{
|
{
|
||||||
geom.label_position(&label_x, &label_y);
|
geom.label_position(&label_x, &label_y);
|
||||||
} else if (how_placed == INTERIOR_PLACEMENT)
|
}
|
||||||
|
else if (how_placed == INTERIOR_PLACEMENT)
|
||||||
{
|
{
|
||||||
geom.label_interior_position(&label_x, &label_y);
|
geom.label_interior_position(&label_x, &label_y);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
#ifdef MAPNIK_DEBUG
|
#ifdef MAPNIK_DEBUG
|
||||||
std::cerr << "ERROR: Unknown placement type in initialize_points();\n";
|
std::cerr << "ERROR: Unknown placement type in initialize_points();\n";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <mapnik/text_placements/registry.hpp>
|
#include <mapnik/text_placements/registry.hpp>
|
||||||
#include <mapnik/text_placements/simple.hpp>
|
#include <mapnik/text_placements/simple.hpp>
|
||||||
#include <mapnik/text_placements/list.hpp>
|
#include <mapnik/text_placements/list.hpp>
|
||||||
|
#include <mapnik/text_placements/dummy.hpp>
|
||||||
|
|
||||||
namespace mapnik
|
namespace mapnik
|
||||||
{
|
{
|
||||||
|
@ -33,6 +34,7 @@ registry::registry()
|
||||||
{
|
{
|
||||||
register_name("simple", &text_placements_simple::from_xml);
|
register_name("simple", &text_placements_simple::from_xml);
|
||||||
register_name("list", &text_placements_list::from_xml);
|
register_name("list", &text_placements_list::from_xml);
|
||||||
|
register_name("dummy", &text_placements_list::from_xml);
|
||||||
}
|
}
|
||||||
|
|
||||||
void registry::register_name(std::string name, from_xml_function_ptr ptr, bool overwrite)
|
void registry::register_name(std::string name, from_xml_function_ptr ptr, bool overwrite)
|
||||||
|
|
|
@ -31,6 +31,8 @@ namespace mapnik
|
||||||
using boost::optional;
|
using boost::optional;
|
||||||
|
|
||||||
text_symbolizer_properties::text_symbolizer_properties() :
|
text_symbolizer_properties::text_symbolizer_properties() :
|
||||||
|
orientation(),
|
||||||
|
displacement(0,0),
|
||||||
label_placement(POINT_PLACEMENT),
|
label_placement(POINT_PLACEMENT),
|
||||||
halign(H_AUTO),
|
halign(H_AUTO),
|
||||||
jalign(J_MIDDLE),
|
jalign(J_MIDDLE),
|
||||||
|
@ -40,11 +42,13 @@ text_symbolizer_properties::text_symbolizer_properties() :
|
||||||
avoid_edges(false),
|
avoid_edges(false),
|
||||||
minimum_distance(0.0),
|
minimum_distance(0.0),
|
||||||
minimum_padding(0.0),
|
minimum_padding(0.0),
|
||||||
|
minimum_path_length(0.0),
|
||||||
max_char_angle_delta(22.5 * M_PI/180.0),
|
max_char_angle_delta(22.5 * M_PI/180.0),
|
||||||
force_odd_labels(false),
|
force_odd_labels(false),
|
||||||
allow_overlap(false),
|
allow_overlap(false),
|
||||||
text_ratio(0),
|
text_ratio(0),
|
||||||
wrap_width(0),
|
wrap_width(0),
|
||||||
|
format(),
|
||||||
tree_()
|
tree_()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -121,11 +125,13 @@ void text_symbolizer_properties::from_xml(boost::property_tree::ptree const &sym
|
||||||
if (n) set_format_tree(n);
|
if (n) set_format_tree(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void text_symbolizer_properties::to_xml(boost::property_tree::ptree &node, bool explicit_defaults, text_symbolizer_properties const &dfl) const
|
void text_symbolizer_properties::to_xml(boost::property_tree::ptree &node,
|
||||||
|
bool explicit_defaults,
|
||||||
|
text_symbolizer_properties const& dfl) const
|
||||||
{
|
{
|
||||||
if (orientation)
|
if (orientation)
|
||||||
{
|
{
|
||||||
const std::string & orientationstr = to_expression_string(*orientation);
|
std::string const& orientationstr = to_expression_string(*orientation);
|
||||||
if (!dfl.orientation || orientationstr != to_expression_string(*(dfl.orientation)) || explicit_defaults) {
|
if (!dfl.orientation || orientationstr != to_expression_string(*(dfl.orientation)) || explicit_defaults) {
|
||||||
set_attr(node, "orientation", orientationstr);
|
set_attr(node, "orientation", orientationstr);
|
||||||
}
|
}
|
||||||
|
@ -216,6 +222,8 @@ void text_symbolizer_properties::set_old_style_expression(expression_ptr expr)
|
||||||
}
|
}
|
||||||
|
|
||||||
char_properties::char_properties() :
|
char_properties::char_properties() :
|
||||||
|
face_name(),
|
||||||
|
fontset(),
|
||||||
text_size(10.0),
|
text_size(10.0),
|
||||||
character_spacing(0),
|
character_spacing(0),
|
||||||
line_spacing(0),
|
line_spacing(0),
|
||||||
|
@ -263,7 +271,8 @@ void char_properties::from_xml(boost::property_tree::ptree const &sym, fontset_m
|
||||||
if (itr != fontsets.end())
|
if (itr != fontsets.end())
|
||||||
{
|
{
|
||||||
fontset = itr->second;
|
fontset = itr->second;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
throw config_error("Unable to find any fontset named '" + *fontset_name_ + "'");
|
throw config_error("Unable to find any fontset named '" + *fontset_name_ + "'");
|
||||||
}
|
}
|
||||||
|
@ -280,8 +289,8 @@ void char_properties::from_xml(boost::property_tree::ptree const &sym, fontset_m
|
||||||
|
|
||||||
void char_properties::to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const &dfl) const
|
void char_properties::to_xml(boost::property_tree::ptree &node, bool explicit_defaults, char_properties const &dfl) const
|
||||||
{
|
{
|
||||||
const std::string & fontset_name = fontset.get_name();
|
std::string const& fontset_name = fontset.get_name();
|
||||||
const std::string & dfl_fontset_name = dfl.fontset.get_name();
|
std::string const& dfl_fontset_name = dfl.fontset.get_name();
|
||||||
if (fontset_name != dfl_fontset_name || explicit_defaults)
|
if (fontset_name != dfl_fontset_name || explicit_defaults)
|
||||||
{
|
{
|
||||||
set_attr(node, "fontset-name", fontset_name);
|
set_attr(node, "fontset-name", fontset_name);
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import mapnik
|
import mapnik
|
||||||
import cairo
|
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
from compare import compare, summary
|
from compare import compare, summary
|
||||||
|
|
||||||
dirname = os.path.dirname(sys.argv[0])
|
dirname = os.path.dirname(__file__)
|
||||||
files = [
|
files = [
|
||||||
("list", 800, 600, 400, 300, 250, 200, 150, 100),
|
("list", 800, 600, 400, 300, 250, 200, 150, 100),
|
||||||
("simple", 800, 600, 400, 300, 250, 200, 150, 100),
|
("simple", 800, 600, 400, 300, 250, 200, 150, 100),
|
||||||
|
@ -40,7 +39,7 @@ def render(filename, width, height=100):
|
||||||
mapnik.load_map(m, os.path.join(dirname, "%s.xml" % filename), False)
|
mapnik.load_map(m, os.path.join(dirname, "%s.xml" % filename), False)
|
||||||
bbox = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01)
|
bbox = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01)
|
||||||
m.zoom_to_box(bbox)
|
m.zoom_to_box(bbox)
|
||||||
basefn = '%s-%d' % (filename, width)
|
basefn = os.path.join(dirname,'%s-%d' % (filename, width))
|
||||||
mapnik.render_to_file(m, basefn+'-agg.png')
|
mapnik.render_to_file(m, basefn+'-agg.png')
|
||||||
diff = compare(basefn + '-agg.png', basefn + '-reference.png')
|
diff = compare(basefn + '-agg.png', basefn + '-reference.png')
|
||||||
if diff > 0:
|
if diff > 0:
|
||||||
|
@ -61,6 +60,6 @@ for f in files:
|
||||||
m = render(f[0], width[0], width[1])
|
m = render(f[0], width[0], width[1])
|
||||||
else:
|
else:
|
||||||
m = render(f[0], width)
|
m = render(f[0], width)
|
||||||
mapnik.save_map(m, "%s-out.xml" % f[0])
|
mapnik.save_map(m, os.path.join(dirname,"%s-out.xml" % f[0]))
|
||||||
|
|
||||||
summary()
|
summary()
|
||||||
|
|
Loading…
Reference in a new issue