QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Public Slots | Public Member Functions | List of all members
QgsLayoutItemMapOverview Class Reference

An individual overview which is drawn above the map content in a QgsLayoutItemMap, and shows the extent of another QgsLayoutItemMap. More...

#include <qgslayoutitemmapoverview.h>

Inheritance diagram for QgsLayoutItemMapOverview:
Inheritance graph
[legend]

Public Slots

void overviewExtentChanged ()
 Handles recentering of the map and redrawing of the map's overview.
 
- Public Slots inherited from QgsLayoutObject
virtual void refresh ()
 Refreshes the object, causing a recalculation of any property overrides.
 

Public Member Functions

 QgsLayoutItemMapOverview (const QString &name, QgsLayoutItemMap *map)
 Constructor for QgsLayoutItemMapOverview.
 
 ~QgsLayoutItemMapOverview () override
 
bool accept (QgsStyleEntityVisitorInterface *visitor) const override
 Accepts the specified style entity visitor, causing it to visit all style entities associated with the map item.
 
QgsVectorLayerasMapLayer ()
 Returns a vector layer to render as part of the QgsLayoutItemMap render, containing a feature representing the overview extent (and with an appropriate renderer set matching the overview's frameSymbol() ).
 
QPainter::CompositionMode blendMode () const
 Retrieves the blending mode used for drawing the overview.
 
bool centered () const
 Returns whether the extent of the map is forced to center on the overview.
 
void connectSignals ()
 Reconnects signals for overview map, so that overview correctly follows changes to source map's extent.
 
void draw (QPainter *painter) override
 Draws the item on to a destination painter.
 
void finalizeRestoreFromXml () override
 Called after all pending items have been restored from XML.
 
QgsFillSymbolframeSymbol ()
 Returns the fill symbol used for drawing the overview extent.
 
const QgsFillSymbolframeSymbol () const
 Returns the fill symbol used for drawing the overview extent.
 
bool inverted () const
 Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.
 
QgsLayoutItemMaplinkedMap ()
 Returns the source map to show the overview extent of.
 
QgsMapLayermapLayer () override
 Returns the internal map layer used by this item, if available.
 
bool readXml (const QDomElement &itemElem, const QDomDocument &doc, const QgsReadWriteContext &context) override
 Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'LayoutMapGrid' tag.
 
void setBlendMode (QPainter::CompositionMode mode)
 Sets the blending mode used for drawing the overview.
 
void setCentered (bool centered)
 Sets whether the extent of the map is forced to center on the overview.
 
void setFrameSymbol (QgsFillSymbol *symbol)
 Sets the fill symbol used for drawing the overview extent.
 
void setInverted (bool inverted)
 Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.
 
void setLinkedMap (QgsLayoutItemMap *map)
 Sets the map to show the overview extent of.
 
bool usesAdvancedEffects () const override
 Returns true if the item is drawn using advanced effects, such as blend modes.
 
bool writeXml (QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const override
 Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMap' tag.
 
- Public Member Functions inherited from QgsLayoutItemMapItem
 QgsLayoutItemMapItem (const QString &name, QgsLayoutItemMap *map)
 Constructor for QgsLayoutItemMapItem, attached to the specified map.
 
QgsExpressionContext createExpressionContext () const override
 This method needs to be reimplemented in all classes which implement this interface and return an expression context.
 
bool enabled () const
 Returns whether the item will be drawn.
 
QString id () const
 Returns the unique id for the map item.
 
const QgsLayoutItemMapmap () const
 Returns the layout item map for the item.
 
QString name () const
 Returns the friendly display name for the item.
 
virtual void setEnabled (bool enabled)
 Controls whether the item will be drawn.
 
void setMap (QgsLayoutItemMap *map)
 Sets the corresponding layout map for the item.
 
void setName (const QString &name)
 Sets the friendly display name for the item.
 
void setStackingLayer (QgsMapLayer *layer)
 Sets the item's stacking layer, which specifies where the in the map's stack the item should be rendered.
 
void setStackingPosition (StackingPosition position)
 Sets the item's stacking position, which specifies where the in the map's stack the item should be rendered.
 
QgsMapLayerstackingLayer () const
 Returns the item's stacking layer, which specifies where the in the map's stack the item should be rendered.
 
StackingPosition stackingPosition () const
 Returns the item's stacking position, which specifies where the in the map's stack the item should be rendered.
 
- Public Member Functions inherited from QgsLayoutObject
 QgsLayoutObject (QgsLayout *layout)
 Constructor for QgsLayoutObject, with the specified parent layout.
 
QgsExpressionContext createExpressionContext () const override
 Creates an expression context relating to the objects' current state.
 
QStringList customProperties () const
 Returns list of keys stored in custom properties for the object.
 
QVariant customProperty (const QString &key, const QVariant &defaultValue=QVariant()) const
 Read a custom property from the object.
 
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the object's property collection, used for data defined overrides.
 
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the object's property collection, used for data defined overrides.
 
QgsLayoutlayout ()
 Returns the layout the object is attached to.
 
const QgsLayoutlayout () const
 Returns the layout the object is attached to.
 
void removeCustomProperty (const QString &key)
 Remove a custom property from the object.
 
void setCustomProperty (const QString &key, const QVariant &value)
 Set a custom property for the object.
 
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the objects's property collection, used for data defined overrides.
 
- Public Member Functions inherited from QgsExpressionContextGenerator
virtual ~QgsExpressionContextGenerator ()=default
 

Additional Inherited Members

- Public Types inherited from QgsLayoutItemMapItem
enum  StackingPosition {
  StackBelowMap , StackBelowMapLayer , StackAboveMapLayer , StackBelowMapLabels ,
  StackAboveMapLabels
}
 Item stacking position, specifies where the in the map's stack the item should be rendered. More...
 
- Public Types inherited from QgsLayoutObject
enum class  DataDefinedProperty : int {
  NoProperty = 0 , AllProperties , TestProperty , PresetPaperSize ,
  PaperWidth , PaperHeight , NumPages , PaperOrientation ,
  PageNumber , PositionX , PositionY , ItemWidth ,
  ItemHeight , ItemRotation , Transparency , Opacity ,
  BlendMode , ExcludeFromExports , FrameColor , BackgroundColor ,
  MarginLeft , MarginTop , MarginRight , MarginBottom ,
  MapRotation , MapScale , MapXMin , MapYMin ,
  MapXMax , MapYMax , MapAtlasMargin , MapLayers ,
  MapStylePreset , MapLabelMargin , MapGridEnabled , MapGridIntervalX ,
  MapGridIntervalY , MapGridOffsetX , MapGridOffsetY , MapGridFrameSize ,
  MapGridFrameMargin , MapGridLabelDistance , MapGridCrossSize , MapGridFrameLineThickness ,
  MapGridAnnotationDisplayLeft , MapGridAnnotationDisplayRight , MapGridAnnotationDisplayTop , MapGridAnnotationDisplayBottom ,
  MapGridFrameDivisionsLeft , MapGridFrameDivisionsRight , MapGridFrameDivisionsTop , MapGridFrameDivisionsBottom ,
  MapCrs , StartDateTime , EndDateTime , MapZRangeLower ,
  MapZRangeUpper , PictureSource , PictureSvgBackgroundColor , PictureSvgStrokeColor ,
  PictureSvgStrokeWidth , SourceUrl , LegendTitle , LegendColumnCount ,
  ScalebarLeftSegments , ScalebarRightSegments , ScalebarSegmentWidth , ScalebarMinimumWidth ,
  ScalebarMaximumWidth , ScalebarHeight , ScalebarRightSegmentSubdivisions , ScalebarSubdivisionHeight ,
  ScalebarFillColor , ScalebarFillColor2 , ScalebarLineColor , ScalebarLineWidth ,
  AttributeTableSourceLayer , ElevationProfileTolerance , ElevationProfileDistanceMajorInterval , ElevationProfileDistanceMinorInterval ,
  ElevationProfileDistanceLabelInterval , ElevationProfileElevationMajorInterval , ElevationProfileElevationMinorInterval , ElevationProfileElevationLabelInterval ,
  ElevationProfileMinimumDistance , ElevationProfileMaximumDistance , ElevationProfileMinimumElevation , ElevationProfileMaximumElevation
}
 Data defined properties for different item types. More...
 
enum  PropertyValueType { EvaluatedValue = 0 , OriginalValue }
 Specifies whether the value returned by a function should be the original, user set value, or the current evaluated value for the property. More...
 
- Signals inherited from QgsLayoutObject
void changed ()
 Emitted when the object's properties change.
 
- Static Public Member Functions inherited from QgsLayoutObject
static bool propertyAssociatesWithParentMultiframe (DataDefinedProperty property)
 Returns true if the specified property key is normally associated with the parent QgsLayoutMultiFrame object instead of a child QgsLayoutFrame object.
 
static const QgsPropertiesDefinitionpropertyDefinitions ()
 Returns the layout object property definitions.
 
- Protected Member Functions inherited from QgsLayoutObject
bool readObjectPropertiesFromElement (const QDomElement &parentElement, const QDomDocument &document, const QgsReadWriteContext &context)
 Sets object properties from a DOM element.
 
bool writeObjectPropertiesToElement (QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context) const
 Stores object properties within an XML DOM element.
 
- Protected Attributes inherited from QgsLayoutItemMapItem
bool mEnabled
 True if item is to be displayed on map.
 
QgsLayoutItemMapmMap = nullptr
 Associated map.
 
QString mName
 Friendly display name.
 
QgsMapLayerRef mStackingLayer
 
StackingPosition mStackingPosition = StackBelowMapLabels
 
QString mUuid
 Unique id.
 
- Protected Attributes inherited from QgsLayoutObject
QgsObjectCustomProperties mCustomProperties
 Custom properties for object.
 
QgsPropertyCollection mDataDefinedProperties
 
QPointer< QgsLayoutmLayout
 

Detailed Description

An individual overview which is drawn above the map content in a QgsLayoutItemMap, and shows the extent of another QgsLayoutItemMap.

See also
QgsLayoutItemMapOverviewStack

Definition at line 124 of file qgslayoutitemmapoverview.h.

Constructor & Destructor Documentation

◆ QgsLayoutItemMapOverview()

QgsLayoutItemMapOverview::QgsLayoutItemMapOverview ( const QString &  name,
QgsLayoutItemMap map 
)

Constructor for QgsLayoutItemMapOverview.

Parameters
namefriendly display name for overview
mapQgsLayoutItemMap the overview is attached to

Definition at line 35 of file qgslayoutitemmapoverview.cpp.

◆ ~QgsLayoutItemMapOverview()

QgsLayoutItemMapOverview::~QgsLayoutItemMapOverview ( )
overridedefault

Member Function Documentation

◆ accept()

bool QgsLayoutItemMapOverview::accept ( QgsStyleEntityVisitorInterface visitor) const
overridevirtual

Accepts the specified style entity visitor, causing it to visit all style entities associated with the map item.

Returns true if the visitor should continue visiting other objects, or false if visiting should be canceled.

Since
QGIS 3.10

Reimplemented from QgsLayoutItemMapItem.

Definition at line 317 of file qgslayoutitemmapoverview.cpp.

◆ asMapLayer()

QgsVectorLayer * QgsLayoutItemMapOverview::asMapLayer ( )

Returns a vector layer to render as part of the QgsLayoutItemMap render, containing a feature representing the overview extent (and with an appropriate renderer set matching the overview's frameSymbol() ).

Ownership of the layer remain with the overview item.

Since
QGIS 3.6

Definition at line 256 of file qgslayoutitemmapoverview.cpp.

◆ blendMode()

QPainter::CompositionMode QgsLayoutItemMapOverview::blendMode ( ) const
inline

Retrieves the blending mode used for drawing the overview.

See also
setBlendMode()

Definition at line 180 of file qgslayoutitemmapoverview.h.

◆ centered()

bool QgsLayoutItemMapOverview::centered ( ) const
inline

Returns whether the extent of the map is forced to center on the overview.

See also
setCentered()

Definition at line 206 of file qgslayoutitemmapoverview.h.

◆ connectSignals()

void QgsLayoutItemMapOverview::connectSignals ( )

Reconnects signals for overview map, so that overview correctly follows changes to source map's extent.

Definition at line 242 of file qgslayoutitemmapoverview.cpp.

◆ draw()

void QgsLayoutItemMapOverview::draw ( QPainter *  painter)
overridevirtual

Draws the item on to a destination painter.

Implements QgsLayoutItemMapItem.

Definition at line 55 of file qgslayoutitemmapoverview.cpp.

◆ finalizeRestoreFromXml()

void QgsLayoutItemMapOverview::finalizeRestoreFromXml ( )
overridevirtual

Called after all pending items have been restored from XML.

Map items can use this method to run steps which must take place after all items have been restored to the layout, such as connecting to signals emitted by other items, which may not have existed in the layout at the time readXml() was called. E.g. an overview can use this to connect to its linked map item after restoration from XML.

See also
readXml()

Reimplemented from QgsLayoutItemMapItem.

Definition at line 204 of file qgslayoutitemmapoverview.cpp.

◆ frameSymbol() [1/2]

QgsFillSymbol * QgsLayoutItemMapOverview::frameSymbol ( )

Returns the fill symbol used for drawing the overview extent.

See also
setFrameSymbol()

Definition at line 334 of file qgslayoutitemmapoverview.cpp.

◆ frameSymbol() [2/2]

const QgsFillSymbol * QgsLayoutItemMapOverview::frameSymbol ( ) const

Returns the fill symbol used for drawing the overview extent.

See also
setFrameSymbol()
Note
not available in Python bindings

Definition at line 339 of file qgslayoutitemmapoverview.cpp.

◆ inverted()

bool QgsLayoutItemMapOverview::inverted ( ) const
inline

Returns whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.

See also
setInverted()

Definition at line 193 of file qgslayoutitemmapoverview.h.

◆ linkedMap()

QgsLayoutItemMap * QgsLayoutItemMapOverview::linkedMap ( )

Returns the source map to show the overview extent of.

See also
setLinkedMap()

Definition at line 237 of file qgslayoutitemmapoverview.cpp.

◆ mapLayer()

QgsMapLayer * QgsLayoutItemMapOverview::mapLayer ( )
overridevirtual

Returns the internal map layer used by this item, if available.

Since
QGIS 3.10.1

Reimplemented from QgsLayoutItemMapItem.

Definition at line 312 of file qgslayoutitemmapoverview.cpp.

◆ overviewExtentChanged

void QgsLayoutItemMapOverview::overviewExtentChanged ( )
slot

Handles recentering of the map and redrawing of the map's overview.

Definition at line 360 of file qgslayoutitemmapoverview.cpp.

◆ readXml()

bool QgsLayoutItemMapOverview::readXml ( const QDomElement &  element,
const QDomDocument &  doc,
const QgsReadWriteContext context 
)
overridevirtual

Sets the map item state from a DOM document, where element is the DOM node corresponding to a 'LayoutMapGrid' tag.

See also
writeXml()

Reimplemented from QgsLayoutItemMapItem.

Definition at line 179 of file qgslayoutitemmapoverview.cpp.

◆ setBlendMode()

void QgsLayoutItemMapOverview::setBlendMode ( QPainter::CompositionMode  mode)

Sets the blending mode used for drawing the overview.

See also
blendMode()

Definition at line 344 of file qgslayoutitemmapoverview.cpp.

◆ setCentered()

void QgsLayoutItemMapOverview::setCentered ( bool  centered)

Sets whether the extent of the map is forced to center on the overview.

See also
centered()

Definition at line 354 of file qgslayoutitemmapoverview.cpp.

◆ setFrameSymbol()

void QgsLayoutItemMapOverview::setFrameSymbol ( QgsFillSymbol symbol)

Sets the fill symbol used for drawing the overview extent.

Ownership is transferred to the overview.

See also
frameSymbol()

Definition at line 329 of file qgslayoutitemmapoverview.cpp.

◆ setInverted()

void QgsLayoutItemMapOverview::setInverted ( bool  inverted)

Sets whether the overview frame is inverted, ie, whether the shaded area is drawn outside the extent of the overview map.

See also
inverted()

Definition at line 349 of file qgslayoutitemmapoverview.cpp.

◆ setLinkedMap()

void QgsLayoutItemMapOverview::setLinkedMap ( QgsLayoutItemMap map)

Sets the map to show the overview extent of.

See also
linkedMap()

Definition at line 217 of file qgslayoutitemmapoverview.cpp.

◆ usesAdvancedEffects()

bool QgsLayoutItemMapOverview::usesAdvancedEffects ( ) const
overridevirtual

Returns true if the item is drawn using advanced effects, such as blend modes.

Reimplemented from QgsLayoutItemMapItem.

Definition at line 212 of file qgslayoutitemmapoverview.cpp.

◆ writeXml()

bool QgsLayoutItemMapOverview::writeXml ( QDomElement &  element,
QDomDocument &  document,
const QgsReadWriteContext context 
) const
overridevirtual

Stores map item state in a DOM element, where element is the DOM element corresponding to a 'LayoutMap' tag.

See also
readXml()

Reimplemented from QgsLayoutItemMapItem.

Definition at line 156 of file qgslayoutitemmapoverview.cpp.


The documentation for this class was generated from the following files: