|
Geometry : |
Subject: [ggl] namespaces, models and algorithms (was: namespaces and ADL)
From: Krzysztof Czainski (1czajnik)
Date: 2010-12-15 18:52:02
Hi Berand, Mateusz
A comment from a noobie follows.
2010/12/15 Mateusz Loskot <mateusz_at_[hidden]>
> On 15/12/10 21:28, barend wrote:>
>
[...]
> > ==================
> > NO-CHANGE: other namespaces
> > In your mail you mention namespaces for dispatch, going to
> implementation,
> > etc. That all has been realized and I didn't propose to change that. It
> is
> > very useful. Those are detail namespaces, not exposed to library users.
>
> I actually think Hartmut has a point. boost::geometry::traits does not
> suggest it's an implementation detail, and I'd bet users may want to use
> them. I'd move all details down in to boost::geometry::detail::,
> namely boost::geometry::detail::traits, boost::geometry::detail::dispatch
The namespace geometry::traits does look pretty public to me. Isn't it there
for the user to specialize things?
Below is what i wrote to integrate my geo class template with geometry, and
it seems to work fine.
I think traits should not go into details, unless I wasn't suppose to
specialize these traits, and should have achieved my goal some other way...
/// @tparam T floating point type for storing latitude and longitude in
degrees
template < class T >
class geo;
namespace boost { namespace geometry { namespace traits {
template < class T >
struct tag< geo<T> > { typedef point_tag type; };
template < class T >
struct dimension< geo<T> > : mpl::int_<2> {};
template < class T >
struct coordinate_type< geo<T> > { typedef T type; };
template < class T >
struct coordinate_system< geo<T> > { typedef cs::geographic<degree> type; };
template < class T >
struct access< geo<T>, 0 >
{
static inline T get( geo<T> const& p )
{
return p.lon();
}
static inline void set( geo<T>& p, T value )
{
p.set_lon(value);
};
};
template < class T >
struct access< geo<T>, 1 >
{
static inline T get( geo<T> const& p )
{
return p.lat();
}
static inline void set( geo<T>& p, T value )
{
p.set_lat(value);
}
};
}}} // boost::geometry::traits
Regards, Kris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20101216/4590672a/attachment-0001.html
Geometry list run by mateusz at loskot.net