17#ifndef QGSTERRAINPROVIDER_H
18#define QGSTERRAINPROVIDER_H
45 if ( sipCpp->type().compare( QLatin1String(
"flat" ) ) == 0 )
47 sipType = sipType_QgsFlatTerrainProvider;
49 else if ( sipCpp->type().compare( QLatin1String(
"raster" ) ) == 0 )
51 sipType = sipType_QgsRasterDemTerrainProvider;
53 else if ( sipCpp->type().compare( QLatin1String(
"mesh" ) ) == 0 )
55 sipType = sipType_QgsMeshTerrainProvider;
81 virtual void resolveReferences(
const QgsProject *project );
98 virtual QString
type()
const = 0;
125 virtual double heightAt(
double x,
double y )
const = 0;
133 double scale()
const {
return mScale; }
149 double offset()
const {
return mOffset; }
177 void writeCommonProperties( QDomElement &element,
const QgsReadWriteContext &context )
const;
182 void readCommonProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
188 double mOffset = 0.0;
214 QString type()
const override;
216 QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const override;
218 double heightAt(
double x,
double y )
const override;
220 void prepare() override;
244 QString type()
const override;
245 void resolveReferences(
const QgsProject *project )
override;
247 QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const override;
249 double heightAt(
double x,
double y )
const override;
252 void prepare() override;
298 QString type()
const override;
299 void resolveReferences(
const QgsProject *project )
override;
301 QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const override;
303 double heightAt(
double x,
double y )
const override;
306 void prepare() override;
Abstract base class for terrain providers.
QgsAbstractTerrainProvider & operator=(const QgsAbstractTerrainProvider &other)=delete
QgsAbstractTerrainProvider cannot be assigned.
virtual bool equals(const QgsAbstractTerrainProvider *other) const =0
Returns true if the provider is equal to other.
virtual QString type() const =0
Returns the unique type ID string for the provider.
virtual double heightAt(double x, double y) const =0
Returns the height at the point (x,y) in the terrain provider's native crs().
virtual bool readXml(const QDomElement &element, const QgsReadWriteContext &context)=0
Reads the terrain provider state from a DOM element.
virtual ~QgsAbstractTerrainProvider()
virtual QgsCoordinateReferenceSystem crs() const =0
Returns the native coordinate reference system of the terrain provider.
virtual void prepare()=0
Called on the main thread prior to accessing the provider from a background thread.
double offset() const
Returns the vertical offset value, used for adjusting the heights from the terrain provider.
double scale() const
Returns the vertical scale factor, which can be used to exaggerate vertical heights.
virtual QDomElement writeXml(QDomDocument &document, const QgsReadWriteContext &context) const =0
Returns a DOM element representing the state of the terrain provider.
QgsAbstractTerrainProvider()=default
Constructor for QgsAbstractTerrainProvider.
void setOffset(double offset)
Returns the vertical offset value, used for adjusting the heights from the terrain provider.
void setScale(double scale)
Sets the vertical scale factor, which can be used to exaggerate vertical heights.
virtual QgsAbstractTerrainProvider * clone() const =0
Creates a clone of the provider and returns the new object.
This class represents a coordinate reference system (CRS).
A terrain provider where the terrain is a simple flat surface.
QgsFlatTerrainProvider()=default
Constructor for QgsFlatTerrainProvider.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
A terrain provider that uses the Z values of a mesh layer to build a terrain surface.
QgsMeshTerrainProvider()=default
Constructor for QgsMeshTerrainProvider.
const QgsMeshTerrainProvider * operator=(const QgsMeshTerrainProvider &other)=delete
QgsMeshTerrainProvider cannot be assigned.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Base class for raster data providers.
A terrain provider where the terrain source is a raster DEM layer.
const QgsRasterDemTerrainProvider * operator=(const QgsRasterDemTerrainProvider &other)=delete
QgsRasterDemTerrainProvider cannot be assigned.
QgsRasterDemTerrainProvider()=default
Constructor for QgsRasterDemTerrainProvider.
Represents a raster layer.
The class is used as a container of context for various read/write operations on other objects.
Triangular/Derived Mesh is mesh with vertices in map coordinates.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
const QgsCoordinateReferenceSystem & crs
Internal structure to keep weak pointer to QgsMapLayer or layerId if the layer is not available yet.