Permalink
Browse files

merge with master

  • Loading branch information...
2 parents 965181b + f0bc106 commit 982a2b940ed7613c3555e3860c53c511a3a667a5 Dane Springmeyer committed Mar 14, 2012
Showing with 2,198 additions and 1,873 deletions.
  1. +1 −1 bindings/python/mapnik_image.cpp
  2. +5 −1 bindings/python/mapnik_polygon_symbolizer.cpp
  3. +51 −51 bindings/python/mapnik_text_placement.cpp
  4. +7 −7 bindings/python/mapnik_threads.hpp
  5. +4 −4 bindings/python/python_optional.hpp
  6. +3 −1 demo/python/rundemo.py
  7. +2 −1 demo/viewer/mapwidget.cpp
  8. +91 −0 include/mapnik/agg_helpers.hpp
  9. +1 −1 include/mapnik/agg_renderer.hpp
  10. +90 −0 include/mapnik/boolean.hpp
  11. +8 −0 include/mapnik/color.hpp
  12. +6 −114 include/mapnik/color_factory.hpp
  13. +0 −2 include/mapnik/config.hpp
  14. +13 −16 include/mapnik/config_error.hpp
  15. +1 −1 include/mapnik/expression.hpp
  16. +2 −2 include/mapnik/expression_grammar.hpp
  17. +12 −12 include/mapnik/feature.hpp
  18. +1 −1 include/mapnik/font_engine_freetype.hpp
  19. +2 −1 include/mapnik/formatting/base.hpp
  20. +2 −2 include/mapnik/formatting/expression.hpp
  21. +1 −1 include/mapnik/formatting/format.hpp
  22. +3 −3 include/mapnik/formatting/registry.hpp
  23. +1 −1 include/mapnik/formatting/text.hpp
  24. +1 −1 include/mapnik/geometry.hpp
  25. +2 −2 include/mapnik/hextree.hpp
  26. +18 −10 include/mapnik/internal/dump_xml.hpp
  27. +2 −1 include/mapnik/metawriter_factory.hpp
  28. +0 −1 include/mapnik/palette.hpp
  29. +6 −6 include/mapnik/placement_finder.hpp
  30. +4 −2 include/mapnik/polygon_symbolizer.hpp
  31. +0 −433 include/mapnik/ptree_helpers.hpp
  32. +0 −1 include/mapnik/raster_colorizer.hpp
  33. +1 −1 include/mapnik/symbolizer_helpers.hpp
  34. +1 −1 include/mapnik/text_placements/list.hpp
  35. +3 −3 include/mapnik/text_placements/registry.hpp
  36. +1 −1 include/mapnik/text_placements/simple.hpp
  37. +2 −2 include/mapnik/text_properties.hpp
  38. +9 −9 include/mapnik/util/conversions.hpp
  39. +0 −1 include/mapnik/value.hpp
  40. +4 −4 include/mapnik/vertex_vector.hpp
  41. +3 −5 include/mapnik/{libxml2_loader.hpp → xml_loader.hpp}
  42. +137 −0 include/mapnik/xml_node.hpp
  43. +62 −0 include/mapnik/xml_tree.hpp
  44. +2 −1 plugins/input/csv/csv_datasource.cpp
  45. +1 −1 plugins/input/gdal/gdal_datasource.cpp
  46. +1 −1 plugins/input/geos/geos_datasource.cpp
  47. +1 −1 plugins/input/kismet/kismet_datasource.cpp
  48. +1 −1 plugins/input/occi/occi_datasource.cpp
  49. +1 −1 plugins/input/occi/occi_featureset.cpp
  50. +1 −1 plugins/input/ogr/ogr_datasource.cpp
  51. +17 −17 plugins/input/postgis/postgis_datasource.cpp
  52. +1 −1 plugins/input/rasterlite/rasterlite_datasource.cpp
  53. +1 −1 plugins/input/shape/dbfile.cpp
  54. +2 −2 plugins/input/shape/shape_index_featureset.cpp
  55. +5 −5 plugins/input/shape/shape_io.cpp
  56. +1 −1 plugins/input/sqlite/sqlite_datasource.cpp
  57. +0 −1 src/agg/agg_renderer.cpp
  58. +16 −65 src/agg/process_line_symbolizer.cpp
  59. +1 −1 src/agg/process_markers_symbolizer.cpp
  60. +4 −22 src/agg/process_polygon_pattern_symbolizer.cpp
  61. +27 −27 src/agg/process_polygon_symbolizer.cpp
  62. +9 −1 src/build.py
  63. +36 −22 src/cairo_renderer.cpp
  64. +97 −0 src/color.cpp
  65. +55 −0 src/config_error.cpp
  66. +9 −9 src/conversions.cpp
  67. +3 −2 src/expression.cpp
  68. +1 −2 src/feature_style_processor.cpp
  69. +6 −5 src/formatting/base.cpp
  70. +13 −12 src/formatting/expression.cpp
  71. +13 −12 src/formatting/format.cpp
  72. +6 −3 src/formatting/registry.cpp
  73. +3 −7 src/formatting/text.cpp
  74. +0 −1 src/grid/grid_renderer.cpp
  75. +18 −18 src/json/feature_collection_parser.cpp
  76. +35 −35 src/json/geojson_generator.cpp
  77. +1 −0 src/layer.cpp
  78. +46 −69 src/libxml2_loader.cpp
  79. +400 −722 src/load_map.cpp
  80. +2 −2 src/map.cpp
  81. +14 −11 src/metawriter_factory.cpp
  82. +1 −0 src/palette.cpp
  83. +15 −15 src/placement_finder.cpp
  84. +14 −2 src/polygon_symbolizer.cpp
  85. +25 −1 src/processed_text.cpp
  86. +171 −0 src/rapidxml_loader.cpp
  87. +4 −0 src/save_map.cpp
  88. +1 −0 src/svg_parser.cpp
  89. +1 −1 src/symbolizer_helpers.cpp
  90. +1 −2 src/text_placements/dummy.cpp
  91. +11 −8 src/text_placements/list.cpp
  92. +3 −2 src/text_placements/registry.cpp
  93. +9 −7 src/text_placements/simple.cpp
  94. +37 −35 src/text_properties.cpp
  95. +483 −0 src/xml_tree.cpp
  96. +2 −7 tests/python_tests/object_test.py
  97. +5 −1 tests/visual_tests/compare.py
  98. +1 −1 tests/visual_tests/shieldsymbolizer-1.xml
  99. +1 −1 tests/visual_tests/test.py
@@ -125,7 +125,7 @@ bool painted(mapnik::image_32 const& im)
void set_pixel(mapnik::image_32 & im, unsigned x, unsigned y, mapnik::color const& c)
{
im.setPixel(x, y, c.rgba());
-}
+}
boost::shared_ptr<image_32> open_from_file(std::string const& filename)
{
@@ -84,7 +84,11 @@ void export_polygon_symbolizer()
.add_property("gamma_method",
&polygon_symbolizer::get_gamma_method,
&polygon_symbolizer::set_gamma_method,
- "Set/get the gamma correction method of the polygon")
+ "gamma correction method")
+ .add_property("smooth",
+ &polygon_symbolizer::smooth,
+ &polygon_symbolizer::set_smooth,
+ "smooth value (0..1.0)")
;
}
@@ -40,15 +40,15 @@
using namespace mapnik;
/* Notes:
-Overriding functions in inherited classes:
-boost.python documentation doesn't really tell you how to do it.
-But this helps:
-http://www.gamedev.net/topic/446225-inheritance-in-boostpython/
+ Overriding functions in inherited classes:
+ boost.python documentation doesn't really tell you how to do it.
+ But this helps:
+ http://www.gamedev.net/topic/446225-inheritance-in-boostpython/
-register_ptr_to_python is required for wrapped classes, but not for unwrapped.
+ register_ptr_to_python is required for wrapped classes, but not for unwrapped.
-Functions don't have to be members of the class, but can also be
-normal functions taking a ref to the class as first parameter.
+ Functions don't have to be members of the class, but can also be
+ normal functions taking a ref to the class as first parameter.
*/
namespace {
@@ -261,7 +261,7 @@ struct TextPlacementsWrap: text_placements, wrapper<text_placements>
struct TextPlacementInfoWrap: text_placement_info, wrapper<text_placement_info>
{
TextPlacementInfoWrap(text_placements const* parent,
- double scale_factor_)
+ double scale_factor_)
: text_placement_info(parent, scale_factor_)
{
@@ -339,7 +339,7 @@ void export_text_placement()
;
class_<text_symbolizer>("TextSymbolizer",
- init<>())
+ init<>())
.def(init<expression_ptr, std::string const&, unsigned, color const&>())
.add_property("placements",
&text_symbolizer::get_placement_options,
@@ -357,7 +357,7 @@ void export_text_placement()
class_with_converter<text_symbolizer_properties>
- ("TextSymbolizerProperties")
+ ("TextSymbolizerProperties")
.def_readwrite_convert("label_placement", &text_symbolizer_properties::label_placement)
.def_readwrite_convert("horizontal_alignment", &text_symbolizer_properties::halign)
.def_readwrite_convert("justify_alignment", &text_symbolizer_properties::jalign)
@@ -381,15 +381,15 @@ void export_text_placement()
.add_property ("format_tree",
&text_symbolizer_properties::format_tree,
&text_symbolizer_properties::set_format_tree);
- /* from_xml, to_xml operate on mapnik's internal XML tree and don't make sense in python.
- add_expressions isn't useful in python either. The result is only needed by
- attribute_collector (which isn't exposed in python) and
- it just calls add_expressions of the associated formatting tree.
- set_old_style expression is just a compatibility wrapper and doesn't need to be exposed in python. */
- ;
+ /* from_xml, to_xml operate on mapnik's internal XML tree and don't make sense in python.
+ add_expressions isn't useful in python either. The result is only needed by
+ attribute_collector (which isn't exposed in python) and
+ it just calls add_expressions of the associated formatting tree.
+ set_old_style expression is just a compatibility wrapper and doesn't need to be exposed in python. */
+ ;
class_<char_properties>
- ("CharProperties")
+ ("CharProperties")
.def(init<char_properties const&>()) //Copy constructor
.def_readwrite("face_name", &char_properties::face_name)
.def_readwrite("fontset", &char_properties::fontset)
@@ -407,20 +407,20 @@ void export_text_placement()
;
class_<TextPlacementsWrap,
- boost::shared_ptr<TextPlacementsWrap>,
- boost::noncopyable>
- ("TextPlacements")
+ boost::shared_ptr<TextPlacementsWrap>,
+ boost::noncopyable>
+ ("TextPlacements")
.def_readwrite("defaults", &text_placements::defaults)
.def("get_placement_info", pure_virtual(&text_placements::get_placement_info))
/* TODO: add_expressions() */
;
register_ptr_to_python<boost::shared_ptr<text_placements> >();
class_<TextPlacementInfoWrap,
- boost::shared_ptr<TextPlacementInfoWrap>,
- boost::noncopyable>
- ("TextPlacementInfo",
- init<text_placements const*, double>())
+ boost::shared_ptr<TextPlacementInfoWrap>,
+ boost::noncopyable>
+ ("TextPlacementInfo",
+ init<text_placements const*, double>())
.def("next", pure_virtual(&text_placement_info::next))
.def("get_actual_label_spacing", &text_placement_info::get_actual_label_spacing)
.def("get_actual_minimum_distance", &text_placement_info::get_actual_minimum_distance)
@@ -432,27 +432,27 @@ void export_text_placement()
class_<processed_text,
- boost::shared_ptr<processed_text>,
- boost::noncopyable>
- ("ProcessedText", no_init)
+ boost::shared_ptr<processed_text>,
+ boost::noncopyable>
+ ("ProcessedText", no_init)
.def("push_back", &processed_text::push_back)
.def("clear", &processed_text::clear)
;
class_<expression_set,
- boost::shared_ptr<expression_set>,
- boost::noncopyable>
- ("ExpressionSet")
+ boost::shared_ptr<expression_set>,
+ boost::noncopyable>
+ ("ExpressionSet")
.def("insert", &insert_expression);
- ;
+ ;
//TODO: Python namespace
class_<NodeWrap,
- boost::shared_ptr<NodeWrap>,
- boost::noncopyable>
- ("FormattingNode")
+ boost::shared_ptr<NodeWrap>,
+ boost::noncopyable>
+ ("FormattingNode")
.def("apply", pure_virtual(&formatting::node::apply))
.def("add_expressions",
&formatting::node::add_expressions,
@@ -462,10 +462,10 @@ void export_text_placement()
class_<TextNodeWrap,
- boost::shared_ptr<TextNodeWrap>,
- bases<formatting::node>,
- boost::noncopyable>
- ("FormattingText", init<expression_ptr>())
+ boost::shared_ptr<TextNodeWrap>,
+ bases<formatting::node>,
+ boost::noncopyable>
+ ("FormattingText", init<expression_ptr>())
.def(init<std::string>())
.def("apply", &formatting::text_node::apply, &TextNodeWrap::default_apply)
.add_property("text",
@@ -476,10 +476,10 @@ void export_text_placement()
class_with_converter<FormatNodeWrap,
- boost::shared_ptr<FormatNodeWrap>,
- bases<formatting::node>,
- boost::noncopyable>
- ("FormattingFormat")
+ boost::shared_ptr<FormatNodeWrap>,
+ bases<formatting::node>,
+ boost::noncopyable>
+ ("FormattingFormat")
.def_readwrite_convert("text_size", &formatting::format_node::text_size)
.def_readwrite_convert("face_name", &formatting::format_node::face_name)
.def_readwrite_convert("character_spacing", &formatting::format_node::character_spacing)
@@ -499,26 +499,26 @@ void export_text_placement()
register_ptr_to_python<boost::shared_ptr<formatting::format_node> >();
class_<ListNodeWrap,
- boost::shared_ptr<ListNodeWrap>,
- bases<formatting::node>,
- boost::noncopyable>
- ("FormattingList", init<>())
+ boost::shared_ptr<ListNodeWrap>,
+ bases<formatting::node>,
+ boost::noncopyable>
+ ("FormattingList", init<>())
.def(init<list>())
.def("append", &formatting::list_node::push_back)
.def("apply", &formatting::list_node::apply, &ListNodeWrap::default_apply)
.def("__len__", &ListNodeWrap::get_length)
.def("__getitem__", &ListNodeWrap::get_item)
.def("__setitem__", &ListNodeWrap::set_item)
.def("append", &ListNodeWrap::append)
- ;
+ ;
register_ptr_to_python<boost::shared_ptr<formatting::list_node> >();
class_<ExprFormatWrap,
- boost::shared_ptr<ExprFormatWrap>,
- bases<formatting::node>,
- boost::noncopyable>
- ("FormattingExpressionFormat")
+ boost::shared_ptr<ExprFormatWrap>,
+ bases<formatting::node>,
+ boost::noncopyable>
+ ("FormattingExpressionFormat")
.def_readwrite("text_size", &formatting::expression_format::text_size)
.def_readwrite("face_name", &formatting::expression_format::face_name)
.def_readwrite("character_spacing", &formatting::expression_format::character_spacing)
@@ -29,17 +29,17 @@ namespace mapnik {
class python_thread
{
/* Docs:
- http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock
- */
+ http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock
+ */
public:
static void unblock()
{
#ifdef MAPNIK_DEBUG
if (state.get())
{
std::cerr << "ERROR: Python threads are already unblocked. "
- "Unblocking again will loose the current state and "
- "might crash later. Aborting!\n";
+ "Unblocking again will loose the current state and "
+ "might crash later. Aborting!\n";
abort(); //This is a serious error and can't be handled in any other sane way
}
#endif
@@ -59,9 +59,9 @@ class python_thread
if (thread_support && !state.get())
{
std::cerr << "ERROR: Trying to restore python thread state, "
- "but no state is saved. Can't continue and also "
- "can't raise an exception because the python "
- "interpreter might be non-function. Aborting!\n";
+ "but no state is saved. Can't continue and also "
+ "can't raise an exception because the python "
+ "interpreter might be non-function. Aborting!\n";
abort();
}
#endif
@@ -102,8 +102,8 @@ struct python_optional : public boost::noncopyable
/** This class works around a bug in boost python.
- See http://osdir.com/ml/python.c++/2003-11/msg00158.html
- */
+ See http://osdir.com/ml/python.c++/2003-11/msg00158.html
+*/
template <typename T, typename X1 = boost::python::detail::not_specified, typename X2 = boost::python::detail::not_specified, typename X3 = boost::python::detail::not_specified>
class class_with_converter : public boost::python::class_<T, X1, X2, X3>
{
@@ -131,8 +131,8 @@ class class_with_converter : public boost::python::class_<T, X1, X2, X3>
self& def_readwrite_convert(char const* name, D const& d, char const* doc=0)
{
this->add_property(name,
- boost::python::make_getter(d, boost::python::return_value_policy<boost::python::return_by_value>()),
- boost::python::make_setter(d, boost::python::default_call_policies()));
+ boost::python::make_getter(d, boost::python::return_value_policy<boost::python::return_by_value>()),
+ boost::python::make_setter(d, boost::python::default_call_policies()));
return *this;
}
};
View
@@ -138,7 +138,9 @@
qcdrain_style = mapnik.Style()
qcdrain_rule = mapnik.Rule()
qcdrain_rule.filter = mapnik.Expression('[HYC] = 8')
-qcdrain_rule.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color(153, 204, 255)))
+sym = mapnik.PolygonSymbolizer(mapnik.Color(153, 204, 255))
+sym.smooth = 1.0 # very smooth
+qcdrain_rule.symbols.append(sym)
qcdrain_style.rules.append(qcdrain_rule)
m.append_style('drainage', qcdrain_style)
@@ -30,6 +30,7 @@
#include <mapnik/ctrans.hpp>
#include <mapnik/memory_datasource.hpp>
#include <mapnik/feature_kv_iterator.hpp>
+#include <mapnik/config_error.hpp>
#include "mapwidget.hpp"
#include "info_dialog.hpp"
@@ -487,7 +488,7 @@ void MapWidget::updateMap()
}
catch (mapnik::config_error & ex)
{
- std::cerr << ex.what() << std::endl;
+ std::cerr << ex.what() << std::endl;
}
catch (...)
{
Oops, something went wrong.

0 comments on commit 982a2b9

Please sign in to comment.