QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgslayoutitemmap.h
Go to the documentation of this file.
1/***************************************************************************
2 qgslayoutitemmap.h
3 -------------------
4 begin : July 2017
5 copyright : (C) 2017 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8/***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17#ifndef QGSLAYOUTITEMMAP_H
18#define QGSLAYOUTITEMMAP_H
19
20#include "qgis_core.h"
21#include "qgsgrouplayer.h"
22#include "qgslayoutitem.h"
26#include "qgsmaplayerref.h"
30
31class QgsAnnotation;
34
41class CORE_EXPORT QgsLayoutItemMapAtlasClippingSettings : public QObject
42{
43 Q_OBJECT
44
45 public:
46
51
57 bool enabled() const;
58
64 void setEnabled( bool enabled );
65
72
79
85 bool forceLabelsInsideFeature() const;
86
92 void setForceLabelsInsideFeature( bool forceInside );
93
100 bool clipItemShape() const;
101
108 void setClipItemShape( bool clipItemShape );
109
116 bool restrictToLayers() const;
117
124 void setRestrictToLayers( bool enabled );
125
134 QList< QgsMapLayer * > layersToClip() const;
135
144 void setLayersToClip( const QList< QgsMapLayer * > &layers );
145
151 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
152
158 bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
159
160 signals:
161
165 void changed();
166
167 private slots:
168 void layersAboutToBeRemoved( const QList<QgsMapLayer *> &layers );
169
170 private:
171
172 QgsLayoutItemMap *mMap = nullptr;
173 bool mClipToAtlasFeature = false;
174 bool mRestrictToLayers = false;
175 QList< QgsMapLayerRef > mLayersToClip;
177 bool mForceLabelsInsideFeature = false;
178 bool mClipItemShape = false;
179};
180
181
188class CORE_EXPORT QgsLayoutItemMapItemClipPathSettings : public QObject
189{
190 Q_OBJECT
191
192 public:
193
198
205 bool isActive() const;
206
212 bool enabled() const;
213
219 void setEnabled( bool enabled );
220
227
238
243
251 void setSourceItem( QgsLayoutItem *item );
252
260
267
274
280 bool forceLabelsInsideClipPath() const;
281
287 void setForceLabelsInsideClipPath( bool forceInside );
288
294 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
295
302 bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
303
309
310 signals:
311
315 void changed();
316
317 private:
318
319 QgsLayoutItemMap *mMap = nullptr;
320 bool mEnabled = false;
322 bool mForceLabelsInsideClipPath = false;
323
324 QPointer< QgsLayoutItem > mClipPathSource;
325 QString mClipPathUuid;
326
327};
328
329
335class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem, public QgsTemporalRangeObject
336{
337
338 Q_OBJECT
339
340 public:
341
348
371
377 {
380 };
381 Q_DECLARE_FLAGS( MapItemFlags, MapItemFlag )
382
383
386 explicit QgsLayoutItemMap( QgsLayout *layout );
387 ~QgsLayoutItemMap() override;
388
389 int type() const override;
390 QIcon icon() const override;
391 QgsLayoutItem::Flags itemFlags() const override;
392
399
406
410 void assignFreeId();
411
412 //overridden to show "Map 1" type names
413 QString displayName() const override;
414
421
422 // for now, map items behave a bit differently and don't implement draw. TODO - see if we can avoid this
423 void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) override;
424
428 Q_DECL_DEPRECATED int numberExportLayers() const override SIP_DEPRECATED;
429
430 void startLayeredExport() override;
431 void stopLayeredExport() override;
432 bool nextExportPart() override;
435 void setFrameStrokeWidth( QgsLayoutMeasurement width ) override;
436
442 double scale() const;
443
451 void setScale( double scale, bool forceUpdate = true );
452
460 void setExtent( const QgsRectangle &extent );
461
469 void zoomToExtent( const QgsRectangle &extent );
470
476 QgsRectangle extent() const;
477
478
486 QPolygonF visibleExtentPolygon() const;
487
497
507
515 void setCrs( const QgsCoordinateReferenceSystem &crs );
516
525 bool keepLayerSet() const { return mKeepLayerSet; }
526
535 void setKeepLayerSet( bool enabled ) { mKeepLayerSet = enabled; }
536
543 QList<QgsMapLayer *> layers() const;
544
554 void setLayers( const QList<QgsMapLayer *> &layers );
555
560 bool keepLayerStyles() const { return mKeepLayerStyles; }
561
566 void setKeepLayerStyles( bool enabled ) { mKeepLayerStyles = enabled; }
567
572 QMap<QString, QString> layerStyleOverrides() const { return mLayerStyleOverrides; }
573
578 void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
579
583 void storeCurrentLayerStyles();
584
595 bool followVisibilityPreset() const { return mFollowVisibilityPreset; }
596
600 void setFollowVisibilityPreset( bool follow );
601
609 QString followVisibilityPresetName() const { return mFollowVisibilityPresetName; }
610
617 void setFollowVisibilityPresetName( const QString &name );
618
619 void moveContent( double dx, double dy ) override;
620 void setMoveContentPreviewOffset( double dx, double dy ) override;
621
622 void zoomContent( double factor, QPointF point ) override;
623
624
626 bool containsWmsLayer() const;
627
628 bool requiresRasterization() const override;
629 bool containsAdvancedEffects() const override;
630
637 void setMapRotation( double rotation );
638
647 double mapRotation( QgsLayoutObject::PropertyValueType valueType = QgsLayoutObject::EvaluatedValue ) const;
648
653 void setDrawAnnotations( bool draw ) { mDrawAnnotations = draw; }
654
659 bool drawAnnotations() const { return mDrawAnnotations; }
660
661
668 bool atlasDriven() const { return mAtlasDriven; }
669
676 void setAtlasDriven( bool enabled );
677
687 AtlasScalingMode atlasScalingMode() const { return mAtlasScalingMode; }
688
698 void setAtlasScalingMode( AtlasScalingMode mode ) { mAtlasScalingMode = mode; }
699
711
719 void setAtlasMargin( double margin ) { mAtlasMargin = margin; }
720
726 QgsLayoutItemMapGridStack *grids() { return mGridStack.get(); }
727
732 QgsLayoutItemMapGrid *grid();
733
740 QgsLayoutItemMapOverviewStack *overviews() { return mOverviewStack.get(); }
741
747 QgsLayoutItemMapOverview *overview();
748
759 QgsLayoutMeasurement labelMargin() const;
760
771 void setLabelMargin( const QgsLayoutMeasurement &margin );
772
773 QgsExpressionContext createExpressionContext() const override;
774
780 double mapUnitsToLayoutUnits() const;
781
789 QgsMapSettings mapSettings( const QgsRectangle &extent, QSizeF size, double dpi, bool includeLayerSettings ) const;
790
791 void finalizeRestoreFromXml() override;
792
799 QList<QgsMapLayer *> layersToRender( const QgsExpressionContext *context = nullptr, bool includeInvalidLayers = false ) const;
800
812 void addLabelBlockingItem( QgsLayoutItem *item );
813
825 void removeLabelBlockingItem( QgsLayoutItem *item );
826
838 bool isLabelBlockingItem( QgsLayoutItem *item ) const;
839
844 QgsMapRendererJob::Errors renderingErrors() const { return mRenderingErrors; }
845
853 QgsLabelingResults *previewLabelingResults() const;
854
855 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
856
869 void addRenderedFeatureHandler( QgsRenderedFeatureHandlerInterface *handler );
870
877 void removeRenderedFeatureHandler( QgsRenderedFeatureHandlerInterface *handler );
878
882 QTransform layoutToMapCoordsTransform() const;
883
890
897
905 void setZRangeEnabled( bool enabled );
906
915 bool zRangeEnabled() const;
916
927 QgsDoubleRange zRange() const;
928
939 void setZRange( const QgsDoubleRange &range );
940
941 // Reimplement estimatedFrameBleed to take the grid frame into account
942 double estimatedFrameBleed() const override;
943
944 protected:
945
946 void draw( QgsLayoutItemRenderContext &context ) override;
947 bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
948 bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context ) override;
949 QPainterPath framePath() const override;
950
952 bool isDrawing() const {return mDrawing;}
953
954 // In case of annotations, the bounding rectangle can be larger than the map item rectangle
955 QRectF boundingRect() const override;
956
958 QPolygonF transformedMapPolygon() const;
959
961 QPointF mapToItemCoords( QPointF mapCoords ) const;
962
966 QgsRectangle requestedExtent() const;
967
968 signals:
969
976
982 void mapRotationChanged( double newRotation );
983
986
992
1001 void themeChanged( const QString &theme );
1002
1009
1016
1017 public slots:
1018
1019 void refresh() override;
1020
1021 void invalidateCache() override;
1022
1024 void updateBoundingRect();
1025
1027
1028 private slots:
1029 void layersAboutToBeRemoved( const QList<QgsMapLayer *> &layers );
1030
1031 void painterJobFinished();
1032
1033 void shapeChanged();
1034
1035 void mapThemeChanged( const QString &theme );
1036
1038 void currentMapThemeRenamed( const QString &theme, const QString &newTheme );
1039
1041 void recreateCachedImageInBackground();
1042
1043 void updateAtlasFeature();
1044 private:
1045
1047
1049 int mMapId = 1;
1050
1051 std::unique_ptr< QgsLayoutItemMapGridStack > mGridStack;
1052 std::unique_ptr< QgsLayoutItemMapOverviewStack > mOverviewStack;
1053
1054 // Map region in map units really used for rendering
1055 // It can be the same as mUserExtent, but it can be bigger in on dimension if mCalculate==Scale,
1056 // so that full rectangle in paper is used.
1057 QgsRectangle mExtent;
1058
1061
1062 // Current temporary map region in map units. This is overwritten when atlas feature changes. It's also
1063 // used when the user changes the map extent and an atlas preview is enabled. This allows the user
1064 // to manually tweak each atlas preview page without affecting the actual original map extent.
1065 QgsRectangle mAtlasFeatureExtent;
1066
1067 // We have two images used for rendering/storing cached map images.
1068 // the first (mCacheFinalImage) is used ONLY for storing the most recent completed map render. It's always
1069 // used when drawing map item previews. The second (mCacheRenderingImage) is used temporarily while
1070 // rendering a new preview image in the background. If (and only if) the background render completes, then
1071 // mCacheRenderingImage is pushed into mCacheFinalImage, and used from then on when drawing the item preview.
1072 // This ensures that something is always shown in the map item, even while refreshing the preview image in the
1073 // background
1074 std::unique_ptr< QImage > mCacheFinalImage;
1075 std::unique_ptr< QImage > mCacheRenderingImage;
1076 bool mUpdatesEnabled = true;
1077
1079 bool mCacheInvalidated = true;
1080
1082 int mNumCachedLayers;
1083
1084 // Set to true if in state of drawing. Concurrent requests to draw method are returned if set to true
1085 bool mDrawing = false;
1086
1087 QTimer *mBackgroundUpdateTimer = nullptr;
1088 double mPreviewScaleFactor = 0;
1089 double mPreviewDevicePixelRatio = 1.0;
1090
1091 bool mDrawingPreview = false;
1092
1094 double mXOffset = 0.0;
1096 double mYOffset = 0.0;
1097
1098 double mLastRenderedImageOffsetX = 0.0;
1099 double mLastRenderedImageOffsetY = 0.0;
1100
1102 double mMapRotation = 0;
1103
1108 double mEvaluatedMapRotation = 0;
1109
1110 bool mZRangeEnabled = false;
1111 QgsDoubleRange mZRange;
1112
1114 bool mKeepLayerSet = false;
1115
1117 QList< QgsMapLayerRef > mLayers;
1118
1119 bool mKeepLayerStyles = false;
1121 QMap<QString, QString> mLayerStyleOverrides;
1122
1124 mutable QString mCachedLayerStyleOverridesPresetName;
1126 mutable QMap<QString, QString> mCachedPresetLayerStyleOverrides;
1127
1133 bool mFollowVisibilityPreset = false;
1134
1139 QString mFollowVisibilityPresetName;
1140
1142 QString mLastEvaluatedThemeName;
1143
1151 void drawMap( QPainter *painter, const QgsRectangle &extent, QSizeF size, double dpi );
1152
1154 void connectUpdateSlot();
1155
1157 void syncLayerSet();
1158
1160 const QgsLayoutItemMapGrid *constFirstMapGrid() const;
1161
1163 const QgsLayoutItemMapOverview *constFirstMapOverview() const;
1164
1169 QList< QgsLabelBlockingRegion > createLabelBlockingRegions( const QgsMapSettings &mapSettings ) const;
1170
1172 QRectF mCurrentRectangle;
1174 bool mDrawAnnotations = true;
1175
1177 bool mAtlasDriven = false;
1179 AtlasScalingMode mAtlasScalingMode = Auto;
1181 double mAtlasMargin = 0.10;
1182
1183 std::unique_ptr< QPainter > mPainter;
1184 std::unique_ptr< QgsMapRendererCustomPainterJob > mPainterJob;
1185 bool mPainterCancelWait = false;
1186
1187 QgsLayoutMeasurement mLabelMargin{ 0 };
1188 QgsLayoutMeasurement mEvaluatedLabelMargin{ 0 };
1189
1190 QStringList mBlockingLabelItemUuids;
1191 QList< QPointer< QgsLayoutItem > > mBlockingLabelItems;
1192
1194 QgsMapRendererJob::Errors mRenderingErrors;
1195
1196 QList< QgsRenderedFeatureHandlerInterface * > mRenderedFeatureHandlers;
1197
1198 std::unique_ptr< QgsMapRendererStagedRenderJob > mStagedRendererJob;
1199
1200 std::unique_ptr< QgsLabelingResults > mPreviewLabelingResults;
1201 std::unique_ptr< QgsLabelingResults > mExportLabelingResults;
1202
1203 void init();
1204
1206 void updateToolTip();
1207
1208 QString themeToRender( const QgsExpressionContext &context ) const;
1209
1211 QMap<QString, QString> layerStyleOverridesToRender( const QgsExpressionContext &context ) const;
1212
1214 QgsRectangle transformedExtent() const;
1215
1217 void mapPolygon( const QgsRectangle &extent, QPolygonF &poly ) const;
1218
1224 void transformShift( double &xShift, double &yShift ) const;
1225
1226 void drawAnnotations( QPainter *painter );
1227 void drawAnnotation( const QgsAnnotation *item, QgsRenderContext &context );
1228 QPointF layoutMapPosForItem( const QgsAnnotation *item ) const;
1229
1230 void drawMapFrame( QPainter *p );
1231 void drawMapBackground( QPainter *p );
1232
1233 enum PartType
1234 {
1235 Start,
1236 Background,
1237 Layer,
1238 Grid,
1239 OverviewMapExtent,
1240 Frame,
1241 SelectionBoxes,
1242 End,
1243 NotLayered,
1244 };
1245
1247 bool shouldDrawPart( PartType part ) const;
1248
1249 PartType mCurrentExportPart = NotLayered;
1250 QStringList mExportThemes;
1251 QStringList::iterator mExportThemeIt;
1252
1253 QgsLayoutItemMapAtlasClippingSettings *mAtlasClippingSettings = nullptr;
1254 QgsLayoutItemMapItemClipPathSettings *mItemClippingSettings = nullptr;
1255
1256 std::unique_ptr<QgsGroupedFeatureFilterProvider> mAtlasFeatureFilterProvider;
1257
1262 void refreshMapExtents( const QgsExpressionContext *context = nullptr );
1263
1264 void refreshLabelMargin( bool updateItem );
1265
1266 QgsRectangle computeAtlasRectangle();
1267
1268 void createStagedRenderJob( const QgsRectangle &extent, const QSizeF size, double dpi );
1269
1270 QPolygonF calculateVisibleExtentPolygon( bool includeClipping ) const;
1271
1275 std::map<QString, std::unique_ptr<QgsGroupLayer>> mGroupLayers;
1276
1280 bool hasCustomFramePath() const;
1281
1285 friend class TestQgsLayoutMap;
1288 friend class QgsLayoutExporter;
1289
1290};
1291
1293
1294#endif //QGSLAYOUTITEMMAP_H
Abstract base class for annotation items which are drawn over a map.
Represents a coordinate reference system (CRS).
QgsRange which stores a range of double values.
Definition qgsrange.h:233
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
A geometry is the spatial representation of a feature.
A filter filter provider grouping several filter providers.
Stores computed placement from labeling engine.
Contains settings relating to clipping a layout map by the current atlas feature.
void setFeatureClippingType(QgsMapClippingRegion::FeatureClippingType type)
Sets the feature clipping type to apply when clipping to the current atlas feature.
bool restrictToLayers() const
Returns true if clipping should be restricted to a subset of layers.
QgsLayoutItemMapAtlasClippingSettings(QgsLayoutItemMap *map=nullptr)
Constructor for QgsLayoutItemMapAtlasClippingSettings, with the specified map parent.
bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)
Sets the setting's state from a DOM document, where element is the DOM node corresponding to a 'Layou...
bool clipItemShape() const
Returns true if the map item shape will be clipped to the atlas feature geometry.
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores settings in a DOM element, where element is the DOM element corresponding to a 'LayoutMap' tag...
void setRestrictToLayers(bool enabled)
Sets whether clipping should be restricted to a subset of layers.
void setLayersToClip(const QList< QgsMapLayer * > &layers)
Sets the list of map layers to clip to the atlas feature.
QList< QgsMapLayer * > layersToClip() const
Returns the list of map layers to clip to the atlas feature.
void setEnabled(bool enabled)
Sets whether the map content should be clipped to the current atlas feature.
void changed()
Emitted when the atlas clipping settings are changed.
void setClipItemShape(bool clipItemShape)
Sets whether the map item shape will be clipped to the atlas feature geometry.
bool forceLabelsInsideFeature() const
Returns true if labels should only be placed inside the atlas feature geometry.
bool enabled() const
Returns true if the map content should be clipped to the current atlas feature.
void setForceLabelsInsideFeature(bool forceInside)
Sets whether labels should only be placed inside the atlas feature geometry.
QgsMapClippingRegion::FeatureClippingType featureClippingType() const
Returns the feature clipping type to apply when clipping to the current atlas feature.
A collection of grids which is drawn above the map content in a QgsLayoutItemMap.
An individual grid which is drawn above the map content in a QgsLayoutItemMap.
Contains settings relating to clipping a layout map by another layout item.
bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores settings in a DOM element, where element is the DOM element corresponding to a 'LayoutMap' tag...
void setForceLabelsInsideClipPath(bool forceInside)
Sets whether labels should only be placed inside the clip path geometry.
void setSourceItem(QgsLayoutItem *item)
Sets the source item which will provide the clipping path for the map.
QgsLayoutItemMapItemClipPathSettings(QgsLayoutItemMap *map=nullptr)
Constructor for QgsLayoutItemMapItemClipPathSettings, with the specified map parent.
bool readXml(const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context)
Sets the setting's state from a DOM document, where element is the DOM node corresponding to a 'Layou...
QgsGeometry clipPathInMapItemCoordinates() const
Returns the clipping path geometry, in the map item's coordinate space.
QgsGeometry clippedMapExtent() const
Returns the geometry to use for clipping the parent map, in the map item's CRS.
QgsLayoutItem * sourceItem()
Returns the source item which will provide the clipping path for the map, or nullptr if no item is se...
void setEnabled(bool enabled)
Sets whether the map content should be clipped to the associated item.
bool forceLabelsInsideClipPath() const
Returns true if labels should only be placed inside the clip path geometry.
void finalizeRestoreFromXml()
To be called after all pending items have been restored from XML.
QgsMapClippingRegion::FeatureClippingType featureClippingType() const
Returns the feature clipping type to apply when clipping to the associated item.
bool enabled() const
Returns true if the map content should be clipped to the associated item.
QgsMapClippingRegion toMapClippingRegion() const
Returns the clip path as a map clipping region.
void changed()
Emitted when the item clipping settings are changed.
void setFeatureClippingType(QgsMapClippingRegion::FeatureClippingType type)
Sets the feature clipping type to apply when clipping to the associated item.
bool isActive() const
Returns true if the item clipping is enabled and set to a valid source item.
A collection of overviews which are drawn above the map content in a QgsLayoutItemMap.
An individual overview which is drawn above the map content in a QgsLayoutItemMap,...
Layout graphical items for displaying a map.
bool nextExportPart() override
Moves to the next export part for a multi-layered export item, during a multi-layered export.
void extentChanged()
Emitted when the map's extent changes.
QIcon icon() const override
Returns the item's icon.
void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::DataDefinedProperty::AllProperties) override
void preparedForAtlas()
Emitted when the map has been prepared for atlas rendering, just before actual rendering.
QgsMapRendererJob::Errors renderingErrors() const
Returns map rendering errors.
bool keepLayerSet() const
Returns whether a stored layer set should be used or the current layer set from the project associate...
QgsMapSettings mapSettings(const QgsRectangle &extent, QSizeF size, double dpi, bool includeLayerSettings) const
Returns map settings that will be used for drawing of the map.
void setKeepLayerSet(bool enabled)
Sets whether the stored layer set should be used or the current layer set of the associated project.
AtlasScalingMode
Scaling modes used for the serial rendering (atlas).
@ Predefined
A scale is chosen from the predefined scales.
@ Auto
The extent is adjusted so that each feature is fully visible.
@ Fixed
The current scale of the map is used for each feature of the atlas.
Q_DECL_DEPRECATED int numberExportLayers() const override
void layerStyleOverridesChanged()
Emitted when layer style overrides are changed... a means to let associated legend items know they sh...
void updateBoundingRect()
Updates the bounding rect of this item. Call this function before doing any changes related to annota...
friend class QgsGeospatialPdfRenderedFeatureHandler
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
QgsCoordinateReferenceSystem presetCrs() const
Returns the map's preset coordinate reference system.
int type() const override
bool isDrawing() const
True if a draw is already in progress.
QString followVisibilityPresetName() const
Preset name that decides which layers and layer styles are used for map rendering.
void previewRefreshed()
Emitted whenever the item's map preview has been refreshed.
friend class QgsLayoutItemMapOverview
void setDrawAnnotations(bool draw)
Sets whether annotations are drawn within the map.
void setExtent(const QgsRectangle &extent)
Sets a new extent for the map.
void paint(QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget) override
QFlags< MapItemFlag > MapItemFlags
void draw(QgsLayoutItemRenderContext &context) override
Draws the item's contents using the specified item render context.
bool followVisibilityPreset() const
Returns whether the map should follow a map theme.
QPolygonF visibleExtentPolygon() const
Returns a polygon representing the current visible map extent, considering map extents and rotation.
friend class QgsLayoutExporter
QgsLayoutItemMap(QgsLayout *layout)
Constructor for QgsLayoutItemMap, with the specified parent layout.
void setMapFlags(QgsLayoutItemMap::MapItemFlags flags)
Sets the map item's flags, which control how the map content is drawn.
void crsChanged()
Emitted when the map's coordinate reference system is changed.
static QgsLayoutItemMap * create(QgsLayout *layout)
Returns a new map item for the specified layout.
QgsLayoutItemMapOverviewStack * overviews()
Returns the map item's overview stack, which is used to control how overviews are drawn over the map'...
QString displayName() const override
Gets item display name.
bool atlasDriven() const
Returns whether the map extent is set to follow the current atlas feature.
bool keepLayerStyles() const
Returns whether current styles of layers should be overridden by previously stored styles.
void stopLayeredExport() override
Stops a multi-layer export operation.
QMap< QString, QString > layerStyleOverrides() const
Returns stored overrides of styles for layers.
AtlasScalingMode atlasScalingMode() const
Returns the current atlas scaling mode.
void setAtlasScalingMode(AtlasScalingMode mode)
Sets the current atlas scaling mode.
void startLayeredExport() override
Starts a multi-layer export operation.
void setScale(double scale, bool forceUpdate=true)
Sets new map scale and changes only the map extent.
void refresh() override
QgsLayoutItemMap::MapItemFlags mapFlags() const
Returns the map item's flags, which control how the map content is drawn.
void themeChanged(const QString &theme)
Emitted when the map's associated theme is changed.
QgsLayoutItem::ExportLayerDetail exportLayerDetails() const override
Returns the details for the specified current export layer.
void zoomToExtent(const QgsRectangle &extent)
Zooms the map so that the specified extent is fully visible within the map item.
double scale() const
Returns the map scale.
MapItemFlag
Various flags that affect drawing of map items.
@ ShowPartialLabels
Whether to draw labels which are partially outside of the map view.
@ ShowUnplacedLabels
Whether to render unplaced labels in the map view.
friend class QgsCompositionConverter
bool drawAnnotations() const
Returns whether annotations are drawn within the map.
QgsLayoutItemMapGridStack * grids()
Returns the map item's grid stack, which is used to control how grids are drawn over the map's conten...
void invalidateCache() override
QgsRectangle extent() const
Returns the current map extent.
void setFrameStrokeWidth(QgsLayoutMeasurement width) override
Sets the frame stroke width.
friend class TestQgsLayoutMap
friend class QgsLayoutItemMapGrid
QgsLayoutItemMapAtlasClippingSettings * atlasClippingSettings()
Returns the map's atlas clipping settings.
QgsLayoutItem::Flags itemFlags() const override
Returns the item's flags, which indicate how the item behaves.
QList< QgsMapLayer * > layers() const
Returns the stored layer set.
void setAtlasMargin(double margin)
Sets the margin size (percentage) used when the map is in atlas mode.
void setKeepLayerStyles(bool enabled)
Sets whether current styles of layers should be overridden by previously stored styles.
friend class QgsLayoutItemLegend
static const QgsSettingsEntryBool * settingForceRasterMasks
Settings entry - Whether to force rasterized clipping masks, regardless of output format.
QgsCoordinateReferenceSystem crs() const
Returns coordinate reference system used for rendering the map.
QgsLayoutItemMapItemClipPathSettings * itemClippingSettings()
Returns the map's item based clip path settings.
void assignFreeId()
Sets the map id() to a number not yet used in the layout.
ExportLayerBehavior exportLayerBehavior() const override
Returns the behavior of this item during exporting to layered exports (e.g.
Contains settings and helpers relating to a render of a QgsLayoutItem.
Base class for graphical items within a QgsLayout.
friend class QgsLayout
QgsLayoutItem(QgsLayout *layout, bool manageZValue=true)
Constructor for QgsLayoutItem, with the specified parent layout.
ExportLayerBehavior
Behavior of item when exporting to layered outputs.
QFlags< Flag > Flags
Provides a method of storing measurements for use in QGIS layouts using a variety of different measur...
const QgsLayout * layout() const
Returns the layout the object is attached to.
DataDefinedProperty
Data defined properties for different item types.
@ AllProperties
All properties for item.
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value,...
@ EvaluatedValue
Return the current evaluated value for the property.
A map clipping region (in map coordinates and CRS).
FeatureClippingType
Feature clipping behavior, which controls how features from vector layers will be clipped.
@ ClipPainterOnly
Applying clipping on the painter only (i.e. feature boundaries will be unchanged, but may be invisibl...
QList< QgsMapRendererJob::Error > Errors
Contains configuration for rendering maps.
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
An interface for classes which provide custom handlers for features rendered as part of a map render ...
A boolean settings entry.
An interface for classes which can visit style entity (e.g.
QgsTemporalRangeObject(bool enabled=false)
Constructor QgsTemporalRangeObject.
#define SIP_DEPRECATED
Definition qgis_sip.h:114
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:275
#define SIP_SKIP
Definition qgis_sip.h:134
#define SIP_FACTORY
Definition qgis_sip.h:84
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)
Contains details of a particular export layer relating to a layout item.