diff --git a/include/mapnik/datasource_cache.hpp b/include/mapnik/datasource_cache.hpp index 1568b85c5..67aec76a1 100644 --- a/include/mapnik/datasource_cache.hpp +++ b/include/mapnik/datasource_cache.hpp @@ -25,7 +25,7 @@ // mapnik #include -#include +#include #include // stl diff --git a/include/mapnik/debug.hpp b/include/mapnik/debug.hpp index a00bca619..6f24e4365 100644 --- a/include/mapnik/debug.hpp +++ b/include/mapnik/debug.hpp @@ -25,7 +25,7 @@ // mapnik (should not depend on anything that need to use this) #include -#include +#include #include // std diff --git a/include/mapnik/factory.hpp b/include/mapnik/factory.hpp index 87b437157..68d7ea110 100644 --- a/include/mapnik/factory.hpp +++ b/include/mapnik/factory.hpp @@ -24,7 +24,7 @@ #define MAPNIK_FACTORY_HPP // mapnik -#include +#include // stl #include diff --git a/include/mapnik/mapped_memory_cache.hpp b/include/mapnik/mapped_memory_cache.hpp index 3673c15e0..bbdf02e70 100644 --- a/include/mapnik/mapped_memory_cache.hpp +++ b/include/mapnik/mapped_memory_cache.hpp @@ -25,7 +25,7 @@ // mapnik #include -#include +#include #include // boost diff --git a/include/mapnik/marker_cache.hpp b/include/mapnik/marker_cache.hpp index d685cc94b..7072b3921 100644 --- a/include/mapnik/marker_cache.hpp +++ b/include/mapnik/marker_cache.hpp @@ -24,7 +24,7 @@ #define MAPNIK_MARKER_CACHE_HPP // mapnik -#include +#include #include #include diff --git a/include/mapnik/pool.hpp b/include/mapnik/pool.hpp index 59e8661d3..44c82941d 100644 --- a/include/mapnik/pool.hpp +++ b/include/mapnik/pool.hpp @@ -24,7 +24,7 @@ #define MAPNIK_POOL_HPP // mapnik -#include +#include #include // boost diff --git a/include/mapnik/text/formatting/registry.hpp b/include/mapnik/text/formatting/registry.hpp index 5ad22dd5a..dbbce936f 100644 --- a/include/mapnik/text/formatting/registry.hpp +++ b/include/mapnik/text/formatting/registry.hpp @@ -23,7 +23,7 @@ #define FORMATTING_REGISTRY_HPP // mapnik -#include +#include #include #include #include diff --git a/include/mapnik/text/placements/registry.hpp b/include/mapnik/text/placements/registry.hpp index eadfdb361..2f833709d 100644 --- a/include/mapnik/text/placements/registry.hpp +++ b/include/mapnik/text/placements/registry.hpp @@ -23,7 +23,7 @@ #define PLACEMENTS_REGISTRY_HPP // mapnik -#include +#include #include #include diff --git a/include/mapnik/util/file_io.hpp b/include/mapnik/util/file_io.hpp index ff9f37e17..e4e0cd559 100644 --- a/include/mapnik/util/file_io.hpp +++ b/include/mapnik/util/file_io.hpp @@ -24,7 +24,7 @@ #define MAPNIK_FILE_IO_HPP // mapnik -#include +#include #include #include //#include diff --git a/include/mapnik/utils.hpp b/include/mapnik/util/singleton.hpp similarity index 90% rename from include/mapnik/utils.hpp rename to include/mapnik/util/singleton.hpp index c9d5b42ba..2c4040603 100644 --- a/include/mapnik/utils.hpp +++ b/include/mapnik/util/singleton.hpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2014 Artem Pavlenko + * Copyright (C) 2015 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * *****************************************************************************/ -#ifndef MAPNIK_UTILS_HPP -#define MAPNIK_UTILS_HPP +#ifndef MAPNIK_UTIL_SINGLETON_HPP +#define MAPNIK_UTIL_SINGLETON_HPP #include @@ -128,24 +128,12 @@ template class CreatePolicy> std::mutex singleton::mutex_; template class CreatePolicy> std::atomic singleton::pInstance_; template class CreatePolicy> bool singleton::destroyed_=false; - - -#ifdef _WINDOWS - -// UTF8 <--> UTF16 conversion routines - - MAPNIK_DECL std::string utf16_to_utf8(std::wstring const& wstr); - MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str); - -#endif // _WINDOWS - + template class CreatePolicy> bool singleton::destroyed_ = false; } -#endif // MAPNIK_UTILS_HPP +#endif // MAPNIK_UTIL_SINGLETON_HPP diff --git a/include/mapnik/util/utf_conv_win.hpp b/include/mapnik/util/utf_conv_win.hpp new file mode 100644 index 000000000..68e28ec15 --- /dev/null +++ b/include/mapnik/util/utf_conv_win.hpp @@ -0,0 +1,43 @@ +/***************************************************************************** + * + * This file is part of Mapnik (c++ mapping toolkit) + * + * Copyright (C) 2015 Artem Pavlenko + * + * 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 + * + *****************************************************************************/ + +#ifndef MAPNIK_UTIL_UTF_CONV_WIN_HPP +#define MAPNIK_UTIL_UTF_CONV_WIN_HPP + +#ifdef _WINDOWS +// mapnik +#include +// stl +#include + +namespace mapnik +{ + +// UTF8 <--> UTF16 conversion routines + + MAPNIK_DECL std::string utf16_to_utf8(std::wstring const& wstr); + MAPNIK_DECL std::wstring utf8_to_utf16(std::string const& str); + +} +#endif // _WINDOWS + +#endif // MAPNIK_UTIL_UTF_CONV_WIN_HPP diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index aab802b9e..3deb429d4 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -29,7 +29,7 @@ // mapnik #include -#include +#include #include #include #include diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index c30d25803..8d82f4266 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -37,7 +37,7 @@ // mapnik #include #include -#include +#include #include #include #include diff --git a/plugins/input/geojson/large_geojson_featureset.cpp b/plugins/input/geojson/large_geojson_featureset.cpp index f3922b279..158455ef7 100644 --- a/plugins/input/geojson/large_geojson_featureset.cpp +++ b/plugins/input/geojson/large_geojson_featureset.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include // stl #include #include diff --git a/plugins/input/occi/occi_types.hpp b/plugins/input/occi/occi_types.hpp index 752246abd..c405fd525 100644 --- a/plugins/input/occi/occi_types.hpp +++ b/plugins/input/occi/occi_types.hpp @@ -25,7 +25,7 @@ // mapnik #include -#include +#include // occi #include diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index dc6247aa9..2c0d90aac 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include // boost diff --git a/plugins/input/postgis/connection_manager.hpp b/plugins/input/postgis/connection_manager.hpp index 64271900a..c1b6dc456 100644 --- a/plugins/input/postgis/connection_manager.hpp +++ b/plugins/input/postgis/connection_manager.hpp @@ -27,7 +27,7 @@ // mapnik #include -#include +#include // boost #include diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 5b1c76e46..2da4978a6 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -22,7 +22,7 @@ // mapnik #include #include -#include +#include #include #include diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 152e107a4..8cf8ba09d 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/plugins/input/shape/shapefile.hpp b/plugins/input/shape/shapefile.hpp index 3e35544d3..a6468b190 100644 --- a/plugins/input/shape/shapefile.hpp +++ b/plugins/input/shape/shapefile.hpp @@ -31,7 +31,7 @@ // mapnik #include -#include +#include #include #ifdef SHAPE_MEMORY_MAPPED_FILE #include diff --git a/plugins/input/sqlite/sqlite_utils.hpp b/plugins/input/sqlite/sqlite_utils.hpp index b38dd0654..fe055ac5e 100644 --- a/plugins/input/sqlite/sqlite_utils.hpp +++ b/plugins/input/sqlite/sqlite_utils.hpp @@ -31,7 +31,6 @@ // mapnik #include -#include #include #include #include diff --git a/src/datasource_cache.cpp b/src/datasource_cache.cpp index 97d65508f..a83f15797 100644 --- a/src/datasource_cache.cpp +++ b/src/datasource_cache.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include // boost #pragma GCC diagnostic push diff --git a/src/font_engine_freetype.cpp b/src/font_engine_freetype.cpp index 1c87f87c1..6c2f01057 100644 --- a/src/font_engine_freetype.cpp +++ b/src/font_engine_freetype.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include // boost diff --git a/src/fs.cpp b/src/fs.cpp index 655472487..0a129e4a6 100644 --- a/src/fs.cpp +++ b/src/fs.cpp @@ -21,7 +21,7 @@ *****************************************************************************/ // mapnik -#include +#include #include // boost diff --git a/src/proj_transform.cpp b/src/proj_transform.cpp index b2cb37de9..f929a7ac9 100644 --- a/src/proj_transform.cpp +++ b/src/proj_transform.cpp @@ -26,7 +26,6 @@ #include #include #include -#include #ifdef MAPNIK_USE_PROJ4 // proj4 @@ -233,7 +232,7 @@ unsigned int proj_transform::backward (geometry::line_string & ls) const { std::size_t size = ls.size(); if (size == 0) return 0; - + if (is_source_equal_dest_) return 0; @@ -247,7 +246,7 @@ unsigned int proj_transform::backward (geometry::line_string & ls) const lonlat2merc(ls); return 0; } - + geometry::point * ptr = ls.data(); double * x = reinterpret_cast(ptr); double * y = x + 1; @@ -270,7 +269,7 @@ bool proj_transform::forward (box2d & box) const double lry = box.miny(); double lrx = box.maxx(); double urx = box.maxx(); - double uly = box.maxy(); + double uly = box.maxy(); double ury = box.maxy(); double z = 0.0; if (!forward(llx,lly,z)) @@ -304,7 +303,7 @@ bool proj_transform::backward (box2d & box) const double lry = box.miny(); double lrx = box.maxx(); double urx = box.maxx(); - double uly = box.maxy(); + double uly = box.maxy(); double ury = box.maxy(); double z = 0.0; if (!backward(llx,lly,z)) @@ -326,8 +325,7 @@ bool proj_transform::backward (box2d & box) const return true; } -/* Returns points in clockwise order. This allows us to do anti-meridian checks. - */ +// Returns points in clockwise order. This allows us to do anti-meridian checks. void envelope_points(std::vector< coord > & coords, box2d& env, int points) { double width = env.width(); @@ -358,7 +356,7 @@ void envelope_points(std::vector< coord > & coords, box2d& env } } -/* determine if an ordered sequence of coordinates is in clockwise order */ +// determine if an ordered sequence of coordinates is in clockwise order bool is_clockwise(const std::vector< coord > & coords) { int n = coords.size(); @@ -385,12 +383,12 @@ box2d calculate_bbox(std::vector > & points) { } -/* More robust, but expensive, bbox transform - * in the face of proj4 out of bounds conditions. - * Can result in 20 -> 10 r/s performance hit. - * Alternative is to provide proper clipping box - * in the target srs by setting map 'maximum-extent' - */ +// More robust, but expensive, bbox transform +// in the face of proj4 out of bounds conditions. +// Can result in 20 -> 10 r/s performance hit. +// Alternative is to provide proper clipping box +// in the target srs by setting map 'maximum-extent' + bool proj_transform::backward(box2d& env, int points) const { if (is_source_equal_dest_) @@ -413,15 +411,15 @@ bool proj_transform::backward(box2d& env, int points) const } box2d result = calculate_bbox(coords); - if (is_source_longlat_ && !is_clockwise(coords)) { - /* we've gone to a geographic CS, and our clockwise envelope has - * changed into an anticlockwise one. This means we've crossed the antimeridian, and - * need to expand the X direction to +/-180 to include all the data. Once we can deal - * with multiple bboxes in queries we can improve. - */ - double miny = result.miny(); - result.expand_to_include(-180.0, miny); - result.expand_to_include(180.0, miny); + if (is_source_longlat_ && !is_clockwise(coords)) + { + // we've gone to a geographic CS, and our clockwise envelope has + // changed into an anticlockwise one. This means we've crossed the antimeridian, and + // need to expand the X direction to +/-180 to include all the data. Once we can deal + // with multiple bboxes in queries we can improve. + double miny = result.miny(); + result.expand_to_include(-180.0, miny); + result.expand_to_include(180.0, miny); } env.re_center(result.center().x, result.center().y); @@ -454,15 +452,15 @@ bool proj_transform::forward(box2d& env, int points) const box2d result = calculate_bbox(coords); - if (is_dest_longlat_ && !is_clockwise(coords)) { - /* we've gone to a geographic CS, and our clockwise envelope has - * changed into an anticlockwise one. This means we've crossed the antimeridian, and - * need to expand the X direction to +/-180 to include all the data. Once we can deal - * with multiple bboxes in queries we can improve. - */ - double miny = result.miny(); - result.expand_to_include(-180.0, miny); - result.expand_to_include(180.0, miny); + if (is_dest_longlat_ && !is_clockwise(coords)) + { + // we've gone to a geographic CS, and our clockwise envelope has + // changed into an anticlockwise one. This means we've crossed the antimeridian, and + // need to expand the X direction to +/-180 to include all the data. Once we can deal + // with multiple bboxes in queries we can improve. + double miny = result.miny(); + result.expand_to_include(-180.0, miny); + result.expand_to_include(180.0, miny); } env.re_center(result.center().x, result.center().y); diff --git a/src/projection.cpp b/src/projection.cpp index 81e24277f..7cacae462 100644 --- a/src/projection.cpp +++ b/src/projection.cpp @@ -22,7 +22,7 @@ // mapnik #include -#include +#include #include #include diff --git a/src/rapidxml_loader.cpp b/src/rapidxml_loader.cpp index 841fa9fd2..77d9dac7e 100644 --- a/src/rapidxml_loader.cpp +++ b/src/rapidxml_loader.cpp @@ -26,7 +26,6 @@ // mapnik #include -#include #include #include #include diff --git a/src/utils.cpp b/src/util/utf_conv_win.cpp similarity index 96% rename from src/utils.cpp rename to src/util/utf_conv_win.cpp index f694faa18..7bfcbc29f 100644 --- a/src/utils.cpp +++ b/src/util/utf_conv_win.cpp @@ -2,7 +2,7 @@ * * This file is part of Mapnik (c++ mapping toolkit) * - * Copyright (C) 2014 Artem Pavlenko + * Copyright (C) 2015 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -22,7 +22,7 @@ #ifdef _WINDOWS // windows specific methods for UTF8 from/to UTF16 -#include +#include #include #include #define NOMINMAX