QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgscreateannotationitemmaptool_impl.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgscreateannotationitemmaptool_impl.cpp
3 ------------------------
4 Date : September 2021
5 Copyright : (C) 2021 Nyall Dawson
6 Email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
17#include "moc_qgscreateannotationitemmaptool_impl.cpp"
18#include "qgsmapmouseevent.h"
26#include "qgsannotationlayer.h"
27#include "qgsstyle.h"
28#include "qgsmapcanvas.h"
29#include "qgsmarkersymbol.h"
30#include "qgslinesymbol.h"
31#include "qgsfillsymbol.h"
33#include "qgsapplication.h"
35#include "qgscurvepolygon.h"
36#include "qgsrubberband.h"
38#include "qgssvgcache.h"
39#include "qgsimagecache.h"
40
41#include <QFileDialog>
42#include <QImageReader>
43
45
46//
47// QgsMapToolCaptureAnnotationItem
48//
49
51 : QgsMapToolCapture( canvas, cadDockWidget, mode )
52{
53 mToolName = tr( "Annotation tool" );
54}
55
57{
58 return mHandler;
59}
60
62{
63 return this;
64}
65
67{
68 return mHandler->targetLayer();
69}
70
71
73{
74 // no geometry validation!
75 return SupportsCurves;
76}
77
79{
80 switch ( technique )
81 {
86 return true;
87 }
89}
90
91
92//
93// QgsCreatePointTextItemMapTool
94//
95
97 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
98 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget ) )
99{
100 setUseSnappingIndicator( true );
101}
102
104
106{
107 if ( event->button() != Qt::LeftButton )
108 return;
109
110 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
111
112 std::unique_ptr< QgsAnnotationPointTextItem > createdItem = std::make_unique< QgsAnnotationPointTextItem >( tr( "Text" ), layerPoint );
113 createdItem->setAlignment( Qt::AlignLeft );
115 // default to HTML formatting
116 format.setAllowHtmlFormatting( true );
117 createdItem->setFormat( format );
118 // newly created point text items default to using symbology reference scale at the current map scale
119 createdItem->setUseSymbologyReferenceScale( true );
120 createdItem->setSymbologyReferenceScale( canvas()->scale() );
121 mHandler->pushCreatedItem( createdItem.release() );
122}
123
125{
126 return mHandler;
127}
128
130{
131 return this;
132}
133
134
135
136//
137// QgsCreateMarkerMapTool
138//
139
141 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePoint )
142{
143 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
144}
145
147{
148 if ( event->button() != Qt::LeftButton )
149 return;
150
151 const QgsPointXY layerPoint = toLayerCoordinates( mHandler->targetLayer(), event->mapPoint() );
152 std::unique_ptr< QgsAnnotationMarkerItem > createdItem = std::make_unique< QgsAnnotationMarkerItem >( QgsPoint( layerPoint ) );
153
154 std::unique_ptr< QgsMarkerSymbol > markerSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsMarkerSymbol >( QStringLiteral( "marker_annotation_item" ) );
155 if ( !markerSymbol )
156 markerSymbol.reset( qgis::down_cast< QgsMarkerSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Point ) ) );
157 createdItem->setSymbol( markerSymbol.release() );
158
159 // set reference scale to match canvas scale, but don't enable it by default for marker items
160 createdItem->setSymbologyReferenceScale( canvas()->scale() );
161
162 mHandler->pushCreatedItem( createdItem.release() );
163
165
167}
168
169//
170// QgsCreateLineMapTool
171//
172
174 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
175{
176 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
177}
178
179void QgsCreateLineItemMapTool::lineCaptured( const QgsCurve *line )
180{
181 if ( line->isEmpty() )
182 return;
183
184 // do it!
185 std::unique_ptr< QgsAbstractGeometry > geometry( line->simplifiedTypeRef()->clone() );
186 if ( qgsgeometry_cast< QgsCurve * >( geometry.get() ) )
187 {
188 std::unique_ptr< QgsAnnotationLineItem > createdItem = std::make_unique< QgsAnnotationLineItem >( qgsgeometry_cast< QgsCurve * >( geometry.release() ) );
189
190 std::unique_ptr< QgsLineSymbol > lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsLineSymbol >( QStringLiteral( "line_annotation_item" ) );
191 if ( !lineSymbol )
192 lineSymbol.reset( qgis::down_cast< QgsLineSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
193 createdItem->setSymbol( lineSymbol.release() );
194
195 // set reference scale to match canvas scale, but don't enable it by default for marker items
196 createdItem->setSymbologyReferenceScale( canvas()->scale() );
197
198 mHandler->pushCreatedItem( createdItem.release() );
199 }
200}
201
202//
203// QgsCreatePolygonItemMapTool
204//
205
207 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CapturePolygon )
208{
209 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
210}
211
212void QgsCreatePolygonItemMapTool::polygonCaptured( const QgsCurvePolygon *polygon )
213{
214 if ( polygon->isEmpty() )
215 return;
216
217 std::unique_ptr< QgsAbstractGeometry > geometry( polygon->exteriorRing()->simplifiedTypeRef()->clone() );
218 if ( qgsgeometry_cast< QgsCurve * >( geometry.get() ) )
219 {
220 std::unique_ptr< QgsCurvePolygon > newPolygon = std::make_unique< QgsCurvePolygon >();
221 newPolygon->setExteriorRing( qgsgeometry_cast< QgsCurve * >( geometry.release() ) );
222 std::unique_ptr< QgsAnnotationPolygonItem > createdItem = std::make_unique< QgsAnnotationPolygonItem >( newPolygon.release() );
223
224 std::unique_ptr< QgsFillSymbol > fillSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsFillSymbol >( QStringLiteral( "polygon_annotation_item" ) );
225 if ( !fillSymbol )
226 fillSymbol.reset( qgis::down_cast< QgsFillSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Polygon ) ) );
227 createdItem->setSymbol( fillSymbol.release() );
228
229 // set reference scale to match canvas scale, but don't enable it by default for marker items
230 createdItem->setSymbologyReferenceScale( canvas()->scale() );
231
232 mHandler->pushCreatedItem( createdItem.release() );
233 }
234}
235
236
237//
238// QgsCreatePictureItemMapTool
239//
240
241const QgsSettingsEntryString *QgsCreatePictureItemMapTool::settingLastSourceFolder = new QgsSettingsEntryString( QStringLiteral( "last-source-folder" ), sTreePicture, QString(), QStringLiteral( "Last used folder for picture annotation source files" ) );
242
244 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
245 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
246{
247 setUseSnappingIndicator( true );
248}
249
251{
252 if ( event->button() == Qt::RightButton && mRubberBand )
253 {
254 mRubberBand.reset();
256 return;
257 }
258
259 if ( event->button() != Qt::LeftButton )
260 return;
261
262 if ( !mRubberBand )
263 {
264 mFirstPoint = event->snapPoint();
265 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
266
268 mRubberBand->setWidth( digitizingStrokeWidth() );
269 QColor color = digitizingStrokeColor();
270
272 color.setAlphaF( color.alphaF() * alphaScale );
273 mRubberBand->setLineStyle( Qt::DotLine );
274 mRubberBand->setStrokeColor( color );
275
276 const QColor fillColor = digitizingFillColor();
277 mRubberBand->setFillColor( fillColor );
278 }
279 else
280 {
281 mRubberBand.reset();
282
283 QStringList formatsFilter;
284 formatsFilter.append( QStringLiteral( "*.svg" ) );
285 const QByteArrayList supportedFormats = QImageReader::supportedImageFormats();
286 for ( const auto &format : supportedFormats )
287 {
288 formatsFilter.append( QString( QStringLiteral( "*.%1" ) ).arg( QString( format ) ) );
289 }
290 const QString dialogFilter = QStringLiteral( "%1 (%2);;%3 (*.*)" ).arg( tr( "Images" ), formatsFilter.join( QLatin1Char( ' ' ) ), tr( "All files" ) );
291 const QString initialDir = settingLastSourceFolder->value();
292 const QString imagePath = QFileDialog::getOpenFileName( nullptr, tr( "Add Picture Annotation" ), initialDir.isEmpty() ? QDir::homePath() : initialDir, dialogFilter );
293
294 if ( imagePath.isEmpty() )
295 {
296 return; //canceled by the user
297 }
298
299 settingLastSourceFolder->setValue( QFileInfo( imagePath ).path() );
300
301 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
302 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
303
304 const QgsPointXY devicePoint1 = toCanvasCoordinates( mFirstPoint );
305 const QgsPointXY devicePoint2 = toCanvasCoordinates( event->snapPoint() );
306 const double initialWidthPixels = std::abs( devicePoint1.x() - devicePoint2.x() );
307 const double initialHeightPixels = std::abs( devicePoint1.y() - devicePoint2.y() );
308
309 const QFileInfo pathInfo( imagePath );
311
312 QSizeF size;
313 if ( pathInfo.suffix().compare( QLatin1String( "svg" ), Qt::CaseInsensitive ) == 0 )
314 {
316 size = QgsApplication::svgCache()->svgViewboxSize( imagePath, 100, QColor(), QColor(), 1, 1 );
317 }
318 else
319 {
321 size = QgsApplication::imageCache()->originalSize( imagePath );
322 }
323
325
326 std::unique_ptr< QgsAnnotationPictureItem > createdItem = std::make_unique< QgsAnnotationPictureItem >( format, imagePath, QgsRectangle( point1, point2 ) );
327 if ( size.isValid() )
328 {
329 const double pixelsToMm = mCanvas->mapSettings().outputDpi() / 25.4;
330 if ( size.width() / size.height() > initialWidthPixels / initialHeightPixels )
331 {
332 createdItem->setFixedSize( QSizeF( initialWidthPixels / pixelsToMm, size.height() / size.width() * initialWidthPixels / pixelsToMm ) );
333 }
334 else
335 {
336 createdItem->setFixedSize( QSizeF( size.width() / size.height() * initialHeightPixels / pixelsToMm, initialHeightPixels / pixelsToMm ) );
337 }
338 createdItem->setFixedSizeUnit( Qgis::RenderUnit::Millimeters );
339 }
340
341 mHandler->pushCreatedItem( createdItem.release() );
342 }
343}
344
346{
347 if ( !mRubberBand )
348 return;
349
350 const QgsPointXY mapPoint = event->snapPoint();
351 mRect.setBottomRight( mapPoint.toQPointF() );
352
353 mRubberBand->reset( Qgis::GeometryType::Polygon );
354 mRubberBand->addPoint( mRect.bottomLeft(), false );
355 mRubberBand->addPoint( mRect.bottomRight(), false );
356 mRubberBand->addPoint( mRect.topRight(), false );
357 mRubberBand->addPoint( mRect.topLeft(), true );
358}
359
360void QgsCreatePictureItemMapTool::keyPressEvent( QKeyEvent *event )
361{
362 if ( event->key() == Qt::Key_Escape )
363 {
364 if ( mRubberBand )
365 {
366 mRubberBand.reset();
368 event->ignore();
369 }
370 }
371}
372
374{
375 return mHandler;
376}
377
379{
380 return this;
381}
382
383
384
385//
386// QgsCreateRectangleTextItemMapTool
387//
388
390 : QgsMapToolAdvancedDigitizing( canvas, cadDockWidget )
391 , mHandler( new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this ) )
392{
393 setUseSnappingIndicator( true );
394}
395
397{
398 if ( event->button() == Qt::RightButton && mRubberBand )
399 {
400 mRubberBand.reset();
402 return;
403 }
404
405 if ( event->button() != Qt::LeftButton )
406 return;
407
408 if ( !mRubberBand )
409 {
410 mFirstPoint = event->snapPoint();
411 mRect.setRect( mFirstPoint.x(), mFirstPoint.y(), mFirstPoint.x(), mFirstPoint.y() );
412
414 mRubberBand->setWidth( digitizingStrokeWidth() );
415 QColor color = digitizingStrokeColor();
416
418 color.setAlphaF( color.alphaF() * alphaScale );
419 mRubberBand->setLineStyle( Qt::DotLine );
420 mRubberBand->setStrokeColor( color );
421
422 const QColor fillColor = digitizingFillColor();
423 mRubberBand->setFillColor( fillColor );
424 }
425 else
426 {
427 mRubberBand.reset();
428
429 const QgsPointXY point1 = toLayerCoordinates( mHandler->targetLayer(), mFirstPoint );
430 const QgsPointXY point2 = toLayerCoordinates( mHandler->targetLayer(), event->snapPoint() );
431
433
434 std::unique_ptr< QgsAnnotationRectangleTextItem > createdItem = std::make_unique< QgsAnnotationRectangleTextItem >( tr( "Text" ), QgsRectangle( point1, point2 ) );
435
437 // default to HTML formatting
438 format.setAllowHtmlFormatting( true );
439 createdItem->setFormat( format );
440
441 // newly created rect text items default to using symbology reference scale at the current map scale
442 createdItem->setUseSymbologyReferenceScale( true );
443 createdItem->setSymbologyReferenceScale( canvas()->scale() );
444 mHandler->pushCreatedItem( createdItem.release() );
445 }
446}
447
449{
450 if ( !mRubberBand )
451 return;
452
453 const QgsPointXY mapPoint = event->snapPoint();
454 mRect.setBottomRight( mapPoint.toQPointF() );
455
456 mRubberBand->reset( Qgis::GeometryType::Polygon );
457 mRubberBand->addPoint( mRect.bottomLeft(), false );
458 mRubberBand->addPoint( mRect.bottomRight(), false );
459 mRubberBand->addPoint( mRect.topRight(), false );
460 mRubberBand->addPoint( mRect.topLeft(), true );
461}
462
464{
465 if ( event->key() == Qt::Key_Escape )
466 {
467 if ( mRubberBand )
468 {
469 mRubberBand.reset();
471 event->ignore();
472 }
473 }
474}
475
477{
478 return mHandler;
479}
480
482{
483 return this;
484}
485
486
487//
488// QgsCreateLineTextItemMapTool
489//
490
492 : QgsMapToolCaptureAnnotationItem( canvas, cadDockWidget, CaptureLine )
493{
494 mHandler = new QgsCreateAnnotationItemMapToolHandler( canvas, cadDockWidget, this );
495}
496
497void QgsCreateLineTextItemMapTool::lineCaptured( const QgsCurve *line )
498{
499 if ( line->isEmpty() )
500 return;
501
502 // do it!
503 std::unique_ptr< QgsAbstractGeometry > geometry( line->simplifiedTypeRef()->clone() );
504 if ( qgsgeometry_cast< QgsCurve * >( geometry.get() ) )
505 {
506 std::unique_ptr< QgsAnnotationLineTextItem > createdItem = std::make_unique< QgsAnnotationLineTextItem >( tr( "Text" ), qgsgeometry_cast< QgsCurve * >( geometry.release() ) );
507
508 std::unique_ptr< QgsLineSymbol > lineSymbol = QgsApplication::recentStyleHandler()->recentSymbol< QgsLineSymbol >( QStringLiteral( "line_annotation_item" ) );
509 if ( !lineSymbol )
510 lineSymbol.reset( qgis::down_cast< QgsLineSymbol * >( QgsSymbol::defaultSymbol( Qgis::GeometryType::Line ) ) );
511
513 // default to HTML formatting
514 format.setAllowHtmlFormatting( true );
515 createdItem->setFormat( format );
516
517 // newly created point text items default to using symbology reference scale at the current map scale
518 createdItem->setUseSymbologyReferenceScale( true );
519 createdItem->setSymbologyReferenceScale( canvas()->scale() );
520 mHandler->pushCreatedItem( createdItem.release() );
521 }
522}
523
void reset(T *p=nullptr)
Will reset the managed pointer to p.
CaptureTechnique
Capture technique.
Definition qgis.h:376
@ Shape
Digitize shapes.
@ StraightSegments
Default capture mode - capture occurs with straight line segments.
@ CircularString
Capture in circular strings.
@ Streaming
Streaming points digitizing mode (points are automatically added as the mouse cursor moves).
PictureFormat
Picture formats.
Definition qgis.h:4893
@ Raster
Raster image.
@ Unknown
Invalid or unknown image type.
@ Polygon
Polygons.
@ Millimeters
Millimeters.
virtual const QgsAbstractGeometry * simplifiedTypeRef() const
Returns a reference to the simplest lossless representation of this geometry, e.g.
virtual bool isEmpty() const
Returns true if the geometry is empty.
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
The QgsAdvancedDigitizingDockWidget class is a dockable widget used to handle the CAD tools on top of...
void clearPoints()
Removes all points from the CAD point list.
static QgsRecentStyleHandler * recentStyleHandler()
Returns the handler for recently used style items.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
A handler object for map tools which create annotation items.
QgsAnnotationLayer * targetLayer()
Returns the target layer for newly created items.
void pushCreatedItem(QgsAnnotationItem *item)
Pushes a created item to the handler.
QgsCreateLineItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateLineTextItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateMarkerItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
void cadCanvasReleaseEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void cadCanvasMoveEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
static const QgsSettingsEntryString * settingLastSourceFolder
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
void cadCanvasPressEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void keyPressEvent(QKeyEvent *event) override
Key event for overriding. Default implementation does nothing.
QgsCreatePictureItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
~QgsCreatePointTextItemMapTool() override
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
void cadCanvasPressEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
QgsCreatePointTextItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
QgsCreatePolygonItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsCreateRectangleTextItemMapTool(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget)
Constructor.
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
void cadCanvasMoveEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void cadCanvasPressEvent(QgsMapMouseEvent *event) override
Override this method when subclassing this class.
void keyPressEvent(QKeyEvent *event) override
Key event for overriding. Default implementation does nothing.
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
Curve polygon geometry type.
const QgsCurve * exteriorRing() const
Returns the curve polygon's exterior ring.
bool isEmpty() const override
Returns true if the geometry is empty.
Abstract base class for curved geometry type.
Definition qgscurve.h:35
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
QSize originalSize(const QString &path, bool blocking=false) const
Returns the original size (in pixels) of the image at the specified path.
A line symbol type, for rendering LineString and MultiLineString geometries.
Map canvas is a class for displaying all GIS data types on a canvas.
double scale() const
Returns the last reported scale of the canvas.
Base class for all map layer types.
Definition qgsmaplayer.h:76
A QgsMapMouseEvent is the result of a user interaction with the mouse on a QgsMapCanvas.
QgsPointXY mapPoint() const
mapPoint returns the point in coordinates
QgsPointXY snapPoint()
snapPoint will snap the points using the map canvas snapping utils configuration
The QgsMapToolAdvancedDigitizing class is a QgsMapTool which gives event directly in map coordinates ...
QgsAdvancedDigitizingDockWidget * cadDockWidget() const
A base class to digitize annotation items using QgsMapToolCapture.
QgsMapToolCaptureAnnotationItem(QgsMapCanvas *canvas, QgsAdvancedDigitizingDockWidget *cadDockWidget, CaptureMode mode)
Constructor.
QgsMapTool * mapTool() override
Returns a reference to the associated map tool.
bool supportsTechnique(Qgis::CaptureTechnique technique) const override
Returns true if the tool supports the specified capture technique.
QgsMapLayer * layer() const override
Returns the layer associated with the map tool.
QgsCreateAnnotationItemMapToolHandler * mHandler
QgsMapToolCapture::Capabilities capabilities() const override
Returns flags containing the supported capabilities.
QgsCreateAnnotationItemMapToolHandler * handler() const override
Returns the handler object for the map tool.
QgsMapToolCapture is a base class capable of capturing point, lines and polygons.
void stopCapturing()
Stop capturing.
QFlags< Capability > Capabilities
@ SupportsCurves
Supports curved geometries input.
static QColor digitizingFillColor()
Returns fill color for rubber bands (from global settings)
static QColor digitizingStrokeColor()
Returns stroke color for rubber bands (from global settings)
static int digitizingStrokeWidth()
Returns stroke width for rubber bands (from global settings)
Abstract base class for all map tools.
Definition qgsmaptool.h:71
QgsPoint toLayerCoordinates(const QgsMapLayer *layer, const QgsPoint &point)
Transforms a point from map coordinates to layer coordinates.
QPointer< QgsMapCanvas > mCanvas
The pointer to the map canvas.
Definition qgsmaptool.h:341
QgsMapCanvas * canvas() const
returns pointer to the tool's map canvas
QPoint toCanvasCoordinates(const QgsPointXY &point) const
Transforms a point from map coordinates to screen coordinates.
A marker symbol type, for rendering Point and MultiPoint geometries.
A class to represent a 2D point.
Definition qgspointxy.h:60
double y
Definition qgspointxy.h:64
double x
Definition qgspointxy.h:63
QPointF toQPointF() const
Converts a point to a QPointF.
Definition qgspointxy.h:165
Point geometry type, with support for z-dimension and m-values.
Definition qgspoint.h:49
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsSymbol * recentSymbol(const QString &identifier) const
Returns a copy of the recently used symbol with the specified identifier, or nullptr if no symbol wit...
A rectangle specified with double values.
A class for drawing transient features (e.g.
void setWidth(double width)
Sets the width of the line.
void reset(Qgis::GeometryType geometryType=Qgis::GeometryType::Line)
Clears all the geometries in this rubberband.
void setStrokeColor(const QColor &color)
Sets the stroke color for the rubberband.
void setLineStyle(Qt::PenStyle penStyle)
Sets the style of the line.
void setFillColor(const QColor &color)
Sets the fill color for the rubberband.
void addPoint(const QgsPointXY &p, bool doUpdate=true, int geometryIndex=0, int ringIndex=0)
Adds a vertex to the rubberband and update canvas.
T value(const QString &dynamicKeyPart=QString()) const
Returns settings value.
bool setValue(const T &value, const QString &dynamicKeyPart=QString()) const
Set settings value.
A string settings entry.
static const QgsSettingsEntryDouble * settingsDigitizingLineColorAlphaScale
Settings entry digitizing line color alpha scale.
static QgsTextFormat defaultTextFormatForProject(QgsProject *project, QgsStyle::TextFormatContext context=QgsStyle::TextFormatContext::Labeling)
Returns the default text format to use for new text based objects for the specified project,...
@ Labeling
Text format used in labeling.
QSizeF svgViewboxSize(const QString &path, double size, const QColor &fill, const QColor &stroke, double strokeWidth, double widthScaleFactor, double fixedAspectRatio=0, bool blocking=false, const QMap< QString, QString > &parameters=QMap< QString, QString >())
Calculates the viewbox size of a (possibly cached) SVG file.
static QgsSymbol * defaultSymbol(Qgis::GeometryType geomType)
Returns a new default symbol for the specified geometry type.
Container for all settings relating to text rendering.
void setAllowHtmlFormatting(bool allow)
Sets whether text should be treated as a HTML document and HTML tags should be used for formatting th...
#define BUILTIN_UNREACHABLE
Definition qgis.h:6571