Skip to content

Commit 80442cb

Browse files
Added wkt read feature to polyhedral surfaces
1 parent b347d87 commit 80442cb

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

include/boost/geometry/algorithms/clear.hpp

+5
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ struct clear<Geometry, ring_tag>
123123
: detail::clear::collection_clear<Geometry>
124124
{};
125125

126+
// Clear for Polyhedral surface
127+
template <typename Geometry>
128+
struct clear<Geometry, polyhedral_surface_tag>
129+
: detail::clear::no_action<Geometry>
130+
{};
126131

127132
// Polygon can (indirectly) use std for clear
128133
template <typename Polygon>

include/boost/geometry/geometries/PolyhedralSurface.hpp

-21
Original file line numberDiff line numberDiff line change
@@ -102,28 +102,7 @@ struct Poly_ring_type
102102
>::ring_type& type;
103103
};
104104

105-
/*template
106-
<
107-
typename Ring,
108-
template<typename, typename> class Container,
109-
template<typename> class Allocator
110-
>
111-
struct ring_type
112-
<
113-
model::PolyhedralSurface
114-
<
115-
Ring,
116-
Container, Allocator
117-
>
118-
>
119-
{
120-
typedef typename model::PolyhedralSurface
121-
<
122-
Ring,
123-
Container, Allocator
124-
>::ring_type& type;
125105

126-
};*/
127106

128107

129108
} // namespace traits

include/boost/geometry/geometries/concepts/PolyhedralSurface_concept.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ class PolyhedralSurface
2727
BOOST_CONCEPT_USAGE(PolyhedralSurface)
2828
{
2929

30-
Geometry* polyhedralSurface = 0;
31-
ring_type* ring = 0;
32-
3330
}
3431
#endif
3532

include/boost/geometry/io/wkt/read.hpp

+11-6
Original file line numberDiff line numberDiff line change
@@ -462,13 +462,18 @@ struct polyhderal_surface_parser
462462
static inline void apply(tokenizer::iterator& it,
463463
tokenizer::iterator const& end,
464464
std::string const& wkt,
465-
PolyhedralSurface& ring)
465+
PolyhedralSurface& Poly)
466466
{
467467
handle_open_parenthesis(it, end, wkt);
468-
int i = 0;
468+
typename ring_type<PolyhedralSurface>::type ring;
469469
while(it != end && *it != ")"){
470-
//appender::apply(it, end, wkt, ring);
471-
i++;
470+
appender::apply(it, end, wkt, ring);
471+
if(it!=end && *it == ",")
472+
{
473+
//skip after ring is parsed
474+
++it;
475+
}
476+
472477
}
473478
handle_close_parenthesis(it, end, wkt);
474479
}
@@ -584,7 +589,7 @@ struct geometry_parser
584589
{
585590
static inline void apply(std::string const& wkt, Geometry& geometry)
586591
{
587-
//geometry::clear(geometry);
592+
geometry::clear(geometry);
588593

589594
tokenizer tokens(wkt, boost::char_separator<char>(" ", ",()"));
590595
tokenizer::iterator it, end;
@@ -933,7 +938,7 @@ struct read_wkt<segment_tag, Segment>
933938
template <typename Geometry>
934939
inline void read_wkt(std::string const& wkt, Geometry& geometry)
935940
{
936-
//geometry::concepts::check<Geometry>();
941+
geometry::concepts::check<Geometry>();
937942
dispatch::read_wkt<typename tag<Geometry>::type, Geometry>::apply(wkt, geometry);
938943
}
939944

0 commit comments

Comments
 (0)