QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
#include <qgsdxfexport.h>
Classes | |
struct | DxfLayer |
Layers and optional attribute index to split into multiple layers using attribute value as layer name. More... | |
Public Types | |
enum | SymbologyExport { NoSymbology = 0, FeatureSymbology, SymbolLayerSymbology } |
Public Member Functions | |
QgsDxfExport () | |
QgsDxfExport (const QgsDxfExport &dxfExport) | |
~QgsDxfExport () | |
void | addLayers (const QList< QgsDxfExport::DxfLayer > &layers) |
Add layers to export. More... | |
void | clipValueToMapUnitScale (double &value, const QgsMapUnitScale &scale, double pixelToMMFactor) const |
Clips value to scale minimum/maximum. More... | |
long | destinationCrs () |
Set destination CRS. 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... | |
bool | force2d () |
Retrieve whether the output should be forced to 2d. 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... | |
QgsDxfExport & | operator= (const QgsDxfExport &dxfExport) |
void | registerDxfLayer (QString layerId, QgsFeatureId fid, QString layer) |
Register name of layer for feature. More... | |
void | setDestinationCrs (long crs) |
Set destination CRS. More... | |
void | setExtent (const QgsRectangle &r) |
Set extent of area to export. More... | |
void | setForce2d (bool force2d) |
Force 2d output (eg. 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 | setMapSettings (const QgsMapSettings &settings) |
Set map settings and assign layer name attributes. 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, double mapUnitsPerPixel=1.0) |
Returns scale factor for conversion to map units. More... | |
Definition at line 43 of file qgsdxfexport.h.
Enumerator | |
---|---|
NoSymbology | |
FeatureSymbology | |
SymbolLayerSymbology |
Definition at line 65 of file qgsdxfexport.h.
QgsDxfExport::QgsDxfExport | ( | ) |
Definition at line 368 of file qgsdxfexport.cpp.
QgsDxfExport::QgsDxfExport | ( | const QgsDxfExport & | dxfExport | ) |
Definition at line 381 of file qgsdxfexport.cpp.
QgsDxfExport::~QgsDxfExport | ( | ) |
Definition at line 401 of file qgsdxfexport.cpp.
void QgsDxfExport::addLayers | ( | const QList< QgsDxfExport::DxfLayer > & | layers | ) |
Add layers to export.
layers | list of layers and corresponding attribute indexes that determine the layer name (-1 for original layer name or title) |
Definition at line 410 of file qgsdxfexport.cpp.
void QgsDxfExport::clipValueToMapUnitScale | ( | double & | value, |
const QgsMapUnitScale & | scale, | ||
double | pixelToMMFactor | ||
) | const |
Clips value to scale minimum/maximum.
value | the value to clip |
scale | the scale dependent minimum/maximum values |
pixelToMMFactor | pixels per mm |
Definition at line 4128 of file qgsdxfexport.cpp.
|
static |
Get DXF palette index of nearest entry for given color.
color |
Definition at line 4059 of file qgsdxfexport.cpp.
long QgsDxfExport::destinationCrs | ( | ) |
Set destination CRS.
Definition at line 4640 of file qgsdxfexport.cpp.
void QgsDxfExport::drawLabel | ( | QString | layerId, |
QgsRenderContext & | context, | ||
pal::LabelPosition * | label, | ||
const QgsPalLayerSettings & | settings | ||
) |
Output the label.
layerId | id of the layer |
context | render context |
label | position of label |
settings | label settings |
Definition at line 4473 of file qgsdxfexport.cpp.
return DXF encoding for Qt encoding
Definition at line 4432 of file qgsdxfexport.cpp.
Return cleaned layer name for use in DXF.
Definition at line 4374 of file qgsdxfexport.cpp.
|
static |
return list of available DXF encodings
Definition at line 4452 of file qgsdxfexport.cpp.
|
inline |
Get extent of area to export.
Definition at line 158 of file qgsdxfexport.h.
|
inline |
Retrieve whether the output should be forced to 2d.
Definition at line 187 of file qgsdxfexport.h.
QString QgsDxfExport::layerName | ( | const QString & | id, |
const QgsFeature & | f | ||
) | const |
Get layer name for feature.
id | layer id of layer |
f | feature of layer |
Definition at line 4417 of file qgsdxfexport.cpp.
QString QgsDxfExport::layerName | ( | QgsVectorLayer * | vl | ) | const |
Get name for layer respecting the use layer title as layer name mode.
vl | the vector layer |
Definition at line 4467 of file qgsdxfexport.cpp.
|
inline |
Retrieve wether layer title (where set) instead of name shall be use.
Definition at line 173 of file qgsdxfexport.h.
|
inline |
|
static |
Returns scale factor for conversion to map units.
scaleDenominator | the map scale denominator |
symbolUnits | the symbol output units |
mapUnits | the map units |
mapUnitsPerPixel | Map units per pixel |
Definition at line 4111 of file qgsdxfexport.cpp.
QgsDxfExport & QgsDxfExport::operator= | ( | const QgsDxfExport & | dxfExport | ) |
Definition at line 386 of file qgsdxfexport.cpp.
void QgsDxfExport::registerDxfLayer | ( | QString | layerId, |
QgsFeatureId | fid, | ||
QString | layer | ||
) |
Register name of layer for feature.
layerId | id of layer |
fid | id of feature |
layer | dxf layer of feature |
Definition at line 4627 of file qgsdxfexport.cpp.
void QgsDxfExport::setDestinationCrs | ( | long | crs | ) |
Set destination CRS.
Definition at line 4635 of file qgsdxfexport.cpp.
|
inline |
Set extent of area to export.
r | area to export |
Definition at line 151 of file qgsdxfexport.h.
|
inline |
Force 2d output (eg.
to support linewidth in polylines)
force2d | flag |
Definition at line 180 of file qgsdxfexport.h.
|
inline |
Enable use of title (where set) instead of layer name, when attribute index of corresponding layer index is -1.
layerTitleAsName | flag |
Definition at line 166 of file qgsdxfexport.h.
void QgsDxfExport::setMapSettings | ( | const QgsMapSettings & | settings | ) |
Set map settings and assign layer name attributes.
settings | map settings to apply |
Definition at line 405 of file qgsdxfexport.cpp.
|
inline |
|
inline |
|
inline |
Set reference scale for output.
d | scale denominator |
Definition at line 102 of file qgsdxfexport.h.
|
inline |
Get symbology export mode.
Definition at line 145 of file qgsdxfexport.h.
|
inline |
Retrieve reference scale for output.
Definition at line 109 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)
Definition at line 3677 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)
Definition at line 3682 of file qgsdxfexport.cpp.
void QgsDxfExport::writeDouble | ( | double | d | ) |
Write a floating point value.
d | floating point value |
Definition at line 500 of file qgsdxfexport.cpp.
void QgsDxfExport::writeFilledCircle | ( | const QString & | layer, |
const QColor & | color, | ||
const QgsPoint & | pt, | ||
double | radius | ||
) |
Write filled circle (as hatch)
Definition at line 3635 of file qgsdxfexport.cpp.
void QgsDxfExport::writeFilledCircle | ( | const QString & | layer, |
const QColor & | color, | ||
const QgsPointV2 & | pt, | ||
double | radius | ||
) |
Write filled circle (as hatch)
Definition at line 3640 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroup | ( | int | code, |
int | i | ||
) |
Write a tuple of group code and integer value.
code | group code |
i | integer value |
Definition at line 427 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroup | ( | int | code, |
double | d | ||
) |
Write a group code with a floating point value.
code | group code |
d | floating point value |
Definition at line 433 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroup | ( | int | code, |
const QString & | s | ||
) |
Write a group code with a string value.
code | group code |
s | string value |
Definition at line 439 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.
code | group code |
p | point value |
z | z value of the point (defaults to 0.0) |
skipz | write point in 2d (defaults to false) |
Definition at line 445 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroup | ( | int | code, |
const QgsPointV2 & | p | ||
) |
Write a group code with a point.
code | group code |
p | point value |
Definition at line 453 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.
color | color |
exactMatch | group code to use if the color has an exact match in the dxf palette |
rgbCode | group code to use if the color doesn't have an exact match or has a transparency component |
transparencyCode | group code to use for transparency component |
Definition at line 461 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroupCode | ( | int | code | ) |
Write a group code.
code | group code value |
Definition at line 490 of file qgsdxfexport.cpp.
int QgsDxfExport::writeHandle | ( | int | code = 5 , |
int | handle = 0 |
||
) |
Write a tuple of group code and a handle.
code | group code to use |
handle | handle to use (0 generates a new handle) |
Definition at line 615 of file qgsdxfexport.cpp.
void QgsDxfExport::writeInt | ( | int | i | ) |
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)
Definition at line 3609 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 |
||
) |
void QgsDxfExport::writeMText | ( | const QString & | layer, |
const QString & | text, | ||
const QgsPoint & | pt, | ||
double | width, | ||
double | angle, | ||
const QColor & | color | ||
) |
Write mtext (MTEXT)
Definition at line 3724 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)
Definition at line 3729 of file qgsdxfexport.cpp.
void QgsDxfExport::writePoint | ( | const QString & | layer, |
const QColor & | color, | ||
const QgsPointV2 & | pt | ||
) |
Write point.
Definition at line 3624 of file qgsdxfexport.cpp.
void QgsDxfExport::writePolygon | ( | const QgsPolygon & | polygon, |
const QString & | layer, | ||
const QString & | hatchPattern, | ||
const QColor & | color | ||
) |
Draw dxf filled polygon (HATCH)
polygon | polygon |
layer | layer name to use |
hatchPattern | hatchPattern to use |
color | color to use |
Definition at line 3554 of file qgsdxfexport.cpp.
void QgsDxfExport::writePolygon | ( | const QgsRingSequenceV2 & | polygon, |
const QString & | layer, | ||
const QString & | hatchPattern, | ||
const QColor & | color | ||
) |
Draw dxf filled polygon (HATCH)
polygon | polygon |
layer | layer name to use |
hatchPattern | hatchPattern to use |
color | color to use |
Definition at line 3570 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)
line | polyline |
layer | layer name to use |
lineStyleName | line type to use |
color | color to use |
width | line width to use |
Definition at line 3475 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)
line | polyline |
layer | layer name to use |
lineStyleName | line type to use |
color | color to use |
width | line width to use |
Definition at line 3483 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)
layer | layer name to use |
color | color to use |
pt1 | 1. point of solid |
pt2 | 2. point of solid |
pt3 | 3. point of solid |
pt4 | 4. point of solid |
Definition at line 3767 of file qgsdxfexport.cpp.
void QgsDxfExport::writeString | ( | const QString & | s | ) |
void QgsDxfExport::writeText | ( | const QString & | layer, |
const QString & | text, | ||
const QgsPoint & | pt, | ||
double | size, | ||
double | angle, | ||
const QColor & | color | ||
) |
Write text (TEXT)
Definition at line 3704 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)
Definition at line 3709 of file qgsdxfexport.cpp.
Export to a dxf file in the given encoding.
d | device |
codec | encoding |
Definition at line 513 of file qgsdxfexport.cpp.