CS Lab machines have met their nemesis
[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                         QuadTreeIndex GenQuadNode(QuadTreeIndex parent, QuadTreeNodeChildren type);
31 #endif
32
33                 private:
34                         friend class View;
35                         Objects m_objects;
36 #ifndef QUADTREE_DISABLED
37                         QuadTree m_quadtree;
38                         void GenBaseQuadtree();
39 #endif
40                         unsigned m_count;
41                         
42
43         };
44 }
45
46 #endif //_DOCUMENT_H

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