Loading...
Searching...
No Matches
RectCollection.h
Go to the documentation of this file.
1#ifndef PDFTRON_H_CPPPDFRectCollection
2#define PDFTRON_H_CPPPDFRectCollection
3
4#include <PDF/Rect.h>
5#include <vector>
6
7namespace pdftron{ namespace PDF{
8
10{
11public:
14
15 void AddRect(const Rect& to_add)
16 {
17 AddRect(to_add.GetX1(), to_add.GetY1(), to_add.GetX2(), to_add.GetY2());
18 }
19
20 void AddRect(double x1, double y1, double x2, double y2)
21 {
22 InnerRect temp = {x1, y1, x2, y2};
23 m_rects.push_back(temp);
24 }
25
26 Rect GetRectAt(size_t index) const
27 {
28 const InnerRect& found = m_rects[index];
29 return Rect(found.x1, found.y1, found.x2, found.y2);
30 }
31
32 size_t GetNumRects() const
33 {
34 return m_rects.size();
35 }
36
37 void Clear()
38 {
39 m_rects.clear();
40 }
41
42private:
43 struct InnerRect{
44 double x1;
45 double y1;
46 double x2;
47 double y2;
48 };
49 std::vector<InnerRect> m_rects;
50};
51
52}
53}
54
55#endif // PDFTRON_H_CPPPDFRectCollection
void AddRect(double x1, double y1, double x2, double y2)
Rect GetRectAt(size_t index) const
void AddRect(const Rect &to_add)
double GetY2() const
double GetX2() const
double GetY1() const
double GetX1() const