*/
class Drawing: public RS_Document
{
-public:
- Drawing(RS_EntityContainer * parent = NULL);
- virtual ~Drawing();
-
- virtual RS2::EntityType rtti() const;
- virtual unsigned long int countLayerEntities(RS_Layer * layer);
- virtual RS_LayerList * getLayerList();
- virtual RS_BlockList * getBlockList();
- virtual void newDoc();
- virtual bool save();
- virtual bool saveAs(const QString& filename, RS2::FormatType type);
- virtual bool open(const QString& filename, RS2::FormatType type);
-
- // Wrappers for Layer functions:
- void clearLayers();
- uint countLayers() const;
- RS_Layer * layerAt(uint i);
- void activateLayer(const QString & name);
- void activateLayer(RS_Layer * layer);
- RS_Layer * getActiveLayer();
- virtual void addLayer(RS_Layer * layer);
- virtual void removeLayer(RS_Layer * layer);
- virtual void editLayer(RS_Layer * layer, const RS_Layer & source);
- RS_Layer * findLayer(const QString & name);
- void toggleLayer(const QString & name);
- void toggleLayer(RS_Layer * layer);
- void toggleLayerLock(RS_Layer * layer);
- void freezeAllLayers(bool freeze);
- void addLayerListListener(RS_LayerListListener * listener);
- void removeLayerListListener(RS_LayerListListener * listener);
-
- // Wrapper for block functions:
- void clearBlocks();
- uint countBlocks();
- RS_Block * blockAt(uint i);
- void activateBlock(const QString & name);
- void activateBlock(RS_Block * block);
- RS_Block * getActiveBlock();
- virtual bool addBlock(RS_Block * block, bool notify = true);
- virtual void addBlockNotification();
- virtual void removeBlock(RS_Block * block);
- RS_Block * findBlock(const QString & name);
- QString newBlockName();
- void toggleBlock(const QString & name);
- void toggleBlock(RS_Block * block);
- void freezeAllBlocks(bool freeze);
- void addBlockListListener(RS_BlockListListener * listener);
- void removeBlockListListener(RS_BlockListListener * listener);
-
- // Wrappers for variable functions:
- void clearVariables();
- int countVariables();
- void addVariable(const QString & key, const Vector & value, int code);
- void addVariable(const QString & key, const QString & value, int code);
- void addVariable(const QString & key, int value, int code);
- void addVariable(const QString & key, double value, int code);
- Vector getVariableVector(const QString & key, const Vector & def);
- QString getVariableString(const QString & key, const QString & def);
- int getVariableInt(const QString & key, int def);
- double getVariableDouble(const QString & key, double def);
- void removeVariable(const QString & key);
-// Q3Dict<RS_Variable> & getVariableDict();
- QMultiHash<QString, RS_Variable *> & getVariableDict();
-
- RS2::LinearFormat getLinearFormat();
- int getLinearPrecision();
- RS2::AngleFormat getAngleFormat();
- int getAnglePrecision();
-
- Vector getPaperSize();
- void setPaperSize(const Vector & s);
-
- Vector getPaperInsertionBase();
- void setPaperInsertionBase(const Vector & p);
-
- RS2::PaperFormat getPaperFormat(bool * landscape);
- void setPaperFormat(RS2::PaperFormat f, bool landscape);
-
- double getPaperScale();
- void setPaperScale(double s);
-
- virtual void setUnit(RS2::Unit u);
- virtual RS2::Unit getUnit();
-
- bool isGridOn();
- void setGridOn(bool on);
-
- bool isDraftOn();
- void setDraftOn(bool on);
-
- void centerToPage();
- void fitToPage();
- virtual bool isModified() const;
- virtual void setModified(bool m);
-
+ public:
+ Drawing(RS_EntityContainer * parent = NULL);
+ virtual ~Drawing();
+
+ virtual RS2::EntityType rtti() const;
+ virtual unsigned long int countLayerEntities(RS_Layer * layer);
+ virtual RS_LayerList * getLayerList();
+ virtual RS_BlockList * getBlockList();
+ virtual void newDoc();
+ virtual bool save();
+ virtual bool saveAs(const QString& filename, RS2::FormatType type);
+ virtual bool open(const QString& filename, RS2::FormatType type);
+
+ // Wrappers for Layer functions:
+ void clearLayers();
+ uint countLayers() const;
+ RS_Layer * layerAt(uint i);
+ void activateLayer(const QString & name);
+ void activateLayer(RS_Layer * layer);
+ RS_Layer * getActiveLayer();
+ virtual void addLayer(RS_Layer * layer);
+ virtual void removeLayer(RS_Layer * layer);
+ virtual void editLayer(RS_Layer * layer, const RS_Layer & source);
+ RS_Layer * findLayer(const QString & name);
+ void toggleLayer(const QString & name);
+ void toggleLayer(RS_Layer * layer);
+ void toggleLayerLock(RS_Layer * layer);
+ void freezeAllLayers(bool freeze);
+// void addLayerListListener(RS_LayerListListener * listener);
+// void removeLayerListListener(RS_LayerListListener * listener);
+
+ // Wrapper for block functions:
+ void clearBlocks();
+ uint countBlocks();
+ RS_Block * blockAt(uint i);
+ void activateBlock(const QString & name);
+ void activateBlock(RS_Block * block);
+ RS_Block * getActiveBlock();
+ virtual bool addBlock(RS_Block * block, bool notify = true);
+ virtual void addBlockNotification();
+ virtual void removeBlock(RS_Block * block);
+ RS_Block * findBlock(const QString & name);
+ QString newBlockName();
+ void toggleBlock(const QString & name);
+ void toggleBlock(RS_Block * block);
+ void freezeAllBlocks(bool freeze);
+// void addBlockListListener(RS_BlockListListener * listener);
+// void removeBlockListListener(RS_BlockListListener * listener);
+
+ // Wrappers for variable functions:
+ void clearVariables();
+ int countVariables();
+ void addVariable(const QString & key, const Vector & value, int code);
+ void addVariable(const QString & key, const QString & value, int code);
+ void addVariable(const QString & key, int value, int code);
+ void addVariable(const QString & key, double value, int code);
+ Vector getVariableVector(const QString & key, const Vector & def);
+ QString getVariableString(const QString & key, const QString & def);
+ int getVariableInt(const QString & key, int def);
+ double getVariableDouble(const QString & key, double def);
+ void removeVariable(const QString & key);
+ // Q3Dict<RS_Variable> & getVariableDict();
+ QMultiHash<QString, RS_Variable *> & getVariableDict();
+
+ RS2::LinearFormat getLinearFormat();
+ int getLinearPrecision();
+ RS2::AngleFormat getAngleFormat();
+ int getAnglePrecision();
+ Vector getPaperSize();
+ void setPaperSize(const Vector & s);
+ Vector getPaperInsertionBase();
+ void setPaperInsertionBase(const Vector & p);
+ RS2::PaperFormat getPaperFormat(bool * landscape);
+ void setPaperFormat(RS2::PaperFormat f, bool landscape);
+ double getPaperScale();
+ void setPaperScale(double s);
+ virtual void setUnit(RS2::Unit u);
+ virtual RS2::Unit getUnit();
+ bool isGridOn();
+ void setGridOn(bool on);
+ bool isDraftOn();
+ void setDraftOn(bool on);
+ void centerToPage();
+ void fitToPage();
+ virtual bool isModified() const;
+ virtual void setModified(bool m);
#ifdef RS_CAM
- RS_CamData & getCamData();
- void setCamData(const RS_CamData & d);
+ RS_CamData & getCamData();
+ void setCamData(const RS_CamData & d);
#endif
- friend std::ostream & operator<<(std::ostream & os, Drawing & g);
+ friend std::ostream & operator<<(std::ostream & os, Drawing & g);
-private:
- RS_LayerList layerList;
- RS_BlockList blockList;
- RS_VariableDict variableDict;
+ private:
+ RS_LayerList layerList;
+ RS_BlockList blockList;
+ RS_VariableDict variableDict;
#ifdef RS_CAM
- RS_CamData camData;
+ RS_CamData camData;
#endif
};