2013-12-05 17:21:55 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
*
|
|
|
|
* This file is part of Mapnik (c++ mapping toolkit)
|
|
|
|
*
|
2015-06-16 12:49:16 +02:00
|
|
|
* Copyright (C) 2015 Artem Pavlenko
|
2013-12-05 17:21:55 +01:00
|
|
|
*
|
|
|
|
* 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 <mapnik/renderer_common.hpp>
|
|
|
|
#include <mapnik/label_collision_detector.hpp>
|
|
|
|
#include <mapnik/map.hpp>
|
|
|
|
#include <mapnik/request.hpp>
|
2014-05-11 22:08:24 +02:00
|
|
|
#include <mapnik/attribute.hpp>
|
2015-06-16 04:36:36 +02:00
|
|
|
#include <mapnik/safe_cast.hpp>
|
2013-12-05 17:21:55 +01:00
|
|
|
|
|
|
|
namespace mapnik {
|
|
|
|
|
2016-01-26 21:18:00 +01:00
|
|
|
// copy constructor exclusively for virtual_renderer_common
|
|
|
|
renderer_common::renderer_common(renderer_common const& other)
|
|
|
|
: width_(other.width_),
|
|
|
|
height_(other.height_),
|
|
|
|
scale_factor_(other.scale_factor_),
|
|
|
|
vars_(other.vars_),
|
|
|
|
shared_font_library_(other.shared_font_library_),
|
|
|
|
font_library_(other.font_library_),
|
|
|
|
font_manager_(other.font_manager_),
|
|
|
|
query_extent_(other.query_extent_),
|
|
|
|
t_(other.t_),
|
|
|
|
detector_(other.detector_)
|
|
|
|
{}
|
|
|
|
|
2014-09-26 07:37:43 +02:00
|
|
|
renderer_common::renderer_common(Map const& map, unsigned width, unsigned height, double scale_factor,
|
2014-05-11 22:08:24 +02:00
|
|
|
attributes const& vars,
|
2014-08-28 11:17:15 +02:00
|
|
|
view_transform && t,
|
2016-01-26 21:18:00 +01:00
|
|
|
detector_ptr detector)
|
2013-12-05 17:21:55 +01:00
|
|
|
: width_(width),
|
|
|
|
height_(height),
|
|
|
|
scale_factor_(scale_factor),
|
2014-05-11 22:08:24 +02:00
|
|
|
vars_(vars),
|
2014-10-02 05:03:03 +02:00
|
|
|
shared_font_library_(std::make_shared<font_library>()),
|
|
|
|
font_library_(*shared_font_library_),
|
|
|
|
font_manager_(font_library_,map.get_font_file_mapping(),map.get_font_memory_cache()),
|
2013-12-05 17:21:55 +01:00
|
|
|
query_extent_(),
|
|
|
|
t_(t),
|
|
|
|
detector_(detector)
|
|
|
|
{}
|
|
|
|
|
2014-05-11 22:08:24 +02:00
|
|
|
renderer_common::renderer_common(Map const &m, attributes const& vars, unsigned offset_x, unsigned offset_y,
|
2013-12-05 17:21:55 +01:00
|
|
|
unsigned width, unsigned height, double scale_factor)
|
2014-09-26 07:37:43 +02:00
|
|
|
: renderer_common(m, width, height, scale_factor,
|
2014-05-11 22:08:24 +02:00
|
|
|
vars,
|
2014-08-28 11:17:15 +02:00
|
|
|
view_transform(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y),
|
2013-12-05 17:21:55 +01:00
|
|
|
std::make_shared<label_collision_detector4>(
|
2014-08-28 11:17:15 +02:00
|
|
|
box2d<double>(-m.buffer_size(), -m.buffer_size(),
|
2013-12-05 17:21:55 +01:00
|
|
|
m.width() + m.buffer_size() ,m.height() + m.buffer_size())))
|
|
|
|
{}
|
|
|
|
|
2014-05-11 22:08:24 +02:00
|
|
|
renderer_common::renderer_common(Map const &m, attributes const& vars, unsigned offset_x, unsigned offset_y,
|
2013-12-05 17:21:55 +01:00
|
|
|
unsigned width, unsigned height, double scale_factor,
|
2016-01-26 21:18:00 +01:00
|
|
|
detector_ptr detector)
|
2014-09-26 07:37:43 +02:00
|
|
|
: renderer_common(m, width, height, scale_factor,
|
2014-05-11 22:08:24 +02:00
|
|
|
vars,
|
2014-08-28 11:17:15 +02:00
|
|
|
view_transform(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y),
|
2013-12-05 17:21:55 +01:00
|
|
|
detector)
|
|
|
|
{}
|
|
|
|
|
2014-09-26 07:37:43 +02:00
|
|
|
renderer_common::renderer_common(Map const &m, request const &req, attributes const& vars, unsigned offset_x, unsigned offset_y,
|
2013-12-05 17:21:55 +01:00
|
|
|
unsigned width, unsigned height, double scale_factor)
|
2014-09-26 07:37:43 +02:00
|
|
|
: renderer_common(m, width, height, scale_factor,
|
2014-05-11 22:08:24 +02:00
|
|
|
vars,
|
2014-08-28 11:17:15 +02:00
|
|
|
view_transform(req.width(),req.height(),req.extent(),offset_x,offset_y),
|
2013-12-05 17:21:55 +01:00
|
|
|
std::make_shared<label_collision_detector4>(
|
2014-08-28 11:17:15 +02:00
|
|
|
box2d<double>(-req.buffer_size(), -req.buffer_size(),
|
2013-12-05 17:21:55 +01:00
|
|
|
req.width() + req.buffer_size() ,req.height() + req.buffer_size())))
|
|
|
|
{}
|
|
|
|
|
2016-01-26 21:18:00 +01:00
|
|
|
renderer_common::~renderer_common()
|
|
|
|
{
|
|
|
|
// defined in .cpp to make this destructible elsewhere without
|
|
|
|
// having to #include <mapnik/label_collision_detector.hpp>
|
|
|
|
}
|
|
|
|
|
2013-12-05 17:21:55 +01:00
|
|
|
}
|