18#ifndef QGSMESH3DAVERAGING_H
19#define QGSMESH3DAVERAGING_H
50 if ( averagingMethod )
52 switch ( averagingMethod->method() )
55 sipType = sipType_QgsMeshMultiLevelsAveragingMethod;
58 sipType = sipType_QgsMeshSigmaAveragingMethod;
61 sipType = sipType_QgsMeshRelativeHeightAveragingMethod;
64 sipType = sipType_QgsMeshElevationAveragingMethod;
99 virtual QDomElement
writeXml( QDomDocument &doc )
const = 0;
105 virtual void readXml(
const QDomElement &elem ) = 0;
121 virtual bool hasValidInputs()
const = 0;
126 void averageVolumeValuesForFace(
128 int volumesBelowFaceCount,
129 int startVolumeIndex,
130 double methodLevelTop,
131 double methodLevelBottom,
133 const QVector<double> &verticalLevelsForFace,
134 const QVector<double> &volumeValues,
135 QVector<double> &valuesFaces
141 virtual void volumeRangeForFace(
142 double &startVerticalLevel,
143 double &endVerticalLevel,
144 int &singleVerticalLevel,
145 const QVector<double> &verticalLevels )
const = 0;
184 QDomElement
writeXml( QDomDocument &doc )
const override;
185 void readXml(
const QDomElement &elem )
override;
220 bool hasValidInputs() const override;
223 int &singleVerticalIndex,
224 const QVector<
double> &verticalLevels ) const override;
226 int mStartVerticalLevel = 1;
227 int mEndVerticalLevel = 1;
228 bool mCountedFromTop = true;
255 QDomElement
writeXml( QDomDocument &doc )
const override;
256 void readXml(
const QDomElement &elem )
override;
277 bool hasValidInputs() const override;
278 void volumeRangeForFace(
double &startVerticalLevel,
279 double &endVerticalLevel,
280 int &singleVerticalIndex,
281 const QVector<
double> &verticalLevels ) const override;
283 double mStartFraction = 0;
284 double mEndFraction = 1;
321 QDomElement
writeXml( QDomDocument &doc )
const override;
322 void readXml(
const QDomElement &elem )
override;
346 bool hasValidInputs() const override;
347 void volumeRangeForFace(
double &startVerticalLevel,
348 double &endVerticalLevel,
349 int &singleVerticalIndex,
350 const QVector<
double> &verticalLevels ) const override;
351 double mStartHeight = 0;
352 double mEndHeight = 0;
353 bool mCountedFromTop = true;
382 QDomElement
writeXml( QDomDocument &doc )
const override;
383 void readXml(
const QDomElement &elem )
override;
398 bool hasValidInputs() const override;
399 void volumeRangeForFace(
double &startVerticalLevel,
400 double &endVerticalLevel,
401 int &singleVerticalIndex,
402 const QVector<
double> &verticalLevels ) const override;
403 double mStartElevation = 0;
404 double mEndElevation = 0;
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Abstract class for interpolating 3d stacked mesh data to 2d data.
static QgsMesh3DAveragingMethod * createFromXml(const QDomElement &elem)
Creates the instance from XML by calling readXml of derived classes.
static bool equals(const QgsMesh3DAveragingMethod *a, const QgsMesh3DAveragingMethod *b)
Returns whether two methods equal.
QgsMeshDataBlock calculate(const QgsMesh3DDataBlock &block3d, QgsFeedback *feedback=nullptr) const
Calculated 2d block values from 3d stacked mesh values.
virtual void readXml(const QDomElement &elem)=0
Reads configuration from the given DOM element.
Method method() const
Returns type of averaging method.
virtual bool equals(const QgsMesh3DAveragingMethod *other) const =0
Returns whether method equals to other.
Method
Type of averaging method.
@ RelativeHeightAveragingMethod
Method to average values defined by range of relative length units to the surface or bed level.
@ MultiLevelsAveragingMethod
Method to average values from selected vertical layers.
@ ElevationAveragingMethod
Method to average values defined by range of absolute length units to the model's datum.
@ SigmaAveragingMethod
Method to average values between 0 (bed level) and 1 (surface).
QgsMesh3DAveragingMethod(Method method)
Ctor.
virtual ~QgsMesh3DAveragingMethod()=default
virtual QDomElement writeXml(QDomDocument &doc) const =0
Writes configuration to a new DOM element.
virtual QgsMesh3DAveragingMethod * clone() const =0
Clone the instance.
A block of 3d stacked mesh data related N faces defined on base mesh frame.
A block of integers/doubles from a mesh dataset.
An index that identifies the dataset group (e.g.
double startElevation() const
Returns start elevation.
QgsMeshElevationAveragingMethod()
~QgsMeshElevationAveragingMethod() override
void readXml(const QDomElement &elem) override
Reads configuration from the given DOM element.
double endElevation() const
Returns end elevation.
QgsMesh3DAveragingMethod * clone() const override
Clone the instance.
QDomElement writeXml(QDomDocument &doc) const override
Writes configuration to a new DOM element.
bool equals(const QgsMesh3DAveragingMethod *other) const override
Returns whether method equals to other.
Represents a mesh layer supporting display of data on structured or unstructured meshes.
QDomElement writeXml(QDomDocument &doc) const override
Writes configuration to a new DOM element.
QgsMeshMultiLevelsAveragingMethod()
Constructs single level averaging method for 1st (top) vertical level.
~QgsMeshMultiLevelsAveragingMethod() override
int endVerticalLevel() const
Returns ending vertical level.
bool equals(const QgsMesh3DAveragingMethod *other) const override
Returns whether method equals to other.
QgsMesh3DAveragingMethod * clone() const override
Clone the instance.
bool countedFromTop() const
Returns whether the start and end vertical levels are indexed from top (surface) or bottom (bed) leve...
bool isSingleLevel() const
Returns whether the averaging method selects only a single vertical level.
void readXml(const QDomElement &elem) override
Reads configuration from the given DOM element.
int startVerticalLevel() const
Returns starting vertical level.
void readXml(const QDomElement &elem) override
Reads configuration from the given DOM element.
double startHeight() const
Returns starting depth/height.
~QgsMeshRelativeHeightAveragingMethod() override
QgsMeshRelativeHeightAveragingMethod()
Constructs default depth averaging method.
bool countedFromTop() const
Returns whether the start and end vertical levels are relative to top (surface) or bottom (bed) level...
bool equals(const QgsMesh3DAveragingMethod *other) const override
Returns whether method equals to other.
QDomElement writeXml(QDomDocument &doc) const override
Writes configuration to a new DOM element.
double endHeight() const
Returns ending depth/height.
QgsMesh3DAveragingMethod * clone() const override
Clone the instance.
double endFraction() const
Returns ending fraction.
QgsMeshSigmaAveragingMethod()
Constructs the sigma method for whole value range 0-1.
void readXml(const QDomElement &elem) override
Reads configuration from the given DOM element.
bool equals(const QgsMesh3DAveragingMethod *other) const override
Returns whether method equals to other.
QDomElement writeXml(QDomDocument &doc) const override
Writes configuration to a new DOM element.
QgsMesh3DAveragingMethod * clone() const override
Clone the instance.
~QgsMeshSigmaAveragingMethod() override
double startFraction() const
Returns starting fraction.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)