Class: QgsRuleBased3DRenderer

class qgis.3d.QgsRuleBased3DRenderer(root: QgsRuleBased3DRenderer.Rule)

Bases: qgis._3d.QgsAbstractVectorLayer3DRenderer

Construct renderer with the given root rule (takes ownership)

Rule-based 3D renderer.

Similar to rule-based 2D renderer and rule-based labeling, it allows specification of rules for 3D symbols.

Warning

This is not considered stable API, and may change in future QGIS releases. It is exposed to the Python bindings as a tech preview only.

New in version 3.6.

Parameters

root

class Rule(symbol: QgsAbstract3DSymbol, filterExp: str = '', description: str = '', elseRule: bool = False)

Bases: sip.wrapper

takes ownership of symbol, symbol may be None

New in version 3.6.

Parameters
  • symbol (QgsAbstract3DSymbol) –

  • filterExp (str = '') –

  • description (str = '') –

  • elseRule (bool = False) –

Filtered = 0
Inactive = 1
class RegisterResult

Bases: int

Registered = 2
active(self) → bool

Returns if this rule is active

Return type

bool

Returns

True if the rule is active

appendChild(self, rule: QgsRuleBased3DRenderer.Rule)

add child rule, take ownership, sets this as parent

Parameters

rule (QgsRuleBased3DRenderer.Rule) –

children(self) → List[QgsRuleBased3DRenderer.Rule]

Returns all children rules of this rule

Return type

List[QgsRuleBased3DRenderer.Rule]

Returns

A list of rules

clone(self) → QgsRuleBased3DRenderer.Rule

clone this rule, return new instance

Return type

QgsRuleBased3DRenderer.Rule

create(ruleElem: QDomElement, context: QgsReadWriteContext) → QgsRuleBased3DRenderer.Rule

Create a rule from an XML definition

Parameters
  • ruleElem (QDomElement) – The XML rule element

  • context (QgsReadWriteContext) – reading context

Return type

QgsRuleBased3DRenderer.Rule

Returns

A new rule

descendants(self) → List[QgsRuleBased3DRenderer.Rule]

Returns all children, grand-children, grand-grand-children, grand-gra… you get it

Return type

List[QgsRuleBased3DRenderer.Rule]

Returns

A list of descendant rules

description(self) → str

A human readable description for this rule

Return type

str

Returns

Description

filterExpression(self) → str

A filter that will check if this rule applies

Return type

str

Returns

An expression

findRuleByKey(self, key: str) → QgsRuleBased3DRenderer.Rule

Try to find a rule given its unique key

Parameters

key (str) –

Return type

QgsRuleBased3DRenderer.Rule

insertChild(self, i: int, rule: QgsRuleBased3DRenderer.Rule)

add child rule, take ownership, sets this as parent

Parameters
isElse(self) → bool

Check if this rule is an ELSE rule

Return type

bool

Returns

True if this rule is an else rule

parent(self) → QgsRuleBased3DRenderer.Rule

The parent rule

Return type

QgsRuleBased3DRenderer.Rule

Returns

Parent rule

removeChildAt(self, i: int)

delete child rule

Parameters

i (int) –

ruleKey(self) → str

Unique rule identifier (for identification of rule within labeling, used as provider ID)

Return type

str

save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement

store labeling info to XML element

Parameters
Return type

QDomElement

setActive(self, state: bool)

Sets if this rule is active

Parameters

state (bool) – Determines if the rule should be activated or deactivated

setDescription(self, description: str)

Set a human readable description for this rule

Parameters

description (str) – Description

setFilterExpression(self, filterExp: str)

Set the expression used to check if a given feature shall be rendered with this rule

Parameters

filterExp (str) – An expression

setIsElse(self, iselse: bool)

Sets if this rule is an ELSE rule

Parameters

iselse (bool) – If True, this rule is an ELSE rule

setRuleKey(self, key: str)

Override the assigned rule key (should be used just internally by rule-based renderer)

Parameters

key (str) –

setSymbol(self, symbol: QgsAbstract3DSymbol)

Sets new symbol (or None). Deletes old symbol if any.

Parameters

symbol (QgsAbstract3DSymbol) –

symbol(self) → QgsAbstract3DSymbol

Returns the labeling settings. May return None.

Return type

QgsAbstract3DSymbol

clone(self) → QgsRuleBased3DRenderer
Return type

QgsRuleBased3DRenderer

copyBaseProperties()
readXml(self, elem: QDomElement, context: QgsReadWriteContext)
Parameters
readXmlBaseProperties()
rootRule(self) → QgsRuleBased3DRenderer.Rule

Returns pointer to the root rule

Return type

QgsRuleBased3DRenderer.Rule

type(self) → str
Return type

str

writeXml(self, elem: QDomElement, context: QgsReadWriteContext)
Parameters
writeXmlBaseProperties()