4 #include "rs_blocklist.h"
5 #include "rs_layerlist.h"
6 #include "rs_variabledict.h"
7 #include "rs_document.h"
9 #include "rs_camdata.h"
15 * A graphic document which can contain entities layers and blocks.
17 * @author Andrew Mustun
19 class Drawing: public RS_Document
22 Drawing(RS_EntityContainer * parent = NULL);
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();
31 virtual bool saveAs(const QString& filename, RS2::FormatType type);
32 virtual bool open(const QString& filename, RS2::FormatType type);
34 // Wrappers for Layer functions:
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);
52 // Wrapper for block functions:
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);
70 // Wrappers for variable functions:
71 void clearVariables();
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();
85 RS2::LinearFormat getLinearFormat();
86 int getLinearPrecision();
87 RS2::AngleFormat getAngleFormat();
88 int getAnglePrecision();
90 Vector getPaperSize();
91 void setPaperSize(const Vector & s);
93 Vector getPaperInsertionBase();
94 void setPaperInsertionBase(const Vector & p);
96 RS2::PaperFormat getPaperFormat(bool * landscape);
97 void setPaperFormat(RS2::PaperFormat f, bool landscape);
99 double getPaperScale();
100 void setPaperScale(double s);
102 virtual void setUnit(RS2::Unit u);
103 virtual RS2::Unit getUnit();
106 void setGridOn(bool on);
109 void setDraftOn(bool on);
113 virtual bool isModified() const;
114 virtual void setModified(bool m);
117 RS_CamData & getCamData();
118 void setCamData(const RS_CamData & d);
121 friend std::ostream & operator<<(std::ostream & os, Drawing & g);
124 RS_LayerList layerList;
125 RS_BlockList blockList;
126 RS_VariableDict variableDict;