Permalink
Browse files

Experimental pdf output using wxPdfDoc:

 - wxpdfdoc patches
 - mapnik patches
 - visual studio build instructions / project files

see /msvc/readme.txt for build instructions

The scons makefiles have not been updated, the new files are in /pdf, /include/pdf, /demo/pdf/, and /bindings/python
  • Loading branch information...
1 parent e1a9612 commit 0a588d044b721dfbe9cb560749b3cec0b3b8bb52 @nehhen nehhen committed Apr 6, 2008
Showing with 23,169 additions and 10 deletions.
  1. +42 −0 bindings/python/mapnik_pdf_line_pattern_symbolizer.cpp
  2. +39 −0 bindings/python/mapnik_pdf_point_symbolizer.cpp
  3. +38 −0 bindings/python/mapnik_pdf_polygon_pattern_symbolizer.cpp
  4. +76 −0 bindings/python/mapnik_pdf_renderer.cpp
  5. +40 −0 bindings/python/mapnik_pdf_shield_symbolizer.cpp
  6. +13 −0 bindings/python/mapnik_python.cpp
  7. BIN demo/pdf/images/a.PNG
  8. BIN demo/pdf/images/b.PNG
  9. BIN demo/pdf/images/c.pdf
  10. +624 −0 demo/pdf/main.cpp
  11. +6 −0 include/mapnik/attribute_collector.hpp
  12. +1 −1 include/mapnik/image_data.hpp
  13. +6 −5 include/mapnik/octree.hpp
  14. +2 −2 include/mapnik/png_io.hpp
  15. +14 −1 include/mapnik/rule.hpp
  16. +1 −1 include/mapnik/symbolizer.hpp
  17. +2 −0 include/mapnik/unicode.hpp
  18. +172 −0 include/pdf/font_engine_pdf.hpp
  19. +105 −0 include/pdf/pdf_line_pattern_symbolizer.hpp
  20. +89 −0 include/pdf/pdf_point_symbolizer.hpp
  21. +89 −0 include/pdf/pdf_polygon_pattern_symbolizer.hpp
  22. +249 −0 include/pdf/pdf_renderer.hpp
  23. +240 −0 include/pdf/pdf_renderer_layout.hpp
  24. +50 −0 include/pdf/pdf_renderer_utility.hpp
  25. +95 −0 include/pdf/pdf_shield_symbolizer.hpp
  26. +758 −0 msvc/agg/agg.vcproj
  27. +356 −0 msvc/binding_python/binding_python.vcproj
  28. +807 −0 msvc/core/core.vcproj
  29. +224 −0 msvc/input_raster/input_raster.vcproj
  30. +262 −0 msvc/input_shapefile/input_shapefile.vcproj
  31. +75 −0 msvc/msvc.sln
  32. +200 −0 msvc/pdf/pdf.vcproj
  33. +281 −0 msvc/readme.txt
  34. +276 −0 msvc/shapeindex/shapeindex.vcproj
  35. +200 −0 pdf/font_engine_pdf.cpp
  36. +73 −0 pdf/pdf_line_pattern_symbolizer.cpp
  37. +80 −0 pdf/pdf_point_symbolizer.cpp
  38. +69 −0 pdf/pdf_polygon_pattern_symbolizer.cpp
  39. +1,719 −0 pdf/pdf_renderer.cpp
  40. +111 −0 pdf/pdf_renderer_layout.cpp
  41. +64 −0 pdf/pdf_renderer_utility.cpp
  42. +76 −0 pdf/pdf_shield_symbolizer.cpp
  43. +2,630 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/include/wx/pdfdoc.h
  44. +179 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/include/wx/pdfoc.h
  45. +882 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/include/wx/pdfproperties.h
  46. +574 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfcolor.cpp
  47. +2,306 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfdoc.cpp
  48. +2,243 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfgraphics.cpp
  49. +1,221 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfimage.cpp
  50. +2,472 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfkernel.cpp
  51. +122 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfoc.cpp
  52. +1,893 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc/src/pdfparser.cpp
  53. +1,023 −0 thirdparty/wxPdfDoc-patch/wxpdfdoc_patch_20080112.patch
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ *
+ * This file is part of the wxPdfDoc modifications for mapnik
+ *
+ * Copyright (C) 2007 Ben Moores
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+#include <boost/python.hpp>
+#include <pdf/pdf_line_pattern_symbolizer.hpp>
+#include <mapnik/line_symbolizer.hpp>
+
+using mapnik::pdf_line_pattern_symbolizer;
+using mapnik::stroke;
+
+void export_pdf_line_pattern_symbolizer()
+{
+ using namespace boost::python;
+
+ class_<pdf_line_pattern_symbolizer, bases<mapnik::line_pattern_symbolizer>>("PDFLinePatternSymbolizer", init<std::string const&, std::string const&, const double, const unsigned, const unsigned, const double, const double>("Create a new PDF Line Pattern Symbolizer"))
+ .def (init<mapnik::pdf_line_pattern_symbolizer const&>("Copies a PDF Line Pattern Symbolizer"))
+ .def (init<mapnik::line_pattern_symbolizer const&, const double, const double, const double>("Creates a PDF Line Pattern Symbolizer from a Line Pattern Symbolizer"))
+ .def ("set_output_size", &mapnik::pdf_line_pattern_symbolizer::set_output_size, "Sets the output size of the tile in PDF units")
+ .def ("get_output_width", &mapnik::pdf_line_pattern_symbolizer::get_output_width, "Gets the output width of the tile in PDF units")
+ .def ("get_output_height", &mapnik::pdf_line_pattern_symbolizer::get_output_height, "Gets the output height of the tile in PDF units")
+ .add_property("stroke",make_function( &pdf_line_pattern_symbolizer::get_stroke, return_value_policy<copy_const_reference>() ), &pdf_line_pattern_symbolizer::set_stroke )
+ ;
+}
@@ -0,0 +1,39 @@
+/*****************************************************************************
+ *
+ * This file is part of the wxPdfDoc modifications for mapnik
+ *
+ * Copyright (C) 2007 Ben Moores
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+#include <boost/python.hpp>
+#include <pdf/pdf_point_symbolizer.hpp>
+
+void export_pdf_point_symbolizer()
+{
+ using namespace boost::python;
+ using mapnik::pdf_point_symbolizer;
+
+ class_<pdf_point_symbolizer, bases<mapnik::point_symbolizer>>("PDFPointSymbolizer", init<>("Default PDF Point Symbolizer - 1x1 black square"))
+ .def (init<std::string const&, std::string const&, unsigned, unsigned, double, double>("Create a new PDF Point Symbolizer"))
+ .def (init<mapnik::pdf_point_symbolizer &>("Copies a PDF Point Symbolizer"))
+ .def (init<mapnik::point_symbolizer &, double, double>("Creates a PDF point symbolizer from a point symbolizer"))
+ .def ("set_output_size", &mapnik::pdf_point_symbolizer::set_output_size, "Sets the output size of the symbol in PDF units")
+ .def ("get_output_width", &mapnik::pdf_point_symbolizer::get_output_width, "Gets the output width of the symbol in PDF units")
+ .def ("get_output_height", &mapnik::pdf_point_symbolizer::get_output_height, "Gets the output height of the symbol in PDF units")
+ ;
+}
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ *
+ * This file is part of the wxPdfDoc modifications for mapnik
+ *
+ * Copyright (C) 2007 Ben Moores
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+#include <boost/python.hpp>
+#include <pdf/pdf_polygon_pattern_symbolizer.hpp>
+
+void export_pdf_polygon_pattern_symbolizer()
+{
+ using namespace boost::python;
+ using mapnik::pdf_polygon_pattern_symbolizer;
+
+ class_<pdf_polygon_pattern_symbolizer, bases<mapnik::polygon_pattern_symbolizer>>("PDFPolygonPatternSymbolizer", init<std::string const&, std::string const&, const unsigned, const unsigned, const double, const double>("Create a new PDF Polygon Pattern Symbolizer"))
+ .def (init<mapnik::pdf_polygon_pattern_symbolizer const&>("Copies a PDF Polygon Pattern Symbolizer"))
+ .def (init<mapnik::polygon_pattern_symbolizer const&, const double, const double>("Creates a PDF Polygon Pattern Symbolizer from a Polygon Pattern Symbolizer"))
+ .def ("set_output_size", &mapnik::pdf_polygon_pattern_symbolizer::set_output_size, "Sets the output size of the tile in PDF units")
+ .def ("get_output_width", &mapnik::pdf_polygon_pattern_symbolizer::get_output_width, "Gets the output width of the tile in PDF units")
+ .def ("get_output_height", &mapnik::pdf_polygon_pattern_symbolizer::get_output_height, "Gets the output height of the tile in PDF units")
+ ;
+}
@@ -0,0 +1,76 @@
+/*****************************************************************************
+ *
+ * This file is part of the wxPdfDoc modifications for mapnik
+ *
+ * Copyright (C) 2007 Ben Moores
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+#include <boost/python.hpp>
+#include <pdf/pdf_renderer.hpp>
+#include <pdf/pdf_renderer_layout.hpp>
+#include <pdf/pdf_renderer_utility.hpp>
+
+
+void export_pdf_renderer_layout()
+{
+ using namespace boost::python;
+ using mapnik::pdf_renderer_layout;
+
+ class_<pdf_renderer_layout>("PDFRendererLayout", init<const std::string, const double, const double, const bool>("Default PDF Renderer Layout"))
+ .def ("set_font", &mapnik::pdf_renderer_layout::set_font, "Set the font to use for overlays")
+ .def ("set_background_colour", &mapnik::pdf_renderer_layout::set_background_colour, "set the page background colour")
+ .def ("set_map_area", &mapnik::pdf_renderer_layout::set_map_area, "Set the area of the page to render the map")
+ .def ("set_map_area_border", &mapnik::pdf_renderer_layout::set_map_area_border, "Set whether to draw a map border")
+ .def ("set_map_area_border_width", &mapnik::pdf_renderer_layout::set_map_area_border_width, "Set the map border width")
+ .def ("add_overlay_image", &mapnik::pdf_renderer_layout::add_overlay_image, "Add an overlay image")
+ .def ("set_map_grid", &mapnik::pdf_renderer_layout::set_map_grid, "Enable/Disable drawing map grid")
+ .def ("set_border_scales", &mapnik::pdf_renderer_layout::set_border_scales, "Enable/Disable drawing scales around edge of map")
+ .def ("set_map_grid_approx_spacing", &mapnik::pdf_renderer_layout::set_map_grid_approx_spacing, "Sets the approximate spacing of the grid lines")
+ .def ("set_border_scale_width", &mapnik::pdf_renderer_layout::set_border_scale_width, "Set width of scale bars around edge of map")
+ .def ("set_border_scale_linewidth", &mapnik::pdf_renderer_layout::set_border_scale_linewidth, "Set thickness of lines around the grid edge")
+ .def ("set_map_grid_colour", &mapnik::pdf_renderer_layout::set_map_grid_colour, "Set the colour of the grid across the map")
+ .def ("set_map_grid_linewidth", &mapnik::pdf_renderer_layout::set_map_grid_linewidth, "Set the map grid line width")
+ .def ("set_scale_bar", &mapnik::pdf_renderer_layout::set_scale_bar, "Enable/Disable the scale bar")
+ .def ("set_scale_bar_area", &mapnik::pdf_renderer_layout::set_scale_bar_area, "Set the scale bar size and location")
+ .def ("set_scale_bar_factor", &mapnik::pdf_renderer_layout::set_scale_bar_factor, "Sets the scale bar scale factor and label")
+ ;
+}
+
+
+
+void render_to_pdf_1(const mapnik::Map& map, const mapnik::pdf_renderer_layout &layout, const std::string& filename) {
+ mapnik::render_to_pdf(map, layout, filename);
+}
+
+void render_to_pdf_2(const mapnik::Map& map, const mapnik::pdf_renderer_layout &layout, const std::string& filename, const bool compress) {
+ mapnik::render_to_pdf(map, layout, filename, compress);
+}
+
+
+
+
+void export_pdf_renderer()
+{
+
+ using namespace boost::python;
+ using mapnik::pdf_renderer;
+
+ def("render_to_pdf",&render_to_pdf_1);
+ def("render_to_pdf",&render_to_pdf_2);
+
+}
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ *
+ * This file is part of the wxPdfDoc modifications for mapnik
+ *
+ * Copyright (C) 2007 Ben Moores
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+#include <boost/python.hpp>
+#include <pdf/pdf_shield_symbolizer.hpp>
+
+void export_pdf_shield_symbolizer()
+{
+ using namespace boost::python;
+ using mapnik::pdf_shield_symbolizer;
+ using mapnik::text_symbolizer;
+
+ class_< pdf_shield_symbolizer, bases<mapnik::shield_symbolizer> >("PDFShieldSymbolizer", init< std::string const&, std::string const&, unsigned, mapnik::Color const&, std::string const&, std::string const&, unsigned, unsigned, double, double>("TODO"))
+ .def (init<mapnik::pdf_shield_symbolizer const&>("Copies a PDF Shield Symbolizer"))
+ .def (init<mapnik::pdf_shield_symbolizer const&, const double, const double>("Creates a PDF Shield Symbolizer from a Shield Symbolizer"))
+ .def ("set_output_size", &mapnik::pdf_shield_symbolizer::set_output_size, "Sets the output size of the shield in PDF units")
+ .def ("get_output_width", &mapnik::pdf_shield_symbolizer::get_output_width, "Gets the output width of the shield in PDF units")
+ .def ("get_output_height", &mapnik::pdf_shield_symbolizer::get_output_height, "Gets the output height of the shield in PDF units")
+ ;
+
+}
@@ -55,6 +55,12 @@ void export_text_symbolizer();
void export_shield_symbolizer();
void export_font_engine();
void export_projection();
+void export_pdf_point_symbolizer();
+void export_pdf_line_pattern_symbolizer();
+void export_pdf_polygon_pattern_symbolizer();
+void export_pdf_shield_symbolizer();
+void export_pdf_renderer_layout();
+void export_pdf_renderer();
#include <mapnik/map.hpp>
#include <mapnik/agg_renderer.hpp>
@@ -178,6 +184,13 @@ BOOST_PYTHON_MODULE(_mapnik)
export_projection();
export_coord();
export_map();
+ export_pdf_point_symbolizer();
+ export_pdf_line_pattern_symbolizer();
+ export_pdf_polygon_pattern_symbolizer();
+ export_pdf_shield_symbolizer();
+ export_pdf_renderer_layout();
+ export_pdf_renderer();
+
def("render_to_file",&render_to_file1);
def("render_to_file",&render_to_file2);
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 0a588d0

Please sign in to comment.