QGIS/python/core/qgsmapsettings.sip

418 lines
12 KiB
Plaintext
Raw Normal View History

2017-05-14 09:48:41 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmapsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
class QgsMapSettings
{
2017-05-14 09:48:41 +02:00
%Docstring
The QgsMapSettings class contains configuration for rendering of the map.
The rendering itself is done by QgsMapRendererJob subclasses.
In order to set up QgsMapSettings instance, it is necessary to set at least
few members: extent, output size and layers.
QgsMapSettings and QgsMapRendererJob (+subclasses) are intended to replace
QgsMapRenderer class that existed before QGIS 2.4. The advantage of the new
classes is that they separate the settings from the rendering and provide
asynchronous API for map rendering.
.. versionadded:: 2.4
%End
2017-05-14 09:48:41 +02:00
%TypeHeaderCode
#include "qgsmapsettings.h"
%End
2014-05-27 23:22:50 +02:00
public:
QgsMapSettings();
QgsRectangle extent() const;
2017-05-14 09:48:41 +02:00
%Docstring
of output size. Use visibleExtent() to get the resulting extent.
:rtype: QgsRectangle
%End
void setExtent( const QgsRectangle &rect, bool magnified = true );
2017-05-14 09:48:41 +02:00
%Docstring
of output size. Use visibleExtent() to get the resulting extent.
%End
2014-05-27 23:22:50 +02:00
QSize outputSize() const;
2017-05-14 09:48:41 +02:00
%Docstring
Return the size of the resulting map image
:rtype: QSize
%End
void setOutputSize( QSize size );
2017-05-14 09:48:41 +02:00
%Docstring
Set the size of the resulting map image
%End
2014-05-27 23:22:50 +02:00
double rotation() const;
2017-05-14 09:48:41 +02:00
%Docstring
Returns the rotation of the resulting map image, in degrees clockwise.
2017-05-14 09:48:41 +02:00
.. versionadded:: 2.8
.. seealso:: setRotation()
2017-05-14 09:48:41 +02:00
:rtype: float
%End
void setRotation( double rotation );
2017-05-14 09:48:41 +02:00
%Docstring
Sets the ``rotation`` of the resulting map image, in degrees clockwise.
2017-05-14 09:48:41 +02:00
.. versionadded:: 2.8
.. seealso:: rotation()
2017-05-14 09:48:41 +02:00
%End
2016-05-28 17:22:22 +02:00
double outputDpi() const;
2017-05-14 09:48:41 +02:00
%Docstring
Default value is 96
:rtype: float
%End
2016-05-28 17:22:22 +02:00
void setOutputDpi( double dpi );
2017-05-14 09:48:41 +02:00
%Docstring
Set DPI used for conversion between real world units (e.g. mm) and pixels
%End
2016-05-29 08:10:23 +10:00
void setMagnificationFactor( double factor );
2017-05-14 09:48:41 +02:00
%Docstring
Set the magnification factor.
\param factor the factor of magnification
.. versionadded:: 2.16
.. seealso:: magnificationFactor()
%End
2016-05-29 08:10:23 +10:00
double magnificationFactor() const;
2017-05-14 09:48:41 +02:00
%Docstring
.. seealso:: setMagnificationFactor()
:rtype: float
%End
2016-05-18 14:36:02 +02:00
QStringList layerIds() const;
2017-05-14 09:48:41 +02:00
%Docstring
The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)
:rtype: list of str
%End
QList<QgsMapLayer *> layers() const;
%Docstring
The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)
:rtype: list of QgsMapLayer
%End
void setLayers( const QList<QgsMapLayer *> &layers );
%Docstring
The layers are stored in the reverse order of how they are rendered (layer with index 0 will be on top)
%End
QMap<QString, QString> layerStyleOverrides() const;
2017-05-14 09:48:41 +02:00
%Docstring
.. versionadded:: 2.8
:rtype: QMap<str, QString>
%End
void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
2017-05-14 09:48:41 +02:00
%Docstring
.. versionadded:: 2.8
%End
QString customRenderFlags() const;
2017-05-14 09:48:41 +02:00
%Docstring
Get custom rendering flags. Layers might honour these to alter their rendering.
:return: custom flags strings, separated by ';'
.. versionadded:: 2.16
.. seealso:: setCustomRenderFlags()
:rtype: str
%End
void setCustomRenderFlags( const QString &customRenderFlags );
2017-05-14 09:48:41 +02:00
%Docstring
Sets the custom rendering flags. Layers might honour these to alter their rendering.
\param customRenderFlags custom flags strings, separated by ';'
.. versionadded:: 2.16
.. seealso:: customRenderFlags()
%End
void setDestinationCrs( const QgsCoordinateReferenceSystem &crs );
2017-05-14 09:48:41 +02:00
%Docstring
sets destination coordinate reference system
%End
QgsCoordinateReferenceSystem destinationCrs() const;
2017-05-14 09:48:41 +02:00
%Docstring
returns CRS of destination coordinate reference system
:rtype: QgsCoordinateReferenceSystem
%End
QgsUnitTypes::DistanceUnit mapUnits() const;
2017-05-14 09:48:41 +02:00
%Docstring
Get units of map's geographical coordinates - used for scale calculation
:rtype: QgsUnitTypes.DistanceUnit
%End
void setBackgroundColor( const QColor &color );
2017-05-14 09:48:41 +02:00
%Docstring
Set the background color of the map
%End
2014-05-27 23:22:50 +02:00
QColor backgroundColor() const;
2017-05-14 09:48:41 +02:00
%Docstring
Get the background color of the map
:rtype: QColor
%End
void setSelectionColor( const QColor &color );
2017-05-14 09:48:41 +02:00
%Docstring
Set color that is used for drawing of selected vector features
%End
2014-05-27 23:22:50 +02:00
QColor selectionColor() const;
2017-05-14 09:48:41 +02:00
%Docstring
Get color that is used for drawing of selected vector features
:rtype: QColor
%End
2014-06-02 21:00:51 +02:00
2014-05-27 23:22:50 +02:00
enum Flag
{
2017-05-14 09:48:41 +02:00
Antialiasing,
DrawEditingInfo,
ForceVectorOutput,
UseAdvancedEffects,
DrawLabeling,
UseRenderingOptimization,
DrawSelection,
DrawSymbolBounds,
RenderMapTile,
RenderPartialOutput,
// TODO
2014-05-27 23:22:50 +02:00
};
typedef QFlags<QgsMapSettings::Flag> Flags;
2017-05-14 09:48:41 +02:00
void setFlags( QgsMapSettings::Flags flags );
%Docstring
Set combination of flags that will be used for rendering
%End
2014-05-27 23:22:50 +02:00
void setFlag( Flag flag, bool on = true );
2017-05-14 09:48:41 +02:00
%Docstring
Enable or disable a particular flag (other flags are not affected)
%End
2014-05-27 23:22:50 +02:00
Flags flags() const;
2017-05-14 09:48:41 +02:00
%Docstring
Return combination of flags used for rendering
:rtype: Flags
%End
2014-05-27 23:22:50 +02:00
bool testFlag( Flag flag ) const;
2017-05-14 09:48:41 +02:00
%Docstring
Check whether a particular flag is enabled
:rtype: bool
%End
void setOutputImageFormat( QImage::Format format );
2017-05-14 09:48:41 +02:00
%Docstring
sets format of internal QImage
%End
QImage::Format outputImageFormat() const;
2017-05-14 09:48:41 +02:00
%Docstring
format of internal QImage, default QImage.Format_ARGB32_Premultiplied
:rtype: QImage.Format
%End
2014-05-27 23:22:50 +02:00
bool hasValidSettings() const;
2017-05-14 09:48:41 +02:00
%Docstring
Check whether the map settings are valid and can be used for rendering
:rtype: bool
%End
2014-05-27 23:22:50 +02:00
QgsRectangle visibleExtent() const;
2017-05-14 09:48:41 +02:00
%Docstring
Return the actual extent derived from requested extent that takes takes output image size into account
:rtype: QgsRectangle
%End
QPolygonF visiblePolygon() const;
2017-05-14 09:48:41 +02:00
%Docstring
.. versionadded:: 2.8
:rtype: QPolygonF
%End
2014-05-27 23:22:50 +02:00
double mapUnitsPerPixel() const;
2017-05-14 09:48:41 +02:00
%Docstring
Return the distance in geographical coordinates that equals to one pixel in the map
:rtype: float
%End
2014-05-27 23:22:50 +02:00
double scale() const;
2017-05-14 09:48:41 +02:00
%Docstring
Returns the calculated map scale.
The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.
2017-05-14 09:48:41 +02:00
:rtype: float
%End
void setExpressionContext( const QgsExpressionContext &context );
2017-05-14 09:48:41 +02:00
%Docstring
Sets the expression context. This context is used for all expression evaluation
associated with this map settings.
.. seealso:: expressionContext()
.. versionadded:: 2.12
%End
const QgsExpressionContext &expressionContext() const;
2017-05-14 09:48:41 +02:00
%Docstring
Gets the expression context. This context should be used for all expression evaluation
associated with this map settings.
.. seealso:: setExpressionContext()
.. versionadded:: 2.12
:rtype: QgsExpressionContext
%End
QgsDatumTransformStore &datumTransformStore();
2017-05-14 09:48:41 +02:00
%Docstring
:rtype: QgsDatumTransformStore
%End
const QgsMapToPixel &mapToPixel() const;
2017-05-14 09:48:41 +02:00
%Docstring
:rtype: QgsMapToPixel
%End
double layerToMapUnits( const QgsMapLayer *layer, const QgsRectangle &referenceExtent = QgsRectangle() ) const;
2017-05-14 09:48:41 +02:00
%Docstring
Computes an *estimated* conversion factor between layer and map units: layerUnits * layerToMapUnits = mapUnits
\param layer The layer
\param referenceExtent A reference extent based on which to perform the computation. If not specified, the layer extent is used
.. versionadded:: 2.12
:rtype: float
%End
QgsRectangle layerExtentToOutputExtent( const QgsMapLayer *layer, QgsRectangle extent ) const;
2017-05-14 09:48:41 +02:00
%Docstring
transform bounding box from layer's CRS to output CRS
.. seealso:: layerToMapCoordinates( QgsMapLayer* layer, QgsRectangle rect ) if you want to transform a rectangle
:return: a bounding box (aligned rectangle) containing the transformed extent
:rtype: QgsRectangle
%End
QgsRectangle outputExtentToLayerExtent( const QgsMapLayer *layer, QgsRectangle extent ) const;
2017-05-14 09:48:41 +02:00
%Docstring
transform bounding box from output CRS to layer's CRS
.. seealso:: mapToLayerCoordinates( QgsMapLayer* layer,QgsRectangle rect ) if you want to transform a rectangle
:return: a bounding box (aligned rectangle) containing the transformed extent
:rtype: QgsRectangle
%End
QgsPointXY layerToMapCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const;
2017-05-14 09:48:41 +02:00
%Docstring
transform point coordinates from layer's CRS to output CRS
:return: the transformed point
:rtype: QgsPointXY
2017-05-14 09:48:41 +02:00
%End
QgsRectangle layerToMapCoordinates( const QgsMapLayer *layer, QgsRectangle rect ) const;
2017-05-14 09:48:41 +02:00
%Docstring
transform rectangle from layer's CRS to output CRS
.. seealso:: layerExtentToOutputExtent() if you want to transform a bounding box
:return: the transformed rectangle
:rtype: QgsRectangle
%End
QgsPointXY mapToLayerCoordinates( const QgsMapLayer *layer, QgsPointXY point ) const;
2017-05-14 09:48:41 +02:00
%Docstring
transform point coordinates from output CRS to layer's CRS
:return: the transformed point
:rtype: QgsPointXY
2017-05-14 09:48:41 +02:00
%End
QgsRectangle mapToLayerCoordinates( const QgsMapLayer *layer, QgsRectangle rect ) const;
2017-05-14 09:48:41 +02:00
%Docstring
transform rectangle from output CRS to layer's CRS
.. seealso:: outputExtentToLayerExtent() if you want to transform a bounding box
:return: the transformed rectangle
:rtype: QgsRectangle
%End
QgsCoordinateTransform layerTransform( const QgsMapLayer *layer ) const;
2017-05-14 09:48:41 +02:00
%Docstring
Return coordinate transform from layer's CRS to destination CRS
\param layer
:return: transform - may be invalid if the transform is not needed
:rtype: QgsCoordinateTransform
%End
2014-05-27 23:22:50 +02:00
QgsRectangle fullExtent() const;
2017-05-14 09:48:41 +02:00
%Docstring
returns current extent of layer set
:rtype: QgsRectangle
%End
void readXml( QDomNode &node );
2017-05-14 09:48:41 +02:00
%Docstring
serialization */
%End
2014-05-27 23:22:50 +02:00
void writeXml( QDomNode &node, QDomDocument &doc );
void setSegmentationTolerance( double tolerance );
2017-05-14 09:48:41 +02:00
%Docstring
Sets the segmentation tolerance applied when rendering curved geometries
\param tolerance the segmentation tolerance*
%End
double segmentationTolerance() const;
2017-05-14 09:48:41 +02:00
%Docstring
Gets the segmentation tolerance applied when rendering curved geometries
:rtype: float
%End
2016-08-06 11:01:42 +02:00
void setSegmentationToleranceType( QgsAbstractGeometry::SegmentationToleranceType type );
2017-05-14 09:48:41 +02:00
%Docstring
Sets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
\param type the segmentation tolerance typename*
%End
2016-08-06 11:01:42 +02:00
QgsAbstractGeometry::SegmentationToleranceType segmentationToleranceType() const;
2017-05-14 09:48:41 +02:00
%Docstring
Gets segmentation tolerance type (maximum angle or maximum difference between curve and approximation)
:rtype: QgsAbstractGeometry.SegmentationToleranceType
%End
void setLabelingEngineSettings( const QgsLabelingEngineSettings &settings );
2017-05-14 09:48:41 +02:00
%Docstring
Sets global configuration of the labeling engine
.. versionadded:: 3.0
%End
const QgsLabelingEngineSettings &labelingEngineSettings() const;
2017-05-14 09:48:41 +02:00
%Docstring
Returns global configuration of the labeling engine
.. versionadded:: 3.0
:rtype: QgsLabelingEngineSettings
%End
protected:
2017-05-14 09:48:41 +02:00
void updateDerived();
};
QFlags<QgsMapSettings::Flag> operator|(QgsMapSettings::Flag f1, QFlags<QgsMapSettings::Flag> f2);
2017-05-14 09:48:41 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsmapsettings.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/