17#include <QSvgRenderer> 
   22#include "moc_qgsmeshrenderer3daveragingwidget.cpp" 
   40  connect( mAveragingMethodComboBox, qOverload<int>( &QComboBox::currentIndexChanged ), 
this, &QgsMeshRenderer3DAveragingWidget::onAveragingMethodChanged );
 
 
   84  std::unique_ptr<QgsMesh3DAveragingMethod> averaging;
 
   86  switch ( mAveragingMethodComboBox->currentIndex() )
 
   90      const int verticalLevel = mSingleVerticalLayerIndexTopSpinBox->value();
 
   96      const int verticalLevel = mSingleVerticalLayerIndexBottomSpinBox->value();
 
  102      const int startVerticalLevel = mMultiTopVerticalLayerStartIndexSpinBox->value();
 
  103      const int endVerticalLevel = mMultiTopVerticalLayerEndIndexSpinBox->value();
 
  109      const int startVerticalLevel = mMultiBottomVerticalLayerStartIndexSpinBox->value();
 
  110      const int endVerticalLevel = mMultiBottomVerticalLayerEndIndexSpinBox->value();
 
  116      const double startFraction = mSigmaStartFractionSpinBox->value();
 
  117      const double endFraction = mSigmaEndFractionSpinBox->value();
 
  123      const double startDepth = mDepthStartSpinBox->value();
 
  124      const double endDepth = mDepthEndSpinBox->value();
 
  130      const double startHeight = mHeightStartSpinBox->value();
 
  131      const double endHeight = mHeightEndSpinBox->value();
 
  137      const double startVerticalLevel = mElevationStartSpinBox->value();
 
  138      const double endVerticalLevel = mElevationEndSpinBox->value();
 
 
  231    whileBlocking( mAveragingMethodComboBox )->setCurrentIndex( pageIndex );
 
  232    whileBlocking( mAveragingMethodStackedWidget )->setCurrentIndex( pageIndex );
 
 
  236void QgsMeshRenderer3DAveragingWidget::onAveragingMethodChanged( 
int methodIndex )
 
  238  whileBlocking( mAveragingMethodStackedWidget )->setCurrentIndex( methodIndex );
 
  242void QgsMeshRenderer3DAveragingWidget::updateGraphics()
 
  244  setLabelSvg( mSingleTopPngLabel, QStringLiteral( 
"SingleTop.svg" ) );
 
  245  mSingleTopGroup->adjustSize();
 
  247  setLabelSvg( mSingleBottomPngLabel, QStringLiteral( 
"SingleBottom.svg" ) );
 
  248  setLabelSvg( mMultiTopPngLabel, QStringLiteral( 
"MultiTop.svg" ) );
 
  249  setLabelSvg( mMultiBottomPngLabel, QStringLiteral( 
"MultiBottom.svg" ) );
 
  250  setLabelSvg( mSigmaPngLabel, QStringLiteral( 
"Sigma.svg" ) );
 
  251  setLabelSvg( mDepthPngLabel, QStringLiteral( 
"Depth.svg" ) );
 
  252  setLabelSvg( mHeightPngLabel, QStringLiteral( 
"Height.svg" ) );
 
  253  setLabelSvg( mElevationPngLabel, QStringLiteral( 
"Elevation.svg" ) );
 
  256void QgsMeshRenderer3DAveragingWidget::setLabelSvg( QLabel *imageLabel, 
const QString &imgName )
 
  258  const qreal dpi = mScreenHelper->
screenDpi();
 
  259  const int desiredWidth = 
static_cast<int>( 100 * dpi / 25.4 );
 
  261  QSvgRenderer renderer( QStringLiteral( 
":/images/themes/default/mesh/%1" ).arg( imgName ) );
 
  262  if ( renderer.isValid() )
 
  264    const QSize defaultSvgSize = renderer.defaultSize();
 
  265    const int desiredHeight = defaultSvgSize.height() * desiredWidth / defaultSvgSize.width();
 
  267    QPixmap pixmap( QSize( desiredWidth, desiredHeight ) );
 
  268    pixmap.fill( Qt::transparent );
 
  271    painter.begin( &pixmap );
 
  272    renderer.render( &painter );
 
  274    imageLabel->setPixmap( pixmap );
 
Abstract class to interpolate 3d stacked mesh data to 2d data.
 
Method method() const
Returns type of averaging method.
 
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)
 
Elevation averaging method averages the values based on range defined absolute value to the model's d...
 
double startElevation() const
Returns start elevation.
 
double endElevation() const
Returns end elevation.
 
Represents a mesh layer supporting display of data on structured or unstructured meshes.
 
QgsMeshRendererSettings rendererSettings() const
Returns renderer settings.
 
Multi level averaging method specifies limits of vertical layers from the top layer down or reversed.
 
Relative height averaging method averages the values based on range defined relative to bed elevation...
 
Represents all mesh renderer settings.
 
QgsMesh3DAveragingMethod * averagingMethod() const
Returns averaging method for conversion of 3d stacked mesh data to 2d data.
 
Sigma averages over the values between 0 (bed level) and 1 (surface).
 
double endFraction() const
Returns ending fraction.
 
double startFraction() const
Returns starting fraction.
 
A utility class for dynamic handling of changes to screen properties.
 
double screenDpi() const
Returns the current screen DPI for the screen that the parent widget appears on.
 
void screenDpiChanged(double dpi)
Emitted whenever the screen dpi associated with the widget is changed.
 
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.