Class: QgsDxfExport¶
-
class
qgis.core.
QgsDxfExport
¶ Bases:
sip.wrapper
Constructor for QgsDxfExport.
QgsDxfExport(QgsDxfExport)
Enums
Methods
Add layers to export
Clips value to scale minimum/maximum
Gets DXF palette index of nearest entry for given color
Returns the destination CRS, or an invalid CRS if no reprojection will be done.
Returns DXF encoding for Qt encoding
Returns cleaned layer name for use in DXF
Returns list of available DXF encodings
Gets extent of area to export
Returns the export flags.
Retrieve whether the output should be forced to 2d
Gets layer name for feature
Retrieve whether layer title (where set) instead of name shall be use
Returns scale factor for conversion to map units
Retrieve map units
Register name of layer for feature
Set destination CRS
Set extent of area to export
Sets the export flags.
Force 2d output (eg.
Enable use of title (where set) instead of layer name, when attribute index of corresponding layer index is -1
Set map settings and assign layer name attributes
Set symbology export mode
Set reference
scale
for output.Gets symbology export mode
Returns the reference scale for output.
Write circle (as polyline)
Write a floating point value
Write filled circle (as hatch)
Write a group code with a string value
Write a group code
Write a group code with a floating point value
Write a tuple of group code and integer value
Write a group code with a point
Write a tuple of group code and a handle
Write an integer value
Write line (as a polyline)
Write mtext (MTEXT)
Write point
Write a string value
Write text (TEXT)
Signals
Attributes
-
class
DxfLayer
(vl: QgsVectorLayer, layerOutputAttributeIndex: int = -1)¶ Bases:
sip.wrapper
QgsDxfExport.DxfLayer(QgsDxfExport.DxfLayer)
-
layer
(self) → QgsVectorLayer¶ Returns the layer
-
layerOutputAttributeIndex
(self) → int¶ Returns the attribute index used to split into multiple layers. The attribute value is used for layer names.
-
-
FeatureSymbology
= 1¶
-
class
Flag
¶ Bases:
int
-
FlagNoMText
= 2¶
-
class
Flags
¶ Bases:
sip.wrapper
QgsDxfExport.Flags(Union[QgsDxfExport.Flags, QgsDxfExport.Flag]) QgsDxfExport.Flags(QgsDxfExport.Flags)
-
NoSymbology
= 0¶
-
SymbolLayerSymbology
= 2¶
-
class
SymbologyExport
¶ Bases:
int
-
addLayers
(self, layers: object)¶ Add layers to export
- Parameters
layers – list of layers and corresponding attribute indexes that determine the layer name (-1 for original layer name or title)
See also
-
clipValueToMapUnitScale
(self, scale: QgsMapUnitScale, pixelToMMFactor: float) → float¶ Clips value to scale minimum/maximum
- Parameters
value – the value to clip
scale – the scale dependent minimum/maximum values
pixelToMMFactor – pixels per mm
-
closestColorMatch
(color: int) → int¶ Gets DXF palette index of nearest entry for given color
- Parameters
color –
-
destinationCrs
(self) → QgsCoordinateReferenceSystem¶ Returns the destination CRS, or an invalid CRS if no reprojection will be done.
See also
New in version 3.0.
-
dxfEncoding
(name: str) → str¶ Returns DXF encoding for Qt encoding
-
dxfLayerName
(name: str) → str¶ Returns cleaned layer name for use in DXF
-
encodings
() → List[str]¶ Returns list of available DXF encodings
-
extent
(self) → QgsRectangle¶ Gets extent of area to export
- Returns
area to export
See also
-
flags
(self) → QgsDxfExport.Flags¶ Returns the export flags.
See also
New in version 3.0.
-
force2d
(self) → bool¶ Retrieve whether the output should be forced to 2d
- Returns
flag
See also
-
layerName
(self, id: str, f: QgsFeature) → str¶ Gets layer name for feature
- Parameters
id – layer id of layer
f – feature of layer
- Returns
layer name for feature
layerName(self, vl: QgsVectorLayer) -> str Gets name for layer respecting the use layer title as layer name mode
- Parameters
vl – the vector layer
- Returns
name of layer
See also
-
layerTitleAsName
(self) → bool¶ Retrieve whether layer title (where set) instead of name shall be use
- Returns
flag
See also
-
mapUnitScaleFactor
(scale: float, symbolUnits: QgsUnitTypes.RenderUnit, mapUnits: QgsUnitTypes.DistanceUnit, mapUnitsPerPixel: float = 1) → float¶ Returns scale factor for conversion to map units
- Parameters
scale – the map scale denominator
symbolUnits – the symbol output units
mapUnits – the map units
mapUnitsPerPixel – Map units per pixel
-
mapUnits
(self) → QgsUnitTypes.DistanceUnit¶ Retrieve map units
- Returns
unit
-
registerDxfLayer
(self, layerId: str, fid: int, layer: str)¶ Register name of layer for feature
- Parameters
layerId – id of layer
fid – id of feature
layer – dxf layer of feature
-
setDestinationCrs
(self, crs: QgsCoordinateReferenceSystem)¶ Set destination CRS
See also
New in version 3.0.
-
setExtent
(self, r: QgsRectangle)¶ Set extent of area to export
- Parameters
r – area to export
-
setFlags
(self, flags: Union[QgsDxfExport.Flags, QgsDxfExport.Flag])¶ Sets the export flags.
See also
New in version 3.0.
-
setForce2d
(self, force2d: bool)¶ Force 2d output (eg. to support linewidth in polylines)
- Parameters
force2d – flag
See also
-
setLayerTitleAsName
(self, layerTitleAsName: bool)¶ Enable use of title (where set) instead of layer name, when attribute index of corresponding layer index is -1
- Parameters
layerTitleAsName – flag
See also
-
setMapSettings
(self, settings: QgsMapSettings)¶ Set map settings and assign layer name attributes
- Parameters
settings – map settings to apply
-
setSymbologyExport
(self, e: QgsDxfExport.SymbologyExport)¶ Set symbology export mode
- Parameters
e – the mode
-
setSymbologyScale
(self, scale: float)¶ Set reference
scale
for output. Thescale
value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.See also
New in version 3.0.
-
symbologyExport
(self) → QgsDxfExport.SymbologyExport¶ Gets symbology export mode
- Returns
mode
See also
-
symbologyScale
(self) → float¶ Returns the reference scale for output. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
See also
New in version 3.0.
-
writeCircleV2
(self, layer: str, color: Union[QColor, Qt.GlobalColor, QGradient], pt: QgsPoint, radius: float, lineStyleName: str, width: float)¶ Write circle (as polyline)
Note
available in Python bindings as writeCircleV2
New in version 2.15.
-
writeDouble
(self, d: float)¶ Write a floating point value
- Parameters
d – floating point value
-
writeFillCircleV2
(self, layer: str, color: Union[QColor, Qt.GlobalColor, QGradient], pt: QgsPoint, radius: float)¶ Write filled circle (as hatch)
Note
available in Python bindings as writePointV2
New in version 2.15.
-
writeGroup
(self, code: int, s: str)¶ Write a group code with a string value
- Parameters
code – group code
s – string value
writeGroup(self, color: Union[QColor, Qt.GlobalColor, QGradient], exactMatch: int = 62, rgbCode: int = 420, transparencyCode: int = 440) Write a group code with color value
- Parameters
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
Note
available in Python bindings as writeGroupPoint
-
writeGroupCode
(self, code: int)¶ Write a group code
- Parameters
code – group code value
-
writeGroupDouble
(self, code: int, d: float)¶ Write a group code with a floating point value
- Parameters
code – group code
d – floating point value
Note
available in Python bindings as writeGroupDouble
-
writeGroupInt
(self, code: int, i: int)¶ Write a tuple of group code and integer value
- Parameters
code – group code
i – integer value
Note
available in Python bindings as writeGroupInt
-
writeGroupPointV2
(self, code: int, p: QgsPoint)¶ Write a group code with a point
- Parameters
code – group code
p – point value
Note
available in Python bindings as writeGroupPointV2
New in version 2.15.
-
writeHandle
(self, code: int = 5, handle: int = 0) → int¶ Write a tuple of group code and a handle
- Parameters
code – group code to use
handle – handle to use (0 generates a new handle)
- Returns
the used handle
-
writeInt
(self, i: int)¶ Write an integer value
- Parameters
i – integer value
-
writeLine
(self, pt1: QgsPoint, pt2: QgsPoint, layer: str, lineStyleName: str, color: Union[QColor, Qt.GlobalColor, QGradient], width: float = -1)¶ Write line (as a polyline)
New in version 2.15.
-
writeMText
(self, layer: str, text: str, pt: QgsPoint, width: float, angle: float, color: Union[QColor, Qt.GlobalColor, QGradient])¶ Write mtext (MTEXT)
Note
available in Python bindings as writeMTextV2
New in version 2.15.
-
writePointV2
(self, layer: str, color: Union[QColor, Qt.GlobalColor, QGradient], pt: QgsPoint)¶ Write point
Note
available in Python bindings as writePointV2
New in version 2.15.
-
writeString
(self, s: str)¶ Write a string value
- Parameters
s – string value
-
writeTextV2
(self, layer: str, text: str, pt: QgsPoint, size: float, angle: float, color: Union[QColor, Qt.GlobalColor, QGradient])¶ Write text (TEXT)
Note
available in Python bindings as writeTextV2
New in version 2.15.
-
writeToFile
(self, d: QIODevice, codec: str) → int¶
-
class