|
Geometry : |
Subject: [ggl] Derived classes and traits
From: vd (zedxz2)
Date: 2011-08-20 03:40:22
Hello, I am starting to play with bg and I want to derive/abstract a couple
of things using it.
For example, a derived point class:
namespace bg = boost::geometry;
template <typename CoordinateType, std::size_t DimensionCount, typename
CoordinateSystem>
class MyPointType : public bg::model::point<CoordinateType, DimensionCount,
CoordinateSystem >
{
// Add possible new functionality here.
};
typedef MyPointType<int32_t, 2, bg::cs::cartesian> MyIntPoint2;
typedef MyPointType<int32_t, 3, bg::cs::cartesian> MyIntPoint3;
This works fine. However, when trying to derive one more level, I'm facing a
problem:
class SomethingDerivedAgain : MyIntPoint3
{
public:
SomethingDerivedAgain(...) // How to access MyIntPoint3's CoordinateType
(abstractly of course, without assuming it's int32_t) so that I can override
the (v0,v1,v2) constructor of bg::model::point ??
private:
// Incredible new stuff here
};
Would "traits" help me achieve this ? Could you provide a snippet of usage
example ? That would be very appreciated.
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/ggl/attachments/20110818/6d5a5ecc/attachment.html
Geometry list run by mateusz at loskot.net