17 #ifndef QGSCOMPOSERMAP_H
18 #define QGSCOMPOSERMAP_H
24 #include <QGraphicsRectItem>
103 DegreeMinuteSecondPadded
160 int id()
const {
return mId;}
166 void resize(
double dx,
double dy );
179 Q_DECL_DEPRECATED
void zoomContent(
int delta,
double x,
double y )
override;
193 double scale()
const;
196 void setNewScale(
double scaleDenominator,
bool forceUpdate =
true );
219 void setNewAtlasFeatureExtent(
const QgsRectangle& extent );
236 void setPreviewMode( PreviewMode m );
248 void storeCurrentLayerSet();
260 void storeCurrentLayerStyles();
263 void setCacheUpdated(
bool u =
false );
271 void setOffset(
double xOffset,
double yOffset );
274 bool containsWMSLayer()
const;
277 bool containsAdvancedEffects()
const;
294 Q_DECL_DEPRECATED
void setGridEnabled(
bool enabled );
299 Q_DECL_DEPRECATED
bool gridEnabled()
const;
304 Q_DECL_DEPRECATED
void setGridStyle( GridStyle style );
309 Q_DECL_DEPRECATED GridStyle gridStyle()
const;
314 Q_DECL_DEPRECATED
void setGridIntervalX(
double interval );
319 Q_DECL_DEPRECATED
double gridIntervalX()
const;
324 Q_DECL_DEPRECATED
void setGridIntervalY(
double interval );
329 Q_DECL_DEPRECATED
double gridIntervalY()
const;
334 Q_DECL_DEPRECATED
void setGridOffsetX(
double offset );
339 Q_DECL_DEPRECATED
double gridOffsetX()
const;
344 Q_DECL_DEPRECATED
void setGridOffsetY(
double offset );
349 Q_DECL_DEPRECATED
double gridOffsetY()
const;
354 Q_DECL_DEPRECATED
void setGridPen(
const QPen& p );
359 Q_DECL_DEPRECATED
QPen gridPen()
const;
364 Q_DECL_DEPRECATED
void setGridPenWidth(
double w );
369 Q_DECL_DEPRECATED
void setGridPenColor(
const QColor& c );
374 Q_DECL_DEPRECATED
void setGridAnnotationFont(
const QFont& f );
379 Q_DECL_DEPRECATED
QFont gridAnnotationFont()
const;
384 Q_DECL_DEPRECATED
void setAnnotationFontColor(
const QColor& c );
389 Q_DECL_DEPRECATED
QColor annotationFontColor()
const;
394 Q_DECL_DEPRECATED
void setGridAnnotationPrecision(
int p );
399 Q_DECL_DEPRECATED
int gridAnnotationPrecision()
const;
404 Q_DECL_DEPRECATED
void setShowGridAnnotation(
bool show );
409 Q_DECL_DEPRECATED
bool showGridAnnotation()
const;
414 Q_DECL_DEPRECATED
void setGridAnnotationPosition( GridAnnotationPosition p,
QgsComposerMap::Border border );
424 Q_DECL_DEPRECATED
void setAnnotationFrameDistance(
double d );
429 Q_DECL_DEPRECATED
double annotationFrameDistance()
const;
434 Q_DECL_DEPRECATED
void setGridAnnotationDirection( GridAnnotationDirection d,
QgsComposerMap::Border border );
444 Q_DECL_DEPRECATED
void setGridAnnotationFormat( GridAnnotationFormat f );
449 Q_DECL_DEPRECATED GridAnnotationFormat gridAnnotationFormat()
const;
454 Q_DECL_DEPRECATED
void setGridFrameStyle( GridFrameStyle style );
459 Q_DECL_DEPRECATED GridFrameStyle gridFrameStyle()
const;
464 Q_DECL_DEPRECATED
void setGridFrameWidth(
double w );
469 Q_DECL_DEPRECATED
double gridFrameWidth()
const;
475 Q_DECL_DEPRECATED
void setGridFramePenSize(
double w );
480 Q_DECL_DEPRECATED
double gridFramePenSize()
const;
486 Q_DECL_DEPRECATED
void setGridFramePenColor(
const QColor& c );
492 Q_DECL_DEPRECATED
QColor gridFramePenColor()
const;
498 Q_DECL_DEPRECATED
void setGridFrameFillColor1(
const QColor& c );
504 Q_DECL_DEPRECATED
QColor gridFrameFillColor1()
const;
510 Q_DECL_DEPRECATED
void setGridFrameFillColor2(
const QColor& c );
516 Q_DECL_DEPRECATED
QColor gridFrameFillColor2()
const;
521 Q_DECL_DEPRECATED
void setCrossLength(
double l );
526 Q_DECL_DEPRECATED
double crossLength();
541 Q_DECL_DEPRECATED QPainter::CompositionMode gridBlendMode()
const;
546 Q_DECL_DEPRECATED
void setGridBlendMode( QPainter::CompositionMode blendMode );
588 Q_DECL_DEPRECATED
void setRotation(
double r )
override;
593 Q_DECL_DEPRECATED
double rotation()
const {
return mMapRotation;}
598 void setMapRotation(
double r );
617 double mapUnitsToMM()
const;
622 Q_DECL_DEPRECATED
void setOverviewFrameMap(
int mapId );
627 Q_DECL_DEPRECATED
int overviewFrameMapId()
const;
632 Q_DECL_DEPRECATED
void setOverviewFrameMapSymbol(
QgsFillSymbolV2* symbol );
642 Q_DECL_DEPRECATED QPainter::CompositionMode overviewBlendMode()
const;
647 Q_DECL_DEPRECATED
void setOverviewBlendMode( QPainter::CompositionMode blendMode );
652 Q_DECL_DEPRECATED
bool overviewInverted()
const;
657 Q_DECL_DEPRECATED
void setOverviewInverted(
bool inverted );
662 Q_DECL_DEPRECATED
bool overviewCentered()
const;
667 Q_DECL_DEPRECATED
void setOverviewCentered(
bool centered );
701 void setAtlasDriven(
bool enabled );
706 Q_DECL_DEPRECATED
bool atlasFixedScale()
const;
711 Q_DECL_DEPRECATED
void setAtlasFixedScale(
bool fixed );
782 Q_DECL_DEPRECATED
void connectMapOverviewSignals();
791 void extentChanged();
794 void mapRotationChanged(
double newRotation );
797 void preparedForAtlas();
803 void layerStyleOverridesChanged();
808 void updateCachedImage();
813 void renderModeUpdateCachedImage();
816 void updateBoundingRect();
829 void layersChanged();
857 PreviewMode mPreviewMode;
860 int mNumCachedLayers;
874 double mEvaluatedMapRotation;
882 bool mKeepLayerStyles;
887 bool mUpdatesEnabled;
890 void connectUpdateSlot();
905 bool mDrawCanvasItems;
909 void adjustExtentToItemShape(
double itemWidth,
double itemHeight,
QgsRectangle& extent )
const;
914 AtlasScalingMode mAtlasScalingMode;
921 void updateToolTip();
938 void transformShift(
double& xShift,
double& yShift )
const;
955 bool shouldDrawPart( PartType part )
const;
964 friend class TestQgsComposerMap;
AtlasScalingMode
Scaling modes used for the serial rendering (atlas)
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...
A rectangle specified with double values.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const
Stores item state in DOM element.
bool updatesEnabled() const
Returns whether updates to the composer map are enabled.
virtual void refreshDataDefinedProperty(const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties, const QgsExpressionContext *context=0) override
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
Q_DECL_DEPRECATED void toggleAtlasPreview()
Called when atlas preview is toggled, to force map item to update its extent and redraw.
void overviewExtentChanged()
QgsComposerMapOverviewStack * overviews()
Returns the map item's overview stack, which is used to control how overviews are drawn over the map'...
bool keepLayerStyles() const
Getter for flag that determines if current styles of layers should be overridden by previously stored...
virtual void setRotation(double r)
Sets the item rotation.
A collection of grids which is drawn above the map content in a QgsComposerMap.
QStringList layerSet() const
Getter for stored layer set that is used if mKeepLayerSet is true.
A item that forms part of a map composition.
#define Q_NOWARN_DEPRECATED_PUSH
Border
Enum for different frame borders.
void setMapCanvas(QGraphicsView *canvas)
Sets canvas pointer (necessary to query and draw map canvas items)
QMap< QString, QString > layerStyleOverrides() const
Getter for stored overrides of styles for layers.
DataDefinedProperty
Data defined properties for different item types.
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 objects's current state.
void setKeepLayerStyles(bool enabled)
Setter for flag that determines if current styles of layers should be overridden by previously stored...
bool isDrawing() const
True if a draw is already in progress.
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)
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.
bool drawCanvasItems() const
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...
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
virtual int numberExportLayers() const
Get the number of layers that this item requires for exporting as layers.
An individual grid which is drawn above the map content in a QgsComposerMap.
PreviewMode
Preview style.
Graphics scene for map printing.
Object representing map window.
void setUpdatesEnabled(bool enabled)
Sets whether updates to the composer map are enabled.
PreviewMode previewMode() const
virtual QString displayName() const
Get item display name.
virtual void setFrameOutlineWidth(const double outlineWidth)
Sets frame outline width.
#define Q_NOWARN_DEPRECATED_POP
int id() const
Get identification number.
Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect(double &x, double &y, double width, double height, double rotation) const
Calculates corner point after rotation and scaling.
virtual Q_DECL_DEPRECATED void zoomContent(int delta, double x, double y)
Zoom content of item.
Q_DECL_DEPRECATED double rotation() const
Returns the rotation used for drawing the map within the composer item.
QgsRectangle extent() 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...
AtlasScalingMode atlasScalingMode() const
Returns the current atlas scaling mode.
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...
bool atlasDriven() const
Returns whether the map extent is set to follow the current atlas feature.
bool keepLayerSet() const
Getter 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.
Q_DECL_DEPRECATED void sizeChangedByRotation(double &width, double &height, double rotation)
Calculates width / height of the bounding box of a rotated rectangle.
A collection of overviews which are drawn above the map content in a QgsComposerMap.