static inline void to_ds_type(mapnik::geometry_container const& paths, boost::optional<mapnik::datasource::geometry_t> & result) { if (paths.size() == 1) { result.reset(static_cast<mapnik::datasource::geometry_t>(paths.front().type())); } else if (paths.size() > 1) { int multi_type = 0; for (auto const& geom : paths) { int type = static_cast<int>(geom.type()); if (multi_type > 0 && multi_type != type) { result.reset(datasource::Collection); } multi_type = type; result.reset(static_cast<mapnik::datasource::geometry_t>(type)); } } }
void to_ds_type(mapnik::geometry_container const& paths, boost::optional<mapnik::datasource::geometry_t> & result) { if (paths.size() == 1) { result.reset(static_cast<mapnik::datasource::geometry_t>(paths.front().type())); } else if (paths.size() > 1) { int multi_type = 0; geometry_container::const_iterator itr = paths.begin(); geometry_container::const_iterator end = paths.end(); for ( ; itr!=end; ++itr) { int type = static_cast<int>(itr->type()); if (multi_type > 0 && multi_type != type) { result.reset(datasource::Collection); } multi_type = type; result.reset(static_cast<mapnik::datasource::geometry_t>(type)); } } }