diff --git a/benchmark/test_offset_converter.cpp b/benchmark/test_offset_converter.cpp index c0d25da89..b08f5e235 100644 --- a/benchmark/test_offset_converter.cpp +++ b/benchmark/test_offset_converter.cpp @@ -2,7 +2,6 @@ // mapnik #include -#include #include #include diff --git a/demo/viewer/mapwidget.cpp b/demo/viewer/mapwidget.cpp index 9b2c5278d..68d44c3f5 100644 --- a/demo/viewer/mapwidget.cpp +++ b/demo/viewer/mapwidget.cpp @@ -45,7 +45,7 @@ using mapnik::image_rgba8; using mapnik::Map; using mapnik::layer; using mapnik::box2d; -using mapnik::coord2d; +using mapnik::geometry::point; using mapnik::feature_ptr; using mapnik::view_transform; using mapnik::projection; @@ -465,7 +465,7 @@ void MapWidget::zoomToLevel(int level) mapnik::box2d ext = map_->get_current_extent(); double width = static_cast(map_->width()); double height= static_cast(map_->height()); - mapnik::coord2d pt = ext.center(); + mapnik::geometry::point pt = ext.center(); double res = scale_denom * 0.00028; diff --git a/include/mapnik/coord.hpp b/include/mapnik/coord.hpp deleted file mode 100644 index f8ea3f161..000000000 --- a/include/mapnik/coord.hpp +++ /dev/null @@ -1,188 +0,0 @@ -/***************************************************************************** - * - * 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_COORD_HPP -#define MAPNIK_COORD_HPP - -#pragma GCC diagnostic push -#include -#include -#pragma GCC diagnostic pop - -namespace mapnik { -template -struct coord { - using type = T; -}; - -template -struct coord - : boost::addable, - boost::addable2,T, - boost::subtractable, - boost::subtractable2,T, - boost::dividable2, T, - boost::multipliable2, T > > > > > > - -{ - using type = T; - T x; - T y; -public: - coord() - : x(),y() {} - coord(T x_,T y_) - : x(x_),y(y_) {} - - coord(coord const& rhs) - : x(rhs.x), - y(rhs.y) {} - - template - coord (coord const& rhs) - : x(type(rhs.x)), - y(type(rhs.y)) {} - - coord(coord && rhs) noexcept - : x(std::move(rhs.x)), - y(std::move(rhs.y)) {} - - coord& operator=(coord rhs) - { - swap(rhs); - return *this; - } - - template - coord& operator=(const coord& rhs) - { - coord tmp(rhs); - swap(rhs); - return *this; - } - - template - bool operator==(coord const& rhs) - { - return x == rhs.x && y == rhs.y; - } - - coord& operator+=(coord const& rhs) - { - x+=rhs.x; - y+=rhs.y; - return *this; - } - - coord& operator+=(T rhs) - { - x+=rhs; - y+=rhs; - return *this; - } - - coord& operator-=(coord const& rhs) - { - x-=rhs.x; - y-=rhs.y; - return *this; - } - - coord& operator-=(T rhs) - { - x-=rhs; - y-=rhs; - return *this; - } - - coord& operator*=(T t) - { - x*=t; - y*=t; - return *this; - } - coord& operator/=(T t) - { - x/=t; - y/=t; - return *this; - } -private: - void swap(coord & rhs) - { - std::swap(this->x, rhs.x); - std::swap(this->y, rhs.y); - } -}; - -template -struct coord -{ - using type = T; - T x; - T y; - T z; -public: - coord() - : x(),y(),z() {} - coord(T x_,T y_,T z_) - : x(x_),y(y_),z(z_) {} - - template - coord (coord const& rhs) - : x(type(rhs.x)), - y(type(rhs.y)), - z(type(rhs.z)) {} - - coord(coord && rhs) noexcept - : x(std::move(rhs.x)), - y(std::move(rhs.y)), - z(std::move(rhs.z)) {} - - coord operator=(coord rhs) - { - swap(rhs); - return *this; - } - - template - coord& operator=(coord const& rhs) - { - coord tmp(rhs); - swap(tmp); - return *this; - } -private: - void swap(coord & rhs) - { - std::swap(this->x, rhs.x); - std::swap(this->y, rhs.y); - std::swap(this->z, rhs.z); - } -}; - -using coord2d = coord; -using coord2i = coord; - -} - -#endif // MAPNIK_COORD_HPP diff --git a/include/mapnik/datasource.hpp b/include/mapnik/datasource.hpp index 23b99390a..d357444aa 100644 --- a/include/mapnik/datasource.hpp +++ b/include/mapnik/datasource.hpp @@ -33,7 +33,6 @@ #include #include #include -#include // stl #include #include @@ -112,7 +111,7 @@ public: } virtual boost::optional get_geometry_type() const = 0; virtual featureset_ptr features(query const& q) const = 0; - virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const = 0; + virtual featureset_ptr features_at_point(geometry::point const& pt, double tol = 0) const = 0; virtual box2d envelope() const = 0; virtual layer_descriptor get_descriptor() const = 0; virtual ~datasource() {} diff --git a/include/mapnik/geom_util.hpp b/include/mapnik/geom_util.hpp index 30c9f778e..48692bd88 100644 --- a/include/mapnik/geom_util.hpp +++ b/include/mapnik/geom_util.hpp @@ -25,7 +25,6 @@ // mapnik #include -#include #include #include // stl @@ -211,7 +210,7 @@ struct filter_in_box struct filter_at_point { box2d box_; - explicit filter_at_point(coord2d const& pt, double tol=0) + explicit filter_at_point(geometry::point const& pt, double tol=0) : box_(pt.x,pt.y, pt.x, pt.y) { box_.pad(tol); diff --git a/include/mapnik/memory_datasource.hpp b/include/mapnik/memory_datasource.hpp index 9b589741f..748e73e3c 100644 --- a/include/mapnik/memory_datasource.hpp +++ b/include/mapnik/memory_datasource.hpp @@ -41,7 +41,7 @@ public: virtual ~memory_datasource(); virtual datasource::datasource_t type() const; virtual featureset_ptr features(query const& q) const; - virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; + virtual featureset_ptr features_at_point(geometry::point const& pt, double tol = 0) const; virtual box2d envelope() const; virtual boost::optional get_geometry_type() const; virtual layer_descriptor get_descriptor() const; diff --git a/include/mapnik/util/spatial_index.hpp b/include/mapnik/util/spatial_index.hpp index 720667768..c1d8b7f7c 100644 --- a/include/mapnik/util/spatial_index.hpp +++ b/include/mapnik/util/spatial_index.hpp @@ -24,7 +24,6 @@ #define MAPNIK_UTIL_SPATIAL_INDEX_HPP //mapnik -#include #include #include #include diff --git a/include/mapnik/view_transform.hpp b/include/mapnik/view_transform.hpp index 74fa89cf7..10e664ca5 100644 --- a/include/mapnik/view_transform.hpp +++ b/include/mapnik/view_transform.hpp @@ -24,7 +24,6 @@ #define MAPNIK_VIEW_TRANSFORM_HPP // mapnik -#include #include #include @@ -109,13 +108,13 @@ public: *y = extent_.maxy() - (*y + (offset_y_ - offset_)) / sy_; } - inline coord2d& forward(coord2d& c) const + inline geometry::point& forward(geometry::point& c) const { forward(&c.x, &c.y); return c; } - inline coord2d& backward(coord2d& c) const + inline geometry::point& backward(geometry::point& c) const { backward(&c.x, &c.y); return c; diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 36c10d7d0..fc3217d24 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -434,7 +434,7 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const return mapnik::featureset_ptr(); } -mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const +mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { mapnik::box2d query_bbox(pt.x, pt.y, pt.x, pt.y); query_bbox.pad(tol); diff --git a/plugins/input/csv/csv_datasource.hpp b/plugins/input/csv/csv_datasource.hpp index 71cf2ea71..fc849f3e6 100644 --- a/plugins/input/csv/csv_datasource.hpp +++ b/plugins/input/csv/csv_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include "csv_utils.hpp" @@ -81,7 +80,7 @@ public: mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; mapnik::layer_descriptor get_descriptor() const; boost::optional get_geometry_type() const; diff --git a/plugins/input/gdal/gdal_datasource.cpp b/plugins/input/gdal/gdal_datasource.cpp index 2454ed65b..b3880ab74 100644 --- a/plugins/input/gdal/gdal_datasource.cpp +++ b/plugins/input/gdal/gdal_datasource.cpp @@ -38,7 +38,7 @@ using mapnik::parameters; DATASOURCE_PLUGIN(gdal_datasource) using mapnik::box2d; -using mapnik::coord2d; +using mapnik::geometry::point; using mapnik::query; using mapnik::featureset_ptr; using mapnik::layer_descriptor; @@ -238,7 +238,7 @@ featureset_ptr gdal_datasource::features(query const& q) const nodata_tolerance_); } -featureset_ptr gdal_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr gdal_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features_at_point"); diff --git a/plugins/input/gdal/gdal_datasource.hpp b/plugins/input/gdal/gdal_datasource.hpp index 3fc3036c8..cdd474b24 100644 --- a/plugins/input/gdal/gdal_datasource.hpp +++ b/plugins/input/gdal/gdal_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include // boost @@ -50,7 +49,7 @@ public: mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; diff --git a/plugins/input/gdal/gdal_featureset.cpp b/plugins/input/gdal/gdal_featureset.cpp index 1377322e3..8cfab0c48 100644 --- a/plugins/input/gdal/gdal_featureset.cpp +++ b/plugins/input/gdal/gdal_featureset.cpp @@ -630,7 +630,7 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q) } -feature_ptr gdal_featureset::get_feature_at_point(mapnik::coord2d const& pt) +feature_ptr gdal_featureset::get_feature_at_point(mapnik::geometry::point const& pt) { CPLErr raster_io_error = CE_None; diff --git a/plugins/input/gdal/gdal_featureset.hpp b/plugins/input/gdal/gdal_featureset.hpp index f2f66f796..5fcec9ed0 100644 --- a/plugins/input/gdal/gdal_featureset.hpp +++ b/plugins/input/gdal/gdal_featureset.hpp @@ -33,7 +33,7 @@ class GDALDataset; class GDALRasterBand; -using gdal_query = mapnik::util::variant; +using gdal_query = mapnik::util::variant>; class gdal_featureset : public mapnik::Featureset { @@ -47,7 +47,7 @@ class gdal_featureset : public mapnik::Featureset return featureset_.get_feature(q); } - mapnik::feature_ptr operator() (mapnik::coord2d const& p) const + mapnik::feature_ptr operator() (mapnik::geometry::point const& p) const { return featureset_.get_feature_at_point(p); } @@ -72,7 +72,7 @@ public: private: mapnik::feature_ptr get_feature(mapnik::query const& q); - mapnik::feature_ptr get_feature_at_point(mapnik::coord2d const& p); + mapnik::feature_ptr get_feature_at_point(mapnik::geometry::point const& p); GDALDataset & dataset_; mapnik::context_ptr ctx_; int band_; diff --git a/plugins/input/geojson/geojson_datasource.cpp b/plugins/input/geojson/geojson_datasource.cpp index fa16cb7b5..4ea97b53d 100644 --- a/plugins/input/geojson/geojson_datasource.cpp +++ b/plugins/input/geojson/geojson_datasource.cpp @@ -591,7 +591,7 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons return mapnik::featureset_ptr(); } -mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const +mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { mapnik::box2d query_bbox(pt.x, pt.y, pt.x, pt.y); query_bbox.pad(tol); diff --git a/plugins/input/geojson/geojson_datasource.hpp b/plugins/input/geojson/geojson_datasource.hpp index a50bd9567..6d260bf6b 100644 --- a/plugins/input/geojson/geojson_datasource.hpp +++ b/plugins/input/geojson/geojson_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -84,7 +83,7 @@ public: mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; mapnik::layer_descriptor get_descriptor() const; boost::optional get_geometry_type() const; diff --git a/plugins/input/ogr/ogr_datasource.cpp b/plugins/input/ogr/ogr_datasource.cpp index 8bdb929b5..eb62b8e4a 100644 --- a/plugins/input/ogr/ogr_datasource.cpp +++ b/plugins/input/ogr/ogr_datasource.cpp @@ -50,7 +50,7 @@ using mapnik::parameters; DATASOURCE_PLUGIN(ogr_datasource) using mapnik::box2d; -using mapnik::coord2d; +using mapnik::geometry::point; using mapnik::query; using mapnik::featureset_ptr; using mapnik::layer_descriptor; @@ -563,7 +563,7 @@ featureset_ptr ogr_datasource::features(query const& q) const return featureset_ptr(); } -featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr ogr_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features_at_point"); diff --git a/plugins/input/ogr/ogr_datasource.hpp b/plugins/input/ogr/ogr_datasource.hpp index 0edeae9dc..bfdc7c527 100644 --- a/plugins/input/ogr/ogr_datasource.hpp +++ b/plugins/input/ogr/ogr_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include // boost @@ -54,7 +53,7 @@ public: mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; diff --git a/plugins/input/pgraster/pgraster_datasource.cpp b/plugins/input/pgraster/pgraster_datasource.cpp index 9390f3ace..aaf833ce4 100644 --- a/plugins/input/pgraster/pgraster_datasource.cpp +++ b/plugins/input/pgraster/pgraster_datasource.cpp @@ -1002,7 +1002,7 @@ featureset_ptr pgraster_datasource::features_with_context(query const& q,process } -featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr pgraster_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "pgraster_datasource::features_at_point"); diff --git a/plugins/input/pgraster/pgraster_datasource.hpp b/plugins/input/pgraster/pgraster_datasource.hpp index 221f196e4..1989f9458 100644 --- a/plugins/input/pgraster/pgraster_datasource.hpp +++ b/plugins/input/pgraster/pgraster_datasource.hpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -60,7 +59,7 @@ using mapnik::featureset_ptr; using mapnik::feature_ptr; using mapnik::query; using mapnik::parameters; -using mapnik::coord2d; +using mapnik::geometry::point; typedef std::shared_ptr< ConnectionManager::PoolType> CnxPool_ptr; @@ -83,7 +82,7 @@ public: processor_context_ptr get_context(feature_style_context_map &) const; featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const; featureset_ptr features(query const& q) const; - featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; + featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; diff --git a/plugins/input/postgis/postgis_datasource.cpp b/plugins/input/postgis/postgis_datasource.cpp index 909cd58ba..93a06c720 100644 --- a/plugins/input/postgis/postgis_datasource.cpp +++ b/plugins/input/postgis/postgis_datasource.cpp @@ -946,7 +946,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q,processo } -featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr postgis_datasource::features_at_point(point const& pt, double tol) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features_at_point"); diff --git a/plugins/input/postgis/postgis_datasource.hpp b/plugins/input/postgis/postgis_datasource.hpp index 80ba89495..c7ddafd0c 100644 --- a/plugins/input/postgis/postgis_datasource.hpp +++ b/plugins/input/postgis/postgis_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -58,7 +57,7 @@ using mapnik::featureset_ptr; using mapnik::feature_ptr; using mapnik::query; using mapnik::parameters; -using mapnik::coord2d; +using mapnik::geometry::point; using CnxPool_ptr = std::shared_ptr< ConnectionManager::PoolType>; @@ -72,7 +71,7 @@ public: processor_context_ptr get_context(feature_style_context_map &) const; featureset_ptr features_with_context(query const& q, processor_context_ptr ctx) const; featureset_ptr features(query const& q) const; - featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; + featureset_ptr features_at_point(point const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 4d8b5f99a..f125b07b4 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -37,7 +37,7 @@ using mapnik::layer_descriptor; using mapnik::featureset_ptr; using mapnik::query; -using mapnik::coord2d; +using mapnik::geometry::point; using mapnik::datasource_exception; using mapnik::datasource; using mapnik::parameters; @@ -220,7 +220,7 @@ featureset_ptr raster_datasource::features(query const& q) const } } -featureset_ptr raster_datasource::features_at_point(coord2d const&, double tol) const +featureset_ptr raster_datasource::features_at_point(mapnik::geometry::point const&, double tol) const { MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported"; diff --git a/plugins/input/raster/raster_datasource.hpp b/plugins/input/raster/raster_datasource.hpp index 7ff099086..740b21dc3 100644 --- a/plugins/input/raster/raster_datasource.hpp +++ b/plugins/input/raster/raster_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include // boost @@ -49,7 +48,7 @@ public: datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(const mapnik::query& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 56d7a6aae..6b6c351c0 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -258,7 +258,7 @@ featureset_ptr shape_datasource::features(query const& q) const } } -featureset_ptr shape_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr shape_datasource::features_at_point(point const& pt, double tol) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point"); diff --git a/plugins/input/shape/shape_datasource.hpp b/plugins/input/shape/shape_datasource.hpp index f702036eb..27dfff168 100644 --- a/plugins/input/shape/shape_datasource.hpp +++ b/plugins/input/shape/shape_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -48,7 +47,7 @@ using mapnik::parameters; using mapnik::query; using mapnik::featureset_ptr; using mapnik::layer_descriptor; -using mapnik::coord2d; +using mapnik::geometry::point; class shape_datasource : public datasource { @@ -58,7 +57,7 @@ public: datasource::datasource_t type() const; static const char * name(); featureset_ptr features(query const& q) const; - featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const; + featureset_ptr features_at_point(point const& pt, double tol = 0) const; box2d envelope() const; boost::optional get_geometry_type() const; layer_descriptor get_descriptor() const; diff --git a/plugins/input/sqlite/sqlite_datasource.cpp b/plugins/input/sqlite/sqlite_datasource.cpp index 939d9d319..60c04daab 100644 --- a/plugins/input/sqlite/sqlite_datasource.cpp +++ b/plugins/input/sqlite/sqlite_datasource.cpp @@ -41,7 +41,7 @@ #include using mapnik::box2d; -using mapnik::coord2d; +using mapnik::geometry::point; using mapnik::query; using mapnik::featureset_ptr; using mapnik::layer_descriptor; @@ -554,7 +554,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const return featureset_ptr(); } -featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr sqlite_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { #ifdef MAPNIK_STATS mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features_at_point"); diff --git a/plugins/input/sqlite/sqlite_datasource.hpp b/plugins/input/sqlite/sqlite_datasource.hpp index eab71e9e3..e2bfe3b90 100644 --- a/plugins/input/sqlite/sqlite_datasource.hpp +++ b/plugins/input/sqlite/sqlite_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -53,7 +52,7 @@ public: datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; boost::optional get_geometry_type() const; mapnik::layer_descriptor get_descriptor() const; diff --git a/plugins/input/topojson/topojson_datasource.cpp b/plugins/input/topojson/topojson_datasource.cpp index 842fd64e7..f3b372e31 100644 --- a/plugins/input/topojson/topojson_datasource.cpp +++ b/plugins/input/topojson/topojson_datasource.cpp @@ -287,7 +287,7 @@ mapnik::featureset_ptr topojson_datasource::features(mapnik::query const& q) con return mapnik::featureset_ptr(); } -mapnik::featureset_ptr topojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const +mapnik::featureset_ptr topojson_datasource::features_at_point(mapnik::geometry::point const& pt, double tol) const { mapnik::box2d query_bbox(pt.x, pt.y, pt.x, pt.y); query_bbox.pad(tol); diff --git a/plugins/input/topojson/topojson_datasource.hpp b/plugins/input/topojson/topojson_datasource.hpp index ebc92aea2..8a7535794 100644 --- a/plugins/input/topojson/topojson_datasource.hpp +++ b/plugins/input/topojson/topojson_datasource.hpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -64,7 +63,7 @@ public: mapnik::datasource::datasource_t type() const; static const char * name(); mapnik::featureset_ptr features(mapnik::query const& q) const; - mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const; + mapnik::featureset_ptr features_at_point(mapnik::geometry::point const& pt, double tol = 0) const; mapnik::box2d envelope() const; mapnik::layer_descriptor get_descriptor() const; boost::optional get_geometry_type() const; diff --git a/src/map.cpp b/src/map.cpp index 2a9704936..a3b2b762e 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -730,7 +730,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const throw std::runtime_error(s.str()); } double tol = (map_ex.maxx() - map_ex.minx()) / static_cast(width_) * 3; - featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y), tol); + featureset_ptr fs = ds->features_at_point(mapnik::geometry::point(x,y), tol); MAPNIK_LOG_DEBUG(map) << "map: Query at point tol=" << tol << "(" << x << "," << y << ")"; if (fs) { diff --git a/src/memory_datasource.cpp b/src/memory_datasource.cpp index 3c182207b..022b8900c 100644 --- a/src/memory_datasource.cpp +++ b/src/memory_datasource.cpp @@ -95,7 +95,7 @@ void memory_datasource::push(feature_ptr feature) throw std::runtime_error("Can not add a raster feature to a memory datasource that contains vectors"); } } - else + else { if (!type_set_) { @@ -121,7 +121,7 @@ featureset_ptr memory_datasource::features(const query& q) const } -featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double tol) const +featureset_ptr memory_datasource::features_at_point(geometry::point const& pt, double tol) const { box2d box = box2d(pt.x, pt.y, pt.x, pt.y); box.pad(tol); diff --git a/test/unit/datasource/csv.cpp b/test/unit/datasource/csv.cpp index 76490fe1a..6da225acc 100644 --- a/test/unit/datasource/csv.cpp +++ b/test/unit/datasource/csv.cpp @@ -284,7 +284,7 @@ TEST_CASE("csv") { auto fs = all_features(ds); auto pt = ds->envelope().center(); - auto fs2 = ds->features_at_point(mapnik::coord(pt.x, pt.y), 10000); + auto fs2 = ds->features_at_point(pt, 10000); REQUIRE(fs != nullptr); auto feature = fs->next(); auto feature2 = fs2->next(); diff --git a/test/unit/datasource/geojson.cpp b/test/unit/datasource/geojson.cpp index f833ddfd3..a358b0b2f 100644 --- a/test/unit/datasource/geojson.cpp +++ b/test/unit/datasource/geojson.cpp @@ -285,7 +285,7 @@ TEST_CASE("geojson") { } auto features = ds->features(query); auto pt = ds->envelope().center(); - auto features2 = ds->features_at_point(mapnik::coord(pt.x, pt.y), 0); + auto features2 = ds->features_at_point(pt, 0); REQUIRE(features != nullptr); REQUIRE(features2 != nullptr); auto feature = features->next(); @@ -343,7 +343,7 @@ TEST_CASE("geojson") { } auto features = ds->features(query); auto pt = ds->envelope().center(); - auto features2 = ds->features_at_point(mapnik::coord(pt.x, pt.y), 10); + auto features2 = ds->features_at_point(pt, 10); auto bounding_box = ds->envelope(); mapnik::box2d bbox; mapnik::value_integer count = 0; diff --git a/test/unit/datasource/postgis.cpp b/test/unit/datasource/postgis.cpp index 95ee65851..6302aa887 100644 --- a/test/unit/datasource/postgis.cpp +++ b/test/unit/datasource/postgis.cpp @@ -207,7 +207,7 @@ TEST_CASE("postgis") { auto ds = mapnik::datasource_cache::instance().create(params); REQUIRE(ds != nullptr); - auto featureset = ds->features_at_point(mapnik::coord2d(1, 1)); + auto featureset = ds->features_at_point(mapnik::geometry::point(1, 1)); mapnik::feature_ptr feature; while ((bool(feature = featureset->next()))) { REQUIRE(feature->get(2).to_string() == feature->get("col_text").to_string());