Draw2D
Draw2D_api_interface.hh
Go to the documentation of this file.
1 /*
2 Copyright 2021 Arkadiusz Mielczarek
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 
6 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 
8 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
9 */
10 
11 #ifndef DR2D_API_INT_HH
12 #define DR2D_API_INT_HH
13 
14 #include <vector>
15 #include <string>
16 #include <iostream>
17 
28 namespace drawNS {
29 
35  class Point2D {
40  double data[2];
41  public:
45  Point2D() = delete;
51  Point2D(double x, double y) : data{x,y} {}
57  const double & operator[](uint ind) const {
58  if (ind < 2)
59  return data[ind];
60  std::cerr << "operator[] dla Point3D poza zakresem" << std::endl;
61  exit(1);
62  };
68  double & operator[](uint ind) {
69  if (ind < 2)
70  return data[ind];
71  std::cerr << "operator[] dla Point3D poza zakresem" << std::endl;
72  exit(1);
73  };
74  };
75 
86  class Draw2DAPI {
87  protected:
97  public:
102  Draw2DAPI(int ref_time_ms = 0) : refresh_rate_ms(ref_time_ms) {}
103  /*
104  * \brief virtual destructor.
105  */
106  virtual ~Draw2DAPI() {};
114  virtual uint draw_line(const Point2D & point1, const Point2D & point2, const std::string & color = "black") = 0;
121  virtual uint draw_polygonal_chain(const std::vector<Point2D> & points, const std::string & color = "black") = 0;
128  virtual void erase_shape(uint id) = 0;
134  virtual void change_shape_color(uint id, const std::string & color) = 0;
139  virtual void change_ref_time_ms(int ref_time_ms) = 0;
144  virtual void redraw() = 0;
145  };
146 
147 }
148 
149 #endif
int refresh_rate_ms
mode for ploting and time between auto-replots
Definition: Draw2D_api_interface.hh:96
Point2D(double x, double y)
Constructor.
Definition: Draw2D_api_interface.hh:51
double & operator[](uint ind)
Acess operator.
Definition: Draw2D_api_interface.hh:68
const double & operator[](uint ind) const
Acess operator.
Definition: Draw2D_api_interface.hh:57
Abstract interface for drawing class Abstract class used as interface for 2D drawing class implementa...
Definition: Draw2D_api_interface.hh:86
Draw2DAPI(int ref_time_ms=0)
Constructor.
Definition: Draw2D_api_interface.hh:102
Point2D()=delete
deleted non-parametric constructor to force using parametric.
Point in 2D Class represents point in 2D.
Definition: Draw2D_api_interface.hh:35
Namespace for drawing tools - abstract interface and 2D point Namespace for drawing tools - abstract ...
Definition: Dr2D_gnuplot_api.hh:24