Boost logo

Geometry :

Subject: [ggl] BOOST_GEOMETRY_REGISTER_BOX documentation issue
From: Barend Gehrels (barend)
Date: 2011-11-13 10:16:02

Hi Jeff,

On 10-11-2011 18:50, Jeff Trull wrote:
> Hi all,
> If I understand correctly, the registration macro for custom boxes
> only currently handles cases where the min/max corners are class
> members, not methods.

You can use methods as well, e.g. here:

class my_box
     my_point m_ll, m_ur;
     public :
         inline my_point& ll() { return m_ll; }
         inline my_point& ur() { return m_ur; }

         inline my_point const& ll() const { return m_ll; }
         inline my_point const& ur() const { return m_ur; }

BOOST_GEOMETRY_REGISTER_BOX(my_box, my_point, ll(), ur())

Not the most probable scenario, but technically possible.

> For Point adapters this is spelled out by
> providing special macros with names containing GET_SET to
> differentiate them from the other macros. However, it seems that such
> a feature is not present for Boxes. This would not be a problem
> except that the BOOST_GEOMETRY_REGISTER_BOX html documentation says
> the MinCorner and MaxCorner parameters "should be public member or
> method". In fact I believe they must be members, and not methods. If
> I'm right about that, and because it may trip up others, I suggest
> removing the "or method" clause from the documentation, and ideally
> also creating a BOOST_GEOMETRY_REGISTER_BOX_GET_SET macro.

Yes, maybe we can do this for the box like we did for the point. We
were, in general, a little hesitant, we want to avoid creating dozens of
macros. The more complex the geometry type is, the more possibilities
there are. For that reason we did not provide them for polygons. Users
can specialize themselves, so there is never a problem.

But maybe the get/set for box is useful for many indeed.

Thanks, Barend

Geometry list run by mateusz at