QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
28 #define ROOF_EXPRESSION \
31 " cos( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )," \
32 " sin( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )" \
35 #define WALL_EXPRESSION \
38 " segments_to_lines( $geometry )," \
39 " cos( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )," \
40 " sin( radians( eval( @qgis_25d_angle ) ) ) * eval( @qgis_25d_height )" \
42 " '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 ) ) ))'," \
46 #define ORDER_BY_EXPRESSION \
50 " @map_extent_center," \
51 " 1000 * @map_extent_width * cos( radians( @qgis_25d_angle + 180 ) )," \
52 " 1000 * @map_extent_width * sin( radians( @qgis_25d_angle + 180 ) )" \
56 #define WALL_SHADING_EXPRESSION \
60 " 40 + 19 * abs( $pi - azimuth( " \
61 " point_n( geometry_n($geometry, @geometry_part_num) , 1 ), " \
62 " point_n( geometry_n($geometry, @geometry_part_num) , 2 )" \
71 mSymbol->deleteSymbolLayer( 0 );
75 QVariantMap wallProperties;
76 wallProperties.insert( QStringLiteral(
"geometryModifier" ),
WALL_EXPRESSION );
77 wallProperties.insert( QStringLiteral(
"symbolType" ), QStringLiteral(
"Fill" ) );
80 QVariantMap roofProperties;
81 roofProperties.insert( QStringLiteral(
"geometryModifier" ),
ROOF_EXPRESSION );
82 roofProperties.insert( QStringLiteral(
"symbolType" ), QStringLiteral(
"Fill" ) );
87 mSymbol->appendSymbolLayer( floor );
88 mSymbol->appendSymbolLayer( walls );
89 mSymbol->appendSymbolLayer( roof );
121 rendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"25dRenderer" ) );
127 rendererElem.appendChild( symbolElem );
136 const QDomNodeList
symbols = element.elementsByTagName( QStringLiteral(
"symbol" ) );
149 mSymbol->startRender( context, fields );
156 mSymbol->stopRender( context );
161 return mSymbol->usedAttributes( context );
167 c->mSymbol.reset( mSymbol->clone() );
175 return mSymbol.get();
182 lst.append( mSymbol.get() );
198 return static_cast<QgsFillSymbolLayer *
>( mSymbol->symbolLayer( 2 )->subSymbol()->symbolLayer( 0 ) );
203 return static_cast<QgsFillSymbolLayer *
>( mSymbol->symbolLayer( 1 )->subSymbol()->symbolLayer( 0 ) );
214 return glowEffect()->
enabled();
224 return glowEffect()->
color();
234 return glowEffect()->
spread();
276 if ( renderer->
type() == QLatin1String(
"25dRenderer" ) )
282 std::unique_ptr< Qgs25DRenderer > res = std::make_unique< Qgs25DRenderer >();
284 return res.release();
#define ORDER_BY_EXPRESSION
void copyRendererData(QgsFeatureRenderer *destRenderer) const
Clones generic renderer data to another renderer.
bool isActive() const
Returns whether the property is currently active.
The OrderByClause class represents an order by clause for a QgsFeatureRequest.
QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const override
To be overridden.
static QgsSymbolLayer * create(const QVariantMap &properties=QVariantMap())
Creates a new QgsSimpleFillSymbolLayer using the specified properties map containing symbol propertie...
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
The class is used as a container of context for various read/write operations on other objects.
void setOrderByEnabled(bool enabled)
Sets whether custom ordering should be applied before features are processed by this renderer.
virtual void setFillColor(const QColor &color)
Sets the fill color for the symbol layer.
QSet< QString > usedAttributes(const QgsRenderContext &context) const override
Returns a list of attributes required by this renderer.
A symbol entity for QgsStyle databases.
QColor color() const
Returns the color for the glow.
void setShadowSpread(double shadowSpread) const
Set the shadow's spread distance in map units.
@ PropertyFillColor
Fill color.
void setBlurLevel(const double level)
Sets blur level (radius) for the glow.
Container of fields for a vector layer.
Contains information about the context of a rendering operation.
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
QColor roofColor() const
Gets the roof color.
double shadowSpread() const
Gets the shadow's spread distance in map units.
Abstract base class for all rendered symbols.
static QgsProperty fromExpression(const QString &expression, bool isActive=true)
Returns a new ExpressionBasedProperty created from the specified expression.
void setWallShadingEnabled(bool enabled) const
Set wall shading enabled.
Contains information relating to the style entity currently being visited.
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
void setActive(bool active)
Sets whether the property is currently active.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
QgsFeatureRequest::OrderBy orderBy() const
Gets the order in which features shall be processed by this renderer.
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.
void setRoofColor(const QColor &roofColor) const
Set the roof color.
QList< QgsSymbol * > QgsSymbolList
bool shadowEnabled() const
Is the shadow enabled.
void saveRendererData(QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context)
Saves generic renderer data into the specified element.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
QgsPaintEffect * effect(int index) const
Returns a pointer to the effect at a specified index within the stack.
bool wallShadingEnabled() const
Gets wall shading enabled.
void setSpreadUnit(const QgsUnitTypes::RenderUnit unit)
Sets the units used for the glow spread distance.
static QgsFeatureRenderer * create(QDomElement &element, const QgsReadWriteContext &context)
Create a new 2.5D renderer from XML.
static QgsSymbolLayer * create(const QVariantMap &properties)
Creates the symbol layer.
#define RENDERER_TAG_NAME
QgsSymbolList symbols(QgsRenderContext &context) const override
Returns list of symbols used by the renderer.
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
static QgsSymbol * loadSymbol(const QDomElement &element, const QgsReadWriteContext &context)
Attempts to load a symbol from a DOM element.
void setColor(const QColor &color)
Sets the color for the glow.
void setEnabled(bool enabled)
Sets whether the effect is enabled.
void setSpread(const double spread)
Sets the spread distance for drawing the glow effect.
QColor wallColor() const
Gets the wall color.
static Qgs25DRenderer * convertFromRenderer(QgsFeatureRenderer *renderer)
Try to convert from an existing renderer.
#define WALL_SHADING_EXPRESSION
bool accept(QgsStyleEntityVisitorInterface *visitor) const override
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
Represents a list of OrderByClauses, with the most important first and the least important last.
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 appendEffect(QgsPaintEffect *effect)
Appends an effect to the end of the stack.
virtual void setStrokeColor(const QColor &color)
Sets the stroke color for the symbol layer.
A paint effect which draws a glow outside of a picture.
void startRender(QgsRenderContext &context, const QgsFields &fields) override
Must be called when a new render cycle is started.
A fill symbol type, for rendering Polygon and MultiPolygon geometries.
void setLocked(bool locked)
Sets whether the layer's colors are locked.
virtual bool visit(const QgsStyleEntityVisitorInterface::StyleLeaf &entity)
Called when the visitor will visit a style entity.
void setOrderBy(const QgsFeatureRequest::OrderBy &orderBy)
Define the order in which features shall be processed by this renderer.
virtual QColor fillColor() const
Returns the fill color for the symbol layer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
QgsFeatureRenderer * clone() const override
Create a deep copy of this renderer.
bool enabled() const
Returns whether the effect is enabled.
QColor shadowColor() const
Gets the shadow's color.
void setShadowEnabled(bool value) const
Enable or disable the shadow.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
void setShadowColor(const QColor &shadowColor) const
Set the shadow's color.
static QDomElement saveSymbol(const QString &symbolName, const QgsSymbol *symbol, QDomDocument &doc, const QgsReadWriteContext &context)
Writes a symbol definition to XML.
@ RenderMapUnits
Map units.
double spread() const
Returns the spread distance used for drawing the glow effect.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
void stopRender(QgsRenderContext &context) override
Must be called when a render cycle has finished, to allow the renderer to clean up.
A paint effect which consists of a stack of other chained paint effects.