Open Source 2D CAD
Go to the documentation of this file.
23 #include "dxf_global.h"
26 #include "dxflib/src/dl_dxf.h"
28 #include "RArc.h"
29 #include "RDocument.h"
30 #include "RDxfServices.h"
31 #include "RFileExporter.h"
32 #include "RRay.h"
33 #include "RXLine.h"
35 class RArcEntity;
36 class RAttributeEntity;
37 class RCircleEntity;
38 class RDimensionEntity;
39 class REllipseEntity;
40 class RHatchEntity;
41 class RImageEntity;
42 class RLeaderEntity;
43 class RLineEntity;
44 class RMessageHandler;
45 class RPointEntity;
46 class RPolylineEntity;
47 class RProgressHandler;
48 class RRayEntity;
49 class RSolidEntity;
50 class RSplineEntity;
51 class RTraceEntity;
52 class RTextEntity;
53 class RTextBasedData;
54 class RTextBasedEntity;
55 class RXLineEntity;
64 public:
65  RDxfExporter(RDocument& document,
66  RMessageHandler* messageHandler = NULL,
67  RProgressHandler* progressHandler = NULL);
68  virtual ~RDxfExporter() {}
70  virtual QString getCorrectedFileName(const QString& fileName, const QString& nameFilter);
72  virtual bool exportFile(const QString& fileName, const QString& nameFilter, bool setFileName = true);
74  void writeVariables();
75  void writeLinetype(const RLinetypePattern& lt);
76  void writeLayer(const RLayer& l);
77  void writeBlock(const RBlock& b);
79  void writeEntity(REntity::Id id);
80  void writeEntity(const REntity& e);
81  void writePoint(const RPointEntity& p);
82  void writeLine(const RLineEntity& l);
83  void writeXLine(const RXLineEntity& l);
84  void writeRay(const RRayEntity& l);
85  void writeCircle(const RCircleEntity& c);
86  void writeArc(const RArcEntity& a);
87  void writeEllipse(const REllipseEntity& el);
88  void writePolyline(const RPolylineEntity& pl);
89  void writePolyline(const RPolyline& pl, bool plineGen);
90  void writeSpline(const RSplineEntity& sp);
91  DL_TextData getTextData(const RTextBasedData& t, const QString& styleName);
92  QString getStyleName(const RTextBasedEntity& t);
93  void writeText(const RTextEntity& t);
94  void writeAttribute(const RAttributeEntity& t);
95  void writeSimpleText(const RTextEntity& t);
96  void writeMText(const RTextEntity& t);
97  void writeDimension(const RDimensionEntity& d);
98  void writeLeader(const RLeaderEntity& l);
99  void writeHatch(const RHatchEntity& h);
100  void writeImage(const RImageEntity& img);
101  void writeSolid(const RSolidEntity& sol);
102  void writeTrace(const RTraceEntity& t);
104  void writeBlockReference(const RBlockReferenceEntity& br);
106  void writeImageDef(const RImageEntity& img);
108  virtual void exportPoint(const RPoint& point) {
109  Q_UNUSED(point)
110  }
112  virtual void exportArcSegment(const RArc& arc, bool allowForZeroLength = false) {
113  Q_UNUSED(arc)
114  Q_UNUSED(allowForZeroLength)
115  }
117  virtual void exportLineSegment(const RLine& line, double angle = RNANDOUBLE) {
118  Q_UNUSED(line)
119  Q_UNUSED(angle)
120  }
122  virtual void exportXLine(const RXLine& xLine) {
123  Q_UNUSED(xLine)
124  }
126  virtual void exportRay(const RRay& ray) {
127  Q_UNUSED(ray)
128  }
130  virtual void exportTriangle(const RTriangle& triangle) {
131  Q_UNUSED(triangle)
132  }
134  static QByteArray escapeUnicode(const QString& str);
136 private:
137  DL_Attributes getEntityAttributes(const REntity& entity);
138  DL_StyleData getStyle(const RTextBasedEntity& entity);
140 private:
145  QMap<int, QString> textStyles;
146  // maps image entity IDs to handles:
147  QMap<int, int> imageHandles;
149 };
153 #endif
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RMessageHandler.h:33
Implements functions defined in DL_Writer for writing low level DXF constructs to an ASCII format DXF...
Definition: dl_writer_ascii.h:49
DL_Dxf dxf
Definition: RDxfExporter.h:141
Base class for dimension entity classes.
Definition: RDimensionEntity.h:38
Point entity.
Definition: RImageEntity.h:38
DL_Attributes attributes
Definition: RDxfExporter.h:143
Reading and writing of DXF files.
Definition: dl_dxf.h:122
Solid entity.
Definition: RSolidEntity.h:38
Linear dimension entity class.
Definition: RTextEntity.h:38
virtual void exportXLine(const RXLine &xLine)
Exports an infinite line.
Definition: RDxfExporter.h:122
Low-level mathematical representation of a triangle.
Definition: RTriangle.h:46
Storing and passing around attributes.
Definition: dl_attributes.h:41
virtual void exportRay(const RRay &ray)
Exports an infinite ray.
Definition: RDxfExporter.h:126
Ellipse entity.
Definition: REllipseEntity.h:39
Low-level mathematical representation of an arc.
Definition: RArc.h:40
Text Data.
Definition: dl_entities.h:800
Represents a block definition in a drawing.
Definition: RBlock.h:44
virtual void exportLineSegment(const RLine &line, double angle=RNANDOUBLE)
Exports a line segment (a line without pattern).
Definition: RDxfExporter.h:117
Leader entity class.
Definition: RLeaderEntity.h:38
Exporter for the DXF format, based on dxflib.
Definition: RDxfExporter.h:63
Text style data.
Definition: dl_entities.h:130
Circle entity.
Definition: RCircleEntity.h:38
int Id
Definition: RObject.h:57
Base class for file exporters.
Definition: RFileExporter.h:42
virtual void exportArcSegment(const RArc &arc, bool allowForZeroLength=false)
Definition: RDxfExporter.h:112
QMap< int, QString > textStyles
Definition: RDxfExporter.h:145
DL_WriterA * dw
Definition: RDxfExporter.h:142
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RLinetypePattern.h:45
Arc entity.
Definition: RArcEntity.h:39
Point entity.
Definition: RPointEntity.h:38
Definition: RMath.h:71
Polyline entity.
Definition: RPolylineEntity.h:44
Stores and manages all data that defines the geometry and appearance of a text based entity (text...
Definition: RTextBasedData.h:44
Line entity.
Definition: RLineEntity.h:38
Infinite ray entity.
Definition: RRayEntity.h:38
Text entity.
Definition: RTextBasedEntity.h:38
Trace entity.
Definition: RTraceEntity.h:38
Base class for all entity classes.
Definition: REntity.h:64
Definition: dxf_global.h:10
A graphics document contains and owns entities, layers, user coordinate systems, variables, block definitions, etc.
Definition: RDocument.h:67
virtual bool exportFile(const QString &fileName, const QString &nameFilter, bool setFileName=true)=0
Must be implemented by file exporters to export the document into the given file. ...
int textStyleCounter
Definition: RDxfExporter.h:144
Spline entity.
Definition: RSplineEntity.h:42
Low-level mathematical representation of an infinite line.
Definition: RXLine.h:42
Low-level mathematical representation of a line.
Definition: RLine.h:41
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RPoint.h:38
virtual void exportPoint(const RPoint &point)
Exports a point with the current attributes.
Definition: RDxfExporter.h:108
virtual ~RDxfExporter()
Definition: RDxfExporter.h:68
Point entity.
Definition: RHatchEntity.h:38
virtual void exportTriangle(const RTriangle &triangle)
Exports a triangle with the current attributes.
Definition: RDxfExporter.h:130
Low-level mathematical representation of an open polyline or closed polyline (= polygon).
Definition: RPolyline.h:49
Represents a layer in a drawing.
Definition: RLayer.h:48
Infinite line entity.
Definition: RXLineEntity.h:38
QMap< int, int > imageHandles
Definition: RDxfExporter.h:147
Block reference entity.
Definition: RBlockReferenceEntity.h:38
bool minimalistic
Definition: RDxfExporter.h:148
virtual QString getCorrectedFileName(const QString &fileName, const QString &nameFilter)=0
Must be implemented by file exporters to correct the given file name if necessary (add extension base...
Low-level mathematical representation of a ray.
Definition: RRay.h:42
Attribute entity.
Definition: RAttributeEntity.h:39
Copyright (c) 2011-2017 by Andrew Mustun.
Definition: RProgressHandler.h:33