QGIS API Documentation
3.0.2-Girona (307d082)
|
#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 | Flag { FlagNoMText = 1 << 1 } |
Export flags. More... | |
enum | SymbologyExport { NoSymbology = 0, FeatureSymbology, SymbolLayerSymbology } |
Public Member Functions | |
QgsDxfExport ()=default | |
Constructor for QgsDxfExport. More... | |
QgsDxfExport (const QgsDxfExport &dxfExport) | |
void | addLayers (const QList< QgsDxfExport::DxfLayer > &layers) |
Add layers to export. More... | |
QgsCoordinateReferenceSystem | destinationCrs () const |
Returns the destination CRS, or an invalid CRS if no reprojection will be done. More... | |
void | drawLabel (const QString &layerId, QgsRenderContext &context, pal::LabelPosition *label, const QgsPalLayerSettings &settings) |
Output the label. More... | |
QgsRectangle | extent () const |
Get extent of area to export. More... | |
QgsDxfExport::Flags | flags () const |
Returns the export flags. 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 whether layer title (where set) instead of name shall be use. More... | |
QgsUnitTypes::DistanceUnit | mapUnits () const |
Retrieve map units. More... | |
QgsDxfExport & | operator= (const QgsDxfExport &dxfExport) |
void | registerDxfLayer (const QString &layerId, QgsFeatureId fid, const QString &layer) |
Register name of layer for feature. More... | |
void | setDestinationCrs (const QgsCoordinateReferenceSystem &crs) |
Set destination CRS. More... | |
void | setExtent (const QgsRectangle &r) |
Set extent of area to export. More... | |
void | setFlags (QgsDxfExport::Flags flags) |
Sets the export flags. 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 | setSymbologyExport (QgsDxfExport::SymbologyExport e) |
Set symbology export mode. More... | |
void | setSymbologyScale (double scale) |
Set reference scale for output. More... | |
QgsDxfExport::SymbologyExport | symbologyExport () const |
Get symbology export mode. More... | |
double | symbologyScale () const |
Returns the reference scale for output. More... | |
void | writeCircle (const QString &layer, const QColor &color, const QgsPoint &pt, double radius, const QString &lineStyleName, double width) |
Write circle (as polyline) More... | |
void | writeDouble (double d) |
Write a floating point value. More... | |
void | writeFilledCircle (const QString &layer, const QColor &color, const QgsPoint &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... | |
void | writeGroup (int code, const QgsPoint &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... | |
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 | writeMText (const QString &layer, const QString &text, const QgsPoint &pt, double width, double angle, const QColor &color) |
Write mtext (MTEXT) More... | |
void | writePoint (const QString &layer, const QColor &color, const QgsPoint &pt) |
Write point. More... | |
void | writePolygon (const QgsRingSequence &polygon, const QString &layer, const QString &hatchPattern, const QColor &color) |
Draw dxf filled polygon (HATCH) More... | |
void | writePolyline (const QgsPointSequence &line, const QString &layer, const QString &lineStyleName, const QColor &color, double width=-1) |
Draw dxf primitives (LWPOLYLINE) More... | |
void | writeString (const QString &s) |
Write a string value. More... | |
void | writeText (const QString &layer, const QString &text, const QgsPoint &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 scale, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits) |
Calculates a scaling factor to convert from map units to a specified symbol unit. More... | |
Definition at line 51 of file qgsdxfexport.h.
enum QgsDxfExport::Flag |
Export flags.
Enumerator | |
---|---|
FlagNoMText | Export text as TEXT elements. If not set, text will be exported as MTEXT elements. |
Definition at line 88 of file qgsdxfexport.h.
Definition at line 80 of file qgsdxfexport.h.
|
default |
Constructor for QgsDxfExport.
QgsDxfExport::QgsDxfExport | ( | const QgsDxfExport & | dxfExport | ) |
Definition at line 364 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 401 of file qgsdxfexport.cpp.
|
static |
Get DXF palette index of nearest entry for given color.
color |
Definition at line 3918 of file qgsdxfexport.cpp.
QgsCoordinateReferenceSystem QgsDxfExport::destinationCrs | ( | ) | const |
Returns the destination CRS, or an invalid CRS if no reprojection will be done.
Definition at line 4458 of file qgsdxfexport.cpp.
void QgsDxfExport::drawLabel | ( | const 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 4297 of file qgsdxfexport.cpp.
|
static |
return DXF encoding for Qt encoding
Definition at line 4254 of file qgsdxfexport.cpp.
|
static |
Return cleaned layer name for use in DXF.
Definition at line 4195 of file qgsdxfexport.cpp.
|
static |
return list of available DXF encodings
Definition at line 4275 of file qgsdxfexport.cpp.
|
inline |
Get extent of area to export.
Definition at line 196 of file qgsdxfexport.h.
QgsDxfExport::Flags QgsDxfExport::flags | ( | ) | const |
Returns the export flags.
Definition at line 396 of file qgsdxfexport.cpp.
|
inline |
Retrieve whether the output should be forced to 2d.
Definition at line 225 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 4238 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 4291 of file qgsdxfexport.cpp.
|
inline |
Retrieve whether layer title (where set) instead of name shall be use.
Definition at line 211 of file qgsdxfexport.h.
QgsUnitTypes::DistanceUnit QgsDxfExport::mapUnits | ( | ) | const |
|
static |
Calculates a scaling factor to convert from map units to a specified symbol unit.
The scale parameter indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
Definition at line 3970 of file qgsdxfexport.cpp.
QgsDxfExport & QgsDxfExport::operator= | ( | const QgsDxfExport & | dxfExport | ) |
Definition at line 369 of file qgsdxfexport.cpp.
void QgsDxfExport::registerDxfLayer | ( | const QString & | layerId, |
QgsFeatureId | fid, | ||
const QString & | layer | ||
) |
Register name of layer for feature.
layerId | id of layer |
fid | id of feature |
layer | dxf layer of feature |
Definition at line 4444 of file qgsdxfexport.cpp.
void QgsDxfExport::setDestinationCrs | ( | const QgsCoordinateReferenceSystem & | crs | ) |
Set destination CRS.
Definition at line 4452 of file qgsdxfexport.cpp.
|
inline |
Set extent of area to export.
r | area to export |
Definition at line 189 of file qgsdxfexport.h.
void QgsDxfExport::setFlags | ( | QgsDxfExport::Flags | flags | ) |
Sets the export flags.
Definition at line 391 of file qgsdxfexport.cpp.
|
inline |
Force 2d output (eg.
to support linewidth in polylines)
force2d | flag |
Definition at line 218 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 204 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 386 of file qgsdxfexport.cpp.
|
inline |
|
inline |
Set reference scale for output.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
Definition at line 142 of file qgsdxfexport.h.
|
inline |
Get symbology export mode.
Definition at line 183 of file qgsdxfexport.h.
|
inline |
Returns the reference scale for output.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
Definition at line 150 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 3607 of file qgsdxfexport.cpp.
void QgsDxfExport::writeDouble | ( | double | d | ) |
Write a floating point value.
d | floating point value |
Definition at line 483 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 3570 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 418 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 424 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 430 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroup | ( | int | code, |
const QgsPoint & | p | ||
) |
Write a group code with a point.
code | group code |
p | point value |
Definition at line 436 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 444 of file qgsdxfexport.cpp.
void QgsDxfExport::writeGroupCode | ( | int | code | ) |
Write a group code.
code | group code value |
Definition at line 473 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 606 of file qgsdxfexport.cpp.
void QgsDxfExport::writeInt | ( | int | i | ) |
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 3645 of file qgsdxfexport.cpp.
void QgsDxfExport::writePoint | ( | const QString & | layer, |
const QColor & | color, | ||
const QgsPoint & | pt | ||
) |
Write point.
Definition at line 3559 of file qgsdxfexport.cpp.
void QgsDxfExport::writePolygon | ( | const QgsRingSequence & | 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 3515 of file qgsdxfexport.cpp.
void QgsDxfExport::writePolyline | ( | const QgsPointSequence & | 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 3444 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 3629 of file qgsdxfexport.cpp.
int QgsDxfExport::writeToFile | ( | QIODevice * | d, |
const QString & | codec | ||
) |
Export to a dxf file in the given encoding.
d | device |
codec | encoding |
Definition at line 496 of file qgsdxfexport.cpp.