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;
78 virtual void resolveReferences(
const QgsProject *project );
95 virtual QString
type()
const = 0;
122 virtual double heightAt(
double x,
double y )
const = 0;
130 double scale()
const {
return mScale; }
146 double offset()
const {
return mOffset; }
167 void writeCommonProperties( QDomElement &element,
const QgsReadWriteContext &context )
const;
172 void readCommonProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
178 double mOffset = 0.0;
201 QString type()
const override;
203 QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const override;
205 double heightAt(
double x,
double y )
const override;
207 void prepare() override;
227 QString type()
const override;
228 void resolveReferences(
const QgsProject *project )
override;
230 QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const override;
232 double heightAt(
double x,
double y )
const override;
235 void prepare() override;
277 QString type()
const override;
278 void resolveReferences(
const QgsProject *project )
override;
280 QDomElement writeXml( QDomDocument &document,
const QgsReadWriteContext &context )
const override;
282 double heightAt(
double x,
double y )
const override;
285 void prepare() override;
Abstract base class for terrain providers.
QgsAbstractTerrainProvider & operator=(const QgsAbstractTerrainProvider &other)=delete
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
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
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
const QgsMeshTerrainProvider * operator=(const QgsMeshTerrainProvider &other)=delete
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()=default
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.