Polygon2D.h 1.01 KB
Newer Older
1 2 3 4 5
#pragma once

#include <QPolygonF>
#include <QPointF>

Valentin Platzgummer's avatar
Valentin Platzgummer committed
6
#include "ros_bridge/include/messages/geometry_msgs/polygon_stamped.h"
7

Valentin Platzgummer's avatar
Valentin Platzgummer committed
8
namespace polygon_stamped = ros_bridge::messages::geometry_msgs::polygon_stamped;
9

10
template <class PointType = QPointF, template <class, class...> class ContainerType = QVector>
Valentin Platzgummer's avatar
Valentin Platzgummer committed
11 12
class Polygon2DTemplate{ //
    typedef ros_bridge::messages::geometry_msgs::polygon::GenericPolygon<PointType, ContainerType> Polygon;
13
public:
14
    Polygon2DTemplate(){}
Valentin Platzgummer's avatar
Valentin Platzgummer committed
15
    Polygon2DTemplate(const Polygon2DTemplate &other) : _polygon(other._polygon){}
16

17 18
    Polygon2DTemplate& operator=(const Polygon2DTemplate& other) {
        this->_polygon = other._polygon;
19 20 21
        return *this;
    }

Valentin Platzgummer's avatar
Valentin Platzgummer committed
22 23
    const Polygon &polygon() const {return _polygon;}
          Polygon &polygon()       {return _polygon;}
24

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

private:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
29
    Polygon _polygon;
30 31

};
32 33

typedef Polygon2DTemplate<> Polygon2D;