diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index 7bd6b3de8..c085d4295 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -19,7 +19,7 @@ // qt -#include +#include #include #include #include diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index 93be08351..dfe4bd682 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -21,7 +21,8 @@ #include #define BOOST_CHRONO_HEADER_ONLY -#include +#include +#include #include #include @@ -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(elapsed) << "\n"; } QImage image((uchar*)buf.raw_data(),width,height,QImage::Format_ARGB32); pix = QPixmap::fromImage(image.rgbSwapped()); diff --git a/demo/viewer/styles_model.cpp b/demo/viewer/styles_model.cpp index 236e0808e..208669ac0 100644 --- a/demo/viewer/styles_model.cpp +++ b/demo/viewer/styles_model.cpp @@ -263,7 +263,6 @@ public: QString name() const { mapnik::expression_ptr filter = rule_.get_filter(); - return QString(mapnik::to_expression_string(*filter).c_str()); } diff --git a/demo/viewer/viewer.pro b/demo/viewer/viewer.pro index 588336387..aad00b424 100644 --- a/demo/viewer/viewer.pro +++ b/demo/viewer/viewer.pro @@ -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 diff --git a/include/mapnik/placement_finder.hpp b/include/mapnik/placement_finder.hpp index ad14c6936..8caa3ef70 100644 --- a/include/mapnik/placement_finder.hpp +++ b/include/mapnik/placement_finder.hpp @@ -102,7 +102,7 @@ private: // RETURN: 1/-1 depending which way up the string ends up being. std::auto_ptr get_placement_offset(std::vector const& path_positions, std::vector 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 line_breaks_; + std::vector line_breaks_; std::vector > line_sizes_; std::queue< box2d > envelopes_; // Used to return all placements found. */ diff --git a/src/placement_finder.cpp b/src/placement_finder.cpp index 63db19727..41b5f7823 100644 --- a/src/placement_finder.cpp +++ b/src/placement_finder.cpp @@ -190,7 +190,7 @@ void placement_finder::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::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::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::find_point_placement(double label_x, // save each character rendering position and build envelope as go thru loop std::queue< box2d > 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::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::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::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 std::auto_ptr placement_finder::get_placement_offset(std::vector const& path_positions, std::vector 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 placement_finder::get_placement_offset(std:: return std::auto_ptr(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 placement_finder::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::test_placement(std::auto_ptr 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