Merge commit 'bb27156df0a111fdecfe87b48d27b2866b7a2816' into harfbuzz

Conflicts:
	include/mapnik/font_engine_freetype.hpp
	include/mapnik/grid/grid_renderer.hpp
	include/mapnik/placement_finder.hpp
	include/mapnik/processed_text.hpp
	include/mapnik/text/formatting/registry.hpp
	include/mapnik/text/placements/registry.hpp
	include/mapnik/text_path.hpp
This commit is contained in:
Hermann Kraus 2013-03-16 13:11:29 +01:00
commit 438e2c4de7
92 changed files with 548 additions and 254 deletions

View file

@ -1336,7 +1336,7 @@ if not preconfigured:
else:
color_print(4,'Not building with cairo support, pass CAIRO=True to enable')
if 'python' in env['BINDINGS']:
if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']:
if not os.access(env['PYTHON'], os.X_OK):
color_print(1,"Cannot run python interpreter at '%s', make sure that you have the permissions to execute it." % env['PYTHON'])
Exit(1)
@ -1391,22 +1391,22 @@ if not preconfigured:
else:
env['PYTHON_IS_64BIT'] = False
if py3 and env['BOOST_PYTHON_LIB'] == 'boost_python':
env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND']
elif env['BOOST_PYTHON_LIB'] == 'boost_python':
env['BOOST_PYTHON_LIB'] = 'boost_python%s' % env['BOOST_APPEND']
if 'python' in env['BINDINGS']:
if py3 and env['BOOST_PYTHON_LIB'] == 'boost_python':
env['BOOST_PYTHON_LIB'] = 'boost_python3%s' % env['BOOST_APPEND']
elif env['BOOST_PYTHON_LIB'] == 'boost_python':
env['BOOST_PYTHON_LIB'] = 'boost_python%s' % env['BOOST_APPEND']
if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'):
color_print(1,'Could not find required header files for boost python')
env['MISSING_DEPS'].append('boost python')
if not conf.CheckHeader(header='boost/python/detail/config.hpp',language='C++'):
color_print(1,'Could not find required header files for boost python')
env['MISSING_DEPS'].append('boost python')
if env['CAIRO']:
if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
env['HAS_PYCAIRO'] = True
if env['CAIRO']:
if conf.CheckPKGConfig('0.15.0') and conf.CheckPKG('pycairo'):
env['HAS_PYCAIRO'] = True
else:
env['SKIPPED_DEPS'].extend(['pycairo'])
else:
env['SKIPPED_DEPS'].extend(['pycairo'])
else:
color_print(4,'Not building with pycairo support, pass CAIRO=True to enable')
color_print(4,'Not building with pycairo support, pass CAIRO=True to enable')
#### End Config Stage for Required Dependencies ####
@ -1531,7 +1531,7 @@ if not preconfigured:
if env['DEBUG_UNDEFINED']:
env.Append(CXXFLAGS = '-fcatch-undefined-behavior -ftrapv -fwrapv')
if 'python' in env['BINDINGS']:
if 'python' in env['BINDINGS'] or 'python' in env['REQUESTED_PLUGINS']:
majver, minver = env['PYTHON_VERSION'].split('.')
# we don't want the includes it in the main environment...
# as they are later set in the python build.py
@ -1547,9 +1547,10 @@ if not preconfigured:
color_print(1,"Python version 2.2 or greater required")
Exit(1)
color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION'])
color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX']))
color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION']))
if 'python' in env['BINDINGS']:
color_print(4,'Bindings Python version... %s' % env['PYTHON_VERSION'])
color_print(4,'Python %s prefix... %s' % (env['PYTHON_VERSION'], env['PYTHON_SYS_PREFIX']))
color_print(4,'Python bindings will install in... %s' % os.path.normpath(env['PYTHON_INSTALL_LOCATION']))
env.Replace(**backup)
# if requested, sort LIBPATH and CPPPATH one last time before saving...

View file

@ -23,6 +23,7 @@
// boost
#include <boost/python.hpp>
#include <boost/python/detail/api_placeholder.hpp>
#include <boost/noncopyable.hpp>
// stl
#include <sstream>

View file

@ -21,6 +21,8 @@
*****************************************************************************/
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/datasource_cache.hpp>
namespace {

View file

@ -23,6 +23,8 @@
// boost
#include <boost/python.hpp>
#include <boost/variant.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/feature.hpp>

View file

@ -28,6 +28,8 @@
#include <boost/python/tuple.hpp>
#include <boost/python/to_python_converter.hpp>
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/feature.hpp>
@ -156,18 +158,53 @@ struct UnicodeString_from_python_str
}
};
struct value_null_from_python
{
value_null_from_python()
{
boost::python::converter::registry::push_back(
&convertible,
&construct,
boost::python::type_id<mapnik::value_null>());
}
static void* convertible(PyObject* obj_ptr)
{
if (obj_ptr == Py_None) return obj_ptr;
return 0;
}
static void construct(
PyObject* obj_ptr,
boost::python::converter::rvalue_from_python_stage1_data* data)
{
if (obj_ptr != Py_None) boost::python::throw_error_already_set();
void* storage = (
(boost::python::converter::rvalue_from_python_storage<mapnik::value_null>*)
data)->storage.bytes;
new (storage) mapnik::value_null();
data->convertible = storage;
}
};
void export_feature()
{
using namespace boost::python;
using mapnik::Feature;
// Python to mapnik::value converters
// NOTE: order matters here. For example value_null must be listed before
// bool otherwise Py_None will be interpreted as bool (false)
implicitly_convertible<UnicodeString,mapnik::value>();
implicitly_convertible<mapnik::value_null,mapnik::value>();
implicitly_convertible<bool,mapnik::value>();
implicitly_convertible<int,mapnik::value>();
implicitly_convertible<double,mapnik::value>();
implicitly_convertible<UnicodeString,mapnik::value>();
implicitly_convertible<bool,mapnik::value>();
// http://misspent.wordpress.com/2009/09/27/how-to-write-boost-python-converters/
UnicodeString_from_python_str();
value_null_from_python();
class_<context_type,context_ptr,boost::noncopyable>
("Context",init<>("Default ctor."))

View file

@ -22,6 +22,7 @@
// boost
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/feature.hpp>

View file

@ -21,6 +21,8 @@
*****************************************************************************/
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/utils.hpp>

View file

@ -26,6 +26,8 @@
#include <boost/python/iterator.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
// mapnik
#include <mapnik/geometry.hpp>

View file

@ -24,6 +24,8 @@
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/map.hpp>

View file

@ -21,6 +21,8 @@
*****************************************************************************/
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/debug.hpp>
#include <mapnik/utils.hpp>
#include "mapnik_enumeration.hpp"

View file

@ -23,6 +23,7 @@
// boost
#include <boost/python.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
//mapnik
#include <mapnik/palette.hpp>

View file

@ -22,6 +22,7 @@
// mapnik
#include <mapnik/proj_transform.hpp>
#include <boost/noncopyable.hpp>
// boost
#include <boost/python.hpp>

View file

@ -21,6 +21,7 @@
*****************************************************************************/
#include <boost/python.hpp>
#include <boost/python/stl_iterator.hpp>
#include <boost/noncopyable.hpp>
#include <mapnik/text/text_properties.hpp>
#include <mapnik/text/placements/simple.hpp>

View file

@ -22,6 +22,7 @@
#include <boost/optional/optional.hpp>
#include <boost/python.hpp>
#include <boost/noncopyable.hpp>
// boost::optional<T> to/from converter from John Wiegley

View file

@ -20,17 +20,18 @@
#include "styles_model.hpp"
#include <mapnik/expression_string.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/concept_check.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/utility.hpp>
// qt
#include <QList>
#include <QIcon>
#include <QPainter>
#include <QPixmap>
class node : private boost::noncopyable
class node : private mapnik::noncopyable
{
struct node_base
{

View file

@ -25,9 +25,7 @@
// mapnik
#include <mapnik/image_data.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_color_rgba.h"
@ -35,7 +33,7 @@
namespace mapnik
{
class pattern_source : private boost::noncopyable
class pattern_source : private mapnik::noncopyable
{
public:
pattern_source(image_data_32 const& pattern)

View file

@ -23,15 +23,15 @@
#ifndef MAPNIK_AGG_RASTERIZER_HPP
#define MAPNIK_AGG_RASTERIZER_HPP
// boost
#include <boost/utility.hpp>
// mapnik
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_rasterizer_scanline_aa.h"
namespace mapnik {
struct rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {};
struct rasterizer : agg::rasterizer_scanline_aa<>, mapnik::noncopyable {};
}

View file

@ -31,9 +31,9 @@
#include <mapnik/map.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/rule.hpp> // for all symbolizers
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
@ -54,7 +54,7 @@ struct rasterizer;
template <typename T>
class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T> >,
private boost::noncopyable
private mapnik::noncopyable
{
public:
@ -120,6 +120,10 @@ public:
};
void painted(bool painted);
inline eAttributeCollectionPolicy attribute_collection_policy() const
{
return DEFAULT;
}
protected:
template <typename R>

View file

@ -26,8 +26,9 @@
// mapnik
#include <mapnik/rule.hpp>
#include <mapnik/transform_processor.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/variant.hpp>
#include <boost/concept_check.hpp>
// stl
@ -206,7 +207,7 @@ private:
};
class attribute_collector : public boost::noncopyable
class attribute_collector : public mapnik::noncopyable
{
private:
std::set<std::string>& names_;

View file

@ -33,13 +33,13 @@
#include <mapnik/map.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/rule.hpp> // for all symbolizers
#include <mapnik/noncopyable.hpp>
// cairo
#include <cairomm/context.h>
#include <cairomm/surface.h>
// boost
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
// FIXME
@ -58,7 +58,7 @@ class cairo_face;
typedef boost::shared_ptr<cairo_face> cairo_face_ptr;
class cairo_face_manager : private boost::noncopyable
class cairo_face_manager : private mapnik::noncopyable
{
public:
cairo_face_manager(boost::shared_ptr<freetype_engine> engine);
@ -70,7 +70,7 @@ private:
cairo_face_cache cache_;
};
class MAPNIK_DECL cairo_renderer_base : private boost::noncopyable
class MAPNIK_DECL cairo_renderer_base : private mapnik::noncopyable
{
protected:
cairo_renderer_base(Map const& m, Cairo::RefPtr<Cairo::Context> const& context, double scale_factor=1.0, unsigned offset_x=0, unsigned offset_y=0);
@ -124,6 +124,11 @@ public:
// nothing to do
}
inline eAttributeCollectionPolicy attribute_collection_policy() const
{
return DEFAULT;
}
void render_marker(pixel_position const& pos, marker const& marker, const agg::trans_affine & mtx, double opacity=1.0, bool recenter=true);
void render_box(box2d<double> const& b);
protected:

View file

@ -29,9 +29,9 @@
#include <mapnik/feature.hpp>
#include <mapnik/query.hpp>
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
// stl
@ -42,7 +42,7 @@ namespace mapnik {
typedef MAPNIK_DECL boost::shared_ptr<Feature> feature_ptr;
struct MAPNIK_DECL Featureset : private boost::noncopyable
struct MAPNIK_DECL Featureset : private mapnik::noncopyable
{
virtual feature_ptr next() = 0;
virtual ~Featureset() {}
@ -70,7 +70,7 @@ private:
std::string message_;
};
class MAPNIK_DECL datasource : private boost::noncopyable
class MAPNIK_DECL datasource : private mapnik::noncopyable
{
public:
enum datasource_t {

View file

@ -28,9 +28,9 @@
#include <mapnik/params.hpp>
#include <mapnik/plugin.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
// stl
@ -40,7 +40,7 @@ namespace mapnik {
class MAPNIK_DECL datasource_cache
: public singleton<datasource_cache, CreateStatic>,
private boost::noncopyable
private mapnik::noncopyable
{
friend class CreateStatic<datasource_cache>;
public:

View file

@ -26,9 +26,9 @@
// mapnik (should not depend on anything that need to use this)
#include <mapnik/config.hpp>
#include <mapnik/utils.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/unordered_map.hpp>
#ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp>
@ -50,7 +50,7 @@ namespace mapnik {
*/
class MAPNIK_DECL logger :
public singleton<logger,CreateStatic>,
private boost::noncopyable
private mapnik::noncopyable
{
public:
enum severity_type
@ -186,7 +186,7 @@ namespace mapnik {
class Ch = char,
class Tr = std::char_traits<Ch>,
class A = std::allocator<Ch> >
class base_log : public boost::noncopyable
class base_log : public mapnik::noncopyable
{
public:
typedef OutputPolicy<Ch, Tr, A> output_policy;
@ -245,7 +245,7 @@ namespace mapnik {
class Ch = char,
class Tr = std::char_traits<Ch>,
class A = std::allocator<Ch> >
class base_log_always : public boost::noncopyable
class base_log_always : public mapnik::noncopyable
{
public:
typedef OutputPolicy<Ch, Tr, A> output_policy;

View file

@ -29,6 +29,8 @@
#include <mapnik/geometry.hpp>
#include <mapnik/raster.hpp>
#include <mapnik/feature_kv_iterator.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/version.hpp>
#if BOOST_VERSION >= 104000
@ -36,7 +38,7 @@
#else
#include <boost/property_map.hpp>
#endif
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
@ -52,7 +54,7 @@ typedef boost::shared_ptr<raster> raster_ptr;
class feature_impl;
template <typename T>
class context : private boost::noncopyable,
class context : private mapnik::noncopyable,
public boost::associative_property_map<T>
{
@ -95,7 +97,7 @@ typedef MAPNIK_DECL boost::shared_ptr<context_type> context_ptr;
static const value default_value;
class MAPNIK_DECL feature_impl : private boost::noncopyable
class MAPNIK_DECL feature_impl : private mapnik::noncopyable
{
friend class feature_kv_iterator;
public:
@ -287,7 +289,14 @@ public:
std::size_t index = itr->second;
if (index < data_.size())
{
ss << " " << itr->first << ":" << data_[itr->second] << std::endl;
if (data_[itr->second] == mapnik::value_null())
{
ss << " " << itr->first << ":null" << std::endl;
}
else
{
ss << " " << itr->first << ":" << data_[itr->second] << std::endl;
}
}
}
ss << ")" << std::endl;

View file

@ -40,6 +40,12 @@ class layer;
class projection;
class proj_transform;
enum eAttributeCollectionPolicy
{
DEFAULT = 0,
COLLECT_ALL = 1
};
template <typename Processor>
class feature_style_processor
{

View file

@ -382,10 +382,20 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
// Don't even try to do more work if there are no active styles.
if (active_styles.size() > 0)
{
// push all property names
BOOST_FOREACH(std::string const& name, names)
if (p.attribute_collection_policy() == COLLECT_ALL)
{
q.add_property_name(name);
layer_descriptor lay_desc = ds->get_descriptor();
BOOST_FOREACH(attribute_descriptor const& desc, lay_desc.get_descriptors())
{
q.add_property_name(desc.get_name());
}
}
else
{
BOOST_FOREACH(std::string const& name, names)
{
q.add_property_name(name);
}
}
// Update filter_factor for all enabled raster layers.
@ -397,14 +407,11 @@ void feature_style_processor<Processor>::apply_to_layer(layer const& lay, Proces
ds->type() == datasource::Raster &&
ds->params().get<double>("filter_factor",0.0) == 0.0)
{
rule::symbolizers const& symbols = r.get_symbolizers();
rule::symbolizers::const_iterator symIter = symbols.begin();
rule::symbolizers::const_iterator symEnd = symbols.end();
while (symIter != symEnd)
BOOST_FOREACH (rule::symbolizers::value_type sym, r.get_symbolizers())
{
// if multiple raster symbolizers, last will be respected
// should we warn or throw?
boost::apply_visitor(d_collector,*symIter++);
boost::apply_visitor(d_collector,sym);
}
q.set_filter_factor(filt_factor);
}

View file

@ -27,6 +27,7 @@
#include <mapnik/config.hpp>
#include <mapnik/font_set.hpp>
#include <mapnik/text/face.hpp>
#include <mapnik/noncopyable.hpp>
// freetype2
extern "C"
@ -52,7 +53,7 @@ namespace mapnik
{
// FT_Stroker wrapper
class stroker : boost::noncopyable
class stroker : mapnik::noncopyable
{
public:
explicit stroker(FT_Stroker s)
@ -97,7 +98,7 @@ private:
};
template <typename T>
class MAPNIK_DECL face_manager : private boost::noncopyable
class MAPNIK_DECL face_manager : private mapnik::noncopyable
{
typedef T font_engine_type;
typedef std::map<std::string, face_ptr> face_ptr_cache_type;

View file

@ -212,11 +212,22 @@ struct filter_in_box
struct filter_at_point
{
coord2d pt_;
explicit filter_at_point(const coord2d& pt)
: pt_(pt) {}
double tol_;
explicit filter_at_point(const coord2d& pt, double tol=0)
: pt_(pt),
tol_(tol) {}
bool pass(const box2d<double>& extent) const
{
return extent.contains(pt_);
if (tol_ == 0)
{
return extent.contains(pt_);
}
else
{
box2d<double> extent2 = extent;
extent2.pad(tol_);
return extent2.contains(pt_);
}
}
};

View file

@ -26,10 +26,10 @@
// mapnik
#include <mapnik/vertex_vector.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
namespace mapnik {
@ -42,7 +42,7 @@ enum eGeomType {
};
template <typename T, template <typename> class Container=vertex_vector>
class geometry : private::boost::noncopyable
class geometry : private::mapnik::noncopyable
{
public:
typedef T coord_type;

View file

@ -23,12 +23,12 @@
#ifndef MAPNIK_GRID_RASTERIZER_HPP
#define MAPNIK_GRID_RASTERIZER_HPP
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
#include "agg_rasterizer_scanline_aa.h"
namespace mapnik {
struct grid_rasterizer : agg::rasterizer_scanline_aa<>, boost::noncopyable {};
struct grid_rasterizer : agg::rasterizer_scanline_aa<>, mapnik::noncopyable {};
}

View file

@ -32,9 +32,9 @@
#include <mapnik/rule.hpp> // for all symbolizers
#include <mapnik/grid/grid.hpp>
#include <mapnik/pixel_position.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp>
// FIXME
@ -53,7 +53,7 @@ struct grid_rasterizer;
template <typename T>
class MAPNIK_DECL grid_renderer : public feature_style_processor<grid_renderer<T> >,
private boost::noncopyable
private mapnik::noncopyable
{
public:
@ -110,6 +110,10 @@ public:
{
pixmap_.painted(painted);
}
inline eAttributeCollectionPolicy attribute_collection_policy() const
{
return DEFAULT;
}
private:
buffer_type & pixmap_;

View file

@ -26,9 +26,9 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/palette.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/version.hpp>
#include <boost/unordered_map.hpp>
#if BOOST_VERSION >= 104600
@ -60,7 +60,7 @@ struct RGBAPolicy
};
template <typename T, typename InsertPolicy = RGBAPolicy >
class hextree : private boost::noncopyable
class hextree : private mapnik::noncopyable
{
struct node
{

View file

@ -114,7 +114,7 @@
namespace mapnik { namespace filter { namespace detail {
static const float blur_matrix[] = {0.1111,0.1111,0.1111,0.1111,0.1111,0.1111,0.1111,0.1111,0.1111};
static const float blur_matrix[] = {0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f,0.1111f};
static const float emboss_matrix[] = {-2,-1,0,-1,1,1,0,1,2};
static const float sharpen_matrix[] = {0,-1,0,-1,5,-1,0,-1,0 };
static const float edge_detect_matrix[] = {0,1,0,1,-4,1,0,1,0 };

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/json/feature_grammar.hpp>
#include <mapnik/feature.hpp>
// spirit::qi
#include <boost/config/warning_disable.hpp>
@ -88,7 +89,7 @@ struct feature_collection_grammar :
> lit(']')
;
feature = eps[_a = construct<feature_ptr>(new_<feature_impl>(ctx_,generate_id_()))]
feature = eps[_a = construct<mapnik::feature_ptr>(new_<mapnik::feature_impl>(ctx_,generate_id_()))]
>> feature_g(*_a)[push_back(_r1,_a)]
;

View file

@ -27,10 +27,11 @@
#include <mapnik/config.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/utility.hpp>
// stl
#include <vector>
@ -39,7 +40,7 @@ namespace mapnik { namespace json {
template <typename Iterator, typename FeatureType> struct feature_collection_grammar;
template <typename Iterator>
class feature_collection_parser : private boost::noncopyable
class feature_collection_parser : private mapnik::noncopyable
{
typedef Iterator iterator_type;
typedef mapnik::Feature feature_type;

View file

@ -25,8 +25,9 @@
#include <mapnik/config.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/utility.hpp>
#include <string>
namespace mapnik { namespace json {
@ -36,7 +37,7 @@ namespace mapnik { namespace json {
template <typename OutputIterator> struct feature_generator_grammar;
template <typename OutputIterator> struct multi_geometry_generator_grammar;
class MAPNIK_DECL feature_generator : private boost::noncopyable
class MAPNIK_DECL feature_generator : private mapnik::noncopyable
{
typedef std::back_insert_iterator<std::string> sink_type;
public:
@ -47,7 +48,7 @@ private:
boost::scoped_ptr<feature_generator_grammar<sink_type> > grammar_;
};
class MAPNIK_DECL geometry_generator : private boost::noncopyable
class MAPNIK_DECL geometry_generator : private mapnik::noncopyable
{
typedef std::back_insert_iterator<std::string> sink_type;
public:
@ -60,7 +61,7 @@ private:
#else
class MAPNIK_DECL feature_generator : private boost::noncopyable
class MAPNIK_DECL feature_generator : private mapnik::noncopyable
{
public:
feature_generator() {}
@ -68,7 +69,7 @@ public:
bool generate(std::string & geojson, mapnik::Feature const& f);
};
class MAPNIK_DECL geometry_generator : private boost::noncopyable
class MAPNIK_DECL geometry_generator : private mapnik::noncopyable
{
public:
geometry_generator() {}

View file

@ -26,10 +26,11 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/scoped_ptr.hpp>
#include <boost/utility.hpp>
// stl
//#include <vector>
@ -40,7 +41,7 @@ template <typename Iterator> struct geometry_grammar;
MAPNIK_DECL bool from_geojson(std::string const& json, boost::ptr_vector<geometry_type> & paths);
template <typename Iterator>
class MAPNIK_DECL geometry_parser : private boost::noncopyable
class MAPNIK_DECL geometry_parser : private mapnik::noncopyable
{
typedef Iterator iterator_type;
public:

View file

@ -25,6 +25,7 @@
// mapnik
#include <mapnik/quad_tree.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <vector>
@ -63,7 +64,7 @@ private:
};
// quad_tree based label collision detector
class label_collision_detector2 : boost::noncopyable
class label_collision_detector2 : mapnik::noncopyable
{
typedef quad_tree<box2d<double> > tree_t;
tree_t tree_;
@ -97,7 +98,7 @@ public:
};
// quad_tree based label collision detector with seperate check/insert
class label_collision_detector3 : boost::noncopyable
class label_collision_detector3 : mapnik::noncopyable
{
typedef quad_tree< box2d<double> > tree_t;
tree_t tree_;
@ -135,7 +136,7 @@ public:
//quad tree based label collision detector so labels dont appear within a given distance
class label_collision_detector4 : boost::noncopyable
class label_collision_detector4 : mapnik::noncopyable
{
public:
struct label

View file

@ -26,9 +26,9 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/utils.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/unordered_map.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <boost/shared_ptr.hpp>
@ -43,7 +43,7 @@ typedef boost::shared_ptr<mapped_region> mapped_region_ptr;
struct MAPNIK_DECL mapped_memory_cache :
public singleton<mapped_memory_cache, CreateStatic>,
private boost::noncopyable
private mapnik::noncopyable
{
friend class CreateStatic<mapped_memory_cache>;
boost::unordered_map<std::string,mapped_region_ptr> cache_;

View file

@ -29,12 +29,12 @@
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_storage.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_path_storage.h"
// boost
#include <boost/utility.hpp>
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
@ -55,7 +55,7 @@ typedef boost::shared_ptr<image_data_32> image_ptr;
* A class to hold either vector or bitmap marker data. This allows these to be treated equally
* in the image caches and most of the render paths.
*/
class marker: private boost::noncopyable
class marker: private mapnik::noncopyable
{
public:
marker()

View file

@ -26,9 +26,9 @@
// mapnik
#include <mapnik/utils.hpp>
#include <mapnik/config.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/unordered_map.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
@ -43,7 +43,7 @@ typedef boost::shared_ptr<marker> marker_ptr;
class MAPNIK_DECL marker_cache :
public singleton <marker_cache, CreateUsingNew>,
private boost::noncopyable
private mapnik::noncopyable
{
friend class CreateUsingNew<marker_cache>;
private:

View file

@ -30,9 +30,7 @@
#include <mapnik/label_collision_detector.hpp>
#include <mapnik/global.hpp> //round
#include <mapnik/box2d.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_basics.h"
@ -48,7 +46,7 @@
namespace mapnik {
template <typename Locator, typename Detector>
class markers_placement : boost::noncopyable
class markers_placement : mapnik::noncopyable
{
public:
/** Constructor for markers_placement object.
@ -293,7 +291,7 @@ private:
last_y = next_y;
}
}
unsigned points = round(length / s);
unsigned points = static_cast<unsigned>(round(length / s));
if (points == 0) return 0.0; //Path to short
return length / points;
}

View file

@ -26,9 +26,7 @@
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/palette.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <vector>
@ -51,7 +49,7 @@ struct RGBPolicy
};
template <typename T, typename InsertPolicy = RGBPolicy >
class octree : private boost::noncopyable
class octree : private mapnik::noncopyable
{
struct node
{
@ -250,7 +248,7 @@ public:
// select best of all reducible:
unsigned red_idx = leaf_level_-1;
unsigned bestv = (*reducible_[red_idx].begin())->reduce_cost;
unsigned bestv = static_cast<unsigned>((*reducible_[red_idx].begin())->reduce_cost);
for(unsigned i=red_idx; i>=InsertPolicy::MIN_LEVELS; i--)
{
if (!reducible_[i].empty())

View file

@ -26,9 +26,9 @@
// mapnik
#include <mapnik/config.hpp>
#include <mapnik/global.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/unordered_map.hpp>
// stl
@ -126,7 +126,7 @@ struct rgba
typedef boost::unordered_map<unsigned, unsigned> rgba_hash_table;
class MAPNIK_DECL rgba_palette : private boost::noncopyable {
class MAPNIK_DECL rgba_palette : private mapnik::noncopyable {
public:
enum palette_type { PALETTE_RGBA = 0, PALETTE_RGB = 1, PALETTE_ACT = 2 };

View file

@ -23,8 +23,8 @@
#ifndef MAPNIK_PLUGIN_HPP
#define MAPNIK_PLUGIN_HPP
// boost
#include <boost/utility.hpp>
// mapnik
#include <mapnik/noncopyable.hpp>
// stl
#include <string>
@ -34,7 +34,7 @@
namespace mapnik
{
class PluginInfo : boost::noncopyable
class PluginInfo : mapnik::noncopyable
{
private:
std::string name_;

View file

@ -30,9 +30,13 @@
#include <mapnik/hextree.hpp>
#include <mapnik/miniz_png.hpp>
#include <mapnik/image_data.hpp>
// zlib
#include <zlib.h>
// boost
#include <boost/scoped_array.hpp>
extern "C"
{
#include <png.h>
@ -118,12 +122,12 @@ void save_as_png(T1 & file,
png_set_IHDR(png_ptr, info_ptr,image.width(),image.height(),8,
(trans_mode == 0) ? PNG_COLOR_TYPE_RGB : PNG_COLOR_TYPE_RGB_ALPHA,PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT,PNG_FILTER_TYPE_DEFAULT);
png_bytep row_pointers[image.height()];
boost::scoped_array<png_byte*> row_pointers(new png_bytep[image.height()]);
for (unsigned int i = 0; i < image.height(); i++)
{
row_pointers[i] = (png_bytep)image.getRow(i);
}
png_set_rows(png_ptr, info_ptr, (png_bytepp)&row_pointers);
png_set_rows(png_ptr, info_ptr, row_pointers.get());
png_write_png(png_ptr, info_ptr, (trans_mode == 0) ? PNG_TRANSFORM_STRIP_FILLER_AFTER : PNG_TRANSFORM_IDENTITY, NULL);
png_destroy_write_struct(&png_ptr, &info_ptr);
}

View file

@ -26,10 +26,10 @@
// mapnik
#include <mapnik/debug.hpp>
#include <mapnik/utils.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#ifdef MAPNIK_THREADSAFE
#include <boost/thread/mutex.hpp>
#endif
@ -65,7 +65,7 @@ private:
};
template <typename T,template <typename> class Creator>
class Pool : private boost::noncopyable
class Pool : private mapnik::noncopyable
{
typedef boost::shared_ptr<T> HolderType;
typedef std::deque<HolderType> ContType;

View file

@ -26,13 +26,11 @@
// mapnik
#include <mapnik/projection.hpp>
#include <mapnik/box2d.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
namespace mapnik {
class MAPNIK_DECL proj_transform : private boost::noncopyable
class MAPNIK_DECL proj_transform : private mapnik::noncopyable
{
public:
proj_transform(projection const& source,

View file

@ -25,10 +25,10 @@
// mapnik
#include <mapnik/box2d.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
// stl
#include <vector>
@ -37,7 +37,7 @@
namespace mapnik
{
template <typename T>
class quad_tree : boost::noncopyable
class quad_tree : mapnik::noncopyable
{
struct node
{

View file

@ -26,12 +26,10 @@
// mapnik
#include <mapnik/box2d.hpp>
#include <mapnik/image_data.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
namespace mapnik {
class raster : private boost::noncopyable
class raster : private mapnik::noncopyable
{
public:
box2d<double> ext_;

View file

@ -5,6 +5,7 @@
#include <mapnik/box2d.hpp>
#include <mapnik/vertex.hpp>
#include <mapnik/simplify.hpp>
#include <mapnik/noncopyable.hpp>
// STL
#include <limits>
@ -17,7 +18,7 @@
namespace mapnik
{
struct weighted_vertex : private boost::noncopyable
struct weighted_vertex : private mapnik::noncopyable
{
vertex2d coord;
double weight;

View file

@ -30,9 +30,8 @@
#include <mapnik/util/geometry_svg_generator.hpp>
#include <mapnik/svg/output/svg_output_grammars.hpp>
#include <mapnik/svg/output/svg_output_attributes.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
namespace mapnik { namespace svg {
@ -43,7 +42,7 @@ namespace mapnik { namespace svg {
* structure.
*/
template <typename OutputIterator>
class svg_generator : private boost::noncopyable
class svg_generator : private mapnik::noncopyable
{
typedef svg::svg_root_attributes_grammar<OutputIterator> root_attributes_grammar;
typedef svg::svg_rect_attributes_grammar<OutputIterator> rect_attributes_grammar;

View file

@ -28,6 +28,7 @@
#include <mapnik/map.hpp>
#include <mapnik/svg/output/svg_generator.hpp>
#include <mapnik/svg/output/svg_output_attributes.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <string>
@ -39,7 +40,7 @@ namespace mapnik
// can target many other output destinations besides streams.
template <typename OutputIterator>
class MAPNIK_DECL svg_renderer : public feature_style_processor<svg_renderer<OutputIterator> >,
private boost::noncopyable
private mapnik::noncopyable
{
public:
typedef svg_renderer<OutputIterator> processor_impl_type;

View file

@ -26,9 +26,7 @@
// mapnik
#include <mapnik/svg/svg_path_attributes.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_path_storage.h"
@ -46,7 +44,7 @@ namespace mapnik {
namespace svg {
template <typename VertexSource, typename AttributeSource>
class svg_converter : boost::noncopyable
class svg_converter : mapnik::noncopyable
{
public:

View file

@ -28,9 +28,9 @@
#include <mapnik/svg/svg_converter.hpp>
#include <mapnik/svg/svg_path_adapter.hpp>
#include <mapnik/gradient.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <libxml/xmlreader.h>
// stl
@ -38,7 +38,7 @@
namespace mapnik { namespace svg {
class svg_parser : private boost::noncopyable
class svg_parser : private mapnik::noncopyable
{
public:
explicit svg_parser(svg_converter_type & path);

View file

@ -24,7 +24,7 @@
#define MAPNIK_SVG_PATH_ADAPTER_HPP
// mapnik
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_math.h"
@ -40,7 +40,7 @@ namespace svg {
using namespace agg;
template<class VertexContainer> class path_adapter : boost::noncopyable
template<class VertexContainer> class path_adapter : mapnik::noncopyable
{
public:
typedef VertexContainer container_type;
@ -838,7 +838,7 @@ void path_adapter<VC>::translate_all_paths(double dx, double dy)
}
template<class Container> class vertex_stl_adapter : boost::noncopyable
template<class Container> class vertex_stl_adapter : mapnik::noncopyable
{
public:

View file

@ -29,9 +29,9 @@
#include <mapnik/gradient.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/grid/grid_pixel.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/foreach.hpp>
// agg
@ -100,7 +100,7 @@ private:
};
template <typename VertexSource, typename AttributeSource, typename ScanlineRenderer, typename PixelFormat>
class svg_renderer_agg : boost::noncopyable
class svg_renderer_agg : mapnik::noncopyable
{
public:
typedef agg::conv_curve<VertexSource> curved_type;

View file

@ -25,15 +25,13 @@
// mapnik
#include <mapnik/box2d.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
namespace mapnik {
namespace svg {
template <typename VertexSource ,typename AttributeSource>
class svg_storage : boost::noncopyable
class svg_storage : mapnik::noncopyable
{
public:
svg_storage() {}

View file

@ -25,9 +25,7 @@
// mapnik
#include <mapnik/utils.hpp>
#include <mapnik/text/formatting/base.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <string>
@ -41,7 +39,7 @@ namespace formatting
typedef node_ptr (*from_xml_function_ptr)(xml_node const& xml);
class registry : public singleton<registry, CreateStatic>,
private boost::noncopyable
private mapnik::noncopyable
{
public:
registry();

View file

@ -37,7 +37,7 @@ class MAPNIK_DECL text_placements;
* This placement has first to be tested by placement_finder to verify it
* can actually be used.
*/
class text_placement_info : boost::noncopyable
class text_placement_info : mapnik::noncopyable
{
public:
/** Constructor. Takes the parent text_placements object as a parameter

View file

@ -25,9 +25,7 @@
// mapnik
#include <mapnik/utils.hpp>
#include <mapnik/text/placements/base.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <string>
@ -42,7 +40,7 @@ typedef text_placements_ptr (*from_xml_function_ptr)(
xml_node const& xml, fontset_map const & fontsets);
class registry : public singleton<registry, CreateStatic>,
private boost::noncopyable
private mapnik::noncopyable
{
public:
registry();

View file

@ -25,13 +25,13 @@
//mapnik
#include <mapnik/config.hpp>
#include <mapnik/noncopyable.hpp>
// icu
#include <unicode/unistr.h>
#include <unicode/ucnv.h>
// boost
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
// stl
@ -39,7 +39,7 @@
namespace mapnik {
class MAPNIK_DECL transcoder : private boost::noncopyable
class MAPNIK_DECL transcoder : private mapnik::noncopyable
{
public:
explicit transcoder (std::string const& encoding);

View file

@ -28,12 +28,15 @@
// stl
#include <string>
#include <cmath> // log10
// boost
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/karma.hpp>
// boost
#include <boost/version.hpp>
#include <boost/math/special_functions/trunc.hpp> // trunc to avoid needing C++11
#if BOOST_VERSION >= 104500
#include <boost/config/warning_disable.hpp>
@ -68,7 +71,11 @@ struct double_policy : boost::spirit::karma::real_policies<T>
{
typedef boost::spirit::karma::real_policies<T> base_type;
static int floatfield(T n) { return base_type::fmtflags::fixed; }
static unsigned precision(T n) { return 16 ;}
static unsigned precision(T n) { return static_cast<unsigned>(15 - boost::math::trunc(log10(n))); }
template <typename OutputIterator>
static bool dot(OutputIterator& sink, T n, unsigned precision) {
return n ? *sink = '.', true : false;
}
};
@ -77,7 +84,7 @@ template <>
inline bool to_string(std::string & str, double value)
{
namespace karma = boost::spirit::karma;
typedef boost::spirit::karma::real_generator<double, double_policy<double> > double_type;
typedef karma::real_generator<double, double_policy<double> > double_type;
std::back_insert_iterator<std::string> sink(str);
return karma::generate(sink, double_type(), value);
}

View file

@ -182,22 +182,21 @@ struct not_equals
bool operator() (value_null, value_null) const
{
// TODO - needs review - https://github.com/mapnik/mapnik/issues/794
return false;
}
template <typename T>
bool operator() (value_null, const T &) const
{
// TODO - needs review - https://github.com/mapnik/mapnik/issues/794
return false;
// https://github.com/mapnik/mapnik/issues/1642
return true;
}
template <typename T>
bool operator() (const T &, value_null) const
{
// TODO - needs review - https://github.com/mapnik/mapnik/issues/794
return false;
// https://github.com/mapnik/mapnik/issues/1642
return true;
}
};

View file

@ -44,13 +44,13 @@
#include <boost/fusion/include/make_vector.hpp>
#include <boost/foreach.hpp>
#include <boost/utility.hpp>
#include <boost/array.hpp>
// mapnik
#include <mapnik/agg_helpers.hpp>
#include <mapnik/offset_converter.hpp>
#include <mapnik/simplify_converter.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_conv_clip_polygon.h"
@ -317,7 +317,7 @@ struct dispatcher
template <typename B, typename R, typename S, typename T, typename P, typename A, typename C >
struct vertex_converter : private boost::noncopyable
struct vertex_converter : private mapnik::noncopyable
{
typedef C conv_types;
typedef B bbox_type;

View file

@ -29,9 +29,9 @@
// mapnik
#include <mapnik/vertex.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/tuple/tuple.hpp>
#include <cstring> // required for memcpy with linux/g++
@ -40,7 +40,7 @@ namespace mapnik
{
template <typename T>
class vertex_vector : private boost::noncopyable
class vertex_vector : private mapnik::noncopyable
{
typedef T coord_type;
typedef vertex<coord_type,2> vertex_type;

View file

@ -25,9 +25,7 @@
// mapnik
#include <mapnik/geometry.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
namespace mapnik
{
@ -50,7 +48,7 @@ enum wkbFormat
wkbSpatiaLite=3
};
class MAPNIK_DECL geometry_utils : private boost::noncopyable
class MAPNIK_DECL geometry_utils : private mapnik::noncopyable
{
public:

View file

@ -27,8 +27,9 @@
#include <mapnik/config.hpp>
#include <mapnik/geometry.hpp>
#include <mapnik/wkt/wkt_grammar.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/version.hpp>
@ -42,7 +43,7 @@ MAPNIK_DECL bool from_wkt(std::string const& wkt, boost::ptr_vector<geometry_typ
#if BOOST_VERSION >= 104700
class MAPNIK_DECL wkt_parser : boost::noncopyable
class MAPNIK_DECL wkt_parser : mapnik::noncopyable
{
typedef std::string::const_iterator iterator_type;
public:

View file

@ -200,8 +200,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
// if layer-level filter_factor is set, apply it
if (filter_factor_)
{
im_width *= filter_factor_;
im_height *= filter_factor_;
im_width = int(im_width * filter_factor_ + 0.5);
im_height = int(im_height * filter_factor_ + 0.5);
MAPNIK_LOG_DEBUG(gdal) << "gdal_featureset: Applying layer filter_factor=" << filter_factor_;
}
@ -209,8 +209,8 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
else
{
double sym_downsample_factor = q.get_filter_factor();
im_width *= sym_downsample_factor;
im_height *= sym_downsample_factor;
im_width = int(im_width * sym_downsample_factor + 0.5);
im_height = int(im_height * sym_downsample_factor + 0.5);
}
// case where we need to avoid upsampling so that the

View file

@ -55,7 +55,6 @@ using mapnik::datasource_exception;
using mapnik::datasource;
using mapnik::parameters;
using mapnik::filter_in_box;
using mapnik::filter_at_point;
DATASOURCE_PLUGIN(geos_datasource)

View file

@ -62,7 +62,6 @@ mapnik::layer_descriptor python_datasource::get_descriptor() const
void python_datasource::bind() const
{
using namespace boost;
using namespace boost::python;
if (is_bound_) return;
@ -81,34 +80,34 @@ void python_datasource::bind() const
+ factory_ + '"');
}
// extract the module and the callable
str module_name("__main__"), callable_name;
boost::python::str module_name("__main__"), callable_name;
if (factory_split.size() == 1)
{
callable_name = str(factory_split[0]);
callable_name = boost::python::str(factory_split[0]);
}
else
{
module_name = str(factory_split[0]);
callable_name = str(factory_split[1]);
module_name = boost::python::str(factory_split[0]);
callable_name = boost::python::str(factory_split[1]);
}
ensure_gil lock;
// import the main module from Python (in case we're embedding the
// interpreter directly) and also import the callable.
object main_module = import("__main__");
object callable_module = import(module_name);
object callable = callable_module.attr(callable_name);
boost::python::object main_module = boost::python::import("__main__");
boost::python::object callable_module = boost::python::import(module_name);
boost::python::object callable = callable_module.attr(callable_name);
// prepare the arguments
dict kwargs;
boost::python::dict kwargs;
typedef std::map<std::string, std::string>::value_type kv_type;
BOOST_FOREACH(const kv_type& kv, kwargs_)
{
kwargs[str(kv.first)] = str(kv.second);
kwargs[boost::python::str(kv.first)] = boost::python::str(kv.second);
}
// get our wrapped data source
datasource_ = callable(*boost::python::make_tuple(), **kwargs);
}
catch ( error_already_set )
catch ( boost::python::error_already_set )
{
throw mapnik::datasource_exception(extractException());
}
@ -118,8 +117,6 @@ void python_datasource::bind() const
mapnik::datasource::datasource_t python_datasource::type() const
{
using namespace boost::python;
typedef boost::optional<mapnik::datasource::geometry_t> return_type;
if (!is_bound_) bind();
@ -127,11 +124,11 @@ mapnik::datasource::datasource_t python_datasource::type() const
try
{
ensure_gil lock;
object data_type = datasource_.attr("data_type");
long data_type_integer = extract<long>(data_type);
boost::python::object data_type = datasource_.attr("data_type");
long data_type_integer = boost::python::extract<long>(data_type);
return mapnik::datasource::datasource_t(data_type_integer);
}
catch ( error_already_set )
catch ( boost::python::error_already_set )
{
throw mapnik::datasource_exception(extractException());
}
@ -140,16 +137,14 @@ mapnik::datasource::datasource_t python_datasource::type() const
mapnik::box2d<double> python_datasource::envelope() const
{
using namespace boost::python;
if (!is_bound_) bind();
try
{
ensure_gil lock;
return extract<mapnik::box2d<double> >(datasource_.attr("envelope"));
return boost::python::extract<mapnik::box2d<double> >(datasource_.attr("envelope"));
}
catch ( error_already_set )
catch ( boost::python::error_already_set )
{
throw mapnik::datasource_exception(extractException());
}
@ -157,8 +152,6 @@ mapnik::box2d<double> python_datasource::envelope() const
boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_type() const
{
using namespace boost::python;
typedef boost::optional<mapnik::datasource::geometry_t> return_type;
if (!is_bound_) bind();
@ -171,16 +164,16 @@ boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_
{
return return_type();
}
object py_geometry_type = datasource_.attr("geometry_type");
boost::python::object py_geometry_type = datasource_.attr("geometry_type");
// if the attribute value is 'None', return a 'none' value
if (py_geometry_type.ptr() == object().ptr())
if (py_geometry_type.ptr() == boost::python::object().ptr())
{
return return_type();
}
long geom_type_integer = extract<long>(py_geometry_type);
long geom_type_integer = boost::python::extract<long>(py_geometry_type);
return mapnik::datasource::geometry_t(geom_type_integer);
}
catch ( error_already_set )
catch ( boost::python::error_already_set )
{
throw mapnik::datasource_exception(extractException());
}
@ -188,8 +181,6 @@ boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_
mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const
{
using namespace boost::python;
if (!is_bound_) bind();
try
@ -198,9 +189,9 @@ mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const
if (envelope().intersects(q.get_bbox()))
{
ensure_gil lock;
object features(datasource_.attr("features")(q));
boost::python::object features(datasource_.attr("features")(q));
// if 'None' was returned, return an empty feature set
if(features.ptr() == object().ptr())
if(features.ptr() == boost::python::object().ptr())
{
return mapnik::featureset_ptr();
}
@ -209,7 +200,7 @@ mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const
// otherwise return an empty featureset pointer
return mapnik::featureset_ptr();
}
catch ( error_already_set )
catch ( boost::python::error_already_set )
{
throw mapnik::datasource_exception(extractException());
}
@ -217,23 +208,22 @@ mapnik::featureset_ptr python_datasource::features(mapnik::query const& q) const
mapnik::featureset_ptr python_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
{
using namespace boost::python;
if (!is_bound_) bind();
try
{
ensure_gil lock;
object features(datasource_.attr("features_at_point")(pt));
boost::python::object features(datasource_.attr("features_at_point")(pt));
// if we returned none, return an empty set
if(features.ptr() == object().ptr())
if(features.ptr() == boost::python::object().ptr())
{
return mapnik::featureset_ptr();
}
// otherwise, return a feature set which can iterate over the iterator
return boost::make_shared<python_featureset>(features);
}
catch ( error_already_set )
catch ( boost::python::error_already_set )
{
throw mapnik::datasource_exception(extractException());
}

View file

@ -160,7 +160,7 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, Feature & f)
{
if (record_[fields_[col].offset_] == '*')
{
f.put(name,0);
f.put(name,mapnik::value_null());
break;
}
if ( fields_[col].dec_>0 )

View file

@ -23,9 +23,11 @@
#ifndef DBFFILE_HPP
#define DBFFILE_HPP
// mapnik
#include <mapnik/feature.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/interprocess/streams/bufferstream.hpp>
// stl
@ -48,7 +50,7 @@ struct field_descriptor
};
class dbf_file : private boost::noncopyable
class dbf_file : private mapnik::noncopyable
{
private:
int num_records_;

View file

@ -296,7 +296,7 @@ featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol
mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point");
#endif
filter_at_point filter(pt);
filter_at_point filter(pt,tol);
// collect all attribute names
std::vector<attribute_descriptor> const& desc_vector = desc_.get_descriptors();
std::vector<attribute_descriptor>::const_iterator itr = desc_vector.begin();

View file

@ -26,16 +26,16 @@
// mapnik
#include <mapnik/geometry.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include "dbfile.hpp"
#include "shapefile.hpp"
#include "shp_index.hpp"
struct shape_io : boost::noncopyable
struct shape_io : mapnik::noncopyable
{
public:
enum shapeType

View file

@ -31,9 +31,9 @@
#include <mapnik/global.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/mapped_memory_cache.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/cstdint.hpp>
#include <boost/interprocess/streams/bufferstream.hpp>
@ -130,7 +130,7 @@ struct shape_record
using namespace boost::interprocess;
class shape_file : boost::noncopyable
class shape_file : mapnik::noncopyable
{
public:

View file

@ -27,10 +27,10 @@
#include <mapnik/datasource.hpp>
#include <mapnik/params.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
// stl
#include <string.h>
@ -42,7 +42,7 @@ extern "C" {
#include <sqlite3.h>
}
class prepared_index_statement : boost::noncopyable
class prepared_index_statement : mapnik::noncopyable
{
public:

View file

@ -31,6 +31,7 @@
#include <mapnik/marker_cache.hpp>
#include <mapnik/line_pattern_symbolizer.hpp>
#include <mapnik/vertex_converters.hpp>
#include <mapnik/noncopyable.hpp>
// agg
#include "agg_basics.h"
@ -47,12 +48,11 @@
#include "agg_conv_clip_polyline.h"
// boost
#include <boost/utility.hpp>
#include <boost/foreach.hpp>
namespace {
class pattern_source : private boost::noncopyable
class pattern_source : private mapnik::noncopyable
{
public:
pattern_source(mapnik::image_data_32 const& pattern)
@ -132,7 +132,7 @@ void agg_renderer<T>::process(line_pattern_symbolizer const& sym,
if (sym.clip())
{
double padding = (double)(query_extent_.width()/pixmap_.width());
float half_stroke = (*mark)->width()/2.0;
double half_stroke = (*mark)->width()/2.0;
if (half_stroke > 1)
padding *= half_stroke;
clipping_extent.pad(padding);

View file

@ -89,7 +89,7 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
if (sym.clip())
{
double padding = (double)(query_extent_.width()/pixmap_.width());
float half_stroke = stroke_.get_width()/2.0;
double half_stroke = stroke_.get_width()/2.0;
if (half_stroke > 1)
padding *= half_stroke;
if (fabs(sym.offset()) > 0)

View file

@ -43,6 +43,7 @@
#include <mapnik/config.hpp>
#include <mapnik/vertex_converters.hpp>
#include <mapnik/marker_helpers.hpp>
#include <mapnik/noncopyable.hpp>
// cairo
#include <cairomm/context.h>
@ -51,7 +52,6 @@
#include <cairo-version.h>
// boost
#include <boost/utility.hpp>
#include <boost/make_shared.hpp>
#include <boost/math/special_functions/round.hpp>
@ -71,7 +71,7 @@
namespace mapnik
{
class cairo_pattern : private boost::noncopyable
class cairo_pattern : private mapnik::noncopyable
{
public:
cairo_pattern(image_data_32 const& data)
@ -145,7 +145,7 @@ private:
Cairo::RefPtr<Cairo::SurfacePattern> pattern_;
};
class cairo_gradient : private boost::noncopyable
class cairo_gradient : private mapnik::noncopyable
{
public:
cairo_gradient(const mapnik::gradient &grad, double opacity=1.0)
@ -201,7 +201,7 @@ private:
};
class cairo_face : private boost::noncopyable
class cairo_face : private mapnik::noncopyable
{
public:
cairo_face(boost::shared_ptr<freetype_engine> const& engine, face_ptr const& face)
@ -268,7 +268,7 @@ cairo_face_ptr cairo_face_manager::get_face(face_ptr face)
return entry;
}
class cairo_context : private boost::noncopyable
class cairo_context : private mapnik::noncopyable
{
public:
cairo_context(Cairo::RefPtr<Cairo::Context> const& context)
@ -1037,7 +1037,7 @@ void cairo_renderer_base::process(line_symbolizer const& sym,
if (sym.clip())
{
double padding = (double)(query_extent_.width()/width_);
float half_stroke = stroke_.get_width()/2.0;
double half_stroke = stroke_.get_width()/2.0;
if (half_stroke > 1)
padding *= half_stroke;
if (fabs(sym.offset()) > 0)

View file

@ -74,7 +74,7 @@ void grid_renderer<T>::process(line_symbolizer const& sym,
if (sym.clip())
{
double padding = (double)(query_extent_.width()/pixmap_.width());
float half_stroke = stroke_.get_width()/2.0;
double half_stroke = stroke_.get_width()/2.0;
if (half_stroke > 1)
padding *= half_stroke;
if (fabs(sym.offset()) > 0)

View file

@ -23,6 +23,7 @@
// mapnik
#include <mapnik/image_reader.hpp>
#include <mapnik/color.hpp>
#include <mapnik/noncopyable.hpp>
// jpeg
extern "C"
@ -32,14 +33,13 @@ extern "C"
// boost
#include <boost/scoped_array.hpp>
#include <boost/utility.hpp>
// std
#include <cstdio>
namespace mapnik
{
class JpegReader : public image_reader, boost::noncopyable
class JpegReader : public image_reader, mapnik::noncopyable
{
private:
std::string fileName_;

View file

@ -27,9 +27,9 @@
#include <mapnik/xml_node.hpp>
#include <mapnik/config_error.hpp>
#include <mapnik/util/trim.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/filesystem/operations.hpp>
// libxml
@ -42,7 +42,7 @@
namespace mapnik
{
class libxml2_loader : boost::noncopyable
class libxml2_loader : mapnik::noncopyable
{
public:
libxml2_loader(const char *encoding = NULL, int options = DEFAULT_OPTIONS, const char *url = NULL) :

View file

@ -50,6 +50,7 @@
#include <mapnik/util/conversions.hpp>
#include <mapnik/util/trim.hpp>
#include <mapnik/marker_cache.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/optional.hpp>
@ -71,7 +72,7 @@ namespace mapnik
{
using boost::optional;
class map_parser : boost::noncopyable {
class map_parser : mapnik::noncopyable {
public:
map_parser(bool strict, std::string const& filename = "") :
strict_(strict),
@ -1125,7 +1126,7 @@ void map_parser::parse_polygon_pattern_symbolizer(rule & rule,
symbol.set_alignment(p_alignment);
// opacity
optional<double> opacity = sym.get_opt_attr<double>("opacity");
optional<float> opacity = sym.get_opt_attr<float>("opacity");
if (opacity) symbol.set_opacity(*opacity);
// gamma
@ -1213,7 +1214,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym)
shield_symbol.set_shield_displacement(shield_dx,shield_dy);
// opacity
optional<double> opacity = sym.get_opt_attr<double>("opacity");
optional<float> opacity = sym.get_opt_attr<float>("opacity");
if (opacity)
{
shield_symbol.set_opacity(*opacity);
@ -1485,7 +1486,7 @@ void map_parser::parse_raster_symbolizer(rule & rule, xml_node const & sym)
}
// opacity
optional<double> opacity = sym.get_opt_attr<double>("opacity");
optional<float> opacity = sym.get_opt_attr<float>("opacity");
if (opacity) raster_sym.set_opacity(*opacity);
// filter factor

View file

@ -24,7 +24,7 @@
#include <mapnik/config_error.hpp>
// stl
#include <iostream>
#include <sstream>
#include <iomanip>
namespace mapnik

View file

@ -22,6 +22,7 @@
#include <mapnik/debug.hpp>
#include <mapnik/image_reader.hpp>
#include <mapnik/noncopyable.hpp>
extern "C"
{
@ -29,11 +30,10 @@ extern "C"
}
#include <boost/scoped_array.hpp>
#include <boost/utility.hpp>
namespace mapnik
{
class png_reader : public image_reader, boost::noncopyable
class png_reader : public image_reader, mapnik::noncopyable
{
private:
std::string fileName_;

View file

@ -32,9 +32,7 @@
#include <mapnik/xml_node.hpp>
#include <mapnik/config_error.hpp>
#include <mapnik/util/trim.hpp>
// boost
#include <boost/utility.hpp>
#include <mapnik/noncopyable.hpp>
// stl
#include <iostream>
@ -43,7 +41,7 @@
namespace rapidxml = boost::property_tree::detail::rapidxml;
namespace mapnik
{
class rapidxml_loader : boost::noncopyable
class rapidxml_loader : mapnik::noncopyable
{
public:
rapidxml_loader(const char *encoding = NULL) :

View file

@ -27,9 +27,9 @@
#include <mapnik/coord_array.hpp>
#include <mapnik/geom_util.hpp>
#include <mapnik/feature.hpp>
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/utility.hpp>
#include <boost/format.hpp>
namespace mapnik
@ -37,7 +37,7 @@ namespace mapnik
typedef coord_array<coord2d> CoordinateArray;
struct wkb_reader : boost::noncopyable
struct wkb_reader : mapnik::noncopyable
{
private:
enum wkbByteOrder {

View file

@ -0,0 +1,123 @@
#include <boost/version.hpp>
#include <mapnik/util/conversions.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
int main( int, char*[] )
{
using mapnik::util::to_string;
try
{
std::string out;
// Test double
to_string(out, double(0));
BOOST_TEST_EQ( out, "0" );
out.clear();
to_string(out, double(1));
BOOST_TEST_EQ( out, "1" );
out.clear();
to_string(out, double(-1));
BOOST_TEST_EQ( out, "-1" );
out.clear();
to_string(out, double(0.1));
BOOST_TEST_EQ( out, "0.1" );
out.clear();
to_string(out, double(-0.1));
BOOST_TEST_EQ( out, "-0.1" );
out.clear();
to_string(out, double(0.123));
BOOST_TEST_EQ( out, "0.123" );
out.clear();
to_string(out, double(-0.123));
BOOST_TEST_EQ( out, "-0.123" );
out.clear();
to_string(out, double(1e-06));
BOOST_TEST_EQ( out, "1e-06" );
out.clear();
to_string(out, double(-1e-06));
BOOST_TEST_EQ( out, "-1e-06" );
out.clear();
to_string(out, double(1e-05));
BOOST_TEST_EQ( out, "0.00001" );
out.clear();
to_string(out, double(-1e-05));
BOOST_TEST_EQ( out, "-0.00001" );
out.clear();
to_string(out, double(0.0001));
BOOST_TEST_EQ( out, "0.0001" );
out.clear();
to_string(out, double(-0.0001));
BOOST_TEST_EQ( out, "-0.0001" );
out.clear();
to_string(out, double(0.0001234567890123456));
BOOST_TEST_EQ( out, "0.0001234567890123456" );
out.clear();
to_string(out, double(-0.0001234567890123456));
BOOST_TEST_EQ( out, "-0.0001234567890123456" );
out.clear();
to_string(out, double(1000000000000000));
BOOST_TEST_EQ( out, "1000000000000000" );
out.clear();
to_string(out, double(-1000000000000000));
BOOST_TEST_EQ( out, "-1000000000000000" );
out.clear();
to_string(out, double(100000000000000.1));
BOOST_TEST_EQ( out, "100000000000000.1" );
out.clear();
to_string(out, double(1.00001));
BOOST_TEST_EQ( out, "1.00001" );
out.clear();
to_string(out, double(1234000000000000));
BOOST_TEST_EQ( out, "1234000000000000" );
out.clear();
to_string(out, double(1.234e+16));
BOOST_TEST_EQ( out, "1.234e+16" );
out.clear();
to_string(out, double(-1.234e+16));
BOOST_TEST_EQ( out, "-1.234e+16" );
out.clear();
// Test int
to_string(out, int(2));
BOOST_TEST_EQ( out, "2" );
out.clear();
}
catch (std::exception const & ex)
{
std::clog << "C++ type conversions problem: " << ex.what() << "\n";
BOOST_TEST(false);
}
if (!::boost::detail::test_errors()) {
std::clog << "C++ type conversions: \x1b[1;32m✓ \x1b[0m\n";
#if BOOST_VERSION >= 104600
::boost::detail::report_errors_remind().called_report_errors_function = true;
#endif
} else {
return ::boost::report_errors();
}
}

View file

@ -192,5 +192,78 @@ def test_string_matching_on_precision():
expr = mapnik.Expression("[num].match('.*(^0|00)$')")
eq_(expr.evaluate(f),True)
def test_creation_of_null_value():
context = mapnik.Context()
context.push('nv')
f = mapnik.Feature(context,0)
f["nv"] = None
eq_(f["nv"],None)
eq_(f["nv"] is None,True)
# test boolean
f["nv"] = 0
eq_(f["nv"],0)
eq_(f["nv"] is not None,True)
def test_creation_of_bool():
context = mapnik.Context()
context.push('bool')
f = mapnik.Feature(context,0)
f["bool"] = True
eq_(f["bool"],True)
eq_(isinstance(f["bool"],bool),True)
f["bool"] = False
eq_(f["bool"],False)
eq_(isinstance(f["bool"],bool),True)
# test NoneType
f["bool"] = None
eq_(f["bool"],None)
eq_(isinstance(f["bool"],bool),False)
# test integer
f["bool"] = 0
eq_(f["bool"],0)
# ugh, boost_python's built into converter does not work right
#eq_(isinstance(f["bool"],bool),False)
null_equality = [
['hello',False,unicode],
[0,False,int],
[0.0,False,float],
[False,False,bool],
[None,True,None]
]
def test_expressions_with_null_equality():
for eq in null_equality:
context = mapnik.Context()
f = mapnik.Feature(context,0)
f["prop"] = eq[0]
eq_(f["prop"],eq[0])
if eq[0] is None:
eq_(f["prop"] is None, True)
else:
eq_(isinstance(f['prop'],eq[2]),True,'%s is not an instance of %s' % (f['prop'],eq[2]))
expr = mapnik.Expression("[prop] = null")
eq_(expr.evaluate(f),eq[1])
expr = mapnik.Expression("[prop] is null")
eq_(expr.evaluate(f),eq[1])
def test_expressions_with_null_equality():
for eq in null_equality:
context = mapnik.Context()
f = mapnik.Feature(context,0)
f["prop"] = eq[0]
eq_(f["prop"],eq[0])
if eq[0] is None:
eq_(f["prop"] is None, True)
else:
eq_(isinstance(f['prop'],eq[2]),True,'%s is not an instance of %s' % (f['prop'],eq[2]))
# TODO - support `is not` syntax:
# https://github.com/mapnik/mapnik/issues/796
expr = mapnik.Expression("not [prop] is null")
eq_(expr.evaluate(f),not eq[1])
# https://github.com/mapnik/mapnik/issues/1642
expr = mapnik.Expression("[prop] != null")
eq_(expr.evaluate(f),not eq[1])
if __name__ == "__main__":
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -14,7 +14,8 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
def test_query_tolerance():
srs = '+init=epsg:4326'
lyr = mapnik.Layer('test')
lyr.datasource = mapnik.Shapefile(file='../data/shp/arrows.shp')
ds = mapnik.Shapefile(file='../data/shp/arrows.shp')
lyr.datasource = ds
lyr.srs = srs
_width = 256
_map = mapnik.Map(_width,_width, srs)
@ -24,16 +25,20 @@ if 'shape' in mapnik.DatasourceCache.plugin_names():
_map_env = _map.envelope()
tol = (_map_env.maxx - _map_env.minx) / _width * 3
# 0.046875 for arrows.shp and zoom_all
assert tol == 0.046875
eq_(tol,0.046875)
# check point really exists
x, y = 2.0, 4.0
features = _map.query_point(0,x,y).features
assert len(features) == 1
eq_(len(features),1)
# check inside tolerance limit
x = 2.0 + tol * 0.9
features = _map.query_point(0,x,y).features
assert len(features) == 1
eq_(len(features),1)
# check outside tolerance limit
x = 2.0 + tol * 1.1
features = _map.query_point(0,x,y).features
assert len(features) == 0
eq_(len(features),0)
if __name__ == "__main__":
setup()
[eval(run)() for run in dir() if 'test_' in run]

View file

@ -20,10 +20,11 @@
*
*****************************************************************************/
#include <mapnik/noncopyable.hpp>
// boost
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
#include <boost/variant.hpp>
//sqlite3
#include <sqlite3.h>
@ -36,7 +37,7 @@
namespace mapnik { namespace sqlite {
class database : private boost::noncopyable
class database : private mapnik::noncopyable
{
friend class prepared_statement;
@ -73,7 +74,7 @@ namespace mapnik { namespace sqlite {
typedef boost::variant<int,double,std::string, blob,null_type> value_type;
typedef std::vector<value_type> record_type;
class prepared_statement : boost::noncopyable
class prepared_statement : mapnik::noncopyable
{
struct binder : public boost::static_visitor<bool>
{