commit
abeace5167
13 changed files with 25 additions and 25 deletions
|
@ -41,21 +41,21 @@ struct MAPNIK_DECL Featureset : private util::noncopyable
|
||||||
virtual ~Featureset() {}
|
virtual ~Featureset() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MAPNIK_DECL invalid_featureset : Featureset
|
struct MAPNIK_DECL empty_featureset : Featureset
|
||||||
{
|
{
|
||||||
feature_ptr next() { return feature_ptr(); }
|
feature_ptr next() { return feature_ptr(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
using featureset_ptr = std::shared_ptr<Featureset>;
|
using featureset_ptr = std::shared_ptr<Featureset>;
|
||||||
|
|
||||||
inline featureset_ptr make_invalid_featureset()
|
inline featureset_ptr make_empty_featureset()
|
||||||
{
|
{
|
||||||
return std::make_shared<invalid_featureset>();
|
return std::make_shared<empty_featureset>();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_valid(featureset_ptr const& ptr)
|
inline bool is_empty(featureset_ptr const& ptr)
|
||||||
{
|
{
|
||||||
return (dynamic_cast<invalid_featureset*>(ptr.get()) == nullptr) ? true : false;
|
return (dynamic_cast<empty_featureset*>(ptr.get()) != nullptr) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mapnik
|
} // namespace mapnik
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#define MAPNIK_MAJOR_VERSION 4
|
#define MAPNIK_MAJOR_VERSION 4
|
||||||
#define MAPNIK_MINOR_VERSION 0
|
#define MAPNIK_MINOR_VERSION 0
|
||||||
#define MAPNIK_PATCH_VERSION 2
|
#define MAPNIK_PATCH_VERSION 3
|
||||||
|
|
||||||
#define MAPNIK_VERSION MAPNIK_VERSION_ENCODE(MAPNIK_MAJOR_VERSION, MAPNIK_MINOR_VERSION, MAPNIK_PATCH_VERSION)
|
#define MAPNIK_VERSION MAPNIK_VERSION_ENCODE(MAPNIK_MAJOR_VERSION, MAPNIK_MINOR_VERSION, MAPNIK_PATCH_VERSION)
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ mapnik::featureset_ptr csv_datasource::features(mapnik::query const& q) const
|
||||||
ctx_);
|
ctx_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
|
mapnik::featureset_ptr csv_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
|
||||||
|
|
|
@ -595,7 +595,7 @@ mapnik::featureset_ptr geojson_datasource::features(mapnik::query const& q) cons
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// otherwise return an empty featureset
|
// otherwise return an empty featureset
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
|
mapnik::featureset_ptr geojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
|
||||||
|
|
|
@ -558,7 +558,7 @@ featureset_ptr ogr_datasource::features(query const& q) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) const
|
featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol) const
|
||||||
|
@ -595,5 +595,5 @@ featureset_ptr ogr_datasource::features_at_point(coord2d const& pt, double tol)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -959,7 +959,7 @@ featureset_ptr pgraster_datasource::features_with_context(query const& q, proces
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double tol) const
|
featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double tol) const
|
||||||
|
@ -972,7 +972,7 @@ featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double
|
||||||
{
|
{
|
||||||
shared_ptr<Connection> conn = pool->borrowObject();
|
shared_ptr<Connection> conn = pool->borrowObject();
|
||||||
if (!conn)
|
if (!conn)
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
|
|
||||||
if (conn->isOK())
|
if (conn->isOK())
|
||||||
{
|
{
|
||||||
|
@ -1042,7 +1042,7 @@ featureset_ptr pgraster_datasource::features_at_point(coord2d const& pt, double
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
box2d<double> pgraster_datasource::envelope() const
|
box2d<double> pgraster_datasource::envelope() const
|
||||||
|
|
|
@ -890,7 +890,7 @@ featureset_ptr postgis_datasource::features_with_context(query const& q, process
|
||||||
twkb_encoding_);
|
twkb_encoding_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double tol) const
|
featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double tol) const
|
||||||
|
@ -903,7 +903,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double t
|
||||||
{
|
{
|
||||||
shared_ptr<Connection> conn = pool->borrowObject();
|
shared_ptr<Connection> conn = pool->borrowObject();
|
||||||
if (!conn)
|
if (!conn)
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
|
|
||||||
if (conn->isOK())
|
if (conn->isOK())
|
||||||
{
|
{
|
||||||
|
@ -973,7 +973,7 @@ featureset_ptr postgis_datasource::features_at_point(coord2d const& pt, double t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
box2d<double> postgis_datasource::envelope() const
|
box2d<double> postgis_datasource::envelope() const
|
||||||
|
|
|
@ -227,5 +227,5 @@ featureset_ptr raster_datasource::features_at_point(coord2d const&, double tol)
|
||||||
{
|
{
|
||||||
MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported";
|
MAPNIK_LOG_WARN(raster) << "raster_datasource: feature_at_point not supported";
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,7 +561,7 @@ featureset_ptr sqlite_datasource::features(query const& q) const
|
||||||
using_subquery_);
|
using_subquery_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double tol) const
|
featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double tol) const
|
||||||
|
@ -640,5 +640,5 @@ featureset_ptr sqlite_datasource::features_at_point(coord2d const& pt, double to
|
||||||
using_subquery_);
|
using_subquery_);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ mapnik::featureset_ptr topojson_datasource::features(mapnik::query const& q) con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// otherwise return an empty featureset pointer
|
// otherwise return an empty featureset pointer
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
mapnik::featureset_ptr topojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
|
mapnik::featureset_ptr topojson_datasource::features_at_point(mapnik::coord2d const& pt, double tol) const
|
||||||
|
|
|
@ -738,7 +738,7 @@ featureset_ptr Map::query_point(unsigned index, double x, double y) const
|
||||||
s << " (map has no layers)";
|
s << " (map has no layers)";
|
||||||
throw std::out_of_range(s.str());
|
throw std::out_of_range(s.str());
|
||||||
}
|
}
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
|
|
||||||
featureset_ptr Map::query_map_point(unsigned index, double x, double y) const
|
featureset_ptr Map::query_map_point(unsigned index, double x, double y) const
|
||||||
|
|
|
@ -125,7 +125,7 @@ featureset_ptr memory_datasource::features(const query& q) const
|
||||||
{
|
{
|
||||||
if (features_.empty())
|
if (features_.empty())
|
||||||
{
|
{
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
return std::make_shared<memory_featureset>(q.get_bbox(), *this, bbox_check_);
|
return std::make_shared<memory_featureset>(q.get_bbox(), *this, bbox_check_);
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ featureset_ptr memory_datasource::features_at_point(coord2d const& pt, double to
|
||||||
{
|
{
|
||||||
if (features_.empty())
|
if (features_.empty())
|
||||||
{
|
{
|
||||||
return mapnik::make_invalid_featureset();
|
return mapnik::make_empty_featureset();
|
||||||
}
|
}
|
||||||
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);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* License as published by the Free Software Foundation; either
|
* License as published by the Free Software Foundation; either
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
i * 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,
|
* This library is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -36,7 +36,7 @@ TEST_CASE("memory datasource")
|
||||||
mapnik::datasource_ptr ds = std::make_shared<mapnik::memory_datasource>(params);
|
mapnik::datasource_ptr ds = std::make_shared<mapnik::memory_datasource>(params);
|
||||||
CHECK(ds != nullptr);
|
CHECK(ds != nullptr);
|
||||||
auto fs = all_features(ds);
|
auto fs = all_features(ds);
|
||||||
REQUIRE(!mapnik::is_valid(fs));
|
REQUIRE(mapnik::is_empty(fs));
|
||||||
while (auto f = fs->next())
|
while (auto f = fs->next())
|
||||||
{
|
{
|
||||||
CHECK(false); // shouldn't get here
|
CHECK(false); // shouldn't get here
|
||||||
|
|
Loading…
Reference in a new issue