6 #include "variabledict.h"
15 * A graphic document which can contain entities layers and blocks.
17 * @author Andrew Mustun
19 class Drawing: public Document
22 Drawing(EntityContainer * parent = NULL);
25 virtual RS2::EntityType rtti() const;
26 virtual unsigned long int countLayerEntities(Layer * layer);
27 virtual LayerList * getLayerList();
28 virtual 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 Layer * layerAt(uint i);
38 void activateLayer(const QString & name);
39 void activateLayer(Layer * layer);
40 Layer * getActiveLayer();
41 virtual void addLayer(Layer * layer);
42 virtual void removeLayer(Layer * layer);
43 virtual void editLayer(Layer * layer, const Layer & source);
44 Layer * findLayer(const QString & name);
45 void toggleLayer(const QString & name);
46 void toggleLayer(Layer * layer);
47 void toggleLayerLock(Layer * layer);
48 void freezeAllLayers(bool freeze);
49 // void addLayerListListener(LayerListListener * listener);
50 // void removeLayerListListener(LayerListListener * listener);
52 // Wrapper for block functions:
55 Block * blockAt(uint i);
56 void activateBlock(const QString & name);
57 void activateBlock(Block * block);
58 Block * getActiveBlock();
59 virtual bool addBlock(Block * block, bool notify = true);
60 virtual void addBlockNotification();
61 virtual void removeBlock(Block * block);
62 Block * findBlock(const QString & name);
63 QString newBlockName();
64 void toggleBlock(const QString & name);
65 void toggleBlock(Block * block);
66 void freezeAllBlocks(bool freeze);
67 // void addBlockListListener(BlockListListener * listener);
68 // void removeBlockListListener(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<Variable> & getVariableDict();
83 QMultiHash<QString, Variable *> & getVariableDict();
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();
100 void setGridOn(bool on);
102 void setDraftOn(bool on);
105 virtual bool isModified() const;
106 virtual void setModified(bool m);
108 RS_CamData & getCamData();
109 void setCamData(const RS_CamData & d);
112 friend std::ostream & operator<<(std::ostream & os, Drawing & g);
117 VariableDict variableDict;