17 #ifndef QGSCOMPOSERMAP_H 18 #define QGSCOMPOSERMAP_H 24 #include <QGraphicsRectItem> 104 DegreeMinuteSecondPadded
161 int id()
const {
return mId;}
167 void resize(
double dx,
double dy );
181 Q_DECL_DEPRECATED
void zoomContent(
int delta,
double x,
double y )
override;
195 double scale()
const;
198 void setNewScale(
double scaleDenominator,
bool forceUpdate =
true );
221 void setNewAtlasFeatureExtent(
const QgsRectangle& extent );
252 void storeCurrentLayerSet();
264 void storeCurrentLayerStyles();
288 void setCacheUpdated(
bool u =
false );
296 void setOffset(
double xOffset,
double yOffset );
299 bool containsWMSLayer()
const;
302 bool containsAdvancedEffects()
const;
319 Q_DECL_DEPRECATED
void setGridEnabled(
bool enabled );
324 Q_DECL_DEPRECATED
bool gridEnabled()
const;
329 Q_DECL_DEPRECATED
void setGridStyle(
GridStyle style );
334 Q_DECL_DEPRECATED
GridStyle gridStyle()
const;
339 Q_DECL_DEPRECATED
void setGridIntervalX(
double interval );
344 Q_DECL_DEPRECATED
double gridIntervalX()
const;
349 Q_DECL_DEPRECATED
void setGridIntervalY(
double interval );
354 Q_DECL_DEPRECATED
double gridIntervalY()
const;
359 Q_DECL_DEPRECATED
void setGridOffsetX(
double offset );
364 Q_DECL_DEPRECATED
double gridOffsetX()
const;
369 Q_DECL_DEPRECATED
void setGridOffsetY(
double offset );
374 Q_DECL_DEPRECATED
double gridOffsetY()
const;
379 Q_DECL_DEPRECATED
void setGridPen(
const QPen& p );
384 Q_DECL_DEPRECATED
QPen gridPen()
const;
389 Q_DECL_DEPRECATED
void setGridPenWidth(
double w );
394 Q_DECL_DEPRECATED
void setGridPenColor(
const QColor& c );
399 Q_DECL_DEPRECATED
void setGridAnnotationFont(
const QFont& f );
404 Q_DECL_DEPRECATED
QFont gridAnnotationFont()
const;
409 Q_DECL_DEPRECATED
void setAnnotationFontColor(
const QColor& c );
414 Q_DECL_DEPRECATED
QColor annotationFontColor()
const;
419 Q_DECL_DEPRECATED
void setGridAnnotationPrecision(
int p );
424 Q_DECL_DEPRECATED
int gridAnnotationPrecision()
const;
429 Q_DECL_DEPRECATED
void setShowGridAnnotation(
bool show );
434 Q_DECL_DEPRECATED
bool showGridAnnotation()
const;
449 Q_DECL_DEPRECATED
void setAnnotationFrameDistance(
double d );
454 Q_DECL_DEPRECATED
double annotationFrameDistance()
const;
489 Q_DECL_DEPRECATED
void setGridFrameWidth(
double w );
494 Q_DECL_DEPRECATED
double gridFrameWidth()
const;
500 Q_DECL_DEPRECATED
void setGridFramePenSize(
double w );
505 Q_DECL_DEPRECATED
double gridFramePenSize()
const;
511 Q_DECL_DEPRECATED
void setGridFramePenColor(
const QColor& c );
517 Q_DECL_DEPRECATED
QColor gridFramePenColor()
const;
523 Q_DECL_DEPRECATED
void setGridFrameFillColor1(
const QColor& c );
529 Q_DECL_DEPRECATED
QColor gridFrameFillColor1()
const;
535 Q_DECL_DEPRECATED
void setGridFrameFillColor2(
const QColor& c );
541 Q_DECL_DEPRECATED
QColor gridFrameFillColor2()
const;
546 Q_DECL_DEPRECATED
void setCrossLength(
double l );
551 Q_DECL_DEPRECATED
double crossLength();
566 Q_DECL_DEPRECATED QPainter::CompositionMode gridBlendMode()
const;
571 Q_DECL_DEPRECATED
void setGridBlendMode( QPainter::CompositionMode blendMode );
613 Q_DECL_DEPRECATED
void setRotation(
double r )
override;
618 Q_DECL_DEPRECATED
double rotation()
const {
return mMapRotation;}
624 void setMapRotation(
double r );
654 double mapUnitsToMM()
const;
659 Q_DECL_DEPRECATED
void setOverviewFrameMap(
int mapId );
664 Q_DECL_DEPRECATED
int overviewFrameMapId()
const;
669 Q_DECL_DEPRECATED
void setOverviewFrameMapSymbol(
QgsFillSymbolV2* symbol );
679 Q_DECL_DEPRECATED QPainter::CompositionMode overviewBlendMode()
const;
684 Q_DECL_DEPRECATED
void setOverviewBlendMode( QPainter::CompositionMode blendMode );
689 Q_DECL_DEPRECATED
bool overviewInverted()
const;
694 Q_DECL_DEPRECATED
void setOverviewInverted(
bool inverted );
699 Q_DECL_DEPRECATED
bool overviewCentered()
const;
704 Q_DECL_DEPRECATED
void setOverviewCentered(
bool centered );
738 void setAtlasDriven(
bool enabled );
743 Q_DECL_DEPRECATED
bool atlasFixedScale()
const;
748 Q_DECL_DEPRECATED
void setAtlasFixedScale(
bool fixed );
820 Q_DECL_DEPRECATED
void connectMapOverviewSignals();
829 void extentChanged();
832 void mapRotationChanged(
double newRotation );
835 void preparedForAtlas();
841 void layerStyleOverridesChanged();
846 void updateCachedImage();
851 void renderModeUpdateCachedImage();
854 void updateBoundingRect();
867 void layersChanged();
898 int mNumCachedLayers;
912 double mEvaluatedMapRotation;
920 bool mKeepLayerStyles;
927 bool mFollowVisibilityPreset;
930 QString mFollowVisibilityPresetName;
933 bool mUpdatesEnabled;
936 void connectUpdateSlot();
951 bool mDrawCanvasItems;
958 void adjustExtentToItemShape(
double itemWidth,
double itemHeight,
QgsRectangle& extent )
const;
970 void updateToolTip();
987 void transformShift(
double& xShift,
double& yShift )
const;
1004 bool shouldDrawPart( PartType part )
const;
1013 friend class TestQgsComposerMap;
AtlasScalingMode
Scaling modes used for the serial rendering (atlas)
bool atlasDriven() const
Returns whether the map extent is set to follow the current atlas feature.
A rectangle specified with double values.
virtual QString displayName() const
Get item display name.
Q_DECL_DEPRECATED void toggleAtlasPreview()
Called when atlas preview is toggled, to force map item to update its extent and redraw.
void overviewExtentChanged()
bool drawCanvasItems() const
QgsComposerMapOverviewStack * overviews()
Returns the map item's overview stack, which is used to control how overviews are drawn over the map'...
virtual void setRotation(double r)
Sets the item rotation.
QStringList layerSet() const
Getter for stored layer set that is used if mKeepLayerSet is true.
bool followVisibilityPreset() const
Whether the map should follow a visibility preset.
QgsRectangle extent() const
ZoomMode
Modes for zooming item content.
A collection of grids which is drawn above the map content in a QgsComposerMap.
A item that forms part of a map composition.
#define Q_NOWARN_DEPRECATED_PUSH
bool updatesEnabled() const
Returns whether updates to the composer map are enabled.
Border
Enum for different frame borders.
virtual int numberExportLayers() const
Get the number of layers that this item requires for exporting as layers.
int id() const
Get identification number.
void setMapCanvas(QGraphicsView *canvas)
Sets canvas pointer (necessary to query and draw map canvas items)
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect(double &x, double &y, double width, double height, double rotation) const
Calculates corner point after rotation and scaling.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
A non GUI class for rendering a map layer set onto a QPainter.
virtual QgsExpressionContext * createExpressionContext() const override
Creates an expression context relating to the item's current state.
DataDefinedProperty
Data defined properties for different item types.
An interface for annotation items which are drawn over a map.
void setKeepLayerStyles(bool enabled)
Setter for flag that determines if current styles of layers should be overridden by previously stored...
The QgsMapSettings class contains configuration for rendering of the map.
void setAtlasMargin(double margin)
Sets the margin size (percentage) used when the map is in atlas mode.
Perform transforms between map coordinates and device coordinates.
virtual QRectF boundingRect() const
virtual void moveContent(double dx, double dy)
Move Content of item.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
const char * name() const
void setAtlasScalingMode(AtlasScalingMode mode)
Sets the current atlas scaling mode.
An individual overview which is drawn above the map content in a QgsComposerMap, and shows the extent...
virtual void updateItem()
Updates item, with the possibility to do custom update for subclasses.
void setFollowVisibilityPreset(bool follow)
Sets whether the map should follow a visibility preset.
virtual int type() const override
Return correct graphics item type.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
virtual void refreshDataDefinedProperty(const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties, const QgsExpressionContext *context=nullptr) override
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
QMap< QString, QString > layerStyleOverrides() const
Getter for stored overrides of styles for layers.
An individual grid which is drawn above the map content in a QgsComposerMap.
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
bool keepLayerStyles() const
Getter for flag that determines if current styles of layers should be overridden by previously stored...
QString followVisibilityPresetName() const
Preset name that decides which layers and layer styles are used for map rendering.
bool isDrawing() const
True if a draw is already in progress.
PreviewMode
Preview style.
bool drawSelection() const
Get the flag to draw selection in map.
Graphics scene for map printing.
Object representing map window.
void setUpdatesEnabled(bool enabled)
Sets whether updates to the composer map are enabled.
virtual void setFrameOutlineWidth(const double outlineWidth)
Sets frame outline width.
#define Q_NOWARN_DEPRECATED_POP
virtual Q_DECL_DEPRECATED void zoomContent(int delta, double x, double y)
Zoom content of item.
AtlasScalingMode atlasScalingMode() const
Returns the current atlas scaling mode.
PreviewMode previewMode() const
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)
Sets item state from DOM element.
void setLayerSet(const QStringList &layerSet)
Setter for stored layer set that is used if mKeepLayerSet is true.
QgsComposerMapGridStack * grids()
Returns the map item's grid stack, which is used to control how grids are drawn over the map's conten...
void setDrawSelection(bool b)
Set the flag to draw selection in map.
void setDrawCanvasItems(bool b)
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
void setKeepLayerSet(bool enabled)
Setter for flag that determines if the stored layer set should be used or the current layer set of th...
Represents a vector layer which manages a vector based data sets.
bool keepLayerSet() const
Getter for flag that determines if the stored layer set should be used or the current layer set of th...
Q_DECL_DEPRECATED double rotation() const
Returns the rotation used for drawing the map within the composer item.
Q_DECL_DEPRECATED bool imageSizeConsideringRotation(double &width, double &height, double rotation) const
Calculates width and hight of the picture (in mm) such that it fits into the item frame with the give...
Q_DECL_DEPRECATED void sizeChangedByRotation(double &width, double &height, double rotation)
Calculates width / height of the bounding box of a rotated rectangle.
void setFollowVisibilityPresetName(const QString &name)
Sets preset name for map rendering.
A collection of overviews which are drawn above the map content in a QgsComposerMap.