28     , mMapPositionFixed( true )
    30     , mOffsetFromReferencePoint( 
QPointF( 50, -50 ) )
    31     , mBalloonSegment( -1 )
    33   setFlag( QGraphicsItem::ItemIsSelectable, 
true );
   129   double halfSymbolSize = 0.0;
   161   double minEdgeDist = DBL_MAX;
   162   int minEdgeIndex = -1;
   167   for ( 
int i = 0; i < 4; ++i )
   169     QLineF currentSegment = segmentList.
at( i );
   171     double currentMinDist = origin.
sqrDistToSegment( currentSegment.
x1(), currentSegment.
y1(), currentSegment.
x2(), currentSegment.
y2(), currentMinDistPoint );
   172     if ( currentMinDist < minEdgeDist )
   175       minEdgePoint = currentMinDistPoint;
   176       minEdgeDist = currentMinDist;
   177       minEdge = currentSegment;
   181   if ( minEdgeIndex < 0 )
   187   double segmentPointWidth = 10;
   192   if ( sqrt( minEdgePoint.
sqrDist( minEdgeEnd.
x(), minEdgeEnd.
y() ) ) < segmentPointWidth )
   211   for ( 
int i = 0; i < 4; ++i )
   214     poly << currentSegment.
p1();
   221     poly << currentSegment.
p2();
   263   if ( 
data( 1 ).toString() == 
"composer" )
   268   double handlerSize = 10;
   300   double dx = directionPoint.
x() - startPoint.
x();
   301   double dy = directionPoint.
y() - startPoint.
y();
   302   double length = sqrt( dx * dx + dy * dy );
   311   int cursorSensitivity = 7;
   313   if ( qAbs( itemPos.
x() ) < cursorSensitivity && qAbs( itemPos.
y() ) < cursorSensitivity ) 
   318   bool left, right, up, down;
   328   else if ( right && up )
   332   else if ( left && down )
   336   else if ( right && down )
   368   switch ( moveAction )
   371       return Qt::ArrowCursor;
   374       return Qt::SizeAllCursor;
   377       return Qt::SizeVerCursor;
   380       return Qt::SizeHorCursor;
   383       return Qt::SizeFDiagCursor;
   386       return Qt::SizeBDiagCursor;
   388       return Qt::ArrowCursor;
   436     if ( !symbolElem.
isNull() )
   447   if ( annotationElem.
isNull() )
   479   if ( !symbolElem.isNull() )
   481     QgsMarkerSymbolV2* symbol = QgsSymbolLayerV2Utils::loadSymbol<QgsMarkerSymbolV2>( symbolElem );
 
QgsMarkerSymbolV2 * mMarkerSymbol
Point symbol that is to be drawn at the map reference location. 
 
void setRenderHint(RenderHint hint, bool on)
 
QgsPoint toMapCoordinates(QPoint point) const
transformation from screen coordinates to map coordinates 
 
void _readXML(const QDomDocument &doc, const QDomElement &annotationElem)
 
double mFrameBorderWidth
Width of the frame. 
 
QDomNode appendChild(const QDomNode &newChild)
 
void setFlag(GraphicsItemFlag flag, bool enabled)
 
QString attribute(const QString &name, const QString &defValue) const
 
void setData(int key, const QVariant &value)
 
QPointF mOffsetFromReferencePoint
Describes the shift of the item content box to the reference point. 
 
const T & at(int i) const
 
void drawMarkerSymbol(QPainter *p) const
Draws the map position marker symbol to a destination painter. 
 
An abstract class for items that can be placed on the map canvas. 
 
Qt::CursorShape cursorShapeForAction(MouseMoveAction moveAction) const
Returns suitable cursor shape for mouse move action. 
 
virtual void setItemData(int role, const QVariant &value) override
deprecated - do not use 
 
static QDomElement saveSymbol(const QString &symbolName, QgsSymbolV2 *symbol, QDomDocument &doc)
 
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
 
QSizeF expandedTo(const QSizeF &otherSize) const
 
double size() const
Returns the size for the whole symbol, which is the maximum size of all marker symbol layers in the s...
 
void drawSelectionBoxes(QPainter *p) const
Draws selection handles around the item. 
 
virtual void setMapPositionCrs(const QgsCoordinateReferenceSystem &crs)
Sets the CRS of the map position. 
 
QgsAnnotationItem::MouseMoveAction moveActionForPosition(QPointF pos) const
Returns the mouse move behaviour for a given position. 
 
void setNamedColor(const QString &name)
 
double toDouble(bool *ok) const
 
virtual ~QgsAnnotationItem()
 
Map canvas is a class for displaying all GIS data types on a canvas. 
 
void update(const QRectF &rect)
 
void setFrameSize(QSizeF size)
 
double y() const
Get the y value of the point. 
 
void updatePosition() override
called on changed extent or resize event to update position of the item 
 
void setMarkerSymbol(QgsMarkerSymbolV2 *symbol)
Set symbol that is drawn on map position. 
 
QRectF mBoundingRect
Bounding rect (including item frame and balloon) 
 
QPointF toCanvasCoordinates(const QgsPoint &point) const
transformation from map coordinates to screen coordinates 
 
void drawRect(const QRectF &rectangle)
 
QPointF mBalloonSegmentPoint1
First segment point for drawing the connection (ccw direction) 
 
virtual void setMapPosition(const QgsPoint &pos)
 
void startRender(QgsRenderContext &context, const QgsFields *fields=nullptr)
 
double sqrDistToSegment(double x1, double y1, double x2, double y2, QgsPoint &minDistPoint, double epsilon=DEFAULT_SEGMENT_EPSILON) const
Returns the minimum distance between this point and a segment. 
 
bool readXML(const QDomNode &theNode)
Restores state from the given Dom node. 
 
void setPen(const QColor &color)
 
void setAttribute(const QString &name, const QString &value)
 
void setWidth(qreal width)
 
void setPos(const QPointF &pos)
 
int toInt(bool *ok, int base) const
 
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double. 
 
QgsAnnotationItem(QgsMapCanvas *mapCanvas)
 
QPointF mapFromScene(const QPointF &point) const
 
void setWidthF(qreal width)
 
void setBrush(const QBrush &brush)
 
void _writeXML(QDomDocument &doc, QDomElement &itemElem) const
 
virtual QSizeF minimumFrameSize() const
 
int mBalloonSegment
Segment number where the connection to the map point is attached. 
 
QRectF boundingRect() const override
default implementation for canvas items 
 
A class to represent a point. 
 
void prepareGeometryChange()
 
void setX(double x)
Sets the x value of the point. 
 
void setOffsetFromReferencePoint(QPointF offset)
 
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
Paint the annotation to a destination painter. 
 
QgsCoordinateReferenceSystem mMapPositionCrs
CRS of the map position. 
 
void setY(double y)
Sets the y value of the point. 
 
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering. 
 
double scaledSymbolSize() const
Returns the symbol size scaled in (mapcanvas) pixels. 
 
bool mMapPositionFixed
True: the item stays at the same map position, False: the item stays on same screen position...
 
QColor mFrameColor
Frame / balloon color. 
 
QVariant data(int key) const
 
Contains information about the context of a rendering operation. 
 
void stopRender(QgsRenderContext &context)
 
void updateBalloon()
Check where to attach the balloon connection between frame and map point. 
 
QgsMapCanvas * mMapCanvas
pointer to map canvas 
 
QDomElement firstChildElement(const QString &tagName) const
 
Class for storing a coordinate reference system (CRS) 
 
void updateBoundingRect()
 
void renderPoint(QPointF point, const QgsFeature *f, QgsRenderContext &context, int layer=-1, bool selected=false)
 
void setVisible(bool visible)
 
QLineF segment(int index) const
Returns frame width in painter units. 
 
virtual QPointF relativePosition() const override
Returns the relative position of the annotation, if it is not attached to a fixed map position...
 
double sqrDist(double x, double y) const
Returns the squared distance between this point a specified x, y coordinate. 
 
QColor mFrameBackgroundColor
 
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 th...
 
QPointF mBalloonSegmentPoint2
Second segment point for drawing the balloon connection (ccw direction) 
 
bool writeXML(QDomNode &theNode, QDomDocument &theDoc) const
Stores state to the given Dom node in the given document. 
 
QDomElement createElement(const QString &tagName)
 
virtual double scaleFactor() const override
Returns a scaling factor which should be applied to painters before rendering the item...
 
QgsPoint mMapPosition
Map position (in case mMapPositionFixed is true) 
 
void setHeight(qreal height)
 
QSizeF mFrameSize
Size of the frame (without balloon) 
 
const QgsCoordinateReferenceSystem & destinationCrs() const
returns CRS of destination coordinate reference system 
 
double x() const
Get the x value of the point. 
 
void setMapPositionFixed(bool fixed)
 
bool setRenderContextVariables(QPainter *p, QgsRenderContext &context) const
Sets render context parameters. 
 
void drawFrame(QPainter *p) const
Draws the annotation frame to a destination painter. 
 
bool isValid() const
Returns whether this CRS is correctly initialized and usable.