34 QGridLayout *layout =
new QGridLayout(
this );
35 QLabel *label =
new QLabel( tr(
"The 2.5D renderer only can be used with polygon layers. \n"
36 "'%1' is not a polygon layer and cannot be rendered in 2.5D." )
37 .arg( layer->
name() ),
this );
38 layout->addWidget( label );
43 this->layout()->setContentsMargins( 0, 0, 0, 0 );
45 mAngleWidget->setClearValue( 0 );
46 mWallColorButton->setColorDialogTitle( tr(
"Select Wall Color" ) );
47 mWallColorButton->setAllowOpacity(
true );
48 mWallColorButton->setContext( QStringLiteral(
"symbology" ) );
49 mRoofColorButton->setColorDialogTitle( tr(
"Select Roof Color" ) );
50 mRoofColorButton->setAllowOpacity(
true );
51 mRoofColorButton->setContext( QStringLiteral(
"symbology" ) );
52 mShadowColorButton->setColorDialogTitle( tr(
"Select Shadow Color" ) );
53 mShadowColorButton->setAllowOpacity(
true );
54 mShadowColorButton->setContext( QStringLiteral(
"symbology" ) );
61 mHeightWidget->setLayer( layer );
64 const QVariant height = scope->
variable( QStringLiteral(
"qgis_25d_height" ) );
65 const QVariant
angle = scope->
variable( QStringLiteral(
"qgis_25d_angle" ) );
70 mAngleWidget->setClearValue( 70 );
71 mWallColorButton->setColor( mRenderer->wallColor() );
72 mRoofColorButton->setColor( mRenderer->roofColor() );
73 mShadowColorButton->setColor( mRenderer->shadowColor() );
74 mShadowEnabledWidget->setChecked( mRenderer->shadowEnabled() );
75 mShadowSizeWidget->setValue( mRenderer->shadowSpread() );
76 mShadowSizeWidget->setClearValue( 4 );
77 mWallExpositionShading->setChecked( mRenderer->wallShadingEnabled() );
79 connect( mAngleWidget,
static_cast < void ( QSpinBox::* )(
int )
> ( &QSpinBox::valueChanged ),
this, &Qgs25DRendererWidget::updateRenderer );
84 connect( mShadowEnabledWidget, &QGroupBox::toggled,
this, &Qgs25DRendererWidget::updateRenderer );
85 connect( mShadowSizeWidget,
static_cast < void ( QDoubleSpinBox::* )(
double )
> ( &QDoubleSpinBox::valueChanged ),
this, &Qgs25DRendererWidget::updateRenderer );
86 connect( mWallExpositionShading, &QAbstractButton::toggled,
this, &Qgs25DRendererWidget::updateRenderer );
93 return mRenderer.get();
96void Qgs25DRendererWidget::updateRenderer()
98 mRenderer->setRoofColor( mRoofColorButton->color() );
99 mRenderer->setWallColor( mWallColorButton->color() );
100 mRenderer->setShadowColor( mShadowColorButton->color() );
101 mRenderer->setShadowEnabled( mShadowEnabledWidget->isChecked() );
102 mRenderer->setShadowSpread( mShadowSizeWidget->value() );
103 mRenderer->setWallShadingEnabled( mWallExpositionShading->isChecked() );
107void Qgs25DRendererWidget::apply()
static Qgs25DRenderer * convertFromRenderer(QgsFeatureRenderer *renderer)
Try to convert from an existing renderer.
Single scope for storing variables and functions for use within a QgsExpressionContext.
QVariant variable(const QString &name) const
Retrieves a variable's value from the scope.
static void setLayerVariable(QgsMapLayer *layer, const QString &name, const QVariant &value)
Sets a layer context variable.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static bool isNull(const QVariant &variant)
Returns true if the specified variant should be considered a NULL value.
Represents a vector layer which manages a vector based data sets.
Q_INVOKABLE QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)