From 80442cb39f0f82b36981a9de5292d2dd407cf65f Mon Sep 17 00:00:00 2001 From: Siddharth kumar Date: Mon, 1 Feb 2021 15:14:49 +0530 Subject: [PATCH] Added wkt read feature to polyhedral surfaces --- include/boost/geometry/algorithms/clear.hpp | 5 +++++ .../geometry/geometries/PolyhedralSurface.hpp | 21 ------------------- .../concepts/PolyhedralSurface_concept.hpp | 3 --- include/boost/geometry/io/wkt/read.hpp | 17 +++++++++------ 4 files changed, 16 insertions(+), 30 deletions(-) diff --git a/include/boost/geometry/algorithms/clear.hpp b/include/boost/geometry/algorithms/clear.hpp index 05c910f2e2..c396be5ed1 100644 --- a/include/boost/geometry/algorithms/clear.hpp +++ b/include/boost/geometry/algorithms/clear.hpp @@ -123,6 +123,11 @@ struct clear : detail::clear::collection_clear {}; +// Clear for Polyhedral surface +template +struct clear + : detail::clear::no_action +{}; // Polygon can (indirectly) use std for clear template diff --git a/include/boost/geometry/geometries/PolyhedralSurface.hpp b/include/boost/geometry/geometries/PolyhedralSurface.hpp index e4aa232e04..62afc41ede 100644 --- a/include/boost/geometry/geometries/PolyhedralSurface.hpp +++ b/include/boost/geometry/geometries/PolyhedralSurface.hpp @@ -102,28 +102,7 @@ struct Poly_ring_type >::ring_type& type; }; -/*template -< - typename Ring, - template class Container, - template class Allocator -> -struct ring_type -< - model::PolyhedralSurface - < - Ring, - Container, Allocator - > -> -{ - typedef typename model::PolyhedralSurface - < - Ring, - Container, Allocator - >::ring_type& type; -};*/ } // namespace traits diff --git a/include/boost/geometry/geometries/concepts/PolyhedralSurface_concept.hpp b/include/boost/geometry/geometries/concepts/PolyhedralSurface_concept.hpp index afb1afeb35..81e014be93 100644 --- a/include/boost/geometry/geometries/concepts/PolyhedralSurface_concept.hpp +++ b/include/boost/geometry/geometries/concepts/PolyhedralSurface_concept.hpp @@ -27,9 +27,6 @@ class PolyhedralSurface BOOST_CONCEPT_USAGE(PolyhedralSurface) { - Geometry* polyhedralSurface = 0; - ring_type* ring = 0; - } #endif diff --git a/include/boost/geometry/io/wkt/read.hpp b/include/boost/geometry/io/wkt/read.hpp index 66750450bd..1454f84b77 100644 --- a/include/boost/geometry/io/wkt/read.hpp +++ b/include/boost/geometry/io/wkt/read.hpp @@ -462,13 +462,18 @@ struct polyhderal_surface_parser static inline void apply(tokenizer::iterator& it, tokenizer::iterator const& end, std::string const& wkt, - PolyhedralSurface& ring) + PolyhedralSurface& Poly) { handle_open_parenthesis(it, end, wkt); - int i = 0; + typename ring_type::type ring; while(it != end && *it != ")"){ - //appender::apply(it, end, wkt, ring); - i++; + appender::apply(it, end, wkt, ring); + if(it!=end && *it == ",") + { + //skip after ring is parsed + ++it; + } + } handle_close_parenthesis(it, end, wkt); } @@ -584,7 +589,7 @@ struct geometry_parser { static inline void apply(std::string const& wkt, Geometry& geometry) { - //geometry::clear(geometry); + geometry::clear(geometry); tokenizer tokens(wkt, boost::char_separator(" ", ",()")); tokenizer::iterator it, end; @@ -933,7 +938,7 @@ struct read_wkt template inline void read_wkt(std::string const& wkt, Geometry& geometry) { - //geometry::concepts::check(); + geometry::concepts::check(); dispatch::read_wkt::type, Geometry>::apply(wkt, geometry); }