Merge branch 'master' of git.ucc.asn.au:ipdf/code
[ipdf/code.git] / src / document.h
1 #ifndef _DOCUMENT_H
2 #define _DOCUMENT_H
3
4 #include "ipdf.h"
5 #include "quadtree.h"
6
7 namespace IPDF
8 {
9         class Document
10         {
11                 public:
12                         Document(const std::string & filename = "") : m_objects(), m_count(0) {Load(filename);}
13                         virtual ~Document() {}
14
15                         void Load(const std::string & filename = "");
16                         void Save(const std::string & filename);
17                         void DebugDumpObjects();
18
19                         unsigned ObjectCount() const {return m_count;}
20                         inline const Objects & GetObjects() const {return m_objects;}
21
22                         bool operator==(const Document & equ) const;
23                         bool operator!=(const Document & equ) const {return !(this->operator==(equ));}
24
25                         void Add(ObjectType type, const Rect & bounds, unsigned data_index = 0);
26                         unsigned AddBezierData(const Bezier & bezier);
27
28 #ifndef QUADTREE_DISABLED
29                         inline const QuadTree& GetQuadTree() { if (m_quadtree.root_id == QUADTREE_EMPTY) { GenBaseQuadtree(); } return m_quadtree; }
30 #endif
31
32                 private:
33                         friend class View;
34                         Objects m_objects;
35 #ifndef QUADTREE_DISABLED
36                         QuadTree m_quadtree;
37                         void GenBaseQuadtree();
38 #endif
39                         unsigned m_count;
40                         
41
42         };
43 }
44
45 #endif //_DOCUMENT_H

UCC git Repository :: git.ucc.asn.au