#pragma once

#include <QPolygonF>
#include <QPointF>

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

namespace polygon_stamped = ros_bridge::messages::geometry_msgs::polygon_stamped;

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

    Polygon2DTemplate& operator=(const Polygon2DTemplate& 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;

};

typedef Polygon2DTemplate<> Polygon2D;
