16 #ifndef QGSCOMPOSITION_H
17 #define QGSCOMPOSITION_H
21 #include <QDomDocument>
22 #include <QGraphicsScene>
23 #include <QLinkedList>
127 void setPaperSize(
const double width,
const double height );
134 double paperHeight()
const;
141 double paperWidth()
const;
152 void setNumPages(
const int pages );
158 int numPages()
const;
169 bool pageIsEmpty(
const int page )
const;
178 bool shouldExportPage(
const int page )
const;
193 int pageNumberForPoint(
const QPointF & position )
const;
198 void setStatusMessage(
const QString & message );
203 void updateSettings();
205 void setSnapToGridEnabled(
const bool b );
208 void setGridVisible(
const bool b );
212 void setSnapLinesVisible(
const bool visible );
222 void clearSnapLines();
224 void setSnapGridResolution(
const double r );
227 void setSnapGridOffsetX(
const double offset );
230 void setSnapGridOffsetY(
const double offset );
233 void setGridPen(
const QPen& p );
236 void setGridStyle(
const GridStyle s );
292 void setBoundingBoxesVisible(
const bool boundsVisible );
320 int pageNumberAt(
const QPointF& position )
const;
340 template<
class T>
void composerItems(
QList<T*>& itemList );
348 template<
class T>
void composerItemsOnPage(
QList<T*>& itemList,
const int pageNumber )
const;
375 void setPrintResolution(
const int dpi );
389 void setUseAdvancedEffects(
const bool effectsEnabled );
392 Q_DECL_DEPRECATED
QgsMapRenderer* mapRenderer() {
return mMapRenderer; }
406 Q_DECL_DEPRECATED
int pixelFontSize(
double pointSize )
const;
411 Q_DECL_DEPRECATED
double pointFontSize(
int pixelSize )
const;
428 bool addUndoCommands =
false,
const bool clearComposition =
true );
440 bool addUndoCommands =
false,
QPointF* pos = 0,
bool pasteInPlace =
false );
448 void raiseSelectedItems();
452 void lowerSelectedItems();
455 void moveSelectedItemsToTop();
458 void moveSelectedItemsToBottom();
463 void selectNextByZOrder(
const ZValueDirection direction );
468 void alignSelectedItemsLeft();
469 void alignSelectedItemsHCenter();
470 void alignSelectedItemsRight();
471 void alignSelectedItemsTop();
472 void alignSelectedItemsVCenter();
473 void alignSelectedItemsBottom();
477 void lockSelectedItems();
479 void unlockAllItems();
537 void cancelCommand();
540 void endMultiFrameCommand();
542 void cancelMultiFrameCommand();
554 void addComposerMap(
QgsComposerMap* map,
const bool setDefaultPreviewStyle =
true );
571 void removeComposerItem(
QgsComposerItem* item,
const bool createCommand =
true,
const bool removeGroupItems =
true );
584 void beginPrint(
QPrinter& printer,
const bool evaluateDDPageSize =
false );
593 void doPrint(
QPrinter& printer,
QPainter& painter,
bool startNewPage =
false );
598 bool print(
QPrinter &printer,
const bool evaluateDDPageSize =
false );
603 bool exportAsPDF(
const QString& file );
607 QImage printPageAsRaster(
int page );
612 void renderPage(
QPainter* p,
int page );
615 void computeWorldFileParameters(
double& a,
double& b,
double& c,
double& d,
double& e,
double& f )
const;
622 Q_DECL_DEPRECATED
static void relativeResizeRect(
QRectF& rectToResize,
const QRectF& boundsBefore,
const QRectF& boundsAfter );
627 Q_DECL_DEPRECATED
static double relativePosition(
double position,
double beforeMin,
double beforeMax,
double afterMin,
double afterMax );
693 void setAllUnselected();
717 double mSpaceBetweenPages;
721 void createDefaultPageStyleSymbol();
727 int mPrintResolution;
733 bool mGenerateWorldFile;
738 bool mUseAdvancedEffects;
743 double mSnapGridResolution;
744 double mSnapGridOffsetX;
745 double mSnapGridOffsetY;
747 GridStyle mGridStyle;
758 bool mBoundingBoxesVisible;
771 bool mPreventCursorChange;
783 QRectF compositionBounds()
const;
786 void updateZValues(
const bool addUndoCommands =
true );
790 int boundingRectOfSelectedItems(
QRectF& bRect );
803 void updatePaperItems();
805 void removePaperItems();
806 void deleteAndRemoveMultiFrames();
814 void refreshPageSize();
856 bool ddPageSizeActive()
const;
860 void prepareAllDataDefinedExpressions();
863 void paperSizeChanged();
864 void nPagesChanged();
867 void printResolutionChanged();
895 void refreshItemsTriggered();
898 void statusMsgChanged(
QString message );
909 for ( ; itemIt != graphicsItemList.
end(); ++itemIt )
911 T* item =
dynamic_cast<T*
>( *itemIt );
924 for ( ; itemIt != graphicsItemList.
end(); ++itemIt )
926 T* item =
dynamic_cast<T*
>( *itemIt );
void setSnapTolerance(const int snapTolerance)
Sets the snap tolerance to use when automatically snapping items during movement and resizing to guid...
A scale bar item that can be added to a map composition.
QUndoStack * undoStack()
Returns pointer to undo/redo command storage.
QgsComposition::AtlasMode atlasMode() const
Returns the current atlas mode of the composition.
bool snapLinesVisible() const
bool boundingBoxesVisible() const
Returns whether selection bounding boxes should be shown in the composition.
A base class for objects which belong to a map composition.
QgsFillSymbolV2 * pageStyleSymbol()
Note: added in version 2.1.
void setPrintAsRaster(const bool enabled)
A container class for data source field mapping or expression.
An item that draws an arrow between to points.
void push_back(const T &value)
QgsComposerModel * itemsModel()
Returns the items model attached to the composition.
GridStyle
Style to draw the snapping grid.
QList< QGraphicsItem * > items() const
void setPlotStyle(const QgsComposition::PlotStyle style)
const QgsMapSettings & mapSettings() const
Return setting of QGIS map canvas.
const QPen & gridPen() const
QgsComposerMouseHandles * selectionHandles()
Returns pointer to selection handles.
bool smartGuidesEnabled() const
A item that forms part of a map composition.
Q_DECL_DEPRECATED double snapGridTolerance() const
Returns the snap tolerance to use when automatically snapping items during movement and resizing to t...
bool preventCursorChange() const
Container of fields for a vector layer.
A container for grouping several QgsComposerItems.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A non GUI class for rendering a map layer set onto a QPainter.
double spaceBetweenPages() const
Returns the vertical space between pages in a composer view.
bool alignmentSnap() const
A table that displays attributes from a vector layer.
DataDefinedProperty
Data defined properties for different item types.
void composerItemsOnPage(QList< T * > &itemList, const int pageNumber) const
Return composer items of a specific type on a specified page.
A composer class that displays svg files or raster format (jpg, png, ...)
The QgsMapSettings class contains configuration for rendering of the map.
Q_DECL_DEPRECATED void sortZList()
Sorts the zList.
int itemPageNumber(const QgsComposerItem *) const
Returns on which page number (0-based) is displayed an item.
void setPreventCursorChange(const bool preventChange)
If true, prevents any mouse cursor changes by the composition or by any composer items Used by QgsCom...
int printResolution() const
Abstract base class for composer items with the ability to distribute the content to several frames (...
A class to display a table in the print composer, and allow the table to span over multiple frames...
void setAlignmentSnap(const bool s)
bool printAsRaster() const
void setWorldFileMap(QgsComposerMap *map)
QgsComposerMap * worldFileMap() const
Graphics scene for map printing.
bool snapToGridEnabled() const
Object representing map window.
Frame item for a composer multiframe item.
void setGenerateWorldFile(const bool enabled)
GridStyle gridStyle() const
A model for items attached to a composition.
QList< QgsPaperItem * > pages()
Return pages in the correct order.
bool useAdvancedEffects() const
Returns true if a composition should use advanced effects such as blend modes.
Q_DECL_DEPRECATED void setSnapGridTolerance(double tolerance)
Sets the snap tolerance to use when automatically snapping items during movement and resizing to the ...
A composer command class for adding / removing composer items.
double snapGridOffsetY() const
double snapGridOffsetX() const
A table class that displays a vector attribute table.
Undo command to undo/redo all composer item related changes.
int snapTolerance() const
Returns the snap tolerance to use when automatically snapping items during movement and resizing to g...
A composer items that draws common shapes (ellipse, triangle, rectangle)
double snapGridResolution() const
AtlasMode
Composition atlas modes.
Q_DECL_DEPRECATED double alignmentSnapTolerance() const
Returns the snap tolerance to use when automatically snapping items during movement and resizing to g...
void setSmartGuidesEnabled(const bool b)
A label that can be placed onto a map composition.
Class used to render an Atlas, iterating over geometry features.
QgsAtlasComposition & atlasComposition()
Handles drawing of selection outlines and mouse handles.
void composerItems(QList< T * > &itemList)
Return composer items of a specific type.
bool generateWorldFile() const
QgsComposition::PlotStyle plotStyle() const
Represents a vector layer which manages a vector based data sets.
A legend that can be placed onto a map composition.
Q_DECL_DEPRECATED void setAlignmentSnapTolerance(double t)
Sets the snap tolerance to use when automatically snapping items during movement and resizing to guid...
QList< QGraphicsLineItem * > * snapLines()
Returns pointer to snap lines collection.