QGIS API Documentation  2.99.0-Master (5753576)
Public Member Functions | List of all members
QgsSvgAnnotationItem Class Reference

#include <qgssvgannotationitem.h>

Inheritance diagram for QgsSvgAnnotationItem:
Inheritance graph

Public Member Functions

 QgsSvgAnnotationItem (QgsMapCanvas *canvas)
QString filePath () const
void paint (QPainter *painter) override
 function to be implemented by derived classes More...
void readXml (const QDomDocument &doc, const QDomElement &itemElem) override
 Deserialize from XML. More...
void setFilePath (const QString &file)
void writeXml (QDomDocument &doc) const override
 Serialize to XML. More...
- Public Member Functions inherited from QgsAnnotationItem
 QgsAnnotationItem (QgsMapCanvas *mapCanvas)
virtual ~QgsAnnotationItem ()
void _readXml (const QDomDocument &doc, const QDomElement &annotationElem)
 Deserialize from XML. More...
void _writeXml (QDomDocument &doc, QDomElement &itemElem) const
 Serialize to XML. More...
QRectF boundingRect () const override
Qt::CursorShape cursorShapeForAction (MouseMoveAction moveAction) const
 Returns suitable cursor shape for mouse move action. More...
QColor frameBackgroundColor () const
double frameBorderWidth () const
QColor frameColor () const
QSizeF frameSize () const
bool hasFixedMapPosition () const override
 Returns true if the annotation is attached to a fixed map position, or false if the annotation uses a position relative to the current map extent. More...
QgsPoint mapPosition () const override
 Returns the map position of the annotation, if it is attached to a fixed map position. More...
QgsCoordinateReferenceSystem mapPositionCrs () const override
 Returns the CRS of the map position, or an invalid CRS if the annotation does not have a fixed map position. More...
const QgsMarkerSymbolmarkerSymbol () const
virtual QSizeF minimumFrameSize () const
QgsAnnotationItem::MouseMoveAction moveActionForPosition (QPointF pos) const
 Returns the mouse move behavior for a given position. More...
QPointF offsetFromReferencePoint () const
virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
 Paint the annotation to a destination painter. More...
virtual QPointF relativePosition () const override
 Returns the relative position of the annotation, if it is not attached to a fixed map position. More...
virtual double scaleFactor () const override
 Returns a scaling factor which should be applied to painters before rendering the item. More...
void setFrameBackgroundColor (const QColor &c)
void setFrameBorderWidth (double w)
void setFrameColor (const QColor &c)
void setFrameSize (QSizeF size)
virtual void setItemData (int role, const QVariant &value) override
 deprecated - do not use More...
virtual void setMapPosition (const QgsPoint &pos)
virtual void setMapPositionCrs (const QgsCoordinateReferenceSystem &crs)
 Sets the CRS of the map position. More...
void setMapPositionFixed (bool fixed)
void setMarkerSymbol (QgsMarkerSymbol *symbol)
 Set symbol that is drawn on map position. Takes ownership. More...
void setOffsetFromReferencePoint (QPointF offset)
virtual bool showItem () const override
 Returns true if the annotation should be shown. More...
void updatePosition () override
 called on changed extent or resize event to update position of the item More...
- Public Member Functions inherited from QgsMapCanvasItem
QgsRectangle rect () const
 returns canvas item rectangle in map units More...
void setRect (const QgsRectangle &r, bool resetRotation=true)
 sets canvas item rectangle in map units More...
QPointF toCanvasCoordinates (const QgsPoint &point) const
 transformation from map coordinates to screen coordinates More...
QgsPoint toMapCoordinates (QPoint point) const
 transformation from screen coordinates to map coordinates More...

Additional Inherited Members

- Public Types inherited from QgsAnnotationItem
enum  MouseMoveAction {
  NoAction, MoveMapPosition, MoveFramePosition, ResizeFrameUp,
  ResizeFrameDown, ResizeFrameLeft, ResizeFrameRight, ResizeFrameLeftUp,
  ResizeFrameRightUp, ResizeFrameLeftDown, ResizeFrameRightDown
- Protected Member Functions inherited from QgsAnnotationItem
void drawFrame (QPainter *p) const
 Draws the annotation frame to a destination painter. More...
void drawMarkerSymbol (QPainter *p) const
 Draws the map position marker symbol to a destination painter. More...
void drawSelectionBoxes (QPainter *p) const
 Draws selection handles around the item. More...
QPointF pointOnLineWithDistance (QPointF startPoint, QPointF directionPoint, double distance) const
 Returns a point on the line from startPoint to directionPoint that is a certain distance away from the starting point. More...
double scaledSymbolSize () const
 Returns the symbol size scaled in (mapcanvas) pixels. Used for the counding rect calculation. More...
QLineF segment (int index) const
 Returns frame width in painter units. More...
void updateBalloon ()
 Check where to attach the balloon connection between frame and map point. More...
void updateBoundingRect ()
- Protected Member Functions inherited from QgsMapCanvasItem
 QgsMapCanvasItem (QgsMapCanvas *mapCanvas)
 protected constructor: cannot be constructed directly More...
virtual ~QgsMapCanvasItem ()
bool setRenderContextVariables (QPainter *p, QgsRenderContext &context) const
 Sets render context parameters. More...
void updateCanvas ()
 schedules map canvas for repaint More...
- Protected Attributes inherited from QgsAnnotationItem
int mBalloonSegment
 Segment number where the connection to the map point is attached. -1 if no balloon needed (e.g. if point is contained in frame) More...
QPointF mBalloonSegmentPoint1
 First segment point for drawing the connection (ccw direction) More...
QPointF mBalloonSegmentPoint2
 Second segment point for drawing the balloon connection (ccw direction) More...
QRectF mBoundingRect
 Bounding rect (including item frame and balloon) More...
QColor mFrameBackgroundColor
double mFrameBorderWidth
 Width of the frame. More...
QColor mFrameColor
 Frame / balloon color. More...
QSizeF mFrameSize
 Size of the frame (without balloon) More...
QgsPoint mMapPosition
 Map position (in case mMapPositionFixed is true) More...
QgsCoordinateReferenceSystem mMapPositionCrs
 CRS of the map position. More...
bool mMapPositionFixed
 True: the item stays at the same map position, False: the item stays on same screen position. More...
 Point symbol that is to be drawn at the map reference location. More...
QPointF mOffsetFromReferencePoint
 Describes the shift of the item content box to the reference point. More...
- Protected Attributes inherited from QgsMapCanvasItem
QSizeF mItemSize
 cached size of the item (to return in boundingRect()) More...
 pointer to map canvas More...
QgsRectangle mRect
 cached canvas item rectangle in map coordinates encodes position (xmin,ymax) and size (width/height) used to re-position and re-size the item on zoom/pan while waiting for the renderer to complete. More...
double mRectRotation

Detailed Description

Definition at line 28 of file qgssvgannotationitem.h.

Constructor & Destructor Documentation

§ QgsSvgAnnotationItem()

QgsSvgAnnotationItem::QgsSvgAnnotationItem ( QgsMapCanvas canvas)

Definition at line 24 of file qgssvgannotationitem.cpp.

Member Function Documentation

§ filePath()

QString QgsSvgAnnotationItem::filePath ( ) const

Definition at line 40 of file qgssvgannotationitem.h.

§ paint()

void QgsSvgAnnotationItem::paint ( QPainter *  painter)

function to be implemented by derived classes

Reimplemented from QgsAnnotationItem.

Definition at line 54 of file qgssvgannotationitem.cpp.

§ readXml()

void QgsSvgAnnotationItem::readXml ( const QDomDocument &  doc,
const QDomElement &  itemElem 

Deserialize from XML.

The itemElem is used as source for the information. Needs to be reimplemented by subclasses

Implements QgsAnnotationItem.

Definition at line 43 of file qgssvgannotationitem.cpp.

§ setFilePath()

void QgsSvgAnnotationItem::setFilePath ( const QString &  file)

Definition at line 95 of file qgssvgannotationitem.cpp.

§ writeXml()

void QgsSvgAnnotationItem::writeXml ( QDomDocument &  doc) const

Serialize to XML.

The doc is used to generate new nodes. Needs to be reimplemented by subclasses.

Implements QgsAnnotationItem.

Definition at line 29 of file qgssvgannotationitem.cpp.

The documentation for this class was generated from the following files: