24 #ifndef COM_DAFER45_TBTK_PLOT_PATH
25 #define COM_DAFER45_TBTK_PLOT_PATH
27 #include "TBTK/Plot/PlotCanvas.h"
28 #include "TBTK/Plot/Coordinate.h"
29 #include "TBTK/Plot/Decoration.h"
30 #include "TBTK/Plot/Drawable.h"
34 #include <opencv2/core/core.hpp>
39 class Path :
public Drawable{
45 Path(
const std::vector<Coordinate> &coordinates, Decoration &decoration);
51 void add(
const Coordinate &coordinate);
54 void setDecoration(
const Decoration &decoration);
57 virtual void draw(PlotCanvas &canvas);
60 virtual double getMinX()
const;
63 virtual double getMaxX()
const;
66 virtual double getMinY()
const;
69 virtual double getMaxY()
const;
72 std::vector<Coordinate> coordinates;
75 Decoration decoration;
82 const std::vector<Coordinate> &coordinates,
83 Decoration &decoration
85 this->coordinates = coordinates;
86 this->decoration = decoration;
92 inline void Path::add(
const Coordinate &coordinate){
93 coordinates.push_back(coordinate);
96 inline void Path::setDecoration(
const Decoration &decoration){
97 this->decoration = decoration;
100 inline double Path::getMinX()
const{
101 if(coordinates.size() == 0)
104 double min = coordinates[0].x;
105 for(
unsigned int n = 0; n < coordinates.size(); n++)
106 if(coordinates[n].x < min)
107 min = coordinates[n].x;
112 inline double Path::getMaxX()
const{
113 if(coordinates.size() == 0)
116 double max = coordinates[0].x;
117 for(
unsigned int n = 0; n < coordinates.size(); n++)
118 if(coordinates[n].x > max)
119 max = coordinates[n].x;
124 inline double Path::getMinY()
const{
125 if(coordinates.size() == 0)
128 double min = coordinates[0].y;
129 for(
unsigned int n = 0; n < coordinates.size(); n++)
130 if(coordinates[n].y < min)
131 min = coordinates[n].y;
136 inline double Path::getMaxY()
const{
137 if(coordinates.size() == 0)
140 double max = coordinates[0].y;
141 for(
unsigned int n = 0; n < coordinates.size(); n++)
142 if(coordinates[n].y > max)
143 max = coordinates[n].y;