25 #define ROOF_EXPRESSION \ 28 " cos( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )," \ 29 " sin( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )" \ 32 #define WALL_EXPRESSION \ 35 " segments_to_lines( $geometry )," \ 36 " cos( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )," \ 37 " sin( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )" \ 39 " '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 ) ) ))'," \ 43 #define ORDER_BY_EXPRESSION \ 47 " @map_extent_center," \ 48 " 1000 * @map_extent_width * cos( radians( @qgis_25d_angle + 180 ) )," \ 49 " 1000 * @map_extent_width * sin( radians( @qgis_25d_angle + 180 ) )" \ 53 #define WALL_SHADING_EXPRESSION \ 57 " 40 + 19 * abs( $pi - azimuth( " \ 58 " point_n( geometry_n($geometry, @geometry_part_num) , 1 ), " \ 59 " point_n( geometry_n($geometry, @geometry_part_num) , 2 )" \ 68 mSymbol->deleteSymbolLayer( 0 );
73 wallProperties.insert( QStringLiteral(
"geometryModifier" ),
WALL_EXPRESSION );
74 wallProperties.insert( QStringLiteral(
"symbolType" ), QStringLiteral(
"Fill" ) );
78 roofProperties.insert( QStringLiteral(
"geometryModifier" ),
ROOF_EXPRESSION );
79 roofProperties.insert( QStringLiteral(
"symbolType" ), QStringLiteral(
"Fill" ) );
84 mSymbol->appendSymbolLayer( floor );
85 mSymbol->appendSymbolLayer( walls );
86 mSymbol->appendSymbolLayer( roof );
118 rendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"25dRenderer" ) );
122 rendererElem.appendChild( symbolElem );
131 QDomNodeList
symbols = element.elementsByTagName( QStringLiteral(
"symbol" ) );
132 if ( symbols.size() )
144 mSymbol->startRender( context, fields );
151 mSymbol->stopRender( context );
156 return mSymbol->usedAttributes( context );
162 c->mSymbol.reset( mSymbol->clone() );
170 return mSymbol.get();
177 lst.append( mSymbol.get() );
183 return static_cast<QgsFillSymbolLayer *
>( mSymbol->symbolLayer( 2 )->subSymbol()->symbolLayer( 0 ) );
188 return static_cast<QgsFillSymbolLayer *
>( mSymbol->symbolLayer( 1 )->subSymbol()->symbolLayer( 0 ) );
199 return glowEffect()->
enabled();
209 return glowEffect()->
color();
214 glowEffect()->
setColor( shadowColor );
219 return glowEffect()->
spread();
261 if ( renderer->
type() == QLatin1String(
"25dRenderer" ) )
The class is used as a container of context for various read/write operations on other objects...
void stopRender(QgsRenderContext &context) override
Must be called when a render cycle has finished, to allow the renderer to clean up.
QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context) override
store renderer info to XML element
void setLocked(bool locked)
void startRender(QgsRenderContext &context, const QgsFields &fields) override
Must be called when a new render cycle is started.
QColor wallColor() const
Gets the wall color.
QgsSymbolList symbols(QgsRenderContext &context) const override
Returns list of symbols used by the renderer.
QgsFeatureRequest::OrderBy orderBy() const
Gets the order in which features shall be processed by this renderer.
QgsFeatureRenderer * clone() const override
Create a deep copy of this renderer.
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
Container of fields for a vector layer.
#define RENDERER_TAG_NAME
#define WALL_SHADING_EXPRESSION
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
static QgsSymbol * loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
QMap< QString, QString > QgsStringMap
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
void setBlurLevel(const int level)
Sets blur level (strength) for the glow.
void setEnabled(bool enabled)
Sets whether the effect is enabled.
bool shadowEnabled() const
Is the shadow enabled.
QList< QgsSymbol * > QgsSymbolList
void setShadowSpread(double shadowSpread)
Set the shadow's spread distance in map units.
QColor shadowColor() const
Gets the shadow's color.
QgsPaintEffect * effect(int index) const
Returns a pointer to the effect at a specified index within the stack.
void setSpreadUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the glow spread distance.
void setActive(bool active)
Sets whether the property is currently active.
static Qgs25DRenderer * convertFromRenderer(QgsFeatureRenderer *renderer)
Try to convert from an existing renderer.
#define ORDER_BY_EXPRESSION
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides...
A paint effect which consists of a stack of other chained paint effects.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
bool enabled() const
Returns whether the effect is enabled.
void setSpread(const double spread)
Sets the spread distance for drawing the glow effect.
void appendEffect(QgsPaintEffect *effect)
Appends an effect to the end of the stack.
virtual void setStrokeColor(const QColor &color)
Set stroke color.
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
A paint effect which draws a glow outside of a picture.
The OrderByClause class represents an order by clause for a QgsFeatureRequest.
QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const override
To be overridden.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns a list of attributes required by this renderer.
Contains information about the context of a rendering operation.
virtual void setFillColor(const QColor &color)
Set fill color.
double spread() const
Returns the spread distance used for drawing the glow effect.
static QgsFeatureRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Create a new 2.5D renderer from XML.
static QgsSymbolLayer * create(const QgsStringMap &properties=QgsStringMap())
static QgsSymbolLayer * create(const QgsStringMap &properties)
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
void setRoofColor(const QColor &roofColor)
Set the roof color.
bool wallShadingEnabled() const
Gets wall shading enabled.
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
void setShadowEnabled(bool value)
Enable or disable the shadow.
void setWallShadingEnabled(bool enabled)
Set wall shading enabled.
static QDomElement saveSymbol(const QString &symbolName, QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
QColor roofColor() const
Gets the roof color.
double shadowSpread() const
Gets the shadow's spread distance in map units.
virtual QColor fillColor() const
Gets fill color.
void setShadowColor(const QColor &shadowColor)
Set the shadow's color.
void setColor(const QColor &color)
Sets the color for the glow.
void setWallColor(const QColor &wallColor)
Set the wall color.
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer...
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
bool isActive() const
Returns whether the property is currently active.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
Represents a list of OrderByClauses, with the most important first and the least important last...
QColor color() const
Returns the color for the glow.