GenericPolygon.h 890 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#pragma once

#include <QPolygonF>
#include <QPointF>

#include "ros_bridge/include/messages/geometry_msgs/polygon_stamped.h"

template <class PointType = QPointF, template <class, class...> class ContainerType = QVector>
class GenericPolygon{ //
    typedef ros_bridge::messages::geometry_msgs::polygon::GenericPolygon<PointType, ContainerType> Polygon;
public:
    GenericPolygon(){}
    GenericPolygon(const GenericPolygon &other) : _polygon(other._polygon){}

    GenericPolygon& operator=(const GenericPolygon& other) {
        this->_polygon = other._polygon;
        return *this;
    }

    const Polygon &polygon() const {return _polygon;}
          Polygon &polygon()       {return _polygon;}

  const ContainerType<PointType> &path() const {return _polygon.points();}
        ContainerType<PointType> &path()       {return _polygon.points();}

private:
    Polygon _polygon;

};