fix viewer compile

This commit is contained in:
Dane Springmeyer 2013-09-19 18:30:28 -07:00
parent 5c534c1ac6
commit 9bd3dd0e21
6 changed files with 22 additions and 21 deletions

View file

@ -19,7 +19,7 @@
// qt
#include <QtWidgets/QApplication>
#include <QApplication>
#include <QStringList>
#include <QSettings>
#include <mapnik/datasource_cache.hpp>

View file

@ -21,7 +21,8 @@
#include <QtGui>
#define BOOST_CHRONO_HEADER_ONLY
#include <boost/timer/timer.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/chrono.hpp>
#include <boost/bind.hpp>
#include <mapnik/agg_renderer.hpp>
@ -504,8 +505,10 @@ void render_agg(mapnik::Map const& map, double scaling_factor, QPixmap & pix)
try
{
{
boost::timer::auto_cpu_timer t;
boost::chrono::process_cpu_clock::time_point start = boost::chrono::process_cpu_clock::now();
ren.apply();
boost::chrono::process_cpu_clock::duration elapsed = boost::chrono::process_cpu_clock::now() - start;
std::clog << "rendering took: " << boost::chrono::duration_cast<boost::chrono::milliseconds>(elapsed) << "\n";
}
QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32);
pix = QPixmap::fromImage(image.rgbSwapped());

View file

@ -263,7 +263,6 @@ public:
QString name() const
{
mapnik::expression_ptr filter = rule_.get_filter();
return QString(mapnik::to_expression_string(*filter).c_str());
}

View file

@ -6,10 +6,9 @@ QT += core gui widgets
QMAKE_CXX = $$system(mapnik-config --cxx)
QMAKE_LINK = $$system(mapnik-config --cxx)
QMAKE_CXXFLAGS += $$system(mapnik-config --cxxflags)
QMAKE_CXXFLAGS += $$system(mapnik-config --includes --dep-includes)
QMAKE_CXXFLAGS += $$system(mapnik-config --includes --dep-includes --defines)
QMAKE_LFLAGS += $$system(mapnik-config --libs)
QMAKE_LFLAGS += $$system(mapnik-config --ldflags --dep-libs)
QMAKE_LFLAGS += -lboost_timer
# Input
CONFIG += qt debug_and_release

View file

@ -102,7 +102,7 @@ private:
// RETURN: 1/-1 depending which way up the string ends up being.
std::auto_ptr<text_path> get_placement_offset(std::vector<vertex2d> const& path_positions,
std::vector<double> const& path_distances,
int & orientation, unsigned index, double distance);
int & orientation, std::size_t index, double distance);
///Tests whether the given text_path be placed without a collision
// Returns true if it can
@ -143,7 +143,7 @@ private:
vertical_alignment_e valign_;
horizontal_alignment_e halign_;
justify_alignment_e jalign_;
std::vector<unsigned> line_breaks_;
std::vector<std::size_t> line_breaks_;
std::vector<std::pair<double, double> > line_sizes_;
std::queue< box2d<double> > envelopes_;
// Used to return all placements found. */

View file

@ -190,7 +190,7 @@ void placement_finder<DetectorT>::init_string_size()
{
// Get total string size
if (!info_.num_characters()) return; //At least one character is required
for (unsigned i = 0; i < info_.num_characters(); i++)
for (std::size_t i = 0; i < info_.num_characters(); i++)
{
char_info const& ci = info_.at(i);
if (!ci.width || !ci.line_height) continue; //Skip empty chars (add no character_spacing for them)
@ -239,7 +239,7 @@ void placement_finder<DetectorT>::find_line_breaks()
double word_height = 0.0;
//line_width and word_width include char width + spacing, but not the spacing after the last char
for (unsigned int ii = 0; ii < info_.num_characters(); ii++)
for (std::size_t ii = 0; ii < info_.num_characters(); ii++)
{
char_info const& ci = info_.at(ii);
unsigned c = ci.c;
@ -391,8 +391,8 @@ void placement_finder<DetectorT>::find_point_placement(double label_x,
adjust_position(current_placement.get());
// presets for first line
unsigned int line_number = 0;
unsigned int index_to_wrap_at = line_breaks_[0];
std::size_t line_number = 0;
std::size_t index_to_wrap_at = line_breaks_[0];
double line_width = line_sizes_[0].first;
double line_height = line_sizes_[0].second;
@ -420,7 +420,7 @@ void placement_finder<DetectorT>::find_point_placement(double label_x,
// save each character rendering position and build envelope as go thru loop
std::queue< box2d<double> > c_envelopes;
for (unsigned i = 0; i < info_.num_characters(); i++)
for (std::size_t i = 0; i < info_.num_characters(); i++)
{
char_info const& ci = info_.at(i);
@ -614,7 +614,7 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
first = true;
for (unsigned index = 0; index < path_positions.size(); index++) //For each node in the shape
for (std::size_t index = 0; index < path_positions.size(); index++) //For each node in the shape
{
cmd = path_positions[index].cmd;
new_x = path_positions[index].x;
@ -651,7 +651,7 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
{
//Average the angle of all characters and then offset them all by that angle
double anglesum = 0;
for (unsigned i = 0; i < current_placement->nodes_.size(); i++)
for (std::size_t i = 0; i < current_placement->nodes_.size(); i++)
{
double angle = current_placement->nodes_[i].angle;
//Normalize angle in range -PI ... PI
@ -665,7 +665,7 @@ void placement_finder<DetectorT>::find_line_placements(PathT & shape_path)
double sina = orientation * std::sin(anglesum);
//Offset all the characters by this angle
for (unsigned i = 0; i < current_placement->nodes_.size(); i++)
for (std::size_t i = 0; i < current_placement->nodes_.size(); i++)
{
current_placement->nodes_[i].pos.x -=
pi.get_scale_factor() * displacement * sina;
@ -712,7 +712,7 @@ template <typename DetectorT>
std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::vector<vertex2d> const& path_positions,
std::vector<double> const& path_distances,
int & orientation,
unsigned index,
std::size_t index,
double distance)
{
//Check that the given distance is on the given index and find the correct index and distance if not
@ -734,7 +734,7 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::
return std::auto_ptr<text_path>(NULL);
//Keep track of the initial index,distance incase we need to re-call get_placement_offset
const unsigned initial_index = index;
const std::size_t initial_index = index;
const double initial_distance = distance;
double old_x = path_positions[index-1].x;
@ -764,9 +764,9 @@ std::auto_ptr<text_path> placement_finder<DetectorT>::get_placement_offset(std::
if (!orientation_forced)
orientation = (angle > 0.55*M_PI || angle < -0.45*M_PI) ? -1 : 1;
unsigned upside_down_char_count = 0; //Count of characters that are placed upside down.
std::size_t upside_down_char_count = 0; //Count of characters that are placed upside down.
for (unsigned i = 0; i < info_.num_characters(); ++i)
for (std::size_t i = 0; i < info_.num_characters(); ++i)
{
// grab the next character according to the orientation
char_info const &ci = orientation > 0 ? info_.at(i) : info_.at(info_.num_characters() - i - 1);
@ -909,7 +909,7 @@ bool placement_finder<DetectorT>::test_placement(std::auto_ptr<text_path> const&
{
//Create and test envelopes
bool status = true;
for (unsigned i = 0; i < info_.num_characters(); ++i)
for (std::size_t i = 0; i < info_.num_characters(); ++i)
{
//TODO: I think this can be simplified by taking the char_info from vertex() but this needs to be carefully tested!
// grab the next character according to the orientation