18 #ifndef QGSDXFEXPORT_H 
   19 #define QGSDXFEXPORT_H 
   21 #include "qgis_core.h" 
   31 #include <QTextStream> 
   45 #define DXF_HANDSEED 100 
   46 #define DXF_HANDMAX 9999999 
   47 #define DXF_HANDPLOTSTYLE 0xf 
   77           , mLayerOutputAttributeIndex( layerOutputAttributeIndex )
 
   96         QString splitLayerAttribute() 
const;
 
  100         int mLayerOutputAttributeIndex = -1;
 
  113       FlagNoMText = 1 << 1, 
 
  115     Q_DECLARE_FLAGS( Flags, Flag )
 
  126       DeviceNotWritableError, 
 
  165       Is3DPolygonMesh = 16, 
 
  168       ContinuousPattern = 128, 
 
  171     Q_DECLARE_FLAGS( DxfPolylineFlags, DxfPolylineFlag )
 
  191     void setFlags( QgsDxfExport::Flags flags );
 
  198     QgsDxfExport::Flags flags() 
const;
 
  205     void addLayers( 
const QList< QgsDxfExport::DxfLayer > &layers );
 
  213     ExportResult writeToFile( QIODevice *d, 
const QString &codec );  
 
  310     static int closestColorMatch( QRgb color );
 
  318     QString layerName( 
const QString &
id, 
const QgsFeature &f ) 
const;
 
  334     void writeGroup( 
int code, 
int i ) 
SIP_PYNAME( writeGroupInt );
 
  342     void writeGroup( 
int code, 
long long i ) 
SIP_PYNAME( writeGroupLong );
 
  350     void writeGroup( 
int code, 
double d ) 
SIP_PYNAME( writeGroupDouble );
 
  357     void writeGroup( 
int code, 
const QString &s );
 
  376     void writeGroup( 
const QColor &color, 
int exactMatch = 62, 
int rgbCode = 420, 
int transparencyCode = 440 );
 
  382     void writeGroupCode( 
int code );
 
  388     void writeInt( 
int i );
 
  394     void writeDouble( 
double d );
 
  400     void writeString( 
const QString &s );
 
  408     int writeHandle( 
int code = 5, 
int handle = 0 );
 
  420     void writePolyline( 
const QgsPointSequence &line, 
const QString &layer, 
const QString &lineStyleName, 
const QColor &color, 
double width = -1 ) 
SIP_SKIP;
 
  432     void writePolyline( const 
QgsCurve &curve, const QString &layer, const QString &lineStyleName, const QColor &color, 
double width = -1 ) 
SIP_SKIP;
 
  443     void writePolygon( const 
QgsRingSequence &polygon, const QString &layer, const QString &hatchPattern, const QColor &color ) 
SIP_SKIP;
 
  454     void writePolygon( const 
QgsCurvePolygon &polygon, const QString &layer, const QString &hatchPattern, const QColor &color ) 
SIP_SKIP;
 
  460     void writeLine( const 
QgsPoint &pt1, const 
QgsPoint &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, 
double width = -1 );
 
  467     void writePoint( const QString &layer, const QColor &color, const 
QgsPoint &pt ) 
SIP_PYNAME( writePointV2 );
 
  474     void writeFilledCircle( const QString &layer, const QColor &color, const 
QgsPoint &pt, 
double radius ) 
SIP_PYNAME( writeFillCircleV2 );
 
  481     void writeCircle( const QString &layer, const QColor &color, const 
QgsPoint &pt, 
double radius, const QString &lineStyleName, 
double width ) 
SIP_PYNAME( writeCircleV2 );
 
  495     void writeMText( const QString &layer, const QString &text, const 
QgsPoint &pt, 
double width, 
double angle, const QColor &color );
 
  504     static 
double mapUnitScaleFactor( 
double scale, 
QgsUnitTypes::RenderUnit symbolUnits, 
QgsUnitTypes::DistanceUnit mapUnits, 
double mapUnitsPerPixel = 1.0 );
 
  512     void clipValueToMapUnitScale( 
double &value, const 
QgsMapUnitScale &scale, 
double pixelToMMFactor ) const;
 
  515     static QString dxfLayerName( const QString &name );
 
  518     static QString dxfEncoding( const QString &name );
 
  521     static QStringList encodings();
 
  538     Q_DECL_DEPRECATED 
void registerDxfLayer( const QString &layerId, 
QgsFeatureId fid, const QString &layer );
 
  549     double mSymbologyScale = 1.0;
 
  550     SymbologyExport mSymbologyExport = NoSymbology;
 
  552     bool mLayerTitleAsName = 
false;
 
  554     QTextStream mTextStream;
 
  556     int mSymbolLayerCounter = 0; 
 
  558     int mBlockCounter = 0;
 
  560     QHash< const QgsSymbolLayer *, QString > mLineStyles; 
 
  561     QHash< const QgsSymbolLayer *, QString > mPointSymbolBlocks; 
 
  564     void writeHeader( 
const QString &codepage );
 
  565     void prepareRenderers();
 
  568     void writeEntities();
 
  569     void writeEntitiesSymbolLevels( 
DxfLayerJob *job );
 
  570     void stopRenderers();
 
  577     void writeDefaultLinetypes();
 
  578     void writeSymbolLayerLinetype( 
const QgsSymbolLayer *symbolLayer );
 
  610     QString lineStyleFromSymbolLayer( 
const QgsSymbolLayer *symbolLayer );
 
  613     static int color_distance( QRgb p1, 
int index );
 
  614     static QRgb createRgbEntry( qreal r, qreal g, qreal b );
 
  619     QList< QPair< QgsSymbolLayer *, QgsSymbol * > > symbolLayers( 
QgsRenderContext &context );
 
  620     static int nLineTypes( 
const QList< QPair< QgsSymbolLayer *, QgsSymbol *> > &symbolLayers );
 
  622     double dashSize() 
const;
 
  623     double dotSize() 
const;
 
  624     double dashSeparatorSize() 
const;
 
  625     double sizeToMapUnits( 
double s ) 
const;
 
  626     static QString lineNameFromPenStyle( Qt::PenStyle style );
 
  627     bool layerIsScaleBasedVisible( 
const QgsMapLayer *layer ) 
const;
 
  629     QHash<QString, int> mBlockHandles;
 
  630     QString mBlockHandle;
 
  633     QMap< QString, QMap<QgsFeatureId, QString> > mDxfLayerNames;
 
  636     QHash<QString, int> mLayerNameAttribute;
 
  637     double mFactor = 1.0;
 
  638     bool mForce2d = 
false;
 
  640     QgsDxfExport::Flags mFlags = QgsDxfExport::Flags();
 
  642     void appendCurve( 
const QgsCurve &
c, QVector<QgsPoint> &points, QVector<double> &bulges );
 
  643     void appendLineString( 
const QgsLineString &ls, QVector<QgsPoint> &points, QVector<double> &bulges );
 
  644     void appendCircularString( 
const QgsCircularString &cs, QVector<QgsPoint> &points, QVector<double> &bulges );
 
  645     void appendCompoundCurve( 
const QgsCompoundCurve &cc, QVector<QgsPoint> &points, QVector<double> &bulges );
 
  649     QList<DxfLayerJob *> mJobs;
 
  650     std::unique_ptr<QgsLabelingEngine> mLabelingEngine;
 
  656 #endif // QGSDXFEXPORT_H