remove <coord.hpp>

This commit is contained in:
artemp 2016-06-21 10:01:31 +01:00
parent 0460aa51ae
commit 8ba78dcded
35 changed files with 45 additions and 248 deletions

View file

@ -2,7 +2,6 @@
// mapnik // mapnik
#include <mapnik/global.hpp> #include <mapnik/global.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/vertex.hpp> #include <mapnik/vertex.hpp>
#include <mapnik/offset_converter.hpp> #include <mapnik/offset_converter.hpp>

View file

@ -45,7 +45,7 @@ using mapnik::image_rgba8;
using mapnik::Map; using mapnik::Map;
using mapnik::layer; using mapnik::layer;
using mapnik::box2d; using mapnik::box2d;
using mapnik::coord2d; using mapnik::geometry::point;
using mapnik::feature_ptr; using mapnik::feature_ptr;
using mapnik::view_transform; using mapnik::view_transform;
using mapnik::projection; using mapnik::projection;
@ -465,7 +465,7 @@ void MapWidget::zoomToLevel(int level)
mapnik::box2d<double> ext = map_->get_current_extent(); mapnik::box2d<double> ext = map_->get_current_extent();
double width = static_cast<double>(map_->width()); double width = static_cast<double>(map_->width());
double height= static_cast<double>(map_->height()); double height= static_cast<double>(map_->height());
mapnik::coord2d pt = ext.center(); mapnik::geometry::point<double> pt = ext.center();
double res = scale_denom * 0.00028; double res = scale_denom * 0.00028;

View file

@ -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 <mapnik/warning_ignore.hpp>
#include <boost/operators.hpp>
#pragma GCC diagnostic pop
namespace mapnik {
template <typename T,int dim>
struct coord {
using type = T;
};
template <typename T>
struct coord<T,2>
: boost::addable<coord<T,2>,
boost::addable2<coord<T,2>,T,
boost::subtractable<coord<T,2>,
boost::subtractable2<coord<T,2>,T,
boost::dividable2<coord<T,2>, T,
boost::multipliable2<coord<T,2>, T > > > > > >
{
using type = T;
T x;
T y;
public:
coord()
: x(),y() {}
coord(T x_,T y_)
: x(x_),y(y_) {}
coord(coord<T,2> const& rhs)
: x(rhs.x),
y(rhs.y) {}
template <typename T2>
coord (coord<T2,2> const& rhs)
: x(type(rhs.x)),
y(type(rhs.y)) {}
coord(coord<T,2> && rhs) noexcept
: x(std::move(rhs.x)),
y(std::move(rhs.y)) {}
coord<T,2>& operator=(coord<T,2> rhs)
{
swap(rhs);
return *this;
}
template <typename T2>
coord<T,2>& operator=(const coord<T2,2>& rhs)
{
coord<T,2> tmp(rhs);
swap(rhs);
return *this;
}
template <typename T2>
bool operator==(coord<T2,2> const& rhs)
{
return x == rhs.x && y == rhs.y;
}
coord<T,2>& operator+=(coord<T,2> const& rhs)
{
x+=rhs.x;
y+=rhs.y;
return *this;
}
coord<T,2>& operator+=(T rhs)
{
x+=rhs;
y+=rhs;
return *this;
}
coord<T,2>& operator-=(coord<T,2> const& rhs)
{
x-=rhs.x;
y-=rhs.y;
return *this;
}
coord<T,2>& operator-=(T rhs)
{
x-=rhs;
y-=rhs;
return *this;
}
coord<T,2>& operator*=(T t)
{
x*=t;
y*=t;
return *this;
}
coord<T,2>& operator/=(T t)
{
x/=t;
y/=t;
return *this;
}
private:
void swap(coord<T,2> & rhs)
{
std::swap(this->x, rhs.x);
std::swap(this->y, rhs.y);
}
};
template <typename T>
struct coord<T,3>
{
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 <typename T2>
coord (coord<T2,3> const& rhs)
: x(type(rhs.x)),
y(type(rhs.y)),
z(type(rhs.z)) {}
coord(coord<T,3> && rhs) noexcept
: x(std::move(rhs.x)),
y(std::move(rhs.y)),
z(std::move(rhs.z)) {}
coord<T,3> operator=(coord<T,3> rhs)
{
swap(rhs);
return *this;
}
template <typename T2>
coord<T,3>& operator=(coord<T2,3> const& rhs)
{
coord<T,3> tmp(rhs);
swap(tmp);
return *this;
}
private:
void swap(coord<T,3> & rhs)
{
std::swap(this->x, rhs.x);
std::swap(this->y, rhs.y);
std::swap(this->z, rhs.z);
}
};
using coord2d = coord<double,2>;
using coord2i = coord<int,2>;
}
#endif // MAPNIK_COORD_HPP

View file

@ -33,7 +33,6 @@
#include <mapnik/util/noncopyable.hpp> #include <mapnik/util/noncopyable.hpp>
#include <mapnik/feature_style_processor_context.hpp> #include <mapnik/feature_style_processor_context.hpp>
#include <mapnik/datasource_geometry_type.hpp> #include <mapnik/datasource_geometry_type.hpp>
#include <mapnik/coord.hpp>
// stl // stl
#include <map> #include <map>
#include <string> #include <string>
@ -112,7 +111,7 @@ public:
} }
virtual boost::optional<datasource_geometry_t> get_geometry_type() const = 0; virtual boost::optional<datasource_geometry_t> get_geometry_type() const = 0;
virtual featureset_ptr features(query const& q) 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<double> const& pt, double tol = 0) const = 0;
virtual box2d<double> envelope() const = 0; virtual box2d<double> envelope() const = 0;
virtual layer_descriptor get_descriptor() const = 0; virtual layer_descriptor get_descriptor() const = 0;
virtual ~datasource() {} virtual ~datasource() {}

View file

@ -25,7 +25,6 @@
// mapnik // mapnik
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/vertex.hpp> #include <mapnik/vertex.hpp>
#include <mapnik/geometry_types.hpp> #include <mapnik/geometry_types.hpp>
// stl // stl
@ -211,7 +210,7 @@ struct filter_in_box
struct filter_at_point struct filter_at_point
{ {
box2d<double> box_; box2d<double> box_;
explicit filter_at_point(coord2d const& pt, double tol=0) explicit filter_at_point(geometry::point<double> const& pt, double tol=0)
: box_(pt.x,pt.y, pt.x, pt.y) : box_(pt.x,pt.y, pt.x, pt.y)
{ {
box_.pad(tol); box_.pad(tol);

View file

@ -41,7 +41,7 @@ public:
virtual ~memory_datasource(); virtual ~memory_datasource();
virtual datasource::datasource_t type() const; virtual datasource::datasource_t type() const;
virtual featureset_ptr features(query const& q) 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<double> const& pt, double tol = 0) const;
virtual box2d<double> envelope() const; virtual box2d<double> envelope() const;
virtual boost::optional<datasource_geometry_t> get_geometry_type() const; virtual boost::optional<datasource_geometry_t> get_geometry_type() const;
virtual layer_descriptor get_descriptor() const; virtual layer_descriptor get_descriptor() const;

View file

@ -24,7 +24,6 @@
#define MAPNIK_UTIL_SPATIAL_INDEX_HPP #define MAPNIK_UTIL_SPATIAL_INDEX_HPP
//mapnik //mapnik
#include <mapnik/coord.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/geom_util.hpp> #include <mapnik/geom_util.hpp>

View file

@ -24,7 +24,6 @@
#define MAPNIK_VIEW_TRANSFORM_HPP #define MAPNIK_VIEW_TRANSFORM_HPP
// mapnik // mapnik
#include <mapnik/coord.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/proj_transform.hpp> #include <mapnik/proj_transform.hpp>
@ -109,13 +108,13 @@ public:
*y = extent_.maxy() - (*y + (offset_y_ - offset_)) / sy_; *y = extent_.maxy() - (*y + (offset_y_ - offset_)) / sy_;
} }
inline coord2d& forward(coord2d& c) const inline geometry::point<double>& forward(geometry::point<double>& c) const
{ {
forward(&c.x, &c.y); forward(&c.x, &c.y);
return c; return c;
} }
inline coord2d& backward(coord2d& c) const inline geometry::point<double>& backward(geometry::point<double>& c) const
{ {
backward(&c.x, &c.y); backward(&c.x, &c.y);
return c; return c;

View file

@ -434,7 +434,7 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
return mapnik::featureset_ptr(); 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<double> const& pt, double tol) const
{ {
mapnik::box2d<double> query_bbox(pt.x, pt.y, pt.x, pt.y); mapnik::box2d<double> query_bbox(pt.x, pt.y, pt.x, pt.y);
query_bbox.pad(tol); query_bbox.pad(tol);

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
#include "csv_utils.hpp" #include "csv_utils.hpp"
@ -81,7 +80,7 @@ public:
mapnik::datasource::datasource_t type() const; mapnik::datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(mapnik::query const& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;

View file

@ -38,7 +38,7 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(gdal_datasource) DATASOURCE_PLUGIN(gdal_datasource)
using mapnik::box2d; using mapnik::box2d;
using mapnik::coord2d; using mapnik::geometry::point;
using mapnik::query; using mapnik::query;
using mapnik::featureset_ptr; using mapnik::featureset_ptr;
using mapnik::layer_descriptor; using mapnik::layer_descriptor;
@ -238,7 +238,7 @@ featureset_ptr gdal_datasource::features(query const& q) const
nodata_tolerance_); 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<double> const& pt, double tol) const
{ {
#ifdef MAPNIK_STATS #ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features_at_point"); mapnik::progress_timer __stats__(std::clog, "gdal_datasource::features_at_point");

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
// boost // boost
@ -50,7 +49,7 @@ public:
mapnik::datasource::datasource_t type() const; mapnik::datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(mapnik::query const& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;

View file

@ -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<double> const& pt)
{ {
CPLErr raster_io_error = CE_None; CPLErr raster_io_error = CE_None;

View file

@ -33,7 +33,7 @@
class GDALDataset; class GDALDataset;
class GDALRasterBand; class GDALRasterBand;
using gdal_query = mapnik::util::variant<mapnik::query, mapnik::coord2d>; using gdal_query = mapnik::util::variant<mapnik::query, mapnik::geometry::point<double>>;
class gdal_featureset : public mapnik::Featureset class gdal_featureset : public mapnik::Featureset
{ {
@ -47,7 +47,7 @@ class gdal_featureset : public mapnik::Featureset
return featureset_.get_feature(q); return featureset_.get_feature(q);
} }
mapnik::feature_ptr operator() (mapnik::coord2d const& p) const mapnik::feature_ptr operator() (mapnik::geometry::point<double> const& p) const
{ {
return featureset_.get_feature_at_point(p); return featureset_.get_feature_at_point(p);
} }
@ -72,7 +72,7 @@ public:
private: private:
mapnik::feature_ptr get_feature(mapnik::query const& q); 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<double> const& p);
GDALDataset & dataset_; GDALDataset & dataset_;
mapnik::context_ptr ctx_; mapnik::context_ptr ctx_;
int band_; int band_;

View file

@ -591,7 +591,7 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
return mapnik::featureset_ptr(); 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<double> const& pt, double tol) const
{ {
mapnik::box2d<double> query_bbox(pt.x, pt.y, pt.x, pt.y); mapnik::box2d<double> query_bbox(pt.x, pt.y, pt.x, pt.y);
query_bbox.pad(tol); query_bbox.pad(tol);

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
@ -84,7 +83,7 @@ public:
mapnik::datasource::datasource_t type() const; mapnik::datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(mapnik::query const& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;

View file

@ -50,7 +50,7 @@ using mapnik::parameters;
DATASOURCE_PLUGIN(ogr_datasource) DATASOURCE_PLUGIN(ogr_datasource)
using mapnik::box2d; using mapnik::box2d;
using mapnik::coord2d; using mapnik::geometry::point;
using mapnik::query; using mapnik::query;
using mapnik::featureset_ptr; using mapnik::featureset_ptr;
using mapnik::layer_descriptor; using mapnik::layer_descriptor;
@ -563,7 +563,7 @@ featureset_ptr ogr_datasource::features(query const& q) const
return featureset_ptr(); 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<double> const& pt, double tol) const
{ {
#ifdef MAPNIK_STATS #ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features_at_point"); mapnik::progress_timer __stats__(std::clog, "ogr_datasource::features_at_point");

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
// boost // boost
@ -54,7 +53,7 @@ public:
mapnik::datasource::datasource_t type() const; mapnik::datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(mapnik::query const& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;

View file

@ -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<double> const& pt, double tol) const
{ {
#ifdef MAPNIK_STATS #ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "pgraster_datasource::features_at_point"); mapnik::progress_timer __stats__(std::clog, "pgraster_datasource::features_at_point");

View file

@ -33,7 +33,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
@ -60,7 +59,7 @@ using mapnik::featureset_ptr;
using mapnik::feature_ptr; using mapnik::feature_ptr;
using mapnik::query; using mapnik::query;
using mapnik::parameters; using mapnik::parameters;
using mapnik::coord2d; using mapnik::geometry::point;
typedef std::shared_ptr< ConnectionManager::PoolType> CnxPool_ptr; typedef std::shared_ptr< ConnectionManager::PoolType> CnxPool_ptr;
@ -83,7 +82,7 @@ public:
processor_context_ptr get_context(feature_style_context_map &) const; 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_with_context(query const& q, processor_context_ptr ctx) const;
featureset_ptr features(query const& q) 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const; layer_descriptor get_descriptor() const;

View file

@ -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<double> const& pt, double tol) const
{ {
#ifdef MAPNIK_STATS #ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features_at_point"); mapnik::progress_timer __stats__(std::clog, "postgis_datasource::features_at_point");

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
@ -58,7 +57,7 @@ using mapnik::featureset_ptr;
using mapnik::feature_ptr; using mapnik::feature_ptr;
using mapnik::query; using mapnik::query;
using mapnik::parameters; using mapnik::parameters;
using mapnik::coord2d; using mapnik::geometry::point;
using CnxPool_ptr = std::shared_ptr< ConnectionManager::PoolType>; using CnxPool_ptr = std::shared_ptr< ConnectionManager::PoolType>;
@ -72,7 +71,7 @@ public:
processor_context_ptr get_context(feature_style_context_map &) const; 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_with_context(query const& q, processor_context_ptr ctx) const;
featureset_ptr features(query const& q) 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const; layer_descriptor get_descriptor() const;

View file

@ -37,7 +37,7 @@
using mapnik::layer_descriptor; using mapnik::layer_descriptor;
using mapnik::featureset_ptr; using mapnik::featureset_ptr;
using mapnik::query; using mapnik::query;
using mapnik::coord2d; using mapnik::geometry::point;
using mapnik::datasource_exception; using mapnik::datasource_exception;
using mapnik::datasource; using mapnik::datasource;
using mapnik::parameters; 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<double> const&, double tol) const
{ {
MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported"; MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported";

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
// boost // boost
@ -49,7 +48,7 @@ public:
datasource::datasource_t type() const; datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(const mapnik::query& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;

View file

@ -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<double> const& pt, double tol) const
{ {
#ifdef MAPNIK_STATS #ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point"); mapnik::progress_timer __stats__(std::clog, "shape_datasource::features_at_point");

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
@ -48,7 +47,7 @@ using mapnik::parameters;
using mapnik::query; using mapnik::query;
using mapnik::featureset_ptr; using mapnik::featureset_ptr;
using mapnik::layer_descriptor; using mapnik::layer_descriptor;
using mapnik::coord2d; using mapnik::geometry::point;
class shape_datasource : public datasource class shape_datasource : public datasource
{ {
@ -58,7 +57,7 @@ public:
datasource::datasource_t type() const; datasource::datasource_t type() const;
static const char * name(); static const char * name();
featureset_ptr features(query const& q) 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<double> const& pt, double tol = 0) const;
box2d<double> envelope() const; box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
layer_descriptor get_descriptor() const; layer_descriptor get_descriptor() const;

View file

@ -41,7 +41,7 @@
#include <boost/tokenizer.hpp> #include <boost/tokenizer.hpp>
using mapnik::box2d; using mapnik::box2d;
using mapnik::coord2d; using mapnik::geometry::point;
using mapnik::query; using mapnik::query;
using mapnik::featureset_ptr; using mapnik::featureset_ptr;
using mapnik::layer_descriptor; using mapnik::layer_descriptor;
@ -554,7 +554,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const
return featureset_ptr(); 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<double> const& pt, double tol) const
{ {
#ifdef MAPNIK_STATS #ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features_at_point"); mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::features_at_point");

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/wkb.hpp> #include <mapnik/wkb.hpp>
#include <mapnik/value_types.hpp> #include <mapnik/value_types.hpp>
@ -53,7 +52,7 @@ public:
datasource::datasource_t type() const; datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(mapnik::query const& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;

View file

@ -287,7 +287,7 @@ mapnik::featureset_ptr topojson_datasource::features(mapnik::query const& q) con
return mapnik::featureset_ptr(); 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<double> const& pt, double tol) const
{ {
mapnik::box2d<double> query_bbox(pt.x, pt.y, pt.x, pt.y); mapnik::box2d<double> query_bbox(pt.x, pt.y, pt.x, pt.y);
query_bbox.pad(tol); query_bbox.pad(tol);

View file

@ -29,7 +29,6 @@
#include <mapnik/query.hpp> #include <mapnik/query.hpp>
#include <mapnik/feature.hpp> #include <mapnik/feature.hpp>
#include <mapnik/box2d.hpp> #include <mapnik/box2d.hpp>
#include <mapnik/coord.hpp>
#include <mapnik/feature_layer_desc.hpp> #include <mapnik/feature_layer_desc.hpp>
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
#include <mapnik/json/topology.hpp> #include <mapnik/json/topology.hpp>
@ -64,7 +63,7 @@ public:
mapnik::datasource::datasource_t type() const; mapnik::datasource::datasource_t type() const;
static const char * name(); static const char * name();
mapnik::featureset_ptr features(mapnik::query const& q) const; 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<double> const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() const; mapnik::box2d<double> envelope() const;
mapnik::layer_descriptor get_descriptor() const; mapnik::layer_descriptor get_descriptor() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const; boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;

View file

@ -730,7 +730,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const
throw std::runtime_error(s.str()); throw std::runtime_error(s.str());
} }
double tol = (map_ex.maxx() - map_ex.minx()) / static_cast<double>(width_) * 3; double tol = (map_ex.maxx() - map_ex.minx()) / static_cast<double>(width_) * 3;
featureset_ptr fs = ds->features_at_point(mapnik::coord2d(x,y), tol); featureset_ptr fs = ds->features_at_point(mapnik::geometry::point<double>(x,y), tol);
MAPNIK_LOG_DEBUG(map) << "map: Query at point tol=" << tol << "(" << x << "," << y << ")"; MAPNIK_LOG_DEBUG(map) << "map: Query at point tol=" << tol << "(" << x << "," << y << ")";
if (fs) if (fs)
{ {

View file

@ -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"); throw std::runtime_error("Can not add a raster feature to a memory datasource that contains vectors");
} }
} }
else else
{ {
if (!type_set_) 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<double> const& pt, double tol) const
{ {
box2d<double> box = box2d<double>(pt.x, pt.y, pt.x, pt.y); box2d<double> box = box2d<double>(pt.x, pt.y, pt.x, pt.y);
box.pad(tol); box.pad(tol);

View file

@ -284,7 +284,7 @@ TEST_CASE("csv") {
auto fs = all_features(ds); auto fs = all_features(ds);
auto pt = ds->envelope().center(); auto pt = ds->envelope().center();
auto fs2 = ds->features_at_point(mapnik::coord<double, 2>(pt.x, pt.y), 10000); auto fs2 = ds->features_at_point(pt, 10000);
REQUIRE(fs != nullptr); REQUIRE(fs != nullptr);
auto feature = fs->next(); auto feature = fs->next();
auto feature2 = fs2->next(); auto feature2 = fs2->next();

View file

@ -285,7 +285,7 @@ TEST_CASE("geojson") {
} }
auto features = ds->features(query); auto features = ds->features(query);
auto pt = ds->envelope().center(); auto pt = ds->envelope().center();
auto features2 = ds->features_at_point(mapnik::coord<double, 2>(pt.x, pt.y), 0); auto features2 = ds->features_at_point(pt, 0);
REQUIRE(features != nullptr); REQUIRE(features != nullptr);
REQUIRE(features2 != nullptr); REQUIRE(features2 != nullptr);
auto feature = features->next(); auto feature = features->next();
@ -343,7 +343,7 @@ TEST_CASE("geojson") {
} }
auto features = ds->features(query); auto features = ds->features(query);
auto pt = ds->envelope().center(); auto pt = ds->envelope().center();
auto features2 = ds->features_at_point(mapnik::coord<double, 2>(pt.x, pt.y), 10); auto features2 = ds->features_at_point(pt, 10);
auto bounding_box = ds->envelope(); auto bounding_box = ds->envelope();
mapnik::box2d<double> bbox; mapnik::box2d<double> bbox;
mapnik::value_integer count = 0; mapnik::value_integer count = 0;

View file

@ -207,7 +207,7 @@ TEST_CASE("postgis") {
auto ds = mapnik::datasource_cache::instance().create(params); auto ds = mapnik::datasource_cache::instance().create(params);
REQUIRE(ds != nullptr); REQUIRE(ds != nullptr);
auto featureset = ds->features_at_point(mapnik::coord2d(1, 1)); auto featureset = ds->features_at_point(mapnik::geometry::point<double>(1, 1));
mapnik::feature_ptr feature; mapnik::feature_ptr feature;
while ((bool(feature = featureset->next()))) { while ((bool(feature = featureset->next()))) {
REQUIRE(feature->get(2).to_string() == feature->get("col_text").to_string()); REQUIRE(feature->get(2).to_string() == feature->get("col_text").to_string());