12 Ekim 2017 Perşembe

geometry BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS

Giriş
Bu macro boost'un kendi iç macrosu ama niyeyse kodlarda kullanılıyor.

Örnek
Şöyle yaparız.
class LocationWayPoint
{
public:
  latlong_container location;
  ...
};

namespace boost { namespace geometry { namespace traits {
 BOOST_GEOMETRY_DETAIL_SPECIALIZE_POINT_TRAITS(LocationWayPoint, 2, double, cs::cartesian)

  template<> struct access<LocationWayPoint, 0> {
    static inline double get(LocationWayPoint const& p) {return p.location.long; }
    static inline void set(LocationWayPoint& p, double const& v) {p.location.long = v; }
  };
  template<> struct access<LocationWayPoint, 1> {
    static inline double get(LocationWayPoint const& p) {return p.location.lat; }
    static inline void set(LocationWayPoint& p, double const& v) {p.location.lat = v; }
  };
}}}
typedef bg::model::linestring<LocationWayPoint> location_linestring_t;

Hiç yorum yok:

Yorum Gönder