19#include "moc_qgscoordinateboundspreviewmapwidget.cpp"
25 mPreviewBand->setWidth( 4 );
28 mCanvasPreviewBand->setWidth( 4 );
29 const QColor rectColor = QColor( 185, 84, 210, 60 );
30 mCanvasPreviewBand->setColor( rectColor );
34 mCanvasCenterMarker->setColor( QColor( 185, 84, 210 ) );
35 mCanvasCenterMarker->setPenWidth( 3 );
43 mLayers <<
new QgsVectorLayer( layerPath, tr(
"World Map" ), QStringLiteral(
"ogr" ), options );
56 qDeleteAll( mLayers );
58 delete mCanvasPreviewBand;
59 delete mCanvasCenterMarker;
78 mPreviewBand->setToGeometry( geom,
nullptr );
79 mPreviewBand->setColor( QColor( 255, 0, 0, 65 ) );
102 mCanvasPreviewBand->show();
103 mCanvasCenterMarker->setCenter( rect.
center() );
104 mCanvasCenterMarker->show();
static QString pkgDataPath()
Returns the common root path of all application data directories.
Represents a coordinate reference system (CRS).
A geometry is the spatial representation of a feature.
static QgsGeometry fromRect(const QgsRectangle &rect)
Creates a new geometry from a QgsRectangle.
Q_DECL_DEPRECATED Qgis::GeometryOperationResult addPart(const QVector< QgsPointXY > &points, Qgis::GeometryType geomType=Qgis::GeometryType::Unknown)
Adds a new part to a the geometry.
QgsRectangle boundingBox() const
Returns the bounding box of the geometry.
void zoomToFullExtent()
Zoom to the full extent of all layers currently visible in the canvas.
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of layers that should be shown in the canvas.
void setExtent(const QgsRectangle &r, bool magnified=false)
Sets the extent of the map canvas to the specified rectangle.
QgsMapCanvas(QWidget *parent=nullptr)
Constructor.
void setPreviewJobsEnabled(bool enabled)
Sets whether canvas map preview jobs (low priority render jobs which render portions of the view just...
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
Sets destination coordinate reference system.
void setMapTool(QgsMapTool *mapTool, bool clean=false)
Sets the map tool currently being used on the canvas.
QgsRectangle extent() const
Returns the current zoom extent of the map canvas.
void refresh()
Repaints the canvas map.
A rectangle specified with double values.
Responsible for drawing transient features (e.g.
Represents a vector layer which manages a vector based dataset.
A map canvas item for marking vertices of features using e.g.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference).
Setting options for loading vector layers.
bool forceReadOnly
Controls whether the layer is forced to be load as Read Only.