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, QString codec );
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 transparencyCode = 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 writeFilledCircle(
const QString &layer, QColor color,
const QgsPoint &pt,
double radius );
96 void writeCircle(
const QString &layer, QColor color,
const QgsPoint &pt,
double radius,
const QString &lineStyleName,
double width );
98 void writeText(
const QString &layer,
const QString &text,
const QgsPoint &pt,
double size,
double angle, QColor color );
100 void writeMText(
const QString &layer,
const QString &text,
const QgsPoint &pt,
double width,
double angle, QColor color );
105 static QString dxfLayerName(
const QString &name );
108 static QString dxfEncoding(
const QString &name );
111 static QStringList encodings();
114 QList< QPair<QgsVectorLayer*, int> > mLayers;
119 double mSymbologyScaleDenominator;
120 SymbologyExport mSymbologyExport;
123 QTextStream mTextStream;
125 static int mDxfColors[][3];
126 static const char *mDxfEncodings[][2];
128 int mSymbolLayerCounter;
132 QHash< const QgsSymbolLayerV2*, QString > mLineStyles;
133 QHash< const QgsSymbolLayerV2*, QString > mPointSymbolBlocks;
136 void writeHeader( QString codepage );
139 void writeEntities();
147 void writeVertex(
const QgsPoint &pt,
const QString &layer );
148 void writeDefaultLinetypes();
161 static int color_distance( QRgb p1,
int index );
162 static QRgb createRgbEntry( qreal r, qreal g, qreal b );
167 QList< QPair< QgsSymbolLayerV2 *, QgsSymbolV2 * > > symbolLayers();
168 static int nLineTypes(
const QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2*> > &symbolLayers );
170 double dashSize()
const;
171 double dotSize()
const;
172 double dashSeparatorSize()
const;
173 double sizeToMapUnits(
double s )
const;
174 static QString lineNameFromPenStyle( Qt::PenStyle style );
175 bool layerIsScaleBasedVisible(
const QgsMapLayer *layer )
const;
180 #endif // QGSDXFEXPORT_H