diff --git a/plugins/input/occi/occi_featureset.cpp b/plugins/input/occi/occi_featureset.cpp index 393e4ed8b..0c624cdfc 100644 --- a/plugins/input/occi/occi_featureset.cpp +++ b/plugins/input/occi/occi_featureset.cpp @@ -259,7 +259,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) SDOPointType* sdopoint = geom->getSdo_point(); if (sdopoint && ! sdopoint->isNull()) { - geometry_type* point = new geometry_type(mapnik::Point); + geometry_type* point = new geometry_type(mapnik::geometry_type::types::Point); point->move_to(sdopoint->getX(), sdopoint->getY()); feature->add_geometry(point); } @@ -272,7 +272,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) const bool is_single_geom = true; const bool is_point_type = false; convert_ordinates(feature, - mapnik::LineString, + mapnik::geometry_type::types::LineString, elem_info, ordinates, dimensions, @@ -288,7 +288,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) const bool is_single_geom = true; const bool is_point_type = false; convert_ordinates(feature, - mapnik::Polygon, + mapnik::geometry_type::types::Polygon, elem_info, ordinates, dimensions, @@ -304,7 +304,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) const bool is_single_geom = false; const bool is_point_type = true; convert_ordinates(feature, - mapnik::Point, + mapnik::geometry_type::types::Point, elem_info, ordinates, dimensions, @@ -321,7 +321,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) const bool is_point_type = false; convert_ordinates(feature, - mapnik::LineString, + mapnik::geometry_type::types::LineString, elem_info, ordinates, dimensions, @@ -338,7 +338,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) const bool is_point_type = false; convert_ordinates(feature, - mapnik::Polygon, + mapnik::geometry_type::types::Polygon, elem_info, ordinates, dimensions, @@ -356,7 +356,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) const bool is_point_type = false; convert_ordinates(feature, - mapnik::Polygon, + mapnik::geometry_type::types::Polygon, elem_info, ordinates, dimensions, @@ -377,7 +377,7 @@ void occi_featureset::convert_geometry(SDOGeometry* geom, feature_ptr feature) } void occi_featureset::convert_ordinates(mapnik::feature_ptr feature, - const mapnik::geometry::types& geom_type, + const mapnik::geometry_type::types& geom_type, const std::vector& elem_info, const std::vector& ordinates, const int dimensions, @@ -404,20 +404,20 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature, int next_interp = elem_info[i + 2]; bool is_linear_element = true; bool is_unknown_etype = false; - mapnik::geometry::types gtype = mapnik::Point; + mapnik::geometry_type::types gtype = mapnik::geometry_type::types::Point; switch (etype) { case SDO_ETYPE_POINT: if (interp == SDO_INTERPRETATION_POINT) {} if (interp > SDO_INTERPRETATION_POINT) {} - gtype = mapnik::Point; + gtype = mapnik::geometry_type::types::Point; break; case SDO_ETYPE_LINESTRING: if (interp == SDO_INTERPRETATION_STRAIGHT) {} if (interp == SDO_INTERPRETATION_CIRCULAR) {} - gtype = mapnik::LineString; + gtype = mapnik::geometry_type::types::LineString; break; case SDO_ETYPE_POLYGON: @@ -426,7 +426,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature, if (interp == SDO_INTERPRETATION_CIRCULAR) {} if (interp == SDO_INTERPRETATION_RECTANGLE) {} if (interp == SDO_INTERPRETATION_CIRCLE) {} - gtype = mapnik::Polygon; + gtype = mapnik::geometry_type::types::Polygon; break; case SDO_ETYPE_COMPOUND_LINESTRING: @@ -434,7 +434,7 @@ void occi_featureset::convert_ordinates(mapnik::feature_ptr feature, case SDO_ETYPE_COMPOUND_POLYGON_INTERIOR: // interp = next ETYPE to consider is_linear_element = false; - gtype = mapnik::Polygon; + gtype = mapnik::geometry_type::types::Polygon; break; case SDO_ETYPE_UNKNOWN: // unknown diff --git a/plugins/input/occi/occi_featureset.hpp b/plugins/input/occi/occi_featureset.hpp index cb879ea04..88f9cfb22 100644 --- a/plugins/input/occi/occi_featureset.hpp +++ b/plugins/input/occi/occi_featureset.hpp @@ -55,7 +55,7 @@ public: private: void convert_geometry (SDOGeometry* geom, mapnik::feature_ptr feature); void convert_ordinates (mapnik::feature_ptr feature, - const mapnik::geometry::types& geom_type, + const mapnik::geometry_type::types& geom_type, const std::vector& elem_info, const std::vector& ordinates, const int dimensions, diff --git a/plugins/input/rasterlite/rasterlite_featureset.cpp b/plugins/input/rasterlite/rasterlite_featureset.cpp index df2e866cf..adf68faec 100644 --- a/plugins/input/rasterlite/rasterlite_featureset.cpp +++ b/plugins/input/rasterlite/rasterlite_featureset.cpp @@ -65,21 +65,8 @@ feature_ptr rasterlite_featureset::next() if (first_) { first_ = false; - - query *q = std::get(&gquery_); - if (q) - { - return get_feature(*q); - } - else - { - coord2d *p = std::get(&gquery_); - if (p) - { - return get_feature_at_point(*p); - } - } - // should never reach here + MAPNIK_LOG_DEBUG(gdal) << "rasterlite_featureset: Next feature in Dataset=" << &dataset_; + return boost::apply_visitor(query_dispatch(*this), gquery_); } return feature_ptr(); } diff --git a/plugins/input/rasterlite/rasterlite_featureset.hpp b/plugins/input/rasterlite/rasterlite_featureset.hpp index 4f58b7220..f4a853945 100644 --- a/plugins/input/rasterlite/rasterlite_featureset.hpp +++ b/plugins/input/rasterlite/rasterlite_featureset.hpp @@ -37,6 +37,24 @@ typedef boost::variant rasterlite_query; class rasterlite_featureset : public mapnik::Featureset { + struct query_dispatch : public boost::static_visitor + { + query_dispatch( rasterlite_featureset & featureset) + : featureset_(featureset) {} + + mapnik::feature_ptr operator() (mapnik::query const& q) const + { + return featureset_.get_feature(q); + } + + mapnik::feature_ptr operator() (mapnik::coord2d const& p) const + { + return featureset_.get_feature_at_point(p); + } + + rasterlite_featureset & featureset_; + }; + public: rasterlite_featureset(void* dataset, rasterlite_query q); diff --git a/plugins/input/templates/helloworld/hello_featureset.cpp b/plugins/input/templates/helloworld/hello_featureset.cpp index 2576e3516..1f2cb507f 100644 --- a/plugins/input/templates/helloworld/hello_featureset.cpp +++ b/plugins/input/templates/helloworld/hello_featureset.cpp @@ -41,7 +41,7 @@ mapnik::feature_ptr hello_featureset::next() mapnik::coord2d center = box_.center(); // create a new point geometry - mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::Point); + mapnik::geometry_type * pt = new mapnik::geometry_type(mapnik::geometry_type::types::Point); // we use path type geometries in Mapnik to fit nicely with AGG and Cairo // here we stick an x,y pair into the geometry using move_to() @@ -53,7 +53,7 @@ mapnik::feature_ptr hello_featureset::next() // A feature usually will have just one geometry of a given type // but mapnik does support many geometries per feature of any type // so here we draw a line around the point - mapnik::geometry_type * line = new mapnik::geometry_type(mapnik::LineString); + mapnik::geometry_type * line = new mapnik::geometry_type(mapnik::geometry_type::types::LineString); line->move_to(box_.minx(),box_.miny()); line->line_to(box_.minx(),box_.maxy()); line->line_to(box_.maxx(),box_.maxy());