17 #ifndef QGSCOMPOSERMAP_H 18 #define QGSCOMPOSERMAP_H 24 #include <QGraphicsRectItem> 103 DegreeMinuteSecondPadded
147 void draw( QPainter *painter,
const QgsRectangle& extent,
const QSizeF& size,
double dpi,
double* forceWidthScale = 0 );
150 void paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget )
override;
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 );
246 void setLayerSet(
const QStringList& layerSet ) {mLayerSet = layerSet;}
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;
283 bool writeXML( QDomElement& elem, QDomDocument & doc )
const override;
289 bool readXML(
const QDomElement& itemElem,
const QDomDocument& doc )
override;
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;
424 Q_DECL_DEPRECATED
void setAnnotationFrameDistance(
double d );
429 Q_DECL_DEPRECATED
double annotationFrameDistance()
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 );
579 QRectF boundingRect()
const override;
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 );
771 QPolygonF visibleExtentPolygon()
const;
777 QPolygonF transformedMapPolygon()
const;
780 QPointF mapToItemCoords(
const QPointF& mapCoords )
const;
782 Q_DECL_DEPRECATED
void connectMapOverviewSignals();
789 void extentChanged();
792 void mapRotationChanged(
double newRotation );
795 void preparedForAtlas();
800 void updateCachedImage();
805 void renderModeUpdateCachedImage();
808 void updateBoundingRect();
821 void layersChanged();
852 int mNumCachedLayers;
866 double mEvaluatedMapRotation;
872 QStringList mLayerSet;
874 bool mKeepLayerStyles;
876 QMap<QString, QString> mLayerStyleOverrides;
879 bool mUpdatesEnabled;
882 void connectUpdateSlot();
894 QRectF mCurrentRectangle;
895 QGraphicsView* mMapCanvas;
897 bool mDrawCanvasItems;
901 void adjustExtentToItemShape(
double itemWidth,
double itemHeight,
QgsRectangle& extent )
const;
913 void updateToolTip();
916 QStringList layersToRender()
const;
922 void mapPolygon(
const QgsRectangle& extent, QPolygonF& poly )
const;
927 void transformShift(
double& xShift,
double& yShift )
const;
929 void drawCanvasItems( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle );
930 void drawCanvasItem( QGraphicsItem* item, QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle );
931 QPointF composerMapPosForItem(
const QGraphicsItem* item )
const;
944 bool shouldDrawPart( PartType part )
const;
949 void refreshMapExtents();
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.
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.
ZoomMode
Modes for zooming item content.
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.
A non GUI class for rendering a map layer set onto a QPainter.
DataDefinedProperty
Data defined properties for different item types.
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 void moveContent(double dx, double dy)
Move Content of item.
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.
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.
PropertyValueType
Specifies whether the value returned by a function should be the original, user set value...
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.
virtual void refreshDataDefinedProperty(const QgsComposerObject::DataDefinedProperty property=QgsComposerObject::AllProperties) override
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
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.
void setLayerStyleOverrides(const QMap< QString, QString > &overrides)
Setter for stored overrides of styles for layers.
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.