30#define ROOF_EXPRESSION \
33 " cos( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )," \
34 " sin( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )" \
37#define WALL_EXPRESSION \
40 " segments_to_lines( @geometry )," \
41 " cos( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )," \
42 " sin( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )" \
44 " 'distance( @geometry, translate( @map_extent_center, 1000 * @map_extent_width * cos( radians( @qgis_25d_angle + 180 ) ), 1000 * @map_extent_width * sin( radians( @qgis_25d_angle + 180 ) ) ))'," \
48#define ORDER_BY_EXPRESSION \
52 " @map_extent_center," \
53 " 1000 * @map_extent_width * cos( radians( @qgis_25d_angle + 180 ) )," \
54 " 1000 * @map_extent_width * sin( radians( @qgis_25d_angle + 180 ) )" \
58#define WALL_SHADING_EXPRESSION \
62 " 40 + 19 * abs( $pi - azimuth( " \
63 " point_n( geometry_n(@geometry, @geometry_part_num) , 1 ), " \
64 " point_n( geometry_n(@geometry, @geometry_part_num) , 2 )" \
71 mSymbol = std::make_unique<QgsFillSymbol>( );
73 mSymbol->deleteSymbolLayer( 0 );
77 QVariantMap wallProperties;
78 wallProperties.insert( QStringLiteral(
"geometryModifier" ),
WALL_EXPRESSION );
79 wallProperties.insert( QStringLiteral(
"symbolType" ), QStringLiteral(
"Fill" ) );
82 QVariantMap roofProperties;
83 roofProperties.insert( QStringLiteral(
"geometryModifier" ),
ROOF_EXPRESSION );
84 roofProperties.insert( QStringLiteral(
"symbolType" ), QStringLiteral(
"Fill" ) );
89 mSymbol->appendSymbolLayer( floor );
90 mSymbol->appendSymbolLayer( walls );
91 mSymbol->appendSymbolLayer( roof );
95 glowEffect->setBlurLevel( 5 );
123 rendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"25dRenderer" ) );
129 rendererElem.appendChild( symbolElem );
147 const QDomNodeList
symbols = element.elementsByTagName( QStringLiteral(
"symbol" ) );
160 mSymbol->startRender( context, fields );
167 mSymbol->stopRender( context );
172 return mSymbol->usedAttributes( context );
178 c->mSymbol.reset( mSymbol->clone() );
186 return mSymbol.get();
193 lst.append( mSymbol.get() );
209 return static_cast<QgsFillSymbolLayer *
>( mSymbol->symbolLayer( 2 )->subSymbol()->symbolLayer( 0 ) );
214 return static_cast<QgsFillSymbolLayer *
>( mSymbol->symbolLayer( 1 )->subSymbol()->symbolLayer( 0 ) );
219 QgsEffectStack *stack =
static_cast<QgsEffectStack *
>( mSymbol->symbolLayer( 0 )->
paintEffect() );
220 return static_cast<QgsOuterGlowEffect *
>( stack->
effect( 0 ) );
225 return glowEffect()->
enabled();
230 glowEffect()->setEnabled( value );
235 return glowEffect()->color();
245 return glowEffect()->spread();
250 glowEffect()->setSpread( spread );
255 return wallLayer()->fillColor();
261 wallLayer()->setStrokeColor(
wallColor );
276 return roofLayer()->fillColor();
282 roofLayer()->setStrokeColor(
roofColor );
287 if ( renderer->
type() == QLatin1String(
"25dRenderer" ) )
293 auto res = std::make_unique< Qgs25DRenderer >();
295 return res.release();
QFlags< FeatureRendererFlag > FeatureRendererFlags
Flags controlling behavior of vector feature renderers.
@ AffectsLabeling
If present, indicates that the renderer will participate in the map labeling problem.
@ AffectsLabeling
If present, indicates that the symbol will participate in the map labeling problem.
Qgis::FeatureRendererFlags flags() const override
Returns flags associated with the renderer.
QgsSymbolList symbols(QgsRenderContext &context) const override
Returns list of symbols used by the renderer.
QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const override
To be overridden.
void stopRender(QgsRenderContext &context) override
Must be called when a render cycle has finished, to allow the renderer to clean up.
void setShadowSpread(double shadowSpread) const
Set the shadow's spread distance in map units.
QColor roofColor() const
Gets the roof color.
void setWallShadingEnabled(bool enabled) const
Set wall shading enabled.
QColor shadowColor() const
Gets the shadow's color.
QgsFeatureRenderer * clone() const override
Create a deep copy of this renderer.
static Qgs25DRenderer * convertFromRenderer(QgsFeatureRenderer *renderer)
Try to convert from an existing renderer.
double shadowSpread() const
Gets the shadow's spread distance in map units.
void startRender(QgsRenderContext &context, const QgsFields &fields) override
Must be called when a new render cycle is started.
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
static QgsFeatureRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Create a new 2.5D renderer from XML.
void setShadowColor(const QColor &shadowColor) const
Set the shadow's color.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns a list of attributes required by this renderer.
bool wallShadingEnabled() const
Gets wall shading enabled.
bool shadowEnabled() const
Is the shadow enabled.
void setRoofColor(const QColor &roofColor) const
Set the roof color.
QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) override
Stores renderer properties to an XML element.
void setWallColor(const QColor &wallColor) const
Set the wall color.
QColor wallColor() const
Gets the wall color.
void setShadowEnabled(bool value) const
Enable or disable the shadow.
A paint effect which consists of a stack of other chained paint effects.
void appendEffect(QgsPaintEffect *effect)
Appends an effect to the end of the stack.
QgsPaintEffect * effect(int index) const
Returns a pointer to the effect at a specified index within the stack.
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the renderer.
QgsFeatureRenderer(const QString &type)
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another renderer.
void saveRendererData(QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context)
Saves generic renderer data into the specified element.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
QgsFeatureRequest::OrderBy orderBy() const
Gets the order in which features shall be processed by this renderer.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
The OrderByClause class represents an order by clause for a QgsFeatureRequest.
Represents a list of OrderByClauses, with the most important first and the least important last.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
Abstract base class for fill symbol layers.
static QgsSymbolLayer * create(const QVariantMap &properties)
Creates the symbol layer.
A paint effect which draws a glow outside of a picture.
bool enabled() const
Returns whether the effect is enabled.
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleFillSymbolLayer using the specified properties map containing symbol propertie...
An interface for classes which can visit style entity (e.g.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
A symbol entity for QgsStyle databases.
static std::unique_ptr< QgsSymbol > loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
Abstract base class for symbol layers.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
void setLocked(bool locked)
Sets whether the layer's colors are locked.
Abstract base class for all rendered symbols.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define WALL_SHADING_EXPRESSION
#define ORDER_BY_EXPRESSION
#define RENDERER_TAG_NAME
QList< QgsSymbol * > QgsSymbolList
Contains information relating to the style entity currently being visited.