Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

code formatting

  • Loading branch information...
commit 39d199aa49848d104395bb6b803ed5c7b63c0249 1 parent f5d0f8c
@springmeyer springmeyer authored
Showing with 1,077 additions and 1,077 deletions.
  1. +2 −2 bindings/python/mapnik_color.cpp
  2. +3 −3 bindings/python/mapnik_coord.cpp
  3. +13 −13 bindings/python/mapnik_datasource.cpp
  4. +3 −3 bindings/python/mapnik_datasource_cache.cpp
  5. +3 −3 bindings/python/mapnik_enumeration.hpp
  6. +6 −6 bindings/python/mapnik_envelope.cpp
  7. +3 −3 bindings/python/mapnik_expression.cpp
  8. +16 −16 bindings/python/mapnik_feature.cpp
  9. +11 −11 bindings/python/mapnik_featureset.cpp
  10. +1 −1  bindings/python/mapnik_font_engine.cpp
  11. +5 −5 bindings/python/mapnik_geometry.cpp
  12. +2 −2 bindings/python/mapnik_glyph_symbolizer.cpp
  13. +13 −13 bindings/python/mapnik_grid.cpp
  14. +5 −5 bindings/python/mapnik_grid_view.cpp
  15. +14 −14 bindings/python/mapnik_image.cpp
  16. +11 −11 bindings/python/mapnik_image_view.cpp
  17. +21 −21 bindings/python/mapnik_inmem_metawriter.cpp
  18. +66 −66 bindings/python/mapnik_label_collision_detector.cpp
  19. +19 −19 bindings/python/mapnik_layer.cpp
  20. +12 −12 bindings/python/mapnik_line_pattern_symbolizer.cpp
  21. +3 −3 bindings/python/mapnik_line_symbolizer.cpp
  22. +70 −70 bindings/python/mapnik_map.cpp
  23. +15 −15 bindings/python/mapnik_markers_symbolizer.cpp
  24. +8 −8 bindings/python/mapnik_palette.cpp
  25. +10 −10 bindings/python/mapnik_parameters.cpp
  26. +10 −10 bindings/python/mapnik_point_symbolizer.cpp
  27. +15 −15 bindings/python/mapnik_polygon_pattern_symbolizer.cpp
  28. +5 −5 bindings/python/mapnik_polygon_symbolizer.cpp
  29. +5 −5 bindings/python/mapnik_proj_transform.cpp
  30. +11 −11 bindings/python/mapnik_projection.cpp
  31. +154 −154 bindings/python/mapnik_python.cpp
  32. +3 −3 bindings/python/mapnik_query.cpp
  33. +101 −101 bindings/python/mapnik_raster_colorizer.cpp
  34. +8 −8 bindings/python/mapnik_raster_symbolizer.cpp
  35. +18 −18 bindings/python/mapnik_rule.cpp
  36. +18 −18 bindings/python/mapnik_shield_symbolizer.cpp
  37. +5 −5 bindings/python/mapnik_stroke.cpp
  38. +6 −6 bindings/python/mapnik_style.cpp
  39. +2 −2 bindings/python/mapnik_svg.hpp
  40. +11 −11 bindings/python/mapnik_symbolizer.cpp
  41. +27 −27 bindings/python/mapnik_text_symbolizer.cpp
  42. +5 −5 bindings/python/mapnik_value_converter.hpp
  43. +6 −6 bindings/python/mapnik_view_transform.cpp
  44. +54 −54 bindings/python/python_grid_utils.hpp
  45. +3 −3 bindings/python/python_optional.hpp
  46. +61 −61 demo/c++/rundemo.cpp
  47. +5 −5 plugins/input/occi/occi_featureset.cpp
  48. +24 −24 utils/ogrindex/ogrindex.cpp
  49. +18 −18 utils/pgsql2sqlite/main.cpp
  50. +61 −61 utils/pgsql2sqlite/pgsql2sqlite.hpp
  51. +6 −6 utils/pgsql2sqlite/sqlite.cpp
  52. +22 −22 utils/pgsql2sqlite/sqlite.hpp
  53. +28 −28 utils/shapeindex/quadtree.hpp
  54. +36 −36 utils/shapeindex/shapeindex.cpp
  55. +14 −14 utils/svg2png/svg2png.cpp
View
4 bindings/python/mapnik_color.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -40,7 +40,7 @@ struct color_pickle_suite : boost::python::pickle_suite
}
};
-void export_color ()
+void export_color ()
{
using namespace boost::python;
class_<color>("Color", init<int,int,int,int>(
View
6 bindings/python/mapnik_coord.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -42,7 +42,7 @@ struct coord_pickle_suite : boost::python::pickle_suite
void export_coord()
{
using namespace boost::python;
- class_<coord<double,2> >("Coord",init<double, double>(
+ class_<coord<double,2> >("Coord",init<double, double>(
// class docstring is in mapnik/__init__.py, class _Coord
(arg("x"), arg("y")),
"Constructs a new point with the given coordinates.\n")
@@ -59,7 +59,7 @@ void export_coord()
.def(self - self) // __sub__
.def(self - float())
.def(self * float()) //__mult__
- .def(float() * self)
+ .def(float() * self)
.def(self / float()) // __div__
;
}
View
26 bindings/python/mapnik_datasource.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -41,7 +41,7 @@ using mapnik::memory_datasource;
using mapnik::layer_descriptor;
using mapnik::attribute_descriptor;
-namespace
+namespace
{
//user-friendly wrapper that uses Python dictionary
using namespace boost::python;
@@ -54,17 +54,17 @@ boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
{
std::string key = extract<std::string>(keys[i]);
object obj = d[key];
-
+
if (key == "bind")
{
bind = extract<bool>(obj)();
continue;
}
-
+
extract<std::string> ex0(obj);
extract<int> ex1(obj);
extract<double> ex2(obj);
-
+
if (ex0.check())
{
params[key] = ex0();
@@ -78,10 +78,10 @@ boost::shared_ptr<mapnik::datasource> create_datasource(const dict& d)
params[key] = ex2();
}
}
-
+
return mapnik::datasource_cache::create(params, bind);
}
-
+
std::string describe(boost::shared_ptr<mapnik::datasource> const& ds)
{
std::stringstream ss;
@@ -95,7 +95,7 @@ std::string describe(boost::shared_ptr<mapnik::datasource> const& ds)
}
return ss.str();
}
-
+
std::string encoding(boost::shared_ptr<mapnik::datasource> const& ds)
{
layer_descriptor ld = ds->get_descriptor();
@@ -134,7 +134,7 @@ boost::python::list field_types(boost::shared_ptr<mapnik::datasource> const& ds)
std::vector<attribute_descriptor>::const_iterator it = desc_ar.begin();
std::vector<attribute_descriptor>::const_iterator end = desc_ar.end();
for (; it != end; ++it)
- {
+ {
unsigned type = it->get_type();
if (type == mapnik::Integer)
// this crashes, so send back strings instead
@@ -162,7 +162,7 @@ boost::python::list field_types(boost::shared_ptr<mapnik::datasource> const& ds)
void export_datasource()
{
using namespace boost::python;
-
+
class_<datasource,boost::shared_ptr<datasource>,
boost::noncopyable>("Datasource",no_init)
.def("envelope",&datasource::envelope)
@@ -174,11 +174,11 @@ void export_datasource()
.def("encoding",&encoding) //todo expose as property
.def("name",&name)
.def("features_at_point",&datasource::features_at_point)
- .def("params",&datasource::params,return_value_policy<copy_const_reference>(),
- "The configuration parameters of the data source. "
+ .def("params",&datasource::params,return_value_policy<copy_const_reference>(),
+ "The configuration parameters of the data source. "
"These vary depending on the type of data source.")
;
-
+
def("Describe",&describe);
def("CreateDatasource",&create_datasource);
View
6 bindings/python/mapnik_datasource_cache.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -36,7 +36,7 @@ void export_datasource_cache()
return_value_policy<reference_existing_object>())
.staticmethod("instance")
;
-
+
class_<datasource_cache,bases<singleton<datasource_cache,CreateStatic> >,
boost::noncopyable>("DatasourceCache",no_init)
.def("create",&datasource_cache::create)
@@ -44,6 +44,6 @@ void export_datasource_cache()
.def("register_datasources",&datasource_cache::register_datasources)
.staticmethod("register_datasources")
.def("plugin_names",&datasource_cache::plugin_names)
- .staticmethod("plugin_names")
+ .staticmethod("plugin_names")
;
}
View
6 bindings/python/mapnik_enumeration.hpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -26,7 +26,7 @@ namespace mapnik {
template <typename EnumWrapper>
class enumeration_ :
- public boost::python::enum_<typename EnumWrapper::native_type>
+ public boost::python::enum_<typename EnumWrapper::native_type>
{
// some short cuts
typedef boost::python::enum_<typename EnumWrapper::native_type> base_type;
@@ -46,7 +46,7 @@ class enumeration_ :
enumeration_(const char * python_alias, const char * doc) :
base_type( python_alias, doc )
#else
- enumeration_(const char * python_alias, const char * /*doc*/) :
+ enumeration_(const char * python_alias, const char * /*doc*/) :
// Boost.Python < 1.35.0 doesn't support
// docstrings for enums so we ignore it.
base_type( python_alias )
View
12 bindings/python/mapnik_envelope.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -102,13 +102,13 @@ void export_envelope()
"Equivalent to Box2d(ll.x, ll.y, ur.x, ur.y).\n"))
.def("from_string",from_string)
.staticmethod("from_string")
- .add_property("minx", &box2d<double>::minx,
+ .add_property("minx", &box2d<double>::minx,
"X coordinate for the lower left corner")
- .add_property("miny", &box2d<double>::miny,
+ .add_property("miny", &box2d<double>::miny,
"Y coordinate for the lower left corner")
.add_property("maxx", &box2d<double>::maxx,
"X coordinate for the upper right corner")
- .add_property("maxy", &box2d<double>::maxy,
+ .add_property("maxy", &box2d<double>::maxy,
"Y coordinate for the upper right corner")
.def("center", &box2d<double>::center,
"Returns the coordinates of the center of the bounding box.\n"
@@ -259,13 +259,13 @@ void export_envelope()
">>> e1 = Box2d(0, 0, 100, 100)\n"
">>> e2 = Box2d(50, 50, 150, 150)\n"
">>> e1.intersect(e2)\n"
- "Box2d(50.0, 50.0, 100.0, 100.0)\n"
+ "Box2d(50.0, 50.0, 100.0, 100.0)\n"
)
.def(self == self) // __eq__
.def(self != self) // __neq__
.def(self + self) // __add__
.def(self * float()) // __mult__
- .def(float() * self)
+ .def(float() * self)
.def(self / float()) // __div__
.def("__getitem__",&box2d<double>::operator[])
.def("valid",&box2d<double>::valid)
View
6 bindings/python/mapnik_expression.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -76,7 +76,7 @@ void export_expression()
.def("evaluate", &expression_evaluate_)
.def("__str__",&to_expression_string);
;
-
+
def("Expression",&parse_expression_,(arg("expr")),"Expression string");
class_<mapnik::path_expression ,boost::noncopyable>("PathExpression",
@@ -85,6 +85,6 @@ void export_expression()
.def("evaluate", &path_evaluate_) // note: "pass" is a reserved word in Python
.def("__str__",&path_to_string_);
;
-
+
def("PathExpression",&parse_path_,(arg("expr")),"PathExpression string");
}
View
32 bindings/python/mapnik_feature.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -70,7 +70,7 @@ namespace boost { namespace python {
: public map_indexing_suite2<Container,
NoProxy, final_map_derived_policies<Container, NoProxy> > {};
}
-
+
template <class Container,bool NoProxy = false,
class DerivedPolicies = detail::final_map_derived_policies<Container, NoProxy> >
class map_indexing_suite2
@@ -97,7 +97,7 @@ namespace boost { namespace python {
static void
extension_def(Class& /*cl*/)
{
-
+
}
static data_type&
@@ -111,37 +111,37 @@ namespace boost { namespace python {
}
return i->second;
}
-
+
static void
set_item(Container& container, index_type i, data_type const& v)
{
container[i] = v;
}
-
+
static void
delete_item(Container& container, index_type i)
{
container.props().erase(i);
}
-
+
static size_t
size(Container& container)
{
return container.props().size();
}
-
+
static bool
contains(Container& container, key_type const& key)
{
return container.props().find(key) != container.end();
}
-
+
static bool
compare_index(Container& container, index_type a, index_type b)
{
return container.props().key_comp()(a, b);
}
-
+
static index_type
convert_index(Container& /*container*/, PyObject* i_)
{
@@ -156,13 +156,13 @@ namespace boost { namespace python {
if (i.check())
return i();
}
-
+
PyErr_SetString(PyExc_TypeError, "Invalid index type");
throw_error_already_set();
return index_type();
}
};
-
+
template <typename T1, typename T2>
struct std_pair_to_tuple
@@ -173,7 +173,7 @@ namespace boost { namespace python {
boost::python::make_tuple(p.first, p.second).ptr());
}
};
-
+
template <typename T1, typename T2>
struct std_pair_to_python_converter
{
@@ -201,9 +201,9 @@ struct UnicodeString_from_python_str
{
if (!(
#if PY_VERSION_HEX >= 0x03000000
- PyBytes_Check(obj_ptr)
+ PyBytes_Check(obj_ptr)
#else
- PyString_Check(obj_ptr)
+ PyString_Check(obj_ptr)
#endif
|| PyUnicode_Check(obj_ptr)))
return 0;
@@ -245,7 +245,7 @@ void export_feature()
{
using namespace boost::python;
using mapnik::Feature;
-
+
implicitly_convertible<int,mapnik::value>();
implicitly_convertible<double,mapnik::value>();
implicitly_convertible<UnicodeString,mapnik::value>();
@@ -253,7 +253,7 @@ void export_feature()
std_pair_to_python_converter<std::string const,mapnik::value>();
UnicodeString_from_python_str();
-
+
class_<Feature,boost::shared_ptr<Feature>,
boost::noncopyable>("Feature",init<int>("Default ctor."))
.def("id",&Feature::id)
View
22 bindings/python/mapnik_featureset.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -65,21 +65,21 @@ void export_featureset()
using namespace boost::python;
using mapnik::Feature;
using mapnik::Featureset;
-
+
class_<Featureset,boost::shared_ptr<Featureset>,
boost::noncopyable>("Featureset",no_init)
.def("__iter__",pass_through)
.def("next",next)
.add_property("features",features,
- "The list of features.\n"
- "\n"
- "Usage:\n"
- ">>> m.query_map_point(0, 10, 10)\n"
- "<mapnik2._mapnik2.Featureset object at 0x1004d2938>\n"
- ">>> fs = m.query_map_point(0, 10, 10)\n"
- ">>> for f in fs.features:\n"
- ">>> print f\n"
- "<mapnik2.Feature object at 0x105e64140>\n"
+ "The list of features.\n"
+ "\n"
+ "Usage:\n"
+ ">>> m.query_map_point(0, 10, 10)\n"
+ "<mapnik2._mapnik2.Featureset object at 0x1004d2938>\n"
+ ">>> fs = m.query_map_point(0, 10, 10)\n"
+ ">>> for f in fs.features:\n"
+ ">>> print f\n"
+ "<mapnik2.Feature object at 0x105e64140>\n"
)
;
}
View
2  bindings/python/mapnik_font_engine.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
View
10 bindings/python/mapnik_geometry.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* This library is free software; you can redistribute it and/or
@@ -63,7 +63,7 @@ void from_wkb_impl(path_type& p, std::string const& wkb)
void export_geometry()
{
using namespace boost::python;
-
+
enum_<mapnik::eGeomType>("GeometryType")
.value("Point",mapnik::Point)
.value("LineString",mapnik::LineString)
@@ -72,7 +72,7 @@ void export_geometry()
.value("MultiLineString",mapnik::MultiLineString)
.value("MultiPolygon",mapnik::MultiPolygon)
;
-
+
using mapnik::geometry_type;
class_<geometry_type, std::auto_ptr<geometry_type>,boost::noncopyable>("Geometry2d",no_init)
.def("envelope",&geometry_type::envelope)
@@ -80,12 +80,12 @@ void export_geometry()
.def("type",&geometry_type::type)
// TODO add other geometry_type methods
;
-
+
class_<path_type,boost::noncopyable>("Path")
.def("__getitem__", getitem_impl,return_value_policy<reference_existing_object>())
.def("__len__", &path_type::size)
.def("from_wkt",from_wkt_impl)
.def("from_wkb",from_wkb_impl)
;
-
+
}
View
4 bindings/python/mapnik_glyph_symbolizer.cpp
@@ -73,7 +73,7 @@ void export_glyph_symbolizer()
&glyph_symbolizer::set_halo_fill)
.add_property("halo_radius",
- &glyph_symbolizer::get_halo_radius,
+ &glyph_symbolizer::get_halo_radius,
&glyph_symbolizer::set_halo_radius)
.add_property("size",
@@ -117,5 +117,5 @@ void export_glyph_symbolizer()
"defined).\n"
"Only needed if no explicit color is provided"
)
- ;
+ ;
}
View
26 bindings/python/mapnik_grid.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
@@ -43,10 +43,10 @@ bool painted(mapnik::grid const& grid)
void export_grid()
{
class_<mapnik::grid,boost::shared_ptr<mapnik::grid> >(
- "Grid",
- "This class represents a feature hitgrid.",
- init<int,int,std::string,unsigned>(
- ( boost::python::arg("width"), boost::python::arg("height"),boost::python::arg("key")="__id__", boost::python::arg("resolution")=1 ),
+ "Grid",
+ "This class represents a feature hitgrid.",
+ init<int,int,std::string,unsigned>(
+ ( boost::python::arg("width"), boost::python::arg("height"),boost::python::arg("key")="__id__", boost::python::arg("resolution")=1 ),
"Create a mapnik.Grid object\n"
))
.def("painted",&painted)
@@ -54,16 +54,16 @@ void export_grid()
.def("height",&mapnik::grid::height)
.def("view",&mapnik::grid::get_view)
.def("encode",encode,
- ( boost::python::arg("encoding")="utf", boost::python::arg("features")=true,boost::python::arg("resolution")=4 ),
- "Encode the grid as as optimized json\n"
+ ( boost::python::arg("encoding")="utf", boost::python::arg("features")=true,boost::python::arg("resolution")=4 ),
+ "Encode the grid as as optimized json\n"
)
.add_property("key",
- make_function(&mapnik::grid::get_key,return_value_policy<copy_const_reference>()),
- &mapnik::grid::set_key,
- "Get/Set key to be used as unique indentifier for features\n"
- "The value should either be __id__ to refer to the feature.id()\n"
- "or some globally unique integer or string attribute field\n"
- )
+ make_function(&mapnik::grid::get_key,return_value_policy<copy_const_reference>()),
+ &mapnik::grid::set_key,
+ "Get/Set key to be used as unique indentifier for features\n"
+ "The value should either be __id__ to refer to the feature.id()\n"
+ "or some globally unique integer or string attribute field\n"
+ )
;
}
View
10 bindings/python/mapnik_grid_view.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
@@ -40,13 +40,13 @@ static dict (*encode)( mapnik::grid_view const&, std::string, bool, unsigned int
void export_grid_view()
{
class_<mapnik::grid_view,
- boost::shared_ptr<mapnik::grid_view> >("GridView",
- "This class represents a feature hitgrid subset.",no_init)
+ boost::shared_ptr<mapnik::grid_view> >("GridView",
+ "This class represents a feature hitgrid subset.",no_init)
.def("width",&mapnik::grid_view::width)
.def("height",&mapnik::grid_view::height)
.def("encode",encode,
- ( boost::python::arg("encoding")="utf",boost::python::arg("add_features")=true,boost::python::arg("resolution")=4 ),
- "Encode the grid as as optimized json\n"
+ ( boost::python::arg("encoding")="utf",boost::python::arg("add_features")=true,boost::python::arg("resolution")=4 ),
+ "Encode the grid as as optimized json\n"
)
;
}
View
28 bindings/python/mapnik_image.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -68,7 +68,7 @@ PyObject* tostring1( image_32 const& im)
{
int size = im.width() * im.height() * 4;
return
-#if PY_VERSION_HEX >= 0x03000000
+#if PY_VERSION_HEX >= 0x03000000
::PyBytes_FromStringAndSize
#else
::PyString_FromStringAndSize
@@ -81,24 +81,24 @@ PyObject* tostring2(image_32 const & im, std::string const& format)
{
std::string s = save_to_string(im, format);
return
-#if PY_VERSION_HEX >= 0x03000000
+#if PY_VERSION_HEX >= 0x03000000
::PyBytes_FromStringAndSize
#else
::PyString_FromStringAndSize
#endif
- (s.data(),s.size());
+ (s.data(),s.size());
}
PyObject* tostring3(image_32 const & im, std::string const& format, mapnik::rgba_palette const& pal)
{
std::string s = save_to_string(im, format, pal);
return
-#if PY_VERSION_HEX >= 0x03000000
+#if PY_VERSION_HEX >= 0x03000000
::PyBytes_FromStringAndSize
#else
::PyString_FromStringAndSize
#endif
- (s.data(),s.size());
+ (s.data(),s.size());
}
@@ -131,16 +131,16 @@ boost::shared_ptr<image_32> open_from_file(std::string const& filename)
std::auto_ptr<image_reader> reader(get_image_reader(filename,*type));
if (reader.get())
{
-
+
boost::shared_ptr<image_32> image_ptr = boost::make_shared<image_32>(reader->width(),reader->height());
reader->read(0,0,image_ptr->data());
return image_ptr;
}
- throw mapnik::image_reader_exception("Failed to load: " + filename);
+ throw mapnik::image_reader_exception("Failed to load: " + filename);
}
throw mapnik::image_reader_exception("Unsupported image format:" + filename);
}
-
+
void blend (image_32 & im, unsigned x, unsigned y, image_32 const& im2, float opacity)
{
im.set_rectangle_alpha2(im2.data(),x,y,opacity);
@@ -169,7 +169,7 @@ void export_image()
.value("src", mapnik::src)
.value("dst", mapnik::dst)
.value("src_over", mapnik::src_over)
- .value("dst_over", mapnik::dst_over)
+ .value("dst_over", mapnik::dst_over)
.value("src_in", mapnik::src_in)
.value("dst_in", mapnik::dst_in)
.value("src_out", mapnik::src_out)
@@ -194,7 +194,7 @@ void export_image()
.value("invert", mapnik::invert)
.value("invert_rgb", mapnik::invert_rgb)
;
-
+
class_<image_32,boost::shared_ptr<image_32> >("Image","This class represents a 32 bit RGBA image.",init<int,int>())
.def("width",&image_32::width)
.def("height",&image_32::height)
@@ -209,7 +209,7 @@ void export_image()
.def("blend",&blend)
.def("composite",&composite)
//TODO(haoyu) The method name 'tostring' might be confusing since they actually return bytes in Python 3
-
+
.def("tostring",&tostring1)
.def("tostring",&tostring2)
.def("tostring",&tostring3)
@@ -222,6 +222,6 @@ void export_image()
.def("from_cairo",&from_cairo)
.staticmethod("from_cairo")
#endif
- ;
-
+ ;
+
}
View
22 bindings/python/mapnik_image_view.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -48,10 +48,10 @@ PyObject* view_tostring1(image_view<image_data_32> const& view)
std::ostringstream ss(std::ios::out|std::ios::binary);
for (unsigned i=0;i<view.height();i++)
{
- ss.write(reinterpret_cast<const char*>(view.getRow(i)),
+ ss.write(reinterpret_cast<const char*>(view.getRow(i)),
view.width() * sizeof(image_view<image_data_32>::pixel_type));
}
- return
+ return
#if PY_VERSION_HEX >= 0x03000000
::PyBytes_FromStringAndSize
#else
@@ -64,7 +64,7 @@ PyObject* view_tostring1(image_view<image_data_32> const& view)
PyObject* view_tostring2(image_view<image_data_32> const & view, std::string const& format)
{
std::string s = save_to_string(view, format);
- return
+ return
#if PY_VERSION_HEX >= 0x03000000
::PyBytes_FromStringAndSize
#else
@@ -76,7 +76,7 @@ PyObject* view_tostring2(image_view<image_data_32> const & view, std::string con
PyObject* view_tostring3(image_view<image_data_32> const & view, std::string const& format, mapnik::rgba_palette const& pal)
{
std::string s = save_to_string(view, format, pal);
- return
+ return
#if PY_VERSION_HEX >= 0x03000000
::PyBytes_FromStringAndSize
#else
@@ -85,22 +85,22 @@ PyObject* view_tostring3(image_view<image_data_32> const & view, std::string con
(s.data(),s.size());
}
-void save_view1(image_view<image_data_32> const& view,
+void save_view1(image_view<image_data_32> const& view,
std::string const& filename)
{
save_to_file(view,filename);
}
-void save_view2(image_view<image_data_32> const& view,
- std::string const& filename,
+void save_view2(image_view<image_data_32> const& view,
+ std::string const& filename,
std::string const& type)
{
save_to_file(view,filename,type);
}
-void save_view3(image_view<image_data_32> const& view,
- std::string const& filename,
- std::string const& type,
+void save_view3(image_view<image_data_32> const& view,
+ std::string const& filename,
+ std::string const& type,
mapnik::rgba_palette const& pal)
{
save_to_file(view,filename,type,pal);
View
42 bindings/python/mapnik_inmem_metawriter.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
@@ -33,36 +33,36 @@ using mapnik::metawriter_inmem;
using mapnik::metawriter_inmem_ptr;
namespace {
-std::map<std::string, mapnik::value>::const_iterator
+std::map<std::string, mapnik::value>::const_iterator
mapnik_value_map_begin(const std::map<std::string, mapnik::value> &m) {
return m.begin();
}
-std::map<std::string, mapnik::value>::const_iterator
+std::map<std::string, mapnik::value>::const_iterator
mapnik_value_map_end(const std::map<std::string, mapnik::value> &m) {
- return m.end();
+ return m.end();
}
}
void export_inmem_metawriter() {
- using namespace boost::python;
+ using namespace boost::python;
- class_<std::map<std::string, mapnik::value> >
- ("MapnikProperties", "Retarded.", init<>())
- .def("__iter__", range(&mapnik_value_map_begin, &mapnik_value_map_end))
- ;
+ class_<std::map<std::string, mapnik::value> >
+ ("MapnikProperties", "Retarded.", init<>())
+ .def("__iter__", range(&mapnik_value_map_begin, &mapnik_value_map_end))
+ ;
- class_<metawriter_inmem::meta_instance>
- ("MetaInstance", "Single rendered instance of meta-information.", no_init)
- .def_readonly("box", &metawriter_inmem::meta_instance::box)
- .def_readonly("properties", &metawriter_inmem::meta_instance::properties)
- ;
+ class_<metawriter_inmem::meta_instance>
+ ("MetaInstance", "Single rendered instance of meta-information.", no_init)
+ .def_readonly("box", &metawriter_inmem::meta_instance::box)
+ .def_readonly("properties", &metawriter_inmem::meta_instance::properties)
+ ;
- class_<metawriter_inmem, metawriter_inmem_ptr, boost::noncopyable>
- ("MetaWriterInMem",
- "Collects meta-information about elements rendered.",
- no_init)
- .def("__iter__", range(&metawriter_inmem::inst_begin,
- &metawriter_inmem::inst_end))
- ;
+ class_<metawriter_inmem, metawriter_inmem_ptr, boost::noncopyable>
+ ("MetaWriterInMem",
+ "Collects meta-information about elements rendered.",
+ no_init)
+ .def("__iter__", range(&metawriter_inmem::inst_begin,
+ &metawriter_inmem::inst_end))
+ ;
}
View
132 bindings/python/mapnik_label_collision_detector.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
@@ -38,86 +38,86 @@ using boost::make_shared;
namespace
{
-boost::shared_ptr<label_collision_detector4>
+boost::shared_ptr<label_collision_detector4>
create_label_collision_detector_from_extent(box2d<double> const &extent)
{
- return make_shared<label_collision_detector4>(extent);
+ return make_shared<label_collision_detector4>(extent);
}
-boost::shared_ptr<label_collision_detector4>
+boost::shared_ptr<label_collision_detector4>
create_label_collision_detector_from_map(Map const &m)
{
- double buffer = m.buffer_size();
- box2d<double> extent(-buffer, -buffer, m.width() + buffer, m.height() + buffer);
- return make_shared<label_collision_detector4>(extent);
+ double buffer = m.buffer_size();
+ box2d<double> extent(-buffer, -buffer, m.width() + buffer, m.height() + buffer);
+ return make_shared<label_collision_detector4>(extent);
}
boost::python::list
-make_label_boxes(boost::shared_ptr<label_collision_detector4> det)
+make_label_boxes(boost::shared_ptr<label_collision_detector4> det)
{
- boost::python::list boxes;
+ boost::python::list boxes;
- for (label_collision_detector4::query_iterator jtr = det->begin();
- jtr != det->end(); ++jtr)
- {
- boxes.append<box2d<double> >(jtr->box);
- }
+ for (label_collision_detector4::query_iterator jtr = det->begin();
+ jtr != det->end(); ++jtr)
+ {
+ boxes.append<box2d<double> >(jtr->box);
+ }
- return boxes;
+ return boxes;
}
}
-void export_label_collision_detector()
+void export_label_collision_detector()
{
- using namespace boost::python;
-
- // for overload resolution
- void (label_collision_detector4::*insert_box)(box2d<double> const &) = &label_collision_detector4::insert;
-
- class_<label_collision_detector4, boost::shared_ptr<label_collision_detector4>, boost::noncopyable>
- ("LabelCollisionDetector",
- "Object to detect collisions between labels, used in the rendering process.",
- no_init)
-
- .def("__init__", make_constructor(create_label_collision_detector_from_extent),
- "Creates an empty collision detection object with a given extent. Note "
- "that the constructor from Map objects is a sensible default and usually "
- "what you want to do.\n"
- "\n"
- "Example:\n"
- ">>> m = Map(size_x, size_y)\n"
- ">>> buf_sz = m.buffer_size\n"
- ">>> extent = mapnik.Box2d(-buf_sz, -buf_sz, m.width + buf_sz, m.height + buf_sz)\n"
- ">>> detector = mapnik.LabelCollisionDetector(extent)")
-
- .def("__init__", make_constructor(create_label_collision_detector_from_map),
- "Creates an empty collision detection object matching the given Map object. "
- "The created detector will have the same size, including the buffer, as the "
- "map object. This is usually what you want to do.\n"
- "\n"
- "Example:\n"
- ">>> m = Map(size_x, size_y)\n"
- ">>> detector = mapnik.LabelCollisionDetector(m)")
-
- .def("extent", &label_collision_detector4::extent, return_value_policy<copy_const_reference>(),
- "Returns the total extent (bounding box) of all labels inside the detector.\n"
- "\n"
- "Example:\n"
- ">>> detector.extent()\n"
- "Box2d(573.252589209,494.789179821,584.261023823,496.83610261)")
-
- .def("boxes", &make_label_boxes,
- "Returns a list of all the label boxes inside the detector.")
-
- .def("insert", insert_box,
- "Insert a 2d box into the collision detector. This can be used to ensure that "
- "some space is left clear on the map for later overdrawing, for example by "
- "non-Mapnik processes.\n"
- "\n"
- "Example:\n"
- ">>> m = Map(size_x, size_y)\n"
- ">>> detector = mapnik.LabelCollisionDetector(m)"
- ">>> detector.insert(mapnik.Box2d(196, 254, 291, 389))")
- ;
+ using namespace boost::python;
+
+ // for overload resolution
+ void (label_collision_detector4::*insert_box)(box2d<double> const &) = &label_collision_detector4::insert;
+
+ class_<label_collision_detector4, boost::shared_ptr<label_collision_detector4>, boost::noncopyable>
+ ("LabelCollisionDetector",
+ "Object to detect collisions between labels, used in the rendering process.",
+ no_init)
+
+ .def("__init__", make_constructor(create_label_collision_detector_from_extent),
+ "Creates an empty collision detection object with a given extent. Note "
+ "that the constructor from Map objects is a sensible default and usually "
+ "what you want to do.\n"
+ "\n"
+ "Example:\n"
+ ">>> m = Map(size_x, size_y)\n"
+ ">>> buf_sz = m.buffer_size\n"
+ ">>> extent = mapnik.Box2d(-buf_sz, -buf_sz, m.width + buf_sz, m.height + buf_sz)\n"
+ ">>> detector = mapnik.LabelCollisionDetector(extent)")
+
+ .def("__init__", make_constructor(create_label_collision_detector_from_map),
+ "Creates an empty collision detection object matching the given Map object. "
+ "The created detector will have the same size, including the buffer, as the "
+ "map object. This is usually what you want to do.\n"
+ "\n"
+ "Example:\n"
+ ">>> m = Map(size_x, size_y)\n"
+ ">>> detector = mapnik.LabelCollisionDetector(m)")
+
+ .def("extent", &label_collision_detector4::extent, return_value_policy<copy_const_reference>(),
+ "Returns the total extent (bounding box) of all labels inside the detector.\n"
+ "\n"
+ "Example:\n"
+ ">>> detector.extent()\n"
+ "Box2d(573.252589209,494.789179821,584.261023823,496.83610261)")
+
+ .def("boxes", &make_label_boxes,
+ "Returns a list of all the label boxes inside the detector.")
+
+ .def("insert", insert_box,
+ "Insert a 2d box into the collision detector. This can be used to ensure that "
+ "some space is left clear on the map for later overdrawing, for example by "
+ "non-Mapnik processes.\n"
+ "\n"
+ "Example:\n"
+ ">>> m = Map(size_x, size_y)\n"
+ ">>> detector = mapnik.LabelCollisionDetector(m)"
+ ">>> detector.insert(mapnik.Box2d(196, 254, 291, 389))")
+ ;
}
View
38 bindings/python/mapnik_layer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -53,7 +53,7 @@ struct layer_pickle_suite : boost::python::pickle_suite
for (unsigned i = 0; i < style_names.size(); ++i)
{
s.append(style_names[i]);
- }
+ }
return boost::python::make_tuple(l.abstract(),l.title(),l.clear_label_cache(),l.getMinZoom(),l.getMaxZoom(),l.isQueryable(),l.datasource()->params(),l.cache_features(),s);
}
@@ -84,7 +84,7 @@ struct layer_pickle_suite : boost::python::pickle_suite
mapnik::parameters params = extract<parameters>(state[6]);
l.set_datasource(datasource_cache::instance()->create(params));
-
+
boost::python::list s = extract<boost::python::list>(state[7]);
for (int i=0;i<len(s);++i)
{
@@ -103,7 +103,7 @@ void export_layer()
class_<std::vector<std::string> >("Names")
.def(vector_indexing_suite<std::vector<std::string>,true >())
;
-
+
class_<layer>("Layer", "A Mapnik map layer.", init<std::string const&,optional<std::string const&> >(
"Create a Layer with a named string and, optionally, an srs string.\n"
"\n"
@@ -119,8 +119,8 @@ void export_layer()
))
.def_pickle(layer_pickle_suite())
-
- .def("envelope",&layer::envelope,
+
+ .def("envelope",&layer::envelope,
"Return the geographic envelope/bounding box."
"\n"
"Determined based on the layer datasource.\n"
@@ -131,7 +131,7 @@ void export_layer()
">>> lyr.envelope()\n"
"box2d(-1.0,-1.0,0.0,0.0) # default until a datasource is loaded\n"
)
-
+
.def("visible", &layer::isVisible,
"Return True if this layer's data is active and visible at a given scale.\n"
"\n"
@@ -151,8 +151,8 @@ void export_layer()
">>> lyr.visible(1.0/1000000)\n"
"False\n"
)
-
- .add_property("abstract",
+
+ .add_property("abstract",
make_function(&layer::abstract,return_value_policy<copy_const_reference>()),
&layer::set_abstract,
"Get/Set the abstract of the layer.\n"
@@ -181,7 +181,7 @@ void export_layer()
">>> lyr.active\n"
"False\n"
)
-
+
.add_property("clear_label_cache",
&layer::clear_label_cache,
&layer::set_clear_label_cache,
@@ -190,7 +190,7 @@ void export_layer()
"Usage:\n"
">>> lyr.clear_label_cache\n"
"False # False by default, meaning label positions from other layers will impact placement \n"
- ">>> lyr.clear_label_cache = True # set to True to clear the label collision detector cache\n"
+ ">>> lyr.clear_label_cache = True # set to True to clear the label collision detector cache\n"
)
.add_property("cache_features",
@@ -201,9 +201,9 @@ void export_layer()
"Usage:\n"
">>> lyr.cache_features\n"
"False # False by default\n"
- ">>> lyr.cache_features = True # set to True to enable feature caching\n"
+ ">>> lyr.cache_features = True # set to True to enable feature caching\n"
)
-
+
.add_property("datasource",
&layer::datasource,
&layer::set_datasource,
@@ -231,7 +231,7 @@ void export_layer()
">>> lyr.maxzoom\n"
"9.9999999999999995e-07\n"
)
-
+
.add_property("minzoom",
&layer::getMinZoom,
&layer::setMinZoom,
@@ -245,9 +245,9 @@ void export_layer()
">>> lyr.minzoom = 1.0/1000000\n"
">>> lyr.minzoom\n"
"9.9999999999999995e-07\n"
- )
+ )
- .add_property("name",
+ .add_property("name",
make_function(&layer::name, return_value_policy<copy_const_reference>()),
&layer::set_name,
"Get/Set the name of the layer.\n"
@@ -277,7 +277,7 @@ void export_layer()
"True\n"
)
- .add_property("srs",
+ .add_property("srs",
make_function(&layer::srs,return_value_policy<copy_const_reference>()),
&layer::set_srs,
"Get/Set the SRS of the layer.\n"
@@ -309,7 +309,7 @@ void export_layer()
">>> lyr.styles[0]\n"
"'My Style'\n"
)
-
+
.add_property("title",
make_function(&layer::title, return_value_policy<copy_const_reference>()),
&layer::set_title,
@@ -324,6 +324,6 @@ void export_layer()
">>> lyr.title\n"
"'My first layer'\n"
)
-
+
;
}
View
24 bindings/python/mapnik_line_pattern_symbolizer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -38,14 +38,14 @@ using mapnik::parse_path;
namespace {
using namespace boost::python;
-const std::string get_filename(line_pattern_symbolizer const& t)
-{
- return path_processor_type::to_string(*t.get_filename());
+const std::string get_filename(line_pattern_symbolizer const& t)
+{
+ return path_processor_type::to_string(*t.get_filename());
}
-void set_filename(line_pattern_symbolizer & t, std::string const& file_expr)
-{
- t.set_filename(parse_path(file_expr));
+void set_filename(line_pattern_symbolizer & t, std::string const& file_expr)
+{
+ t.set_filename(parse_path(file_expr));
}
}
@@ -56,7 +56,7 @@ struct line_pattern_symbolizer_pickle_suite : boost::python::pickle_suite
getinitargs(const line_pattern_symbolizer& l)
{
std::string filename = path_processor_type::to_string(*l.get_filename());
- // FIXME : Do we need "type" parameter at all ?
+ // FIXME : Do we need "type" parameter at all ?
return boost::python::make_tuple(filename, guess_type(filename));
}
};
@@ -64,16 +64,16 @@ struct line_pattern_symbolizer_pickle_suite : boost::python::pickle_suite
void export_line_pattern_symbolizer()
{
using namespace boost::python;
-
+
class_<line_pattern_symbolizer>("LinePatternSymbolizer",
init<path_expression_ptr>
("<image file expression>"))
//.def_pickle(line_pattern_symbolizer_pickle_suite())
.add_property("transform",
- mapnik::get_svg_transform<line_pattern_symbolizer>,
- mapnik::set_svg_transform<line_pattern_symbolizer>)
+ mapnik::get_svg_transform<line_pattern_symbolizer>,
+ mapnik::set_svg_transform<line_pattern_symbolizer>)
.add_property("filename",
&get_filename,
&set_filename)
- ;
+ ;
}
View
6 bindings/python/mapnik_line_symbolizer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -43,7 +43,7 @@ struct line_symbolizer_pickle_suite : boost::python::pickle_suite
void export_line_symbolizer()
{
using namespace boost::python;
-
+
enumeration_<line_rasterizer_e>("line_rasterizer")
.value("FULL",RASTERIZER_FULL)
.value("FAST",RASTERIZER_FAST)
@@ -62,5 +62,5 @@ void export_line_symbolizer()
(&line_symbolizer::get_stroke,
return_value_policy<copy_const_reference>()),
&line_symbolizer::set_stroke)
- ;
+ ;
}
View
140 bindings/python/mapnik_map.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -57,7 +57,7 @@ struct map_pickle_suite : boost::python::pickle_suite
{
l.append(m.getLayer(i));
}
-
+
boost::python::list s;
Map::const_style_iterator it = m.styles().begin();
Map::const_style_iterator end = m.styles().end();
@@ -91,14 +91,14 @@ struct map_pickle_suite : boost::python::pickle_suite
{
color bg = extract<color>(state[1]);
m.set_background(bg);
- }
-
+ }
+
boost::python::list l=extract<boost::python::list>(state[2]);
for (int i=0;i<len(l);++i)
{
m.addLayer(extract<layer>(l[i]));
}
-
+
boost::python::list s=extract<boost::python::list>(state[3]);
for (int i=0;i<len(s);++i)
{
@@ -112,7 +112,7 @@ struct map_pickle_suite : boost::python::pickle_suite
{
std::string base_path = extract<std::string>(state[4]);
m.set_base_path(base_path);
- }
+ }
}
};
@@ -138,17 +138,17 @@ bool has_metawriter(mapnik::Map const& m)
return false;
}
-// 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.
mapnik::metawriter_inmem_ptr find_inmem_metawriter(const mapnik::Map &m, const std::string &name) {
- mapnik::metawriter_ptr metawriter = m.find_metawriter(name);
- mapnik::metawriter_inmem_ptr inmem;
-
- if (metawriter) {
- inmem = boost::dynamic_pointer_cast<mapnik::metawriter_inmem>(metawriter);
- }
-
- return inmem;
+ mapnik::metawriter_ptr metawriter = m.find_metawriter(name);
+ mapnik::metawriter_inmem_ptr inmem;
+
+ if (metawriter) {
+ inmem = boost::dynamic_pointer_cast<mapnik::metawriter_inmem>(metawriter);
+ }
+
+ return inmem;
}
// TODO - we likely should allow indexing by negative number from python
@@ -157,7 +157,7 @@ mapnik::featureset_ptr query_point(mapnik::Map const& m, int index, double x, do
{
if (index < 0){
PyErr_SetString(PyExc_IndexError, "Please provide a layer index >= 0");
- boost::python::throw_error_already_set();
+ boost::python::throw_error_already_set();
}
unsigned idx = index;
return m.query_point(idx, x, y);
@@ -167,16 +167,16 @@ mapnik::featureset_ptr query_map_point(mapnik::Map const& m, int index, double x
{
if (index < 0){
PyErr_SetString(PyExc_IndexError, "Please provide a layer index >= 0");
- boost::python::throw_error_already_set();
+ boost::python::throw_error_already_set();
}
unsigned idx = index;
return m.query_map_point(idx, x, y);
}
-void export_map()
+void export_map()
{
using namespace boost::python;
-
+
// aspect ratio fix modes
mapnik::enumeration_<mapnik::aspect_fix_mode_e>("aspect_fix_mode")
.value("GROW_BBOX", mapnik::Map::GROW_BBOX)
@@ -188,12 +188,12 @@ void export_map()
.value("ADJUST_CANVAS_WIDTH",mapnik::Map::ADJUST_CANVAS_WIDTH)
.value("ADJUST_CANVAS_HEIGHT", mapnik::Map::ADJUST_CANVAS_HEIGHT)
;
-
+
python_optional<mapnik::color> ();
class_<std::vector<layer> >("Layers")
.def(vector_indexing_suite<std::vector<layer> >())
;
-
+
class_<Map>("Map","The map object.",init<int,int,optional<std::string const&> >(
( arg("width"),arg("height"),arg("srs") ),
"Create a Map with a width and height as integers and, optionally,\n"
@@ -209,10 +209,10 @@ void export_map()
">>> m.srs\n"
"'+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'\n"
))
-
+
.def_pickle(map_pickle_suite()
)
-
+
.def("append_style",&Map::insert_style,
(arg("style_name"),arg("style_object")),
"Insert a Mapnik Style onto the map by appending it.\n"
@@ -278,7 +278,7 @@ void export_map()
">>> m.has_metawriter()\n"
"False\n"
)
-
+
.def("pan",&Map::pan,
(arg("x"),arg("y")),
"Set the Map center at a given x,y location\n"
@@ -292,7 +292,7 @@ void export_map()
">>> m.envelope().center()\n"
"Coord(0.00166666666667,-0.835)\n"
)
-
+
.def("pan_and_zoom",&Map::pan_and_zoom,
(arg("x"),arg("y"),arg("factor")),
"Set the Map center at a given x,y location\n"
@@ -308,7 +308,7 @@ void export_map()
">>> m.scale()\n"
"0.00062500000000000001\n"
)
-
+
.def("query_map_point",query_map_point,
(arg("layer_idx"),arg("pixel_x"),arg("pixel_y")),
"Query a Map Layer (by layer index) for features \n"
@@ -325,7 +325,7 @@ void export_map()
">>> featureset.features\n"
">>> [<mapnik.Feature object at 0x3995630>]\n"
)
-
+
.def("query_point",query_point,
(arg("layer idx"),arg("x"),arg("y")),
"Query a Map Layer (by layer index) for features \n"
@@ -349,7 +349,7 @@ void export_map()
"Usage:\n"
">>> m.remove_all()\n"
)
-
+
.def("remove_style",&Map::remove_style,
(arg("style_name")),
"Remove a Mapnik Style from the map.\n"
@@ -365,7 +365,7 @@ void export_map()
"Usage:\n"
">>> m.resize(64,64)\n"
)
-
+
.def("scale", &Map::scale,
"Return the Map Scale.\n"
"Usage:\n"
@@ -379,16 +379,16 @@ void export_map()
"\n"
">>> m.scale_denominator()\n"
)
-
+
.def("view_transform",&Map::view_transform,
"Return the map ViewTransform object\n"
"which is used internally to convert between\n"
"geographic coordinates and screen coordinates.\n"
"\n"
"Usage:\n"
- ">>> m.view_transform()\n"
+ ">>> m.view_transform()\n"
)
-
+
.def("zoom",&Map::zoom,
(arg("factor")),
"Zoom in or out by a given factor.\n"
@@ -399,7 +399,7 @@ void export_map()
"\n"
">>> m.zoom(0.25)\n"
)
-
+
.def("zoom_all",&Map::zoom_all,
"Set the geographical extent of the map\n"
"to the combined extents of all active layers.\n"
@@ -407,7 +407,7 @@ void export_map()
"Usage:\n"
">>> m.zoom_all()\n"
)
-
+
.def("zoom_to_box",&Map::zoom_to_box,
(arg("Boxd2")),
"Set the geographical extent of the map\n"
@@ -418,37 +418,37 @@ void export_map()
">>> m.zoom_to_box(extent)\n"
)
.def("get_metawriter_property", &Map::get_metawriter_property,
- (arg("name")),
- "Reads a metawriter property.\n"
- "These properties are completely user-defined and can be used to"
- "create filenames, etc.\n"
- "\n"
- "Usage:\n"
- ">>> map.set_metawriter_property(\"x\", \"10\")\n"
- ">>> map.get_metawriter_property(\"x\")\n"
- "10\n"
- )
+ (arg("name")),
+ "Reads a metawriter property.\n"
+ "These properties are completely user-defined and can be used to"
+ "create filenames, etc.\n"
+ "\n"
+ "Usage:\n"
+ ">>> map.set_metawriter_property(\"x\", \"10\")\n"
+ ">>> map.get_metawriter_property(\"x\")\n"
+ "10\n"
+ )
.def("set_metawriter_property", &Map::set_metawriter_property,
- (arg("name"),arg("value")),
- "Sets a metawriter property.\n"
- "These properties are completely user-defined and can be used to"
- "create filenames, etc.\n"
- "\n"
- "Usage:\n"
- ">>> map.set_metawriter_property(\"x\", str(x))\n"
- ">>> map.set_metawriter_property(\"y\", str(y))\n"
- ">>> map.set_metawriter_property(\"z\", str(z))\n"
- "\n"
- "Use a path like \"[z]/[x]/[y].json\" to create filenames.\n"
- )
+ (arg("name"),arg("value")),
+ "Sets a metawriter property.\n"
+ "These properties are completely user-defined and can be used to"
+ "create filenames, etc.\n"
+ "\n"
+ "Usage:\n"
+ ">>> map.set_metawriter_property(\"x\", str(x))\n"
+ ">>> map.set_metawriter_property(\"y\", str(y))\n"
+ ">>> map.set_metawriter_property(\"z\", str(z))\n"
+ "\n"
+ "Use a path like \"[z]/[x]/[y].json\" to create filenames.\n"
+ )
.def("find_inmem_metawriter", find_inmem_metawriter,
- (arg("name")),
- "Gets an inmem metawriter, or None if no such metawriter "
- "exists.\n"
- "Use this after the map has been rendered to retrieve information "
- "about the hit areas rendered on the map.\n"
- )
-
+ (arg("name")),
+ "Gets an inmem metawriter, or None if no such metawriter "
+ "exists.\n"
+ "Use this after the map has been rendered to retrieve information "
+ "about the hit areas rendered on the map.\n"
+ )
+
.def("extra_attributes",&Map::get_extra_attributes,return_value_policy<copy_const_reference>(),"TODO")
.add_property("aspect_fix_mode",
@@ -460,8 +460,8 @@ void export_map()
"Usage:\n"
"\n"
">>> m.aspect_fix_mode = aspect_fix_mode.GROW_BBOX\n"
- )
-
+ )
+
.add_property("background",make_function
(&Map::background,return_value_policy<copy_const_reference>()),
&Map::set_background,
@@ -480,7 +480,7 @@ void export_map()
"Usage:\n"
">>> m.base_path = '.'\n"
)
-
+
.add_property("buffer_size",
&Map::buffer_size,
&Map::set_buffer_size,
@@ -493,7 +493,7 @@ void export_map()
">>> m.buffer_size\n"
"2\n"
)
-
+
.add_property("height",
&Map::height,
&Map::set_height,
@@ -507,9 +507,9 @@ void export_map()
">>> m.height\n"
"600\n"
)
-
+
.add_property("layers",make_function
- (layers_nonconst,return_value_policy<reference_existing_object>()),
+ (layers_nonconst,return_value_policy<reference_existing_object>()),
"The list of map layers.\n"
"\n"
"Usage:\n"
@@ -548,7 +548,7 @@ void export_map()
"... \n"
">>> m.srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs +over'\n"
)
-
+
.add_property("width",
&Map::width,
&Map::set_width,
View
30 bindings/python/mapnik_markers_symbolizer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2010 Artem Pavlenko
@@ -33,18 +33,18 @@ using mapnik::symbolizer_with_image;
using mapnik::path_processor_type;
using mapnik::parse_path;
-namespace {
+namespace {
using namespace boost::python;
-std::string get_filename(mapnik::markers_symbolizer const& symbolizer)
-{
- return path_processor_type::to_string(*symbolizer.get_filename());
-}
+std::string get_filename(mapnik::markers_symbolizer const& symbolizer)
+{
+ return path_processor_type::to_string(*symbolizer.get_filename());
+}
-void set_filename(mapnik::markers_symbolizer & symbolizer, std::string const& file_expr)
-{
- symbolizer.set_filename(parse_path(file_expr));
-}
+void set_filename(mapnik::markers_symbolizer & symbolizer, std::string const& file_expr)
+{
+ symbolizer.set_filename(parse_path(file_expr));
+}
}
@@ -75,10 +75,10 @@ struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
);
throw_error_already_set();
}
-
+
p.set_allow_overlap(extract<bool>(state[0]));
//p.set_opacity(extract<float>(state[1]));
-
+
}
};
@@ -87,14 +87,14 @@ struct markers_symbolizer_pickle_suite : boost::python::pickle_suite
void export_markers_symbolizer()
{
using namespace boost::python;
-
+
class_<markers_symbolizer>("MarkersSymbolizer",
- init<>("Default Markers Symbolizer - blue arrow"))
+ init<>("Default Markers Symbolizer - blue arrow"))
.def (init<mapnik::path_expression_ptr>("<path expression ptr>"))
//.def_pickle(markers_symbolizer_pickle_suite())
.add_property("filename",
&get_filename,
- &set_filename)
+ &set_filename)
.add_property("allow_overlap",
&markers_symbolizer::get_allow_overlap,
&markers_symbolizer::set_allow_overlap)
View
16 bindings/python/mapnik_palette.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2011 Artem Pavlenko
@@ -40,14 +40,14 @@ static boost::shared_ptr<mapnik::rgba_palette> make_palette( const std::string&
return boost::make_shared<mapnik::rgba_palette>(palette, type);
}
-void export_palette ()
+void export_palette ()
{
using namespace boost::python;
class_<boost::shared_ptr<mapnik::rgba_palette> >("Palette",no_init)
- /*, init<std::string,std::string>(
- ( arg("palette"), arg("type")),
- "Creates a new color palette from a file\n"
- )*/
- .def( "__init__", boost::python::make_constructor( &make_palette))
- ;
+ /*, init<std::string,std::string>(
+ ( arg("palette"), arg("type")),
+ "Creates a new color palette from a file\n"
+ )*/
+ .def( "__init__", boost::python::make_constructor( &make_palette))
+ ;
}
View
20 bindings/python/mapnik_parameters.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -33,14 +33,14 @@ using mapnik::parameters;
struct pickle_value : public boost::static_visitor<>
{
public:
- pickle_value( boost::python::list vals):
+ pickle_value( boost::python::list vals):
vals_(vals) {}
-
+
void operator () ( int val )
{
vals_.append(val);
}
-
+
void operator () ( double val )
{
vals_.append(val);
@@ -50,7 +50,7 @@ struct pickle_value : public boost::static_visitor<>
{
vals_.append(val);
}
-
+
private:
boost::python::list vals_;
@@ -97,7 +97,7 @@ struct parameters_pickle_suite : boost::python::pickle_suite
);
throw_error_already_set();
}
-
+
dict d = extract<dict>(state[0]);
boost::python::list keys = d.keys();
for (int i=0; i<len(keys); ++i)
@@ -107,7 +107,7 @@ struct parameters_pickle_suite : boost::python::pickle_suite
extract<std::string> ex0(obj);
extract<int> ex1(obj);
extract<double> ex2(obj);
-
+
if (ex0.check())
{
p[key] = ex0();
@@ -119,14 +119,14 @@ struct parameters_pickle_suite : boost::python::pickle_suite
else if (ex2.check())
{
p[key] = ex2();
- }
-
+ }
+
/*
extract_value serializer( p, key );
mapnik::value_holder val = extract<mapnik::value_holder>(d[key]);
boost::apply_visitor( serializer, val );
*/
- }
+ }
}
};
View
20 bindings/python/mapnik_point_symbolizer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -39,14 +39,14 @@ using mapnik::parse_path;
namespace {
using namespace boost::python;
-const std::string get_filename(point_symbolizer const& t)
-{
- return path_processor_type::to_string(*t.get_filename());
+const std::string get_filename(point_symbolizer const& t)
+{
+ return path_processor_type::to_string(*t.get_filename());
}
-void set_filename(point_symbolizer & t, std::string const& file_expr)
-{
- t.set_filename(parse_path(file_expr));
+void set_filename(point_symbolizer & t, std::string const& file_expr)
+{
+ t.set_filename(parse_path(file_expr));
}
}
@@ -81,12 +81,12 @@ struct point_symbolizer_pickle_suite : boost::python::pickle_suite
);
throw_error_already_set();
}
-
+
p.set_allow_overlap(extract<bool>(state[0]));
p.set_opacity(extract<float>(state[1]));
p.set_ignore_placement(extract<bool>(state[2]));
p.set_point_placement(extract<point_placement_e>(state[3]));
-
+
}
};
@@ -100,7 +100,7 @@ void export_point_symbolizer()
.value("CENTROID",CENTROID_POINT_PLACEMENT)
.value("INTERIOR",INTERIOR_POINT_PLACEMENT)
;
-
+
class_<point_symbolizer>("PointSymbolizer",
init<>("Default Point Symbolizer - 4x4 black square"))
.def (init<mapnik::path_expression_ptr>("<path expression ptr>"))
View
30 bindings/python/mapnik_polygon_pattern_symbolizer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -38,14 +38,14 @@ using mapnik::guess_type;
namespace {
using namespace boost::python;
-const std::string get_filename(polygon_pattern_symbolizer const& t)
-{
- return path_processor_type::to_string(*t.get_filename());
+const std::string get_filename(polygon_pattern_symbolizer const& t)
+{
+ return path_processor_type::to_string(*t.get_filename());
}
-void set_filename(polygon_pattern_symbolizer & t, std::string const& file_expr)
-{
- t.set_filename(parse_path(file_expr));
+void set_filename(polygon_pattern_symbolizer & t, std::string const& file_expr)
+{
+ t.set_filename(parse_path(file_expr));
}
}
@@ -77,7 +77,7 @@ struct polygon_pattern_symbolizer_pickle_suite : boost::python::pickle_suite
);
throw_error_already_set();
}
-
+
p.set_alignment(extract<pattern_alignment_e>(state[0]));
p.set_gamma(extract<float>(state[1]));
}
@@ -92,22 +92,22 @@ void export_polygon_pattern_symbolizer()
.value("LOCAL",LOCAL_ALIGNMENT)
.value("GLOBAL",GLOBAL_ALIGNMENT)
;
-
+
class_<polygon_pattern_symbolizer>("PolygonPatternSymbolizer",
init<path_expression_ptr>("<path_expression_ptr>"))
.def_pickle(polygon_pattern_symbolizer_pickle_suite())
.add_property("alignment",
- &polygon_pattern_symbolizer::get_alignment,
- &polygon_pattern_symbolizer::set_alignment,
- "Set/get the alignment of the pattern")
+ &polygon_pattern_symbolizer::get_alignment,
+ &polygon_pattern_symbolizer::set_alignment,
+ "Set/get the alignment of the pattern")
.add_property("transform",
- mapnik::get_svg_transform<polygon_pattern_symbolizer>,
- mapnik::set_svg_transform<polygon_pattern_symbolizer>)
+ mapnik::get_svg_transform<polygon_pattern_symbolizer>,
+ mapnik::set_svg_transform<polygon_pattern_symbolizer>)
.add_property("filename",
&get_filename,
&set_filename)
.add_property("gamma",
&polygon_pattern_symbolizer::get_gamma,
&polygon_pattern_symbolizer::set_gamma)
- ;
+ ;
}
View
10 bindings/python/mapnik_polygon_symbolizer.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -32,7 +32,7 @@ struct polygon_symbolizer_pickle_suite : boost::python::pickle_suite
static boost::python::tuple
getinitargs(const polygon_symbolizer& p)
{
- return boost::python::make_tuple(p.get_fill());
+ return boost::python::make_tuple(p.get_fill());
}
static boost::python::tuple
@@ -53,7 +53,7 @@ struct polygon_symbolizer_pickle_suite : boost::python::pickle_suite
);
throw_error_already_set();
}
-
+
p.set_opacity(extract<float>(state[0]));
p.set_gamma(extract<float>(state[1]));
}
@@ -63,7 +63,7 @@ struct polygon_symbolizer_pickle_suite : boost::python::pickle_suite
void export_polygon_symbolizer()
{
using namespace boost::python;
-
+
class_<polygon_symbolizer>("PolygonSymbolizer",
init<>("Default PolygonSymbolizer - solid fill grey"))
.def(init<color const&>("TODO"))
@@ -78,6 +78,6 @@ void export_polygon_symbolizer()
.add_property("gamma",
&polygon_symbolizer::get_gamma,
&polygon_symbolizer::set_gamma)
- ;
+ ;
}
View
10 bindings/python/mapnik_proj_transform.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2009 Artem Pavlenko
@@ -25,7 +25,7 @@
#include <mapnik/proj_transform.hpp>
// boost
#include <boost/python.hpp>
-
+
using mapnik::proj_transform;
using mapnik::projection;
@@ -54,7 +54,7 @@ mapnik::coord2d forward_transform_c(mapnik::proj_transform& t, mapnik::coord2d c
}
return mapnik::coord2d(x,y);
}
-
+
mapnik::coord2d backward_transform_c(mapnik::proj_transform& t, mapnik::coord2d const& c)
{
double x = c.x;
@@ -122,7 +122,7 @@ mapnik::box2d<double> backward_transform_env_p(mapnik::proj_transform& t, mapnik
void export_proj_transform ()
{
using namespace boost::python;
-
+
class_<proj_transform, boost::noncopyable>("ProjTransform", init< projection const&, projection const& >())
.def_pickle(proj_transform_pickle_suite())
.def("forward", forward_transform_c)
@@ -132,5 +132,5 @@ void export_proj_transform ()
.def("forward", forward_transform_env_p)
.def("backward",backward_transform_env_p)
;
-
+
}
View
22 bindings/python/mapnik_projection.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -41,7 +41,7 @@ struct projection_pickle_suite : boost::python::pickle_suite
};
namespace {
-mapnik::coord2d forward_pt(mapnik::coord2d const& pt,
+mapnik::coord2d forward_pt(mapnik::coord2d const& pt,
mapnik::projection const& prj)
{
double x = pt.x;
@@ -49,8 +49,8 @@ mapnik::coord2d forward_pt(mapnik::coord2d const& pt,
prj.forward(x,y);
return mapnik::coord2d(x,y);
}
-
-mapnik::coord2d inverse_pt(mapnik::coord2d const& pt,
+
+mapnik::coord2d inverse_pt(mapnik::coord2d const& pt,
mapnik::projection const& prj)
{
double x = pt.x;
@@ -58,7 +58,7 @@ mapnik::coord2d inverse_pt(mapnik::coord2d const& pt,
prj.inverse(x,y);
return mapnik::coord2d(x,y);
}
-
+
mapnik::box2d<double> forward_env(mapnik::box2d<double> const & box,
mapnik::projection const& prj)
{
@@ -70,7 +70,7 @@ mapnik::box2d<double> forward_env(mapnik::box2d<double> const & box,
prj.forward(maxx,maxy);
return mapnik::box2d<double>(minx,miny,maxx,maxy);
}
-
+
mapnik::box2d<double> inverse_env(mapnik::box2d<double> const & box,
mapnik::projection const& prj)
{
@@ -82,18 +82,18 @@ mapnik::box2d<double> inverse_env(mapnik::box2d<double> const & box,
prj.inverse(maxx,maxy);
return mapnik::box2d<double>(minx,miny,maxx,maxy);
}
-
+
}
void export_projection ()
{
- using namespace boost::python;
+ using namespace boost::python;
class_<projection>("Projection", "Represents a map projection.",init<optional<std::string const&> >(
(arg("proj4_string")),
"Constructs a new projection from its PROJ.4 string representation.\n"
"\n"
- "The parameterless version of this constructor is equivalent to\n"
+ "The parameterless version of this constructor is equivalent to\n"
" Projection('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')\n"
"\n"
"The constructor will throw a RuntimeError in case the projection\n"
@@ -110,10 +110,10 @@ void export_projection ()
"This property is True if the projection is a geographic projection\n"
"(i.e. it uses lon/lat coordinates)\n")
;
-
+
def("forward_",&forward_pt);
def("inverse_",&inverse_pt);
def("forward_",&forward_env);
def("inverse_",&inverse_env);
-
+
}
View
308 bindings/python/mapnik_python.cpp
@@ -1,5 +1,5 @@
/*****************************************************************************
- *
+ *
* This file is part of Mapnik (c++ mapping toolkit)
*
* Copyright (C) 2006 Artem Pavlenko, Jean-Francois Doyon
@@ -99,53 +99,53 @@ namespace boost { namespace python {
return boost::apply_visitor(value_converter(),v.base());
}
};
-}}
+ }}
void render(const mapnik::Map& map,
- mapnik::image_32& image,
- double scale_factor = 1.0,
- unsigned offset_x = 0u,
- unsigned offset_y = 0u)
+ mapnik::image_32& image,
+ double scale_factor = 1.0,
+ unsigned offset_x = 0u,
+ unsigned offset_y = 0u)
{
Py_BEGIN_ALLOW_THREADS
- try
- {
- mapnik::agg_renderer<mapnik::image_32> ren(map,image,scale_factor,offset_x, offset_y);
- ren.apply();
- }
- catch (...)
- {
- Py_BLOCK_THREADS
- throw;
- }
+ try
+ {
+ mapnik::agg_renderer<mapnik::image_32> ren(map,image,scale_factor,offset_x, offset_y);
+ ren.apply();
+ }
+ catch (...)
+ {
+ Py_BLOCK_THREADS
+ throw;
+ }
Py_END_ALLOW_THREADS
-}
+ }
void render_with_detector(
- const mapnik::Map &map,
- mapnik::image_32 &image,
- boost::shared_ptr<mapnik::label_collision_detector4> detector,
- double scale_factor = 1.0,
- unsigned offset_x = 0u,
- unsigned offset_y = 0u)
+ const mapnik::Map &map,
+ mapnik::image_32 &image,
+ boost::shared_ptr<mapnik::label_collision_detector4> detector,
+ double scale_factor = 1.0,
+ unsigned offset_x = 0u,
+ unsigned offset_y = 0u)
{
Py_BEGIN_ALLOW_THREADS
- try
- {
- mapnik::agg_renderer<mapnik::image_32> ren(map,image,detector);
- ren.apply();
- }
- catch (...)
- {
- Py_BLOCK_THREADS
</