QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
46 mProject->disconnect(
this );
80 return mMapSettings.
extent();
207 return mMapSettings.
layers();
216 void QgsQuickMapSettings::onCrsChanged()
221 void QgsQuickMapSettings::onReadProject(
const QDomDocument &doc )
225 int red = mProject->
readNumEntry( QStringLiteral(
"Gui" ), QStringLiteral(
"/CanvasColorRedPart" ), 255 );
226 int green = mProject->
readNumEntry( QStringLiteral(
"Gui" ), QStringLiteral(
"/CanvasColorGreenPart" ), 255 );
227 int blue = mProject->
readNumEntry( QStringLiteral(
"Gui" ), QStringLiteral(
"/CanvasColorBluePart" ), 255 );
231 QDomNodeList nodes = doc.elementsByTagName(
"mapcanvas" );
232 bool foundTheMapCanvas =
false;
233 for (
int i = 0; i < nodes.size(); i++ )
235 QDomNode node = nodes.item( 0 );
236 QDomElement element = node.toElement();
238 if ( element.hasAttribute( QStringLiteral(
"name" ) ) && element.attribute( QStringLiteral(
"name" ) ) == QLatin1String(
"theMapCanvas" ) )
240 foundTheMapCanvas =
true;
247 if ( !foundTheMapCanvas )
292 return mDevicePixelRatio;
void setDestinationCrs(const QgsCoordinateReferenceSystem &crs)
Sets the destination crs (coordinate reference system) for the map render.
void setExtent(const QgsRectangle &extent)
Sets the coordinates of the rectangle which should be rendered.
Contains information about the context in which a coordinate transform is executed.
const QgsProjectViewSettings * viewSettings() const
Returns the project's view settings, which contains settings and properties relating to how a QgsProj...
void extentChanged()
Geographical coordinates of the rectangle that should be rendered.
void readXml(QDomNode &node)
void destinationCrsChanged()
CRS of destination coordinate reference system.
QSize outputSize() const
Returns the size of the resulting map image, in pixels.
void setRotation(double rotation)
Sets the rotation of the resulting map image, in degrees clockwise.
Point geometry type, with support for z-dimension and m-values.
QgsRectangle visibleExtent
Returns the actual extent derived from requested extent that takes output image size into account.
double outputDpi
Output DPI used for conversion between real world units (e.g.
double mapUnitsPerPixel
Returns the distance in geographical coordinates that equals to one pixel in the map.
QgsPointXY center() const SIP_HOLDGIL
Returns the center point of the rectangle.
QgsProject project
A project property should be used as a primary source of project all other components in the applicat...
void projectChanged()
A project property should be used as a primary source of project all other components in the applicat...
double mapUnitsPerPoint
Returns the distance in geographical coordinates that equals to one point unit in the map.
QgsPathResolver pathResolver() const
Returns path resolver object with considering whether the project uses absolute or relative paths and...
double yMinimum() const SIP_HOLDGIL
Returns the y minimum value (bottom side of rectangle).
void setY(double y) SIP_HOLDGIL
Sets the y value of the point.
QgsCoordinateTransformContext transformContext
double mapUnitsPerPixel() const
Returns the distance in geographical coordinates that equals to one pixel in the map.
QPointF toQPointF() const
Converts a point to a QPointF.
void readProject(const QDomDocument &)
Emitted when a project is being read.
QgsQuickMapSettings(QObject *parent=nullptr)
Create new map settings.
void setRotation(double rotation)
The rotation of the resulting map image, in degrees clockwise.
void setOutputDpi(double dpi)
Sets the dpi (dots per inch) used for conversion between real world units (e.g.
Q_INVOKABLE QPointF coordinateToScreen(const QgsPoint &point) const
Convert a map coordinate to screen pixel coordinates.
QgsPointXY toMapCoordinates(int x, int y) const
Transforms device coordinates to map (world) coordinates.
QgsMapSettings mapSettings() const
Clone map settings.
void layersChanged()
Set list of layers for map rendering.
void setX(double x) SIP_HOLDGIL
Sets the x value of the point.
A rectangle specified with double values.
Q_INVOKABLE QgsPoint screenToCoordinate(const QPointF &point) const
Convert a screen coordinate to a map coordinate.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of layers to render in the map.
QgsRectangle extent() const
Returns geographical coordinates of the rectangle that should be rendered.
void setOutputDpi(double outputDpi)
Sets the dpi (dots per inch) used for conversion between real world units (e.g.
double xMaximum() const SIP_HOLDGIL
Returns the x maximum value (right side of rectangle).
void crsChanged()
Emitted when the CRS of the project has changed.
QgsCoordinateReferenceSystem destinationCrs
CRS of destination coordinate reference system.
QSize outputSize
The size of the resulting map image.
void setBackgroundColor(const QColor &color)
Sets the background color of the map.
void setDestinationCrs(const QgsCoordinateReferenceSystem &destinationCrs)
Sets the destination crs (coordinate reference system) for the map render.
QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
double rotation() const
Returns the rotation of the resulting map image, in degrees clockwise.
void outputDpiChanged()
Output DPI used for conversion between real world units (e.g.
double rotation
The rotation of the resulting map image, in degrees clockwise.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsReferencedRectangle fullExtent() const
Returns the full extent of the project, which represents the maximal limits of the project.
double x() const SIP_HOLDGIL
Returns the vector's x-component.
virtual QgsRectangle extent() const
Returns the extent of the layer.
QList< QgsMapLayer * > layers
Set list of layers for map rendering.
QColor backgroundColor() const
Returns the background color of the map.
double y() const SIP_HOLDGIL
Returns the vector's y-component.
void setXMinimum(double x) SIP_HOLDGIL
Set the minimum x value.
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
Q_INVOKABLE void setCenterToLayer(QgsMapLayer *layer, bool shouldZoom=true)
Move current map extent to have center point defined by layer. Optionally only pan to the layer if sh...
void setProject(QgsProject *project)
A project property should be used as a primary source of project all other components in the applicat...
double xMinimum() const SIP_HOLDGIL
Returns the x minimum value (left side of rectangle).
void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the coordinate transform context, which stores various information regarding which datum transfo...
void mapUnitsPerPixelChanged()
Returns the distance in geographical coordinates that equals to one pixel in the map.
void rotationChanged()
The rotation of the resulting map image, in degrees clockwise.
This class represents a coordinate reference system (CRS).
QgsPointXY transform(const QgsPointXY &p) const
Transforms a point p from map (world) coordinates to device coordinates.
void setXMaximum(double x) SIP_HOLDGIL
Set the maximum x value.
void setLayers(const QList< QgsMapLayer * > &layers)
Sets the list of layers to render in the map.
A class to represent a 2D point.
QgsCoordinateReferenceSystem destinationCrs() const
Returns the destination coordinate reference system for the map render.
void setYMaximum(double y) SIP_HOLDGIL
Set the maximum y value.
Q_INVOKABLE QgsCoordinateTransformContext transformContext() const
Returns the coordinate transform context, which stores various information regarding which datum tran...
void outputSizeChanged()
The size of the resulting map image.
void backgroundColorChanged()
The background color used to render the map.
void setDevicePixelRatio(const qreal &devicePixelRatio)
Sets the ratio between physical pixels and device-independent pixels.
double yMaximum() const SIP_HOLDGIL
Returns the y maximum value (top side of rectangle).
void setYMinimum(double y) SIP_HOLDGIL
Set the minimum y value.
QColor backgroundColor
The background color used to render the map.
void devicePixelRatioChanged()
Returns the ratio between physical pixels and device-independent pixels.
Base class for all map layer types. This is the base class for all map layer types (vector,...
A class to represent a vector. Currently no Z axis / 2.5D support is implemented.
void setOutputSize(QSize outputSize)
Sets the size of the resulting map image, in pixels.
qreal devicePixelRatio() const
Returns the ratio between physical pixels and device-independent pixels.
void setOutputSize(QSize size)
Sets the size of the resulting map image, in pixels.
double outputDpi() const
Returns the DPI (dots per inch) used for conversion between real world units (e.g.
void setPathResolver(const QgsPathResolver &resolver)
Sets the path resolver for conversion between relative and absolute paths during rendering operations...
The QgsMapSettings class contains configuration for rendering of the map. The rendering itself is don...
QgsRectangle visibleExtent() const
Returns the actual extent derived from requested extent that takes output image size into account.
QgsPointXY layerToMapCoordinates(const QgsMapLayer *layer, QgsPointXY point) const
transform point coordinates from layer's CRS to output CRS
QgsRectangle extent
Geographical coordinates of the rectangle that should be rendered.
void setExtent(const QgsRectangle &rect, bool magnified=true)
Sets the coordinates of the rectangle which should be rendered.
bool isEmpty() const
Returns true if the rectangle is empty.
void visibleExtentChanged()
Returns the actual extent derived from requested extent that takes output image size into account.
QgsCoordinateReferenceSystem crs
const QgsMapToPixel & mapToPixel() const
void setBackgroundColor(const QColor &color)
The background color used to render the map.
Q_INVOKABLE void setCenter(const QgsPoint ¢er)
Move current map extent to have center point defined by center.
QList< QgsMapLayer * > layers(bool expandGroupLayers=false) const
Returns the list of layers which will be rendered in the map.
int readNumEntry(const QString &scope, const QString &key, int def=0, bool *ok=nullptr) const
Reads an integer from the specified scope and key.
void setTransformContext(const QgsCoordinateTransformContext &context)
Sets the coordinate transform context, which stores various information regarding which datum transfo...