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

An annotation item that embedds a designer form showing the feature attribute. More...

#include <qgshtmlannotationitem.h>

Inheritance diagram for QgsHtmlAnnotationItem:
Inheritance graph
[legend]

Public Member Functions

 QgsHtmlAnnotationItem (QgsMapCanvas *canvas, QgsVectorLayer *vlayer=nullptr, bool hasFeature=false, int feature=0)
 
 ~QgsHtmlAnnotationItem ()
 
QString htmlPage () const
 
QSizeF minimumFrameSize () const override
 
void paint (QPainter *painter) override
 function to be implemented by derived classes More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
 paint function called by map canvas More...
 
void readXml (const QDomDocument &doc, const QDomElement &itemElem) override
 Deserialize from XML. More...
 
void setHTMLPage (const QString &htmlFile)
 
void setMapPosition (const QgsPoint &pos) override
 Reimplemented from QgsAnnotationItem. More...
 
QgsVectorLayervectorLayer () const
 
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
 default implementation for canvas items More...
 
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. More...
 
const QgsMarkerSymbolmarkerSymbol () const
 
QgsAnnotationItem::MouseMoveAction moveActionForPosition (QPointF pos) const
 Returns the mouse move behaviour for a given position. More...
 
QPointF offsetFromReferencePoint () const
 
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 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...
 
QgsMarkerSymbolmMarkerSymbol
 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...
 
QgsMapCanvasmMapCanvas
 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

An annotation item that embedds a designer form showing the feature attribute.

Definition at line 31 of file qgshtmlannotationitem.h.

Constructor & Destructor Documentation

§ QgsHtmlAnnotationItem()

QgsHtmlAnnotationItem::QgsHtmlAnnotationItem ( QgsMapCanvas canvas,
QgsVectorLayer vlayer = nullptr,
bool  hasFeature = false,
int  feature = 0 
)

Definition at line 41 of file qgshtmlannotationitem.cpp.

§ ~QgsHtmlAnnotationItem()

QgsHtmlAnnotationItem::~QgsHtmlAnnotationItem ( )

Definition at line 67 of file qgshtmlannotationitem.cpp.

Member Function Documentation

§ htmlPage()

QString QgsHtmlAnnotationItem::htmlPage ( ) const
inline

Definition at line 49 of file qgshtmlannotationitem.h.

§ minimumFrameSize()

QSizeF QgsHtmlAnnotationItem::minimumFrameSize ( ) const
overridevirtual

Reimplemented from QgsAnnotationItem.

Definition at line 131 of file qgshtmlannotationitem.cpp.

§ paint() [1/2]

void QgsHtmlAnnotationItem::paint ( QPainter *  painter)
overridevirtual

function to be implemented by derived classes

Reimplemented from QgsAnnotationItem.

Definition at line 97 of file qgshtmlannotationitem.cpp.

§ paint() [2/2]

void QgsHtmlAnnotationItem::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget = nullptr 
)
overridevirtual

paint function called by map canvas

Reimplemented from QgsAnnotationItem.

Definition at line 102 of file qgshtmlannotationitem.cpp.

§ readXml()

void QgsHtmlAnnotationItem::readXml ( const QDomDocument &  doc,
const QDomElement &  itemElem 
)
overridevirtual

Deserialize from XML.

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

Implements QgsAnnotationItem.

Definition at line 165 of file qgshtmlannotationitem.cpp.

§ setHTMLPage()

void QgsHtmlAnnotationItem::setHTMLPage ( const QString &  htmlFile)

Definition at line 72 of file qgshtmlannotationitem.cpp.

§ setMapPosition()

void QgsHtmlAnnotationItem::setMapPosition ( const QgsPoint pos)
overridevirtual

Reimplemented from QgsAnnotationItem.

Reimplemented from QgsAnnotationItem.

Definition at line 91 of file qgshtmlannotationitem.cpp.

§ vectorLayer()

QgsVectorLayer* QgsHtmlAnnotationItem::vectorLayer ( ) const
inline

Definition at line 54 of file qgshtmlannotationitem.h.

§ writeXml()

void QgsHtmlAnnotationItem::writeXml ( QDomDocument &  doc) const
overridevirtual

Serialize to XML.

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

Implements QgsAnnotationItem.

Definition at line 144 of file qgshtmlannotationitem.cpp.


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