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 shadowColor() const
Gets the shadow's color.
QColor wallColor() const
Gets the wall color.
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)
void setShadowSpread(double shadowSpread)
Set the shadow's spread distance in map units.
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.
QColor roofColor() const
Gets the roof color.
void setRoofColor(const QColor &roofColor)
Set the roof color.
bool wallShadingEnabled() const
Gets wall shading enabled.
void setShadowEnabled(bool value)
Enable or disable the shadow.
void setWallShadingEnabled(bool enabled)
Set wall shading enabled.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
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.
double shadowSpread() const
Gets the shadow's spread distance in map units.
bool shadowEnabled() const
Is the shadow enabled.