- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
7 namespace pdftron{ namespace PDF{
8
9 class RectCollection
10 {
11 public:
12 RectCollection()
13 {}
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
42 private:
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
pdftron::PDF::Rect::GetY1
double GetY1() const
pdftron::PDF::RectCollection::AddRect
void AddRect(const Rect &to_add)
Definition: RectCollection.h:15
pdftron::PDF::RectCollection::AddRect
void AddRect(double x1, double y1, double x2, double y2)
Definition: RectCollection.h:20
pdftron::PDF::Rect
Definition: Rect.h:28
pdftron::PDF::Rect::GetX2
double GetX2() const
pdftron::PDF::Rect::GetY2
double GetY2() const
pdftron::PDF::RectCollection::GetRectAt
Rect GetRectAt(size_t index) const
Definition: RectCollection.h:26
pdftron::PDF::RectCollection
Definition: RectCollection.h:9
pdftron::PDF::Rect::GetX1
double GetX1() const
pdftron::PDF::RectCollection::GetNumRects
size_t GetNumRects() const
Definition: RectCollection.h:32
Rect.h
pdftron::PDF::RectCollection::RectCollection
RectCollection()
Definition: RectCollection.h:12
pdftron::PDF::RectCollection::Clear
void Clear()
Definition: RectCollection.h:37