32 QGridLayout *layout =
new QGridLayout(
this );
33 QLabel *label =
new QLabel( tr(
"The 2.5D renderer only can be used with polygon layers. \n" 34 "'%1' is not a polygon layer and cannot be rendered in 2.5D." )
35 .arg( layer->
name() ),
this );
36 layout->addWidget( label );
41 this->layout()->setContentsMargins( 0, 0, 0, 0 );
43 mAngleWidget->setClearValue( 0 );
44 mWallColorButton->setColorDialogTitle( tr(
"Select Wall Color" ) );
45 mWallColorButton->setAllowOpacity(
true );
46 mWallColorButton->setContext( QStringLiteral(
"symbology" ) );
47 mRoofColorButton->setColorDialogTitle( tr(
"Select Roof Color" ) );
48 mRoofColorButton->setAllowOpacity(
true );
49 mRoofColorButton->setContext( QStringLiteral(
"symbology" ) );
50 mShadowColorButton->setColorDialogTitle( tr(
"Select Shadow Color" ) );
51 mShadowColorButton->setAllowOpacity(
true );
52 mShadowColorButton->setContext( QStringLiteral(
"symbology" ) );
59 mHeightWidget->setLayer( layer );
62 QVariant height = scope->
variable( QStringLiteral(
"qgis_25d_height" ) );
63 QVariant
angle = scope->
variable( QStringLiteral(
"qgis_25d_angle" ) );
66 mHeightWidget->setField( height.isNull() ? QStringLiteral(
"10" ) : height.toString() );
67 mAngleWidget->setValue( angle.isNull() ? 70 : angle.toDouble() );
68 mWallColorButton->setColor( mRenderer->
wallColor() );
69 mRoofColorButton->setColor( mRenderer->
roofColor() );
70 mShadowColorButton->setColor( mRenderer->
shadowColor() );
71 mShadowEnabledWidget->setChecked( mRenderer->
shadowEnabled() );
72 mShadowSizeWidget->setValue( mRenderer->
shadowSpread() );
75 connect( mAngleWidget, static_cast <
void ( QSpinBox::* )(
int ) > ( &QSpinBox::valueChanged ),
this, &Qgs25DRendererWidget::updateRenderer );
80 connect( mShadowEnabledWidget, &QGroupBox::toggled,
this, &Qgs25DRendererWidget::updateRenderer );
81 connect( mShadowSizeWidget, static_cast <
void ( QDoubleSpinBox::* )(
double ) > ( &QDoubleSpinBox::valueChanged ),
this, &Qgs25DRendererWidget::updateRenderer );
82 connect( mWallExpositionShading, &QAbstractButton::toggled,
this, &Qgs25DRendererWidget::updateRenderer );
90 void Qgs25DRendererWidget::updateRenderer()
101 void Qgs25DRendererWidget::apply()
QColor wallColor() const
Get the wall color.
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)
bool shadowEnabled() const
Is the shadow enabled.
void setShadowSpread(double shadowSpread)
Set the shadow's spread distance in map units.
QColor shadowColor() const
Get the shadow's color.
static Qgs25DRenderer * convertFromRenderer(QgsFeatureRenderer *renderer)
Try to convert from an existing renderer.
QVariant variable(const QString &name) const
Retrieves a variable's value from the scope.
Single scope for storing variables and functions for use within a QgsExpressionContext.
static void setLayerVariable(QgsMapLayer *layer, const QString &name, const QVariant &value)
Sets a layer context variable.
void setRoofColor(const QColor &roofColor)
Set the roof color.
bool wallShadingEnabled() const
Get wall shading enabled.
void setShadowEnabled(bool value)
Enable or disable the shadow.
void setWallShadingEnabled(bool enabled)
Set wall shading enabled.
QColor roofColor() const
Get the roof color.
double shadowSpread() const
Get the shadow's spread distance in map units.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Represents a vector layer which manages a vector based data sets.
void setShadowColor(const QColor &shadowColor)
Set the shadow's color.
void setWallColor(const QColor &wallColor)
Set the wall color.