18 #ifndef QGSDXFEXPORT_H
19 #define QGSDXFEXPORT_H
25 #include <QTextStream>
47 void addLayers(
const QList< QPair<QgsVectorLayer *, int > > &layers );
48 int writeToFile( QIODevice* d );
63 static int closestColorMatch( QRgb pixel );
65 QString layerName(
const QString &
id,
const QgsFeature &f )
const;
68 void writeGroup(
int code,
int i );
70 void writeGroup(
int code,
double d );
71 void writeGroup(
int code,
const QString& s );
72 void writeGroupCode(
int code );
73 void writeInt(
int i );
74 void writeDouble(
double d );
75 void writeString(
const QString& s );
76 void writeGroup(
int code,
const QgsPoint &p,
double z = 0.0,
bool skipz =
false );
77 void writeGroup( QColor color,
int exactMatch = 62,
int rgbCode = 420,
int tranparencyCode = 440 );
79 int writeHandle(
int code = 5,
int handle = 0 );
82 void writePolyline(
const QgsPolyline& line,
const QString& layer,
const QString& lineStyleName, QColor color,
83 double width = -1,
bool polygon =
false );
85 void writePolygon(
const QgsPolygon &polygon,
const QString &layer,
const QString &hatchPattern, QColor color );
90 void writeLine(
const QgsPoint& pt1,
const QgsPoint& pt2,
const QString& layer,
const QString& lineStyleName, QColor color,
double width = -1 );
92 void writePoint(
const QString& layer, QColor color,
const QgsPoint& pt );
94 void writeCircle(
const QString& layer, QColor color,
const QgsPoint& pt,
double radius );
96 void writeText(
const QString& layer,
const QString& text,
const QgsPoint& pt,
double size,
double angle, QColor color );
98 void writeMText(
const QString& layer,
const QString& text,
const QgsPoint& pt,
double width,
double angle, QColor color );
102 static QString dxfLayerName(
const QString& name );
105 QList< QPair<QgsVectorLayer*, int> > mLayers;
110 double mSymbologyScaleDenominator;
111 SymbologyExport mSymbologyExport;
114 QTextStream mTextStream;
116 static int mDxfColors[][3];
118 int mSymbolLayerCounter;
122 QHash< const QgsSymbolLayerV2*, QString > mLineStyles;
123 QHash< const QgsSymbolLayerV2*, QString > mPointSymbolBlocks;
129 void writeEntities();
137 void writeVertex(
const QgsPoint& pt,
const QString& layer );
138 void writeDefaultLinetypes();
144 void writeHeaderAC1018( QTextStream& stream );
145 void writeTablesAC1018( QTextStream& stream );
146 void writeEntitiesAC1018( QTextStream& stream );
147 void writeEntitiesSymbolLevelsAC1018( QTextStream& stream,
QgsVectorLayer* layer );
148 void writeSymbolLayerLinetypeAC1018( QTextStream& stream,
const QgsSymbolLayerV2* symbolLayer );
149 void writeLinetypeAC1018( QTextStream& stream,
const QString& styleName,
const QVector<qreal>& pattern,
QgsSymbolV2::OutputUnit u );
150 void writeVertexAC1018( QTextStream& stream,
const QgsPoint& pt );
151 void writePolylineAC1018( QTextStream& stream,
const QgsPolyline& line,
const QString& layer,
const QString& lineStyleName, QColor color,
152 double width = -1,
bool polygon =
false );
164 static int color_distance( QRgb p1,
int index );
165 static QRgb createRgbEntry( qreal r, qreal g, qreal b );
170 QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2* > > symbolLayers();
171 static int nLineTypes(
const QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2*> >& symbolLayers );
173 double dashSize()
const;
174 double dotSize()
const;
175 double dashSeparatorSize()
const;
176 double sizeToMapUnits(
double s )
const;
177 static QString lineNameFromPenStyle( Qt::PenStyle style );
178 bool layerIsScaleBasedVisible(
const QgsMapLayer* layer )
const;
183 #endif // QGSDXFEXPORT_H