17#ifndef QGSLAYOUTITEMMAP_H 
   18#define QGSLAYOUTITEMMAP_H 
   63    void setEnabled( 
bool enabled );
 
   84    bool forceLabelsInsideFeature() 
const;
 
   91    void setForceLabelsInsideFeature( 
bool forceInside );
 
   99    bool restrictToLayers() 
const;
 
  107    void setRestrictToLayers( 
bool enabled );
 
  117    QList< QgsMapLayer * > layersToClip() 
const;
 
  127    void setLayersToClip( 
const QList< QgsMapLayer * > &layers );
 
  134    bool writeXml( QDomElement &element, QDomDocument &document, 
const QgsReadWriteContext &context ) 
const;
 
  141    bool readXml( 
const QDomElement &element, 
const QDomDocument &doc, 
const QgsReadWriteContext &context );
 
  151    void layersAboutToBeRemoved( 
const QList<QgsMapLayer *> &layers );
 
  156    bool mClipToAtlasFeature = 
false;
 
  157    bool mRestrictToLayers = 
false;
 
  158    QList< QgsMapLayerRef > mLayersToClip;
 
  160    bool mForceLabelsInsideFeature = 
false;
 
 
  187    bool isActive() 
const;
 
  194    bool enabled() 
const;
 
  201    void setEnabled( 
bool enabled );
 
  262    bool forceLabelsInsideClipPath() 
const;
 
  269    void setForceLabelsInsideClipPath( 
bool forceInside );
 
  276    bool writeXml( QDomElement &element, QDomDocument &document, 
const QgsReadWriteContext &context ) 
const;
 
  284    bool readXml( 
const QDomElement &element, 
const QDomDocument &doc, 
const QgsReadWriteContext &context );
 
  290    void finalizeRestoreFromXml();
 
  302    bool mEnabled = 
false;
 
  304    bool mForceLabelsInsideClipPath = 
false;
 
  306    QPointer< QgsLayoutItem > mClipPathSource;
 
  307    QString mClipPathUuid;
 
 
  353      ShowPartialLabels  = 1 << 0, 
 
  354      ShowUnplacedLabels = 1 << 1, 
 
 
  364    int type() 
const override;
 
  365    QIcon icon() 
const override;
 
  388    QString displayName() 
const override;
 
  398    void paint( QPainter *painter, 
const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget ) 
override;
 
  399    Q_DECL_DEPRECATED 
int numberExportLayers() const override 
SIP_DEPRECATED;
 
  400    void startLayeredExport() override;
 
  401    void stopLayeredExport() override;
 
  402    bool nextExportPart() override;
 
  412    double scale() const;
 
  421    void setScale( 
double scale, 
bool forceUpdate = true );
 
  456    QPolygonF visibleExtentPolygon() const;
 
  513    QList<QgsMapLayer *> layers() 
const;
 
  524    void setLayers( 
const QList<QgsMapLayer *> &layers );
 
  548    void setLayerStyleOverrides( 
const QMap<QString, QString> &overrides );
 
  553    void storeCurrentLayerStyles();
 
  570    void setFollowVisibilityPreset( 
bool follow );
 
  587    void setFollowVisibilityPresetName( 
const QString &name );
 
  589    void moveContent( 
double dx, 
double dy ) 
override;
 
  590    void setMoveContentPreviewOffset( 
double dx, 
double dy ) 
override;
 
  592    void zoomContent( 
double factor, QPointF point ) 
override;
 
  596    bool containsWmsLayer() 
const;
 
  598    bool requiresRasterization() 
const override;
 
  599    bool containsAdvancedEffects() 
const override;
 
  607    void setMapRotation( 
double rotation );
 
  646    void setAtlasDriven( 
bool enabled );
 
  750    double mapUnitsToLayoutUnits() 
const;
 
  761    void finalizeRestoreFromXml() 
override;
 
  850    QTransform layoutToMapCoordsTransform() 
const;
 
  873    void setZRangeEnabled( 
bool enabled );
 
  883    bool zRangeEnabled() 
const;
 
  910    double estimatedFrameBleed() 
const override;
 
  915    bool writePropertiesToElement( QDomElement &element, QDomDocument &document, 
const QgsReadWriteContext &context ) 
const override;
 
  916    bool readPropertiesFromElement( 
const QDomElement &element, 
const QDomDocument &document, 
const QgsReadWriteContext &context ) 
override;
 
  917    QPainterPath framePath() 
const override;
 
  923    QRectF boundingRect() 
const override;
 
  926    QPolygonF transformedMapPolygon() 
const;
 
  929    QPointF mapToItemCoords( QPointF mapCoords ) 
const;
 
  987    void refresh() 
override;
 
  989    void invalidateCache() 
override;
 
  992    void updateBoundingRect();
 
  997    void layersAboutToBeRemoved( 
const QList<QgsMapLayer *> &layers );
 
  999    void painterJobFinished();
 
 1001    void shapeChanged();
 
 1003    void mapThemeChanged( 
const QString &theme );
 
 1006    void currentMapThemeRenamed( 
const QString &theme, 
const QString &newTheme );
 
 1009    void recreateCachedImageInBackground();
 
 1011    void updateAtlasFeature();
 
 1019    std::unique_ptr< QgsLayoutItemMapGridStack > mGridStack;
 
 1020    std::unique_ptr< QgsLayoutItemMapOverviewStack > mOverviewStack;
 
 1042    std::unique_ptr< QImage > mCacheFinalImage;
 
 1043    std::unique_ptr< QImage > mCacheRenderingImage;
 
 1044    bool mUpdatesEnabled = 
true;
 
 1047    bool mCacheInvalidated = 
true;
 
 1050    int mNumCachedLayers;
 
 1053    bool mDrawing = 
false;
 
 1055    QTimer *mBackgroundUpdateTimer = 
nullptr;
 
 1056    double mPreviewScaleFactor = 0;
 
 1057    double mPreviewDevicePixelRatio = 1.0;
 
 1059    bool mDrawingPreview = 
false;
 
 1062    double mXOffset = 0.0;
 
 1064    double mYOffset = 0.0;
 
 1066    double mLastRenderedImageOffsetX = 0.0;
 
 1067    double mLastRenderedImageOffsetY = 0.0;
 
 1070    double mMapRotation = 0;
 
 1076    double mEvaluatedMapRotation = 0;
 
 1078    bool mZRangeEnabled = 
false;
 
 1082    bool mKeepLayerSet = 
false;
 
 1085    QList< QgsMapLayerRef > mLayers;
 
 1087    bool mKeepLayerStyles = 
false;
 
 1089    QMap<QString, QString> mLayerStyleOverrides;
 
 1092    mutable QString mCachedLayerStyleOverridesPresetName;
 
 1094    mutable QMap<QString, QString> mCachedPresetLayerStyleOverrides;
 
 1101    bool mFollowVisibilityPreset = 
false;
 
 1107    QString mFollowVisibilityPresetName;
 
 1110    QString mLastEvaluatedThemeName;
 
 1119    void drawMap( QPainter *painter, 
const QgsRectangle &extent, QSizeF size, 
double dpi );
 
 1122    void connectUpdateSlot();
 
 1125    void syncLayerSet();
 
 1137    QList< QgsLabelBlockingRegion > createLabelBlockingRegions( 
const QgsMapSettings &mapSettings ) 
const;
 
 1140    QRectF mCurrentRectangle;
 
 1142    bool mDrawAnnotations = 
true;
 
 1145    bool mAtlasDriven = 
false;
 
 1149    double mAtlasMargin = 0.10;
 
 1151    std::unique_ptr< QPainter > mPainter;
 
 1152    std::unique_ptr< QgsMapRendererCustomPainterJob > mPainterJob;
 
 1153    bool mPainterCancelWait = 
false;
 
 1158    QStringList mBlockingLabelItemUuids;
 
 1159    QList< QPointer< QgsLayoutItem > > mBlockingLabelItems;
 
 1164    QList< QgsRenderedFeatureHandlerInterface * > mRenderedFeatureHandlers;
 
 1166    std::unique_ptr< QgsMapRendererStagedRenderJob > mStagedRendererJob;
 
 1168    std::unique_ptr< QgsLabelingResults > mPreviewLabelingResults;
 
 1169    std::unique_ptr< QgsLabelingResults > mExportLabelingResults;
 
 1174    void updateToolTip();
 
 1179    QMap<QString, QString> layerStyleOverridesToRender( 
const QgsExpressionContext &context ) 
const;
 
 1185    void mapPolygon( 
const QgsRectangle &extent, QPolygonF &poly ) 
const;
 
 1192    void transformShift( 
double &xShift, 
double &yShift ) 
const;
 
 1194    void drawAnnotations( QPainter *painter );
 
 1196    QPointF layoutMapPosForItem( 
const QgsAnnotation *item ) 
const;
 
 1198    void drawMapFrame( QPainter *p );
 
 1199    void drawMapBackground( QPainter *p );
 
 1215    bool shouldDrawPart( PartType part ) 
const;
 
 1217    PartType mCurrentExportPart = NotLayered;
 
 1218    QStringList mExportThemes;
 
 1219    QStringList::iterator mExportThemeIt;
 
 1230    void refreshLabelMargin( 
bool updateItem );
 
 1234    void createStagedRenderJob( 
const QgsRectangle &extent, 
const QSizeF size, 
double dpi );
 
 1236    QPolygonF calculateVisibleExtentPolygon( 
bool includeClipping ) 
const;
 
 1241    std::map<QString, std::unique_ptr<QgsGroupLayer>> mGroupLayers;
 
 1246    friend class TestQgsLayoutMap;
 
 1248    friend class QgsGeospatialPdfRenderedFeatureHandler;
 
 
Abstract base class for annotation items which are drawn over a map.
 
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
 
This class represents a coordinate reference system (CRS).
 
QgsRange which stores a range of double values.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
A geometry is the spatial representation of a feature.
 
Class that stores computed placement from labeling engine.
 
Handles rendering and exports of layouts to various formats.
 
A layout item subclass for map legends.
 
Contains settings relating to clipping a layout map by the current atlas feature.
 
void changed()
Emitted when the atlas clipping settings are changed.
 
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.
 
void changed()
Emitted when the item clipping settings are changed.
 
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.
 
void extentChanged()
Emitted when the map's extent changes.
 
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...
 
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.
 
@ Fixed
The current scale of the map is used for each feature of the atlas.
 
void layerStyleOverridesChanged()
Emitted when layer style overrides are changed... a means to let associated legend items know they sh...
 
void mapRotationChanged(double newRotation)
Emitted when the map's rotation changes.
 
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.
 
void setDrawAnnotations(bool draw)
Sets whether annotations are drawn within the map.
 
QFlags< MapItemFlag > MapItemFlags
 
bool followVisibilityPreset() const
Returns whether the map should follow a map theme.
 
void crsChanged()
Emitted when the map's coordinate reference system is changed.
 
QgsLayoutItemMapOverviewStack * overviews()
Returns the map item's overview stack, which is used to control how overviews are drawn over the map'...
 
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.
 
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 themeChanged(const QString &theme)
Emitted when the map's associated theme is changed.
 
MapItemFlag
Various flags that affect drawing of map items.
 
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...
 
QgsLayoutItemMapAtlasClippingSettings * atlasClippingSettings()
Returns the map's atlas clipping settings.
 
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.
 
QgsLayoutItemMapItemClipPathSettings * itemClippingSettings()
Returns the map's item based clip path settings.
 
Contains settings and helpers relating to a render of a QgsLayoutItem.
 
Base class for graphical items within a QgsLayout.
 
ExportLayerBehavior
Behavior of item when exporting to layered outputs.
 
This class provides a method of storing measurements for use in QGIS layouts using a variety of diffe...
 
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.
 
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
 
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
 
The QgsMapSettings class contains configuration for rendering of the map.
 
The class is used as a container of context for various read/write operations on other objects.
 
A rectangle specified with double values.
 
Contains information about the context of a rendering operation.
 
An interface for classes which provider custom handlers for features rendered as part of a map render...
 
An interface for classes which can visit style entity (e.g.
 
Base class for objects with an associated (optional) temporal range.
 
#define SIP_ENUM_BASETYPE(type)
 
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsTextRendererUtils::CurvedTextFlags)
 
const QgsCoordinateReferenceSystem & crs
 
Contains details of a particular export layer relating to a layout item.