QGIS API Documentation  2.15.0-Master (94d88e6)
Public Types | Public Member Functions | Static Public Member Functions | List of all members
QgsDxfExport Class Reference

#include <qgsdxfexport.h>

Public Types

enum  SymbologyExport { NoSymbology = 0, FeatureSymbology, SymbolLayerSymbology }
 

Public Member Functions

 QgsDxfExport ()
 
 QgsDxfExport (const QgsDxfExport &dxfExport)
 
 ~QgsDxfExport ()
 
void addLayers (const QList< QPair< QgsVectorLayer *, int > > &layers)
 Add layers to export. More...
 
void drawLabel (QString layerId, QgsRenderContext &context, pal::LabelPosition *label, const QgsPalLayerSettings &settings)
 Output the label. More...
 
QgsRectangle extent () const
 Get extent of area to export. More...
 
QString layerName (const QString &id, const QgsFeature &f) const
 Get layer name for feature. More...
 
QString layerName (QgsVectorLayer *vl) const
 Get name for layer respecting the use layer title as layer name mode. More...
 
bool layerTitleAsName ()
 Retrieve wether layer title (where set) instead of name shall be use. More...
 
QGis::UnitType mapUnits () const
 Retrieve map units. More...
 
QgsDxfExportoperator= (const QgsDxfExport &dxfExport)
 
void registerDxfLayer (QString layerId, QgsFeatureId fid, QString layer)
 Register name of layer for feature. More...
 
void setExtent (const QgsRectangle &r)
 Set extent of area to export. More...
 
void setLayerTitleAsName (bool layerTitleAsName)
 Enable use of title (where set) instead of layer name, when attribute index of corresponding layer index is -1. More...
 
void setMapUnits (QGis::UnitType u)
 Set map units. More...
 
void setSymbologyExport (SymbologyExport e)
 Set symbology export mode. More...
 
void setSymbologyScaleDenominator (double d)
 Set reference scale for output. More...
 
SymbologyExport symbologyExport () const
 Get symbology export mode. More...
 
double symbologyScaleDenominator () const
 Retrieve reference scale for output. More...
 
Q_DECL_DEPRECATED void writeCircle (const QString &layer, const QColor &color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width)
 Write circle (as polyline) More...
 
void writeCircle (const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius, const QString &lineStyleName, double width)
 Write circle (as polyline) More...
 
void writeDouble (double d)
 Write a floating point value. More...
 
Q_DECL_DEPRECATED void writeFilledCircle (const QString &layer, const QColor &color, const QgsPoint &pt, double radius)
 Write filled circle (as hatch) More...
 
void writeFilledCircle (const QString &layer, const QColor &color, const QgsPointV2 &pt, double radius)
 Write filled circle (as hatch) More...
 
void writeGroup (int code, int i)
 Write a tuple of group code and integer value. More...
 
void writeGroup (int code, double d)
 Write a group code with a floating point value. More...
 
void writeGroup (int code, const QString &s)
 Write a group code with a string value. More...
 
Q_DECL_DEPRECATED void writeGroup (int code, const QgsPoint &p, double z=0.0, bool skipz=false)
 Write a group code with a point. More...
 
void writeGroup (int code, const QgsPointV2 &p)
 Write a group code with a point. More...
 
void writeGroup (const QColor &color, int exactMatch=62, int rgbCode=420, int transparencyCode=440)
 Write a group code with color value. More...
 
void writeGroupCode (int code)
 Write a group code. More...
 
int writeHandle (int code=5, int handle=0)
 Write a tuple of group code and a handle. More...
 
void writeInt (int i)
 Write an integer value. More...
 
Q_DECL_DEPRECATED void writeLine (const QgsPoint &pt1, const QgsPoint &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
 Write line (as a polyline) More...
 
void writeLine (const QgsPointV2 &pt1, const QgsPointV2 &pt2, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
 Write line (as a polyline) More...
 
Q_DECL_DEPRECATED void writeMText (const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, const QColor &color)
 Write mtext (MTEXT) More...
 
void writeMText (const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor &color)
 Write mtext (MTEXT) More...
 
Q_DECL_DEPRECATED void writePoint (const QString &layer, const QColor &color, const QgsPoint &pt)
 Write point. More...
 
void writePoint (const QString &layer, const QColor &color, const QgsPointV2 &pt)
 Write point. More...
 
Q_DECL_DEPRECATED void writePolygon (const QgsPolygon &polygon, const QString &layer, const QString &hatchPattern, const QColor &color)
 Draw dxf filled polygon (HATCH) More...
 
void writePolygon (const QgsRingSequenceV2 &polygon, const QString &layer, const QString &hatchPattern, const QColor &color)
 Draw dxf filled polygon (HATCH) More...
 
Q_DECL_DEPRECATED void writePolyline (const QgsPolyline &line, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
 Draw dxf primitives (LWPOLYLINE) More...
 
void writePolyline (const QgsPointSequenceV2 &line, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1)
 Draw dxf primitives (LWPOLYLINE) More...
 
Q_DECL_DEPRECATED void writeSolid (const QString &layer, const QColor &color, const QgsPoint &pt1, const QgsPoint &pt2, const QgsPoint &pt3, const QgsPoint &pt4)
 Draw dxf filled polygon (SOLID) More...
 
void writeString (const QString &s)
 Write a string value. More...
 
Q_DECL_DEPRECATED void writeText (const QString &layer, const QString &text, const QgsPoint &pt, double size, double angle, const QColor &color)
 Write text (TEXT) More...
 
void writeText (const QString &layer, const QString &text, const QgsPointV2 &pt, double size, double angle, const QColor &color)
 Write text (TEXT) More...
 
int writeToFile (QIODevice *d, const QString &codec)
 Export to a dxf file in the given encoding. More...
 

Static Public Member Functions

static int closestColorMatch (QRgb color)
 Get DXF palette index of nearest entry for given color. More...
 
static QString dxfEncoding (const QString &name)
 return DXF encoding for Qt encoding More...
 
static QString dxfLayerName (const QString &name)
 Return cleaned layer name for use in DXF. More...
 
static QStringList encodings ()
 return list of available DXF encodings More...
 
static double mapUnitScaleFactor (double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, QGis::UnitType mapUnits)
 

Detailed Description

Definition at line 39 of file qgsdxfexport.h.

Member Enumeration Documentation

Enumerator
NoSymbology 
FeatureSymbology 
SymbolLayerSymbology 

Definition at line 42 of file qgsdxfexport.h.

Constructor & Destructor Documentation

QgsDxfExport::QgsDxfExport ( )

Definition at line 365 of file qgsdxfexport.cpp.

QgsDxfExport::QgsDxfExport ( const QgsDxfExport dxfExport)

Definition at line 376 of file qgsdxfexport.cpp.

QgsDxfExport::~QgsDxfExport ( )

Definition at line 394 of file qgsdxfexport.cpp.

Member Function Documentation

void QgsDxfExport::addLayers ( const QList< QPair< QgsVectorLayer *, int > > &  layers)

Add layers to export.

Parameters
layerslist of layers and corresponding attribute indexes that determine the layer name (-1 for original layer name or title)
See also
setLayerTitleAsName

Definition at line 398 of file qgsdxfexport.cpp.

int QgsDxfExport::closestColorMatch ( QRgb  color)
static

Get DXF palette index of nearest entry for given color.

Parameters
color

Definition at line 3914 of file qgsdxfexport.cpp.

void QgsDxfExport::drawLabel ( QString  layerId,
QgsRenderContext context,
pal::LabelPosition label,
const QgsPalLayerSettings settings 
)

Output the label.

Parameters
layerIdid of the layer
contextrender context
labelposition of label
settingslabel settings
Note
not available in Python bindings

Definition at line 4285 of file qgsdxfexport.cpp.

QString QgsDxfExport::dxfEncoding ( const QString name)
static

return DXF encoding for Qt encoding

Definition at line 4244 of file qgsdxfexport.cpp.

QString QgsDxfExport::dxfLayerName ( const QString name)
static

Return cleaned layer name for use in DXF.

Definition at line 4192 of file qgsdxfexport.cpp.

QStringList QgsDxfExport::encodings ( )
static

return list of available DXF encodings

Definition at line 4264 of file qgsdxfexport.cpp.

QgsRectangle QgsDxfExport::extent ( ) const
inline

Get extent of area to export.

Returns
area to export
See also
setExtent

Definition at line 119 of file qgsdxfexport.h.

QString QgsDxfExport::layerName ( const QString id,
const QgsFeature f 
) const

Get layer name for feature.

Parameters
idlayer id of layer
ffeature of layer
Returns
layer name for feature

Definition at line 4230 of file qgsdxfexport.cpp.

QString QgsDxfExport::layerName ( QgsVectorLayer vl) const

Get name for layer respecting the use layer title as layer name mode.

Parameters
vlthe vector layer
Returns
name of layer
See also
setLayerTitleAsName

Definition at line 4279 of file qgsdxfexport.cpp.

bool QgsDxfExport::layerTitleAsName ( )
inline

Retrieve wether layer title (where set) instead of name shall be use.

Returns
flag
See also
setLayerTitleAsName

Definition at line 134 of file qgsdxfexport.h.

QGis::UnitType QgsDxfExport::mapUnits ( ) const
inline

Retrieve map units.

Returns
unit
See also
setMapUnits

Definition at line 93 of file qgsdxfexport.h.

double QgsDxfExport::mapUnitScaleFactor ( double  scaleDenominator,
QgsSymbolV2::OutputUnit  symbolUnits,
QGis::UnitType  mapUnits 
)
static

Definition at line 3966 of file qgsdxfexport.cpp.

QgsDxfExport & QgsDxfExport::operator= ( const QgsDxfExport dxfExport)

Definition at line 381 of file qgsdxfexport.cpp.

void QgsDxfExport::registerDxfLayer ( QString  layerId,
QgsFeatureId  fid,
QString  layer 
)

Register name of layer for feature.

Parameters
layerIdid of layer
fidid of feature
layerdxf layer of feature

Definition at line 4422 of file qgsdxfexport.cpp.

void QgsDxfExport::setExtent ( const QgsRectangle r)
inline

Set extent of area to export.

Parameters
rarea to export

Definition at line 112 of file qgsdxfexport.h.

void QgsDxfExport::setLayerTitleAsName ( bool  layerTitleAsName)
inline

Enable use of title (where set) instead of layer name, when attribute index of corresponding layer index is -1.

Parameters
layerTitleAsNameflag
See also
addLayers

Definition at line 127 of file qgsdxfexport.h.

void QgsDxfExport::setMapUnits ( QGis::UnitType  u)
inline

Set map units.

Parameters
uunit

Definition at line 86 of file qgsdxfexport.h.

void QgsDxfExport::setSymbologyExport ( SymbologyExport  e)
inline

Set symbology export mode.

Parameters
ethe mode

Definition at line 99 of file qgsdxfexport.h.

void QgsDxfExport::setSymbologyScaleDenominator ( double  d)
inline

Set reference scale for output.

Parameters
dscale denominator

Definition at line 73 of file qgsdxfexport.h.

SymbologyExport QgsDxfExport::symbologyExport ( ) const
inline

Get symbology export mode.

Returns
mode
See also
setSymbologyExport

Definition at line 106 of file qgsdxfexport.h.

double QgsDxfExport::symbologyScaleDenominator ( ) const
inline

Retrieve reference scale for output.

Returns
reference scale
See also
setSymbologyScaleDenominator

Definition at line 80 of file qgsdxfexport.h.

void QgsDxfExport::writeCircle ( const QString layer,
const QColor color,
const QgsPoint pt,
double  radius,
const QString lineStyleName,
double  width 
)

Write circle (as polyline)

Deprecated:
use QgsPointV2 version

Definition at line 3593 of file qgsdxfexport.cpp.

void QgsDxfExport::writeCircle ( const QString layer,
const QColor color,
const QgsPointV2 pt,
double  radius,
const QString lineStyleName,
double  width 
)

Write circle (as polyline)

Note
available in Python bindings as writeCircleV2
added in 2.15

Definition at line 3598 of file qgsdxfexport.cpp.

void QgsDxfExport::writeDouble ( double  d)

Write a floating point value.

Parameters
dfloating point value

Definition at line 475 of file qgsdxfexport.cpp.

void QgsDxfExport::writeFilledCircle ( const QString layer,
const QColor color,
const QgsPoint pt,
double  radius 
)

Write filled circle (as hatch)

Deprecated:
use QgsPointV2 version

Definition at line 3548 of file qgsdxfexport.cpp.

void QgsDxfExport::writeFilledCircle ( const QString layer,
const QColor color,
const QgsPointV2 pt,
double  radius 
)

Write filled circle (as hatch)

Note
available in Python bindings as writePointV2
added in 2.15

Definition at line 3553 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroup ( int  code,
int  i 
)

Write a tuple of group code and integer value.

Parameters
codegroup code
iinteger value
Note
available in python bindings as writeGroupInt

Definition at line 403 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroup ( int  code,
double  d 
)

Write a group code with a floating point value.

Parameters
codegroup code
dfloating point value
Note
available in python bindings as writeGroupDouble

Definition at line 409 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroup ( int  code,
const QString s 
)

Write a group code with a string value.

Parameters
codegroup code
sstring value

Definition at line 415 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroup ( int  code,
const QgsPoint p,
double  z = 0.0,
bool  skipz = false 
)

Write a group code with a point.

Parameters
codegroup code
ppoint value
zz value of the point (defaults to 0.0)
skipzwrite point in 2d (defaults to false)
Note
available in python bindings as writeGroupPoint
Deprecated:
use QgsPointV2 version instead

Definition at line 421 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroup ( int  code,
const QgsPointV2 p 
)

Write a group code with a point.

Parameters
codegroup code
ppoint value
Note
available in python bindings as writeGroupPointV2
added in 2.15

Definition at line 429 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroup ( const QColor color,
int  exactMatch = 62,
int  rgbCode = 420,
int  transparencyCode = 440 
)

Write a group code with color value.

Parameters
colorcolor
exactMatchgroup code to use if the color has an exact match in the dxf palette
rgbCodegroup code to use if the color doesn't have an exact match or has a transparency component
transparencyCodegroup code to use for transparency component
Note
available in python bindings as writeGroupPoint

Definition at line 437 of file qgsdxfexport.cpp.

void QgsDxfExport::writeGroupCode ( int  code)

Write a group code.

Parameters
codegroup code value

Definition at line 465 of file qgsdxfexport.cpp.

int QgsDxfExport::writeHandle ( int  code = 5,
int  handle = 0 
)

Write a tuple of group code and a handle.

Parameters
codegroup code to use
handlehandle to use (0 generates a new handle)
Returns
the used handle

Definition at line 560 of file qgsdxfexport.cpp.

void QgsDxfExport::writeInt ( int  i)

Write an integer value.

Parameters
iinteger value

Definition at line 470 of file qgsdxfexport.cpp.

void QgsDxfExport::writeLine ( const QgsPoint pt1,
const QgsPoint pt2,
const QString layer,
const QString lineStyleName,
const QColor color,
double  width = -1 
)

Write line (as a polyline)

Deprecated:
use QgsPointV2 version

Definition at line 3522 of file qgsdxfexport.cpp.

void QgsDxfExport::writeLine ( const QgsPointV2 pt1,
const QgsPointV2 pt2,
const QString layer,
const QString lineStyleName,
const QColor color,
double  width = -1 
)

Write line (as a polyline)

Note
added in 2.15

Definition at line 3527 of file qgsdxfexport.cpp.

void QgsDxfExport::writeMText ( const QString layer,
const QString text,
const QgsPoint pt,
double  width,
double  angle,
const QColor color 
)

Write mtext (MTEXT)

Deprecated:
use QgsPointV2 version

Definition at line 3640 of file qgsdxfexport.cpp.

void QgsDxfExport::writeMText ( const QString layer,
const QString text,
const QgsPointV2 pt,
double  width,
double  angle,
const QColor color 
)

Write mtext (MTEXT)

Note
available in Python bindings as writeMTextV2
added in 2.15

Definition at line 3645 of file qgsdxfexport.cpp.

void QgsDxfExport::writePoint ( const QString layer,
const QColor color,
const QgsPoint pt 
)

Write point.

Deprecated:
use QgsPointV2 version

Definition at line 3532 of file qgsdxfexport.cpp.

void QgsDxfExport::writePoint ( const QString layer,
const QColor color,
const QgsPointV2 pt 
)

Write point.

Note
available in Python bindings as writePointV2
added in 2.15

Definition at line 3537 of file qgsdxfexport.cpp.

void QgsDxfExport::writePolygon ( const QgsPolygon polygon,
const QString layer,
const QString hatchPattern,
const QColor color 
)

Draw dxf filled polygon (HATCH)

Parameters
polygonpolygon
layerlayer name to use
hatchPatternhatchPattern to use
colorcolor to use
Deprecated:
use version with QgsRingSequenceV2

Definition at line 3467 of file qgsdxfexport.cpp.

void QgsDxfExport::writePolygon ( const QgsRingSequenceV2 polygon,
const QString layer,
const QString hatchPattern,
const QColor color 
)

Draw dxf filled polygon (HATCH)

Parameters
polygonpolygon
layerlayer name to use
hatchPatternhatchPattern to use
colorcolor to use
Note
not available in Python bindings
added in 2.15

Definition at line 3483 of file qgsdxfexport.cpp.

void QgsDxfExport::writePolyline ( const QgsPolyline line,
const QString layer,
const QString lineStyleName,
const QColor color,
double  width = -1 
)

Draw dxf primitives (LWPOLYLINE)

Parameters
linepolyline
layerlayer name to use
lineStyleNameline type to use
colorcolor to use
widthline width to use
Deprecated:
use QgsPointSequenceV2 variant

Definition at line 3393 of file qgsdxfexport.cpp.

void QgsDxfExport::writePolyline ( const QgsPointSequenceV2 line,
const QString layer,
const QString lineStyleName,
const QColor color,
double  width = -1 
)

Draw dxf primitives (LWPOLYLINE)

Parameters
linepolyline
layerlayer name to use
lineStyleNameline type to use
colorcolor to use
widthline width to use
Note
not available in Python bindings
added in 2.15

Definition at line 3401 of file qgsdxfexport.cpp.

void QgsDxfExport::writeSolid ( const QString layer,
const QColor color,
const QgsPoint pt1,
const QgsPoint pt2,
const QgsPoint pt3,
const QgsPoint pt4 
)

Draw dxf filled polygon (SOLID)

Parameters
layerlayer name to use
colorcolor to use
pt11. point of solid
pt22. point of solid
pt33. point of solid
pt44. point of solid
Deprecated:
see writePolygon

Definition at line 3682 of file qgsdxfexport.cpp.

void QgsDxfExport::writeString ( const QString s)

Write a string value.

Parameters
sstring value

Definition at line 483 of file qgsdxfexport.cpp.

void QgsDxfExport::writeText ( const QString layer,
const QString text,
const QgsPoint pt,
double  size,
double  angle,
const QColor color 
)

Write text (TEXT)

Deprecated:
use QgsPointV2 version

Definition at line 3620 of file qgsdxfexport.cpp.

void QgsDxfExport::writeText ( const QString layer,
const QString text,
const QgsPointV2 pt,
double  size,
double  angle,
const QColor color 
)

Write text (TEXT)

Note
available in Python bindings as writeTextV2
added in 2.15

Definition at line 3625 of file qgsdxfexport.cpp.

int QgsDxfExport::writeToFile ( QIODevice d,
const QString codec 
)

Export to a dxf file in the given encoding.

Parameters
ddevice
codecencoding
Returns
0 on success, 1 on invalid device, 2 when devices is not writable

Definition at line 488 of file qgsdxfexport.cpp.


The documentation for this class was generated from the following files: