]> Shamusworld >> Repos - architektonas/blob - src/base/drawing.h
Removed useless *Listener class and references.
[architektonas] / src / base / drawing.h
1 #ifndef RS_GRAPHIC_H
2 #define RS_GRAPHIC_H
3
4 #include "rs_blocklist.h"
5 #include "rs_layerlist.h"
6 #include "rs_variabledict.h"
7 #include "rs_document.h"
8 #ifdef RS_CAM
9 #include "rs_camdata.h"
10 #endif
11
12 //class RS_CamData;
13
14 /**
15  * A graphic document which can contain entities layers and blocks.
16  *
17  * @author Andrew Mustun
18  */
19 class Drawing: public RS_Document
20 {
21         public:
22                 Drawing(RS_EntityContainer * parent = NULL);
23                 virtual ~Drawing();
24
25                 virtual RS2::EntityType rtti() const;
26                 virtual unsigned long int countLayerEntities(RS_Layer * layer);
27                 virtual RS_LayerList * getLayerList();
28                 virtual RS_BlockList * getBlockList();
29                 virtual void newDoc();
30                 virtual bool save();
31                 virtual bool saveAs(const QString& filename, RS2::FormatType type);
32                 virtual bool open(const QString& filename, RS2::FormatType type);
33
34                 // Wrappers for Layer functions:
35                 void clearLayers();
36                 uint countLayers() const;
37                 RS_Layer * layerAt(uint i);
38                 void activateLayer(const QString & name);
39                 void activateLayer(RS_Layer * layer);
40                 RS_Layer * getActiveLayer();
41                 virtual void addLayer(RS_Layer * layer);
42                 virtual void removeLayer(RS_Layer * layer);
43                 virtual void editLayer(RS_Layer * layer, const RS_Layer & source);
44                 RS_Layer * findLayer(const QString & name);
45                 void toggleLayer(const QString & name);
46                 void toggleLayer(RS_Layer * layer);
47                 void toggleLayerLock(RS_Layer * layer);
48                 void freezeAllLayers(bool freeze);
49 //          void addLayerListListener(RS_LayerListListener * listener);
50 //          void removeLayerListListener(RS_LayerListListener * listener);
51
52                 // Wrapper for block functions:
53                 void clearBlocks();
54                 uint countBlocks();
55                 RS_Block * blockAt(uint i);
56                 void activateBlock(const QString & name);
57                 void activateBlock(RS_Block * block);
58                 RS_Block * getActiveBlock();
59                 virtual bool addBlock(RS_Block * block, bool notify = true);
60                 virtual void addBlockNotification();
61                 virtual void removeBlock(RS_Block * block);
62                 RS_Block * findBlock(const QString & name);
63                 QString newBlockName();
64                 void toggleBlock(const QString & name);
65                 void toggleBlock(RS_Block * block);
66                 void freezeAllBlocks(bool freeze);
67 //          void addBlockListListener(RS_BlockListListener * listener);
68 //          void removeBlockListListener(RS_BlockListListener * listener);
69
70                 // Wrappers for variable functions:
71                 void clearVariables();
72                 int countVariables();
73                 void addVariable(const QString & key, const Vector & value, int code);
74                 void addVariable(const QString & key, const QString & value, int code);
75                 void addVariable(const QString & key, int value, int code);
76                 void addVariable(const QString & key, double value, int code);
77                 Vector getVariableVector(const QString & key, const Vector & def);
78                 QString getVariableString(const QString & key, const QString & def);
79                 int getVariableInt(const QString & key, int def);
80                 double getVariableDouble(const QString & key, double def);
81                 void removeVariable(const QString & key);
82         //      Q3Dict<RS_Variable> & getVariableDict();
83                 QMultiHash<QString, RS_Variable *> & getVariableDict();
84
85                 RS2::LinearFormat getLinearFormat();
86                 int getLinearPrecision();
87                 RS2::AngleFormat getAngleFormat();
88                 int getAnglePrecision();
89                 Vector getPaperSize();
90                 void setPaperSize(const Vector & s);
91                 Vector getPaperInsertionBase();
92                 void setPaperInsertionBase(const Vector & p);
93                 RS2::PaperFormat getPaperFormat(bool * landscape);
94                 void setPaperFormat(RS2::PaperFormat f, bool landscape);
95                 double getPaperScale();
96                 void setPaperScale(double s);
97                 virtual void setUnit(RS2::Unit u);
98                 virtual RS2::Unit getUnit();
99                 bool isGridOn();
100                 void setGridOn(bool on);
101                 bool isDraftOn();
102                 void setDraftOn(bool on);
103                 void centerToPage();
104                 void fitToPage();
105                 virtual bool isModified() const;
106                 virtual void setModified(bool m);
107 #ifdef RS_CAM
108                 RS_CamData & getCamData();
109                 void setCamData(const RS_CamData & d);
110 #endif
111
112                 friend std::ostream & operator<<(std::ostream & os, Drawing & g);
113
114         private:
115                 RS_LayerList layerList;
116                 RS_BlockList blockList;
117                 RS_VariableDict variableDict;
118 #ifdef RS_CAM
119                 RS_CamData camData;
120 #endif
121 };
122
123 #endif