17 #ifndef QGSCOMPOSERMAP_H
18 #define QGSCOMPOSERMAP_H
24 #include <QGraphicsRectItem>
114 void draw( QPainter *painter,
const QgsRectangle& extent,
const QSizeF&
size,
double dpi,
double* forceWidthScale = 0 );
117 void paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
129 void resize(
double dx,
double dy );
146 double scale()
const;
149 void setNewScale(
double scaleDenominator );
157 void setNewAtlasFeatureExtent(
const QgsRectangle& extent );
160 void toggleAtlasPreview();
169 void setPreviewMode( PreviewMode m );
183 void setLayerSet(
const QStringList& layerSet ) {mLayerSet = layerSet;}
185 void storeCurrentLayerSet();
188 void setCacheUpdated(
bool u =
false );
195 void setOffset(
double xOffset,
double yOffset );
198 bool containsWMSLayer()
const;
201 bool containsAdvancedEffects()
const;
207 bool writeXML( QDomElement& elem, QDomDocument & doc )
const;
213 bool readXML(
const QDomElement& itemElem,
const QDomDocument& doc );
247 void setGridPen(
const QPen& p );
248 QPen gridPen()
const;
252 void setGridPenWidth(
double w );
256 void setGridPenColor(
const QColor& c );
332 QRectF boundingRect()
const;
335 void updateBoundingRect();
358 void setMapRotation(
double r );
371 double mapUnitsToMM()
const;
375 void setOverviewFrameMap(
int mapId );
386 void setOverviewBlendMode( QPainter::CompositionMode blendMode );
391 void setOverviewInverted(
bool inverted );
396 void setOverviewCentered(
bool centered );
404 void setGridBlendMode( QPainter::CompositionMode blendMode );
442 void extentChanged();
445 void mapRotationChanged(
double newRotation );
450 void updateCachedImage( );
452 void renderModeUpdateCachedImage();
454 void overviewExtentChanged();
522 void connectUpdateSlot();
590 void adjustExtentToItemShape(
double itemWidth,
double itemHeight,
QgsRectangle& extent )
const;
600 QStringList layersToRender();
603 void drawGrid( QPainter* p );
604 void drawGridFrame( QPainter* p,
const QList< QPair< double, QLineF > >& hLines,
const QList< QPair< double, QLineF > >& vLines );
609 void drawCoordinateAnnotations( QPainter* p,
const QList< QPair< double, QLineF > >& hLines,
const QList< QPair< double, QLineF > >& vLines );
610 void drawCoordinateAnnotation( QPainter* p,
const QPointF& pos, QString annotationString );
616 void drawAnnotation( QPainter* p,
const QPointF& pos,
int rotation,
const QString& annotationText );
620 int xGridLines( QList< QPair< double, QLineF > >& lines )
const;
623 int yGridLines( QList< QPair< double, QLineF > >& lines )
const;
627 QPolygonF transformedMapPolygon()
const;
628 double maxExtension()
const;
632 void mapPolygon( QPolygonF& poly )
const;
634 void mapPolygon(
const QgsRectangle& extent, QPolygonF& poly )
const;
641 void transformShift(
double& xShift,
double& yShift )
const;
643 QPointF mapToItemCoords(
const QPointF& mapCoords )
const;
645 Border borderForLineCoord(
const QPointF& p )
const;
647 void drawCanvasItems( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle );
648 void drawCanvasItem( QGraphicsItem* item, QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle );
649 QPointF composerMapPosForItem(
const QGraphicsItem* item )
const;
650 void sortGridLinesOnBorders(
const QList< QPair< double, QLineF > >& hLines,
const QList< QPair< double, QLineF > >& vLines, QMap< double, double >& leftFrameEntries,
651 QMap< double, double >& rightFrameEntries, QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFrameEntries )
const;
652 void drawGridFrameBorder( QPainter* p,
const QMap< double, double >& borderPos,
Border border );
653 void drawGridLine(
const QLineF& line, QPainter* p );
654 void drawOverviewMapExtent( QPainter* p );
655 void createDefaultOverviewFrameSymbol();
656 void createDefaultGridLineSymbol();
657 void initGridAnnotationFormatFromProject();