-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed Writing 3D WKT:Z prefix #782
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,13 +113,14 @@ struct double_closing_parenthesis | |
/*! | ||
\brief Stream points as \ref WKT | ||
*/ | ||
template <typename Point, typename Policy> | ||
template <typename Point, typename Policy1, typename Policy2> | ||
struct wkt_point | ||
{ | ||
template <typename Char, typename Traits> | ||
static inline void apply(std::basic_ostream<Char, Traits>& os, Point const& p, bool) | ||
{ | ||
os << Policy::apply() << "("; | ||
if(dimension<Point>::type::value == 3) os << Policy2::apply() << "("; | ||
else os << Policy1::apply() << "("; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: do we always want a Apart from this it should be a compile time condition i/o a runtime condition. So we should dispatch based on dimension. But I'm not sure about that either, because if it is optional (as it probably should be), that might be inconvenient. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As far as I can see the specification indeed mentions a In my personal opinion, for a three dimensional point, a list with three coordinates is already enough. In reading we can read or not read the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would agree with @barendgehrels Another issue here is that after this change the following code
will output
I think we should decide how we want to support more than 2 dimensions and probably issue #664 is the right place for that. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @barendgehrels points out a valid issue.
From the OGC SFS point, we have:
It seems desirable indeed to keep the current WKT I/O that does not read/output the Perhaps, an acceptable solution would be an optional
where enum /*class*/ wkt_flavour
{
ogc2d, // OGC SFS 1.1.0
ogc3d, // OGC SFS 1.2.x
ogc25d, // Adam Gawne-Caine, 1999, Simple Features Revision Proposal
ewkt = ogc25d // PostGIS terminology
}; or as an entirely separate OGC-compliant |
||
stream_coordinate<Point, 0, dimension<Point>::type::value>::apply(os, p); | ||
os << ")"; | ||
} | ||
|
@@ -350,7 +351,8 @@ struct wkt<Point, point_tag> | |
: detail::wkt::wkt_point | ||
< | ||
Point, | ||
detail::wkt::prefix_point | ||
detail::wkt::prefix_point, | ||
detail::wkt::prefix_point_z | ||
> | ||
{}; | ||
|
||
|
@@ -417,6 +419,7 @@ struct wkt<Multi, multi_point_tag> | |
detail::wkt::wkt_point | ||
< | ||
typename boost::range_value<Multi>::type, | ||
detail::wkt::prefix_null, | ||
detail::wkt::prefix_null | ||
>, | ||
detail::wkt::prefix_multipoint | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note about style here, there should be an empty space between
if
and(
, there are not one lineif
s etc. You may want to consult https://github.com/boostorg/geometry/wiki/Guidelines-for-Developers