+ apply show_page.patch (thanks Berteun) (closes #201)
This commit is contained in:
parent
5b0c59428e
commit
51293f64ba
3 changed files with 20 additions and 6 deletions
|
@ -107,7 +107,7 @@ void render2(const mapnik::Map& map,mapnik::Image32& image)
|
|||
|
||||
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
||||
|
||||
void render3(const mapnik::Map& map,PycairoSurface* surface, unsigned offset_x = 0, unsigned offset_y = 0)
|
||||
void render3(const mapnik::Map& map,PycairoSurface* surface, unsigned offset_x = 0, unsigned offset_y = 0, bool show_page=true)
|
||||
{
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
try
|
||||
|
@ -124,13 +124,18 @@ void render3(const mapnik::Map& map,PycairoSurface* surface, unsigned offset_x =
|
|||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
|
||||
void render4(const mapnik::Map& map,PycairoSurface* surface)
|
||||
void render4(const mapnik::Map& map,PycairoSurface* surface, unsigned offset_x = 0, unsigned offset_y = 0) {
|
||||
render3(map, surface, offset_x, offset_y);
|
||||
}
|
||||
|
||||
|
||||
void render5(const mapnik::Map& map,PycairoSurface* surface, bool show_page=true)
|
||||
{
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
try
|
||||
{
|
||||
Cairo::RefPtr<Cairo::Surface> s(new Cairo::Surface(surface->surface));
|
||||
mapnik::cairo_renderer<Cairo::Surface> ren(map,s);
|
||||
mapnik::cairo_renderer<Cairo::Surface> ren(map,s,0,0,show_page);
|
||||
ren.apply();
|
||||
}
|
||||
catch (...)
|
||||
|
@ -141,6 +146,10 @@ void render4(const mapnik::Map& map,PycairoSurface* surface)
|
|||
Py_END_ALLOW_THREADS
|
||||
}
|
||||
|
||||
void render6(const mapnik::Map& map,PycairoSurface* surface) {
|
||||
render5(map, surface);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void render_tile_to_file(const mapnik::Map& map,
|
||||
|
@ -233,6 +242,8 @@ BOOST_PYTHON_MODULE(_mapnik)
|
|||
#if defined(HAVE_CAIRO) && defined(HAVE_PYCAIRO)
|
||||
def("render",&render3);
|
||||
def("render",&render4);
|
||||
def("render",&render5);
|
||||
def("render",&render6);
|
||||
#endif
|
||||
def("scale_denominator", &scale_denominator);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace mapnik {
|
|||
{
|
||||
|
||||
public:
|
||||
cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Surface> const& surface, unsigned offset_x=0, unsigned offset_y=0);
|
||||
cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Surface> const& surface, unsigned offset_x=0, unsigned offset_y=0, bool show_page=true);
|
||||
~cairo_renderer();
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
|
@ -112,6 +112,7 @@ namespace mapnik {
|
|||
face_manager<freetype_engine> font_manager_;
|
||||
cairo_face_manager face_manager_;
|
||||
label_collision_detector4 detector_;
|
||||
bool show_page;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -466,7 +466,7 @@ namespace mapnik
|
|||
};
|
||||
|
||||
template <typename T>
|
||||
cairo_renderer<T>::cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Surface> const& surface, unsigned offset_x, unsigned offset_y)
|
||||
cairo_renderer<T>::cairo_renderer(Map const& m, Cairo::RefPtr<Cairo::Surface> const& surface, unsigned offset_x, unsigned offset_y, bool show_page)
|
||||
: feature_style_processor<cairo_renderer>(m),
|
||||
m_(m),
|
||||
surface_(surface),
|
||||
|
@ -480,6 +480,7 @@ namespace mapnik
|
|||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "scale=" << m.scale() << "\n";
|
||||
#endif
|
||||
this->show_page = show_page;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -514,7 +515,8 @@ namespace mapnik
|
|||
#ifdef MAPNIK_DEBUG
|
||||
std::clog << "end map processing\n";
|
||||
#endif
|
||||
context_->show_page();
|
||||
if (show_page)
|
||||
context_->show_page();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Add table
Reference in a new issue