move datasource::geometry_t into separate header and rename -> datasource_geometry_t to avoid cyclic dependencies issue

to_ds_type - return actual datasource_geometry_t (remove optional)
update across datasources
experssions - revert to using
This commit is contained in:
artemp 2015-03-24 12:13:31 +01:00
parent 163da958f4
commit 1cf0a897ac
39 changed files with 159 additions and 131 deletions

View file

@ -177,11 +177,11 @@ void export_datasource()
.value("Raster",mapnik::datasource::Raster)
;
enum_<mapnik::datasource::geometry_t>("DataGeometryType")
.value("Point",mapnik::datasource::Point)
.value("LineString",mapnik::datasource::LineString)
.value("Polygon",mapnik::datasource::Polygon)
.value("Collection",mapnik::datasource::Collection)
enum_<mapnik::datasource_geometry_t>("DataGeometryType")
.value("Point",mapnik::datasource_geometry_t::Point)
.value("LineString",mapnik::datasource_geometry_t::LineString)
.value("Polygon",mapnik::datasource_geometry_t::Polygon)
.value("Collection",mapnik::datasource_geometry_t::Collection)
;
class_<datasource,std::shared_ptr<datasource>,

View file

@ -196,7 +196,7 @@ struct agg_renderer_visitor_1
{
agg_renderer_visitor_1(mapnik::Map const& m, double scale_factor, unsigned offset_x, unsigned offset_y)
: m_(m), scale_factor_(scale_factor), offset_x_(offset_x), offset_y_(offset_y) {}
template <typename T>
void operator() (T & pixmap)
{
@ -222,7 +222,7 @@ struct agg_renderer_visitor_2
agg_renderer_visitor_2(mapnik::Map const &m, std::shared_ptr<mapnik::label_collision_detector4> detector,
double scale_factor, unsigned offset_x, unsigned offset_y)
: m_(m), detector_(detector), scale_factor_(scale_factor), offset_x_(offset_x), offset_y_(offset_y) {}
template <typename T>
void operator() (T & pixmap)
{
@ -249,7 +249,7 @@ struct agg_renderer_visitor_3
agg_renderer_visitor_3(mapnik::Map const& m, mapnik::request const& req, mapnik::attributes const& vars,
double scale_factor, unsigned offset_x, unsigned offset_y)
: m_(m), req_(req), vars_(vars), scale_factor_(scale_factor), offset_x_(offset_x), offset_y_(offset_y) {}
template <typename T>
void operator() (T & pixmap)
{
@ -279,7 +279,7 @@ struct agg_renderer_visitor_4
mapnik::layer const& layer, std::set<std::string>& names)
: m_(m), scale_factor_(scale_factor), offset_x_(offset_x), offset_y_(offset_y),
layer_(layer), names_(names) {}
template <typename T>
void operator() (T & pixmap)
{
@ -1056,7 +1056,7 @@ BOOST_PYTHON_MODULE(_mapnik)
python_optional<mapnik::color>();
python_optional<mapnik::box2d<double> >();
python_optional<mapnik::composite_mode_e>();
python_optional<mapnik::datasource::geometry_t>();
python_optional<mapnik::datasource_geometry_t>();
python_optional<std::string>();
python_optional<unsigned>();
python_optional<double>();

View file

@ -26,7 +26,7 @@
// mapnik
#include <mapnik/value_types.hpp>
#include <mapnik/value.hpp>
#include <mapnik/geometry_type.hpp>
#include <mapnik/util/geometry_to_ds_type.hpp>
// stl
#include <string>
#include <unordered_map>
@ -53,7 +53,7 @@ struct geometry_type_attribute
template <typename V, typename F>
V value(F const& f) const
{
return static_cast<mapnik::value_integer>(new_geometry::geometry_type(f.get_geometry()));
return static_cast<mapnik::value_integer>(util::to_ds_type(f.get_geometry()));
}
};

View file

@ -32,6 +32,7 @@
#include <mapnik/feature_layer_desc.hpp>
#include <mapnik/util/noncopyable.hpp>
#include <mapnik/feature_style_processor_context.hpp>
#include <mapnik/datasource_geometry_type.hpp>
// stl
#include <map>
@ -68,14 +69,6 @@ public:
Raster
};
enum geometry_t : std::uint8_t {
Unknown = 0,
Point = 1,
LineString = 2,
Polygon = 3,
Collection = 4
};
datasource (parameters const& params)
: params_(params) {}
@ -112,7 +105,7 @@ public:
// default implementation without context use features method
return features(q);
}
virtual boost::optional<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_at_point(coord2d const& pt, double tol = 0) const = 0;
virtual box2d<double> envelope() const = 0;

View file

@ -0,0 +1,39 @@
/*****************************************************************************
*
* 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_DATASOURCE_GEOMETRY_TYPE_HPP
#define MAPNIK_DATASOURCE_GEOMETRY_TYPE_HPP
namespace mapnik {
enum datasource_geometry_t : std::uint8_t {
Unknown = 0,
Point = 1,
LineString = 2,
Polygon = 3,
Collection = 4
};
}
#endif // MAPNIK_DATASOURCE_GEOMETRY_TYPE_HPP

View file

@ -29,7 +29,7 @@
#include <mapnik/unicode.hpp>
#include <mapnik/expression_node.hpp>
#include <mapnik/function_call.hpp>
#include <mapnik/geometry_types.hpp>
//#include <mapnik/datasource.hpp>
// boost
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
@ -114,14 +114,10 @@ struct geometry_types : qi::symbols<char, mapnik::value_integer>
geometry_types()
{
add
("unknown", static_cast<mapnik::value_integer>(new_geometry::geometry_types::Unknown))
("point", static_cast<mapnik::value_integer>(new_geometry::geometry_types::Point))
("linestring", static_cast<mapnik::value_integer>(new_geometry::geometry_types::LineString))
("polygon",static_cast<mapnik::value_integer>(new_geometry::geometry_types::Polygon))
("multipoint",static_cast<mapnik::value_integer>(new_geometry::geometry_types::MultiPoint))
("multilinestring",static_cast<mapnik::value_integer>(new_geometry::geometry_types::MultiLineString))
("multipolygon",static_cast<mapnik::value_integer>(new_geometry::geometry_types::MultiPolygon))
("geometrycollection",static_cast<mapnik::value_integer>(new_geometry::geometry_types::GeometryCollection))
("point", 1)
("linestring", 2)
("polygon",3)
("collection",4)
;
}
};

View file

@ -43,7 +43,7 @@ public:
virtual featureset_ptr features(query const& q) const;
virtual featureset_ptr features_at_point(coord2d const& pt, double tol = 0) const;
virtual box2d<double> envelope() const;
virtual boost::optional<geometry_t> get_geometry_type() const;
virtual boost::optional<datasource_geometry_t> get_geometry_type() const;
virtual layer_descriptor get_descriptor() const;
//
void push(feature_ptr feature);

View file

@ -20,13 +20,13 @@
*
*****************************************************************************/
#ifndef MAPNIK_GEOMETRY_TO_DS_TYPE
#define MAPNIK_GEOMETRY_TO_DS_TYPE
#ifndef MAPNIK_GEOMETRY_TO_DS_TYPE_HPP
#define MAPNIK_GEOMETRY_TO_DS_TYPE_HPP
// mapnik
#include <mapnik/global.hpp>
#include <mapnik/geometry_impl.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/datasource_geometry_type.hpp>
#include <mapnik/util/variant.hpp>
// boost
#include <boost/optional.hpp>
@ -37,54 +37,54 @@ namespace detail {
struct datasource_geometry_type
{
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::geometry_empty const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::geometry_empty const&) const
{
return mapnik::datasource::Unknown;
return mapnik::datasource_geometry_t::Unknown;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::point const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::point const&) const
{
return mapnik::datasource::Point;
return mapnik::datasource_geometry_t::Point;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::line_string const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::line_string const&) const
{
return mapnik::datasource::LineString;
return mapnik::datasource_geometry_t::LineString;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::polygon const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::polygon const&) const
{
return mapnik::datasource::Polygon;
return mapnik::datasource_geometry_t::Polygon;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::multi_point const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::multi_point const&) const
{
return mapnik::datasource::Point;
return mapnik::datasource_geometry_t::Point;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::multi_line_string const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::multi_line_string const&) const
{
return mapnik::datasource::LineString;
return mapnik::datasource_geometry_t::LineString;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::multi_polygon const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::multi_polygon const&) const
{
return mapnik::datasource::Polygon;
return mapnik::datasource_geometry_t::Polygon;
}
mapnik::datasource::geometry_t operator () (mapnik::new_geometry::geometry_collection const&) const
mapnik::datasource_geometry_t operator () (mapnik::new_geometry::geometry_collection const&) const
{
return mapnik::datasource::Collection;
return mapnik::datasource_geometry_t::Collection;
}
};
} // detail
static void to_ds_type(mapnik::new_geometry::geometry const& geom, boost::optional<mapnik::datasource::geometry_t> & result)
static inline mapnik::datasource_geometry_t to_ds_type(mapnik::new_geometry::geometry const& geom)
{
result = util::apply_visitor(detail::datasource_geometry_type(), geom);
return util::apply_visitor(detail::datasource_geometry_type(), geom);
}
}}
#endif // MAPNIK_GEOMETRY_TO_DS_TYPE
#endif // MAPNIK_GEOMETRY_TO_DS_TYPE_HPP

View file

@ -937,20 +937,20 @@ mapnik::layer_descriptor csv_datasource::get_descriptor() const
return desc_;
}
boost::optional<mapnik::datasource::geometry_t> csv_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> csv_datasource::get_geometry_type() const
{
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
int multi_type = 0;
unsigned num_features = features_.size();
for (unsigned i = 0; i < num_features && i < 5; ++i)
{
mapnik::util::to_ds_type(features_[i]->get_geometry(),result);
result = mapnik::util::to_ds_type(features_[i]->get_geometry());
if (result)
{
int type = static_cast<int>(*result);
if (multi_type > 0 && multi_type != type)
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
multi_type = type;

View file

@ -52,7 +52,7 @@ public:
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() 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;
template <typename T>
void parse_csv(T & stream,
std::string const& escape,

View file

@ -201,9 +201,9 @@ box2d<double> gdal_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> gdal_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> gdal_datasource::get_geometry_type() const
{
return boost::optional<mapnik::datasource::geometry_t>();
return boost::optional<mapnik::datasource_geometry_t>();
}
layer_descriptor gdal_datasource::get_descriptor() const

View file

@ -52,7 +52,7 @@ public:
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) 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;
private:
GDALDataset* open_dataset() const;

View file

@ -302,22 +302,22 @@ mapnik::layer_descriptor geojson_datasource::get_descriptor() const
return desc_;
}
boost::optional<mapnik::datasource::geometry_t> geojson_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> geojson_datasource::get_geometry_type() const
{
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
int multi_type = 0;
if (cache_features_)
{
unsigned num_features = features_.size();
for (unsigned i = 0; i < num_features && i < 5; ++i)
{
mapnik::util::to_ds_type(features_[i]->get_geometry(),result);
result = mapnik::util::to_ds_type(features_[i]->get_geometry());
if (result)
{
int type = static_cast<int>(*result);
if (multi_type > 0 && multi_type != type)
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
multi_type = type;
@ -356,13 +356,13 @@ boost::optional<mapnik::datasource::geometry_t> geojson_datasource::get_geometry
{
throw std::runtime_error("Failed to parse geojson feature");
}
mapnik::util::to_ds_type(feature->get_geometry(),result);
result = mapnik::util::to_ds_type(feature->get_geometry());
if (result)
{
int type = static_cast<int>(*result);
if (multi_type > 0 && multi_type != type)
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
multi_type = type;

View file

@ -94,7 +94,7 @@ public:
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() 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;
template <typename Iterator>
void parse_geojson(Iterator start, Iterator end);
template <typename Iterator>

View file

@ -443,9 +443,9 @@ box2d<double> occi_datasource::envelope() const
}
boost::optional<mapnik::datasource::geometry_t> occi_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> occi_datasource::get_geometry_type() const
{
return boost::optional<mapnik::datasource::geometry_t>();
return boost::optional<mapnik::datasource_geometry_t>();
}
layer_descriptor occi_datasource::get_descriptor() const

View file

@ -54,7 +54,7 @@ public:
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) 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;
private:

View file

@ -390,9 +390,9 @@ box2d<double> ogr_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> ogr_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> ogr_datasource::get_geometry_type() const
{
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
if (dataset_ && layer_.is_valid())
{
OGRLayer* layer = layer_.layer();
@ -417,7 +417,7 @@ boost::optional<mapnik::datasource::geometry_t> ogr_datasource::get_geometry_typ
result.reset(mapnik::datasource::Polygon);
break;
case wkbGeometryCollection:
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
break;
case wkbNone:
case wkbUnknown:
@ -452,7 +452,7 @@ boost::optional<mapnik::datasource::geometry_t> ogr_datasource::get_geometry_typ
result.reset(mapnik::datasource::Polygon);
break;
case wkbGeometryCollection:
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
break;
default:
break;

View file

@ -54,7 +54,7 @@ public:
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) 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;
private:

View file

@ -153,7 +153,7 @@ box2d<double> osm_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> osm_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> osm_datasource::get_geometry_type() const
{
return boost::optional<mapnik::datasource::geometry_t>(mapnik::datasource::Collection);
return boost::optional<mapnik::datasource_geometry_t>(mapnik::datasource_geometry_t::Collection);
}

View file

@ -60,7 +60,7 @@ public:
featureset_ptr features(const query& q) const;
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) 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;
private:

View file

@ -357,7 +357,7 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
{
pgraster_overview ov = pgraster_overview();
ov.schema = rs->getValue("sch");
ov.schema = rs->getValue("sch");
ov.table = rs->getValue("tab");
ov.column = rs->getValue("col");
ov.scale = atof(rs->getValue("scl"));
@ -1201,7 +1201,7 @@ box2d<double> pgraster_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> pgraster_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> pgraster_datasource::get_geometry_type() const
{
return boost::optional<mapnik::datasource::geometry_t>();
return boost::optional<mapnik::datasource_geometry_t>();
}

View file

@ -85,7 +85,7 @@ public:
featureset_ptr features(query const& q) const;
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) 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;
private:

View file

@ -1033,9 +1033,9 @@ box2d<double> postgis_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> postgis_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> postgis_datasource::get_geometry_type() const
{
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
CnxPool_ptr pool = ConnectionManager::instance().getPool(creator_.id());
if (pool)
@ -1070,17 +1070,17 @@ boost::optional<mapnik::datasource::geometry_t> postgis_datasource::get_geometry
g_type = rs->getValue("type");
if (boost::algorithm::contains(g_type, "line"))
{
result.reset(mapnik::datasource::LineString);
result.reset(mapnik::datasource_geometry_t::LineString);
return result;
}
else if (boost::algorithm::contains(g_type, "point"))
{
result.reset(mapnik::datasource::Point);
result.reset(mapnik::datasource_geometry_t::Point);
return result;
}
else if (boost::algorithm::contains(g_type, "polygon"))
{
result.reset(mapnik::datasource::Polygon);
result.reset(mapnik::datasource_geometry_t::Polygon);
return result;
}
else // geometry
@ -1121,26 +1121,26 @@ boost::optional<mapnik::datasource::geometry_t> postgis_datasource::get_geometry
if (boost::algorithm::icontains(data, "line"))
{
g_type = "linestring";
result.reset(mapnik::datasource::LineString);
result.reset(mapnik::datasource_geometry_t::LineString);
}
else if (boost::algorithm::icontains(data, "point"))
{
g_type = "point";
result.reset(mapnik::datasource::Point);
result.reset(mapnik::datasource_geometry_t::Point);
}
else if (boost::algorithm::icontains(data, "polygon"))
{
g_type = "polygon";
result.reset(mapnik::datasource::Polygon);
result.reset(mapnik::datasource_geometry_t::Polygon);
}
else // geometry
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
if (! prev_type.empty() && g_type != prev_type)
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
prev_type = g_type;

View file

@ -74,7 +74,7 @@ public:
featureset_ptr features(query const& q) const;
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) 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;
private:

View file

@ -163,9 +163,9 @@ mapnik::box2d<double> python_datasource::envelope() const
return box;
}
boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> python_datasource::get_geometry_type() const
{
using return_type = boost::optional<mapnik::datasource::geometry_t>;
using return_type = boost::optional<mapnik::datasource_geometry_t>;
try
{
@ -182,7 +182,7 @@ boost::optional<mapnik::datasource::geometry_t> python_datasource::get_geometry_
return return_type();
}
long geom_type_integer = boost::python::extract<long>(py_geometry_type);
return mapnik::datasource::geometry_t(geom_type_integer);
return mapnik::datasource_geometry_t(geom_type_integer);
}
catch ( boost::python::error_already_set )
{

View file

@ -41,7 +41,7 @@ public:
mapnik::box2d<double> envelope() const;
// mandatory: optionally return the overal geometry type of the datasource
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
// mandatory: return the layer descriptor
mapnik::layer_descriptor get_descriptor() const;

View file

@ -171,9 +171,9 @@ mapnik::box2d<double> raster_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> raster_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> raster_datasource::get_geometry_type() const
{
return boost::optional<mapnik::datasource::geometry_t>();
return boost::optional<mapnik::datasource_geometry_t>();
}
layer_descriptor raster_datasource::get_descriptor() const

View file

@ -51,7 +51,7 @@ public:
mapnik::featureset_ptr features(const mapnik::query& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) 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;
bool log_enabled() const;

View file

@ -168,9 +168,9 @@ box2d<double> rasterlite_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> rasterlite_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> rasterlite_datasource::get_geometry_type() const
{
return boost::optional<mapnik::datasource::geometry_t>();
return boost::optional<mapnik::datasource_geometry_t>();
}
layer_descriptor rasterlite_datasource::get_descriptor() const

View file

@ -52,7 +52,7 @@ public:
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) 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;
private:

View file

@ -301,13 +301,13 @@ box2d<double> shape_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> shape_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> shape_datasource::get_geometry_type() const
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "shape_datasource::get_geometry_type");
#endif
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
switch (shape_type_)
{
case shape_io::shape_point:
@ -317,21 +317,21 @@ boost::optional<mapnik::datasource::geometry_t> shape_datasource::get_geometry_t
case shape_io::shape_multipointm:
case shape_io::shape_multipointz:
{
result.reset(mapnik::datasource::Point);
result.reset(mapnik::datasource_geometry_t::Point);
break;
}
case shape_io::shape_polyline:
case shape_io::shape_polylinem:
case shape_io::shape_polylinez:
{
result.reset(mapnik::datasource::LineString);
result.reset(mapnik::datasource_geometry_t::LineString);
break;
}
case shape_io::shape_polygon:
case shape_io::shape_polygonm:
case shape_io::shape_polygonz:
{
result.reset(mapnik::datasource::Polygon);
result.reset(mapnik::datasource_geometry_t::Polygon);
break;
}
default:

View file

@ -60,7 +60,7 @@ public:
featureset_ptr features(query const& q) const;
featureset_ptr features_at_point(coord2d const& pt, double tol = 0) 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;
private:
void init(shape_io& shape);

View file

@ -418,13 +418,13 @@ box2d<double> sqlite_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> sqlite_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> sqlite_datasource::get_geometry_type() const
{
#ifdef MAPNIK_STATS
mapnik::progress_timer __stats__(std::clog, "sqlite_datasource::get_geometry_type");
#endif
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
if (dataset_)
{
// get geometry type by querying first features
@ -453,13 +453,13 @@ boost::optional<mapnik::datasource::geometry_t> sqlite_datasource::get_geometry_
{
continue;
}
mapnik::util::to_ds_type(geom,result);
result = mapnik::util::to_ds_type(geom);
if (result)
{
int type = static_cast<int>(*result);
if (multi_type > 0 && multi_type != type)
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
multi_type = type;

View file

@ -55,7 +55,7 @@ public:
mapnik::featureset_ptr features(mapnik::query const& q) const;
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) 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;
private:

View file

@ -46,9 +46,9 @@ mapnik::box2d<double> hello_datasource::envelope() const
return extent_;
}
boost::optional<mapnik::datasource::geometry_t> hello_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> hello_datasource::get_geometry_type() const
{
return mapnik::datasource::Point;
return mapnik::datasource_geometry_t::Point;
}
mapnik::layer_descriptor hello_datasource::get_descriptor() const

View file

@ -46,7 +46,7 @@ public:
mapnik::box2d<double> envelope() const;
// mandatory: optionally return the overal geometry type of the datasource
boost::optional<mapnik::datasource::geometry_t> get_geometry_type() const;
boost::optional<mapnik::datasource_geometry_t> get_geometry_type() const;
// mandatory: return the layer descriptor
mapnik::layer_descriptor get_descriptor() const;

View file

@ -86,27 +86,27 @@ struct geometry_type_visitor
{
int operator() (mapnik::topojson::point const&) const
{
return static_cast<int>(mapnik::datasource::Point);
return static_cast<int>(mapnik::datasource_geometry_t::Point);
}
int operator() (mapnik::topojson::multi_point const&) const
{
return static_cast<int>(mapnik::datasource::Point);
return static_cast<int>(mapnik::datasource_geometry_t::Point);
}
int operator() (mapnik::topojson::linestring const&) const
{
return static_cast<int>(mapnik::datasource::LineString);
return static_cast<int>(mapnik::datasource_geometry_t::LineString);
}
int operator() (mapnik::topojson::multi_linestring const&) const
{
return static_cast<int>(mapnik::datasource::LineString);
return static_cast<int>(mapnik::datasource_geometry_t::LineString);
}
int operator() (mapnik::topojson::polygon const&) const
{
return static_cast<int>(mapnik::datasource::Polygon);
return static_cast<int>(mapnik::datasource_geometry_t::Polygon);
}
int operator() (mapnik::topojson::multi_polygon const&) const
{
return static_cast<int>(mapnik::datasource::Polygon);
return static_cast<int>(mapnik::datasource_geometry_t::Polygon);
}
int operator() (mapnik::topojson::invalid const&) const
{
@ -234,9 +234,9 @@ const char * topojson_datasource::name()
return "topojson";
}
boost::optional<mapnik::datasource::geometry_t> topojson_datasource::get_geometry_type() const
boost::optional<mapnik::datasource_geometry_t> topojson_datasource::get_geometry_type() const
{
boost::optional<mapnik::datasource::geometry_t> result;
boost::optional<mapnik::datasource_geometry_t> result;
int multi_type = 0;
std::size_t num_features = topo_.geometries.size();
for (std::size_t i = 0; i < num_features && i < 5; ++i)
@ -247,12 +247,12 @@ boost::optional<mapnik::datasource::geometry_t> topojson_datasource::get_geometr
{
if (multi_type > 0 && multi_type != type)
{
result.reset(mapnik::datasource::Collection);
result.reset(mapnik::datasource_geometry_t::Collection);
return result;
}
else
{
result.reset(static_cast<mapnik::datasource::geometry_t>(type));
result.reset(static_cast<mapnik::datasource_geometry_t>(type));
}
multi_type = type;
}

View file

@ -73,7 +73,7 @@ public:
mapnik::featureset_ptr features_at_point(mapnik::coord2d const& pt, double tol = 0) const;
mapnik::box2d<double> envelope() 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;
template <typename T>
void parse_topojson(T const& buffer);
private:

View file

@ -125,10 +125,10 @@ box2d<double> memory_datasource::envelope() const
return extent_;
}
boost::optional<datasource::geometry_t> memory_datasource::get_geometry_type() const
boost::optional<datasource_geometry_t> memory_datasource::get_geometry_type() const
{
// TODO - detect this?
return datasource::Collection;
return datasource_geometry_t::Collection;
}
layer_descriptor memory_datasource::get_descriptor() const