QGIS API Documentation 4.0.0-Norrköping (1ddcee3d0e4)
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:
50
56 bool enabled() const;
57
63 void setEnabled( bool enabled );
64
71
78
84 bool forceLabelsInsideFeature() const;
85
91 void setForceLabelsInsideFeature( bool forceInside );
92
99 bool clipItemShape() const;
100
107 void setClipItemShape( bool clipItemShape );
108
115 bool restrictToLayers() const;
116
123 void setRestrictToLayers( bool enabled );
124
133 QList< QgsMapLayer * > layersToClip() const;
134
143 void setLayersToClip( const QList< QgsMapLayer * > &layers );
144
150 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
151
157 bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
158
159 signals:
160
164 void changed();
165
166 private slots:
167 void layersAboutToBeRemoved( const QList<QgsMapLayer *> &layers );
168
169 private:
170 QgsLayoutItemMap *mMap = nullptr;
171 bool mClipToAtlasFeature = false;
172 bool mRestrictToLayers = false;
173 QList< QgsMapLayerRef > mLayersToClip;
175 bool mForceLabelsInsideFeature = false;
176 bool mClipItemShape = false;
177};
178
179
186class CORE_EXPORT QgsLayoutItemMapItemClipPathSettings : public QObject
187{
188 Q_OBJECT
189
190 public:
195
202 bool isActive() const;
203
209 bool enabled() const;
210
216 void setEnabled( bool enabled );
217
224
235
240
248 void setSourceItem( QgsLayoutItem *item );
249
257
264
271
277 bool forceLabelsInsideClipPath() const;
278
284 void setForceLabelsInsideClipPath( bool forceInside );
285
291 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
292
299 bool readXml( const QDomElement &element, const QDomDocument &doc, const QgsReadWriteContext &context );
300
306
307 signals:
308
312 void changed();
313
314 private:
315 QgsLayoutItemMap *mMap = nullptr;
316 bool mEnabled = false;
318 bool mForceLabelsInsideClipPath = false;
319
320 QPointer< QgsLayoutItem > mClipPathSource;
321 QString mClipPathUuid;
322};
323
324
330class CORE_EXPORT QgsLayoutItemMap : public QgsLayoutItem, public QgsTemporalRangeObject
331{
332 Q_OBJECT
333
334 public:
341
364
370 {
373 };
374 Q_DECLARE_FLAGS( MapItemFlags, MapItemFlag )
375
376
379 explicit QgsLayoutItemMap( QgsLayout *layout );
380 ~QgsLayoutItemMap() override;
381
382 int type() const override;
383 QIcon icon() const override;
384 QgsLayoutItem::Flags itemFlags() const override;
385
392
399
403 void assignFreeId();
404
405 //overridden to show "Map 1" type names
406 QString displayName() const override;
407
414
415 // for now, map items behave a bit differently and don't implement draw. TODO - see if we can avoid this
416 void paint( QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) override;
417
421 Q_DECL_DEPRECATED int numberExportLayers() const override SIP_DEPRECATED;
422
423 void startLayeredExport() override;
424 void stopLayeredExport() override;
425 bool nextExportPart() override;
428 void setFrameStrokeWidth( QgsLayoutMeasurement width ) override;
429
435 double scale() const;
436
444 void setScale( double scale, bool forceUpdate = true );
445
453 void setExtent( const QgsRectangle &extent );
454
462 void zoomToExtent( const QgsRectangle &extent );
463
469 QgsRectangle extent() const;
470
471
479 QPolygonF visibleExtentPolygon() const;
480
490
500
508 void setCrs( const QgsCoordinateReferenceSystem &crs );
509
518 bool keepLayerSet() const { return mKeepLayerSet; }
519
528 void setKeepLayerSet( bool enabled ) { mKeepLayerSet = enabled; }
529
536 QList<QgsMapLayer *> layers() const;
537
547 void setLayers( const QList<QgsMapLayer *> &layers );
548
553 bool keepLayerStyles() const { return mKeepLayerStyles; }
554
559 void setKeepLayerStyles( bool enabled ) { mKeepLayerStyles = enabled; }
560
565 QMap<QString, QString> layerStyleOverrides() const { return mLayerStyleOverrides; }
566
571 void setLayerStyleOverrides( const QMap<QString, QString> &overrides );
572
576 void storeCurrentLayerStyles();
577
588 bool followVisibilityPreset() const { return mFollowVisibilityPreset; }
589
593 void setFollowVisibilityPreset( bool follow );
594
602 QString followVisibilityPresetName() const { return mFollowVisibilityPresetName; }
603
610 void setFollowVisibilityPresetName( const QString &name );
611
612 void moveContent( double dx, double dy ) override;
613 void setMoveContentPreviewOffset( double dx, double dy ) override;
614
615 void zoomContent( double factor, QPointF point ) override;
616
617
619 bool containsWmsLayer() const;
620
621 bool requiresRasterization() const override;
622 bool containsAdvancedEffects() const override;
623
630 void setMapRotation( double rotation );
631
640 double mapRotation( QgsLayoutObject::PropertyValueType valueType = QgsLayoutObject::EvaluatedValue ) const;
641
646 void setDrawAnnotations( bool draw ) { mDrawAnnotations = draw; }
647
652 bool drawAnnotations() const { return mDrawAnnotations; }
653
654
661 bool atlasDriven() const { return mAtlasDriven; }
662
669 void setAtlasDriven( bool enabled );
670
680 AtlasScalingMode atlasScalingMode() const { return mAtlasScalingMode; }
681
691 void setAtlasScalingMode( AtlasScalingMode mode ) { mAtlasScalingMode = mode; }
692
704
712 void setAtlasMargin( double margin ) { mAtlasMargin = margin; }
713
719 QgsLayoutItemMapGridStack *grids() { return mGridStack.get(); }
720
725 QgsLayoutItemMapGrid *grid();
726
733 QgsLayoutItemMapOverviewStack *overviews() { return mOverviewStack.get(); }
734
740 QgsLayoutItemMapOverview *overview();
741
752 QgsLayoutMeasurement labelMargin() const;
753
764 void setLabelMargin( const QgsLayoutMeasurement &margin );
765
766 QgsExpressionContext createExpressionContext() const override;
767
773 double mapUnitsToLayoutUnits() const;
774
782 QgsMapSettings mapSettings( const QgsRectangle &extent, QSizeF size, double dpi, bool includeLayerSettings ) const;
783
784 void finalizeRestoreFromXml() override;
785
792 QList<QgsMapLayer *> layersToRender( const QgsExpressionContext *context = nullptr, bool includeInvalidLayers = false ) const;
793
805 void addLabelBlockingItem( QgsLayoutItem *item );
806
818 void removeLabelBlockingItem( QgsLayoutItem *item );
819
831 bool isLabelBlockingItem( QgsLayoutItem *item ) const;
832
837 QgsMapRendererJob::Errors renderingErrors() const { return mRenderingErrors; }
838
846 QgsLabelingResults *previewLabelingResults() const;
847
848 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
849
862 void addRenderedFeatureHandler( QgsRenderedFeatureHandlerInterface *handler );
863
870 void removeRenderedFeatureHandler( QgsRenderedFeatureHandlerInterface *handler );
871
875 QTransform layoutToMapCoordsTransform() const;
876
883
890
898 void setZRangeEnabled( bool enabled );
899
908 bool zRangeEnabled() const;
909
920 QgsDoubleRange zRange() const;
921
932 void setZRange( const QgsDoubleRange &range );
933
934 // Reimplement estimatedFrameBleed to take the grid frame into account
935 double estimatedFrameBleed() const override;
936
937 protected:
938 void draw( QgsLayoutItemRenderContext &context ) override;
939 bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
940 bool readPropertiesFromElement( const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context ) override;
941 QPainterPath framePath() const override;
942
944 bool isDrawing() const { return mDrawing; }
945
946 // In case of annotations, the bounding rectangle can be larger than the map item rectangle
947 QRectF boundingRect() const override;
948
950 QPolygonF transformedMapPolygon() const;
951
953 QPointF mapToItemCoords( QPointF mapCoords ) const;
954
958 QgsRectangle requestedExtent() const;
959
960 signals:
961
968
974 void mapRotationChanged( double newRotation );
975
978
984
993 void themeChanged( const QString &theme );
994
1001
1008
1009 public slots:
1010
1011 void refresh() override;
1012
1013 void invalidateCache() override;
1014
1016 void updateBoundingRect();
1017
1019
1020 private slots:
1021 void layersAboutToBeRemoved( const QList<QgsMapLayer *> &layers );
1022
1023 void painterJobFinished();
1024
1025 void shapeChanged();
1026
1027 void mapThemeChanged( const QString &theme );
1028
1030 void currentMapThemeRenamed( const QString &theme, const QString &newTheme );
1031
1033 void recreateCachedImageInBackground();
1034
1035 void updateAtlasFeature();
1036
1037 private:
1039
1041 int mMapId = 1;
1042
1043 std::unique_ptr< QgsLayoutItemMapGridStack > mGridStack;
1044 std::unique_ptr< QgsLayoutItemMapOverviewStack > mOverviewStack;
1045
1046 // Map region in map units really used for rendering
1047 // It can be the same as mUserExtent, but it can be bigger in on dimension if mCalculate==Scale,
1048 // so that full rectangle in paper is used.
1049 QgsRectangle mExtent;
1050
1053
1054 // Current temporary map region in map units. This is overwritten when atlas feature changes. It's also
1055 // used when the user changes the map extent and an atlas preview is enabled. This allows the user
1056 // to manually tweak each atlas preview page without affecting the actual original map extent.
1057 QgsRectangle mAtlasFeatureExtent;
1058
1059 // We have two images used for rendering/storing cached map images.
1060 // the first (mCacheFinalImage) is used ONLY for storing the most recent completed map render. It's always
1061 // used when drawing map item previews. The second (mCacheRenderingImage) is used temporarily while
1062 // rendering a new preview image in the background. If (and only if) the background render completes, then
1063 // mCacheRenderingImage is pushed into mCacheFinalImage, and used from then on when drawing the item preview.
1064 // This ensures that something is always shown in the map item, even while refreshing the preview image in the
1065 // background
1066 std::unique_ptr< QImage > mCacheFinalImage;
1067 std::unique_ptr< QImage > mCacheRenderingImage;
1068 bool mUpdatesEnabled = true;
1069
1071 bool mCacheInvalidated = true;
1072
1074 int mNumCachedLayers;
1075
1076 // Set to true if in state of drawing. Concurrent requests to draw method are returned if set to true
1077 bool mDrawing = false;
1078
1079 QTimer *mBackgroundUpdateTimer = nullptr;
1080 double mPreviewScaleFactor = 0;
1081 double mPreviewDevicePixelRatio = 1.0;
1082
1083 bool mDrawingPreview = false;
1084
1086 double mXOffset = 0.0;
1088 double mYOffset = 0.0;
1089
1090 double mLastRenderedImageOffsetX = 0.0;
1091 double mLastRenderedImageOffsetY = 0.0;
1092
1094 double mMapRotation = 0;
1095
1100 double mEvaluatedMapRotation = 0;
1101
1102 bool mZRangeEnabled = false;
1103 QgsDoubleRange mZRange;
1104
1106 bool mKeepLayerSet = false;
1107
1109 QList< QgsMapLayerRef > mLayers;
1110
1111 bool mKeepLayerStyles = false;
1113 QMap<QString, QString> mLayerStyleOverrides;
1114
1116 mutable QString mCachedLayerStyleOverridesPresetName;
1118 mutable QMap<QString, QString> mCachedPresetLayerStyleOverrides;
1119
1125 bool mFollowVisibilityPreset = false;
1126
1131 QString mFollowVisibilityPresetName;
1132
1134 QString mLastEvaluatedThemeName;
1135
1143 void drawMap( QPainter *painter, const QgsRectangle &extent, QSizeF size, double dpi );
1144
1146 void connectUpdateSlot();
1147
1149 void syncLayerSet();
1150
1152 const QgsLayoutItemMapGrid *constFirstMapGrid() const;
1153
1155 const QgsLayoutItemMapOverview *constFirstMapOverview() const;
1156
1161 QList< QgsLabelBlockingRegion > createLabelBlockingRegions( const QgsMapSettings &mapSettings ) const;
1162
1164 QRectF mCurrentRectangle;
1166 bool mDrawAnnotations = true;
1167
1169 bool mAtlasDriven = false;
1171 AtlasScalingMode mAtlasScalingMode = Auto;
1173 double mAtlasMargin = 0.10;
1174
1175 std::unique_ptr< QPainter > mPainter;
1176 std::unique_ptr< QgsMapRendererCustomPainterJob > mPainterJob;
1177 bool mPainterCancelWait = false;
1178
1179 QgsLayoutMeasurement mLabelMargin { 0 };
1180 QgsLayoutMeasurement mEvaluatedLabelMargin { 0 };
1181
1182 QStringList mBlockingLabelItemUuids;
1183 QList< QPointer< QgsLayoutItem > > mBlockingLabelItems;
1184
1186 QgsMapRendererJob::Errors mRenderingErrors;
1187
1188 QList< QgsRenderedFeatureHandlerInterface * > mRenderedFeatureHandlers;
1189
1190 std::unique_ptr< QgsMapRendererStagedRenderJob > mStagedRendererJob;
1191
1192 std::unique_ptr< QgsLabelingResults > mPreviewLabelingResults;
1193 std::unique_ptr< QgsLabelingResults > mExportLabelingResults;
1194
1195 void init();
1196
1198 void updateToolTip();
1199
1200 QString themeToRender( const QgsExpressionContext &context ) const;
1201
1203 QMap<QString, QString> layerStyleOverridesToRender( const QgsExpressionContext &context ) const;
1204
1206 QgsRectangle transformedExtent() const;
1207
1209 void mapPolygon( const QgsRectangle &extent, QPolygonF &poly ) const;
1210
1216 void transformShift( double &xShift, double &yShift ) const;
1217
1218 void drawAnnotations( QPainter *painter );
1219 void drawAnnotation( const QgsAnnotation *item, QgsRenderContext &context );
1220 QPointF layoutMapPosForItem( const QgsAnnotation *item ) const;
1221
1222 void drawMapFrame( QPainter *p );
1223 void drawMapBackground( QPainter *p );
1224
1225 enum PartType
1226 {
1227 Start,
1228 Background,
1229 Layer,
1230 Grid,
1231 OverviewMapExtent,
1232 Frame,
1233 SelectionBoxes,
1234 End,
1235 NotLayered,
1236 };
1237
1239 bool shouldDrawPart( PartType part ) const;
1240
1241 PartType mCurrentExportPart = NotLayered;
1242 QStringList mExportThemes;
1243 QStringList::iterator mExportThemeIt;
1244
1245 QgsLayoutItemMapAtlasClippingSettings *mAtlasClippingSettings = nullptr;
1246 QgsLayoutItemMapItemClipPathSettings *mItemClippingSettings = nullptr;
1247
1248 std::unique_ptr<QgsGroupedFeatureFilterProvider> mAtlasFeatureFilterProvider;
1249
1254 void refreshMapExtents( const QgsExpressionContext *context = nullptr );
1255
1256 void refreshLabelMargin( bool updateItem );
1257
1258 QgsRectangle computeAtlasRectangle();
1259
1260 void createStagedRenderJob( const QgsRectangle &extent, const QSizeF size, double dpi );
1261
1262 QPolygonF calculateVisibleExtentPolygon( bool includeClipping ) const;
1263
1267 std::map<QString, std::unique_ptr<QgsGroupLayer>> mGroupLayers;
1268
1272 bool hasCustomFramePath() const;
1273
1277 friend class TestQgsLayoutMap;
1280 friend class QgsLayoutExporter;
1281};
1282
1284
1285#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:217
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:113
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_ENUM_BASETYPE(type)
Definition qgis_sip.h:274
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_FACTORY
Definition qgis_sip.h:83
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsProjectionSelectionWidget::CrsOptions)
Contains details of a particular export layer relating to a layout item.