QGIS API Documentation 4.3.0-Master (52aa6503bed)
Loading...
Searching...
No Matches
Qgs3DSymbolUtils Class Reference

Miscellaneous utility functions used in 3D code for symbols. More...

#include <qgs3dsymbolutils.h>

Static Public Member Functions

static bool copyVectorSymbolMaterial (const QgsAbstract3DSymbol *fromSymbol, QgsAbstract3DSymbol *toSymbol)
 Copies the material properties of a vector 3D symbol from one symbol to another.
static std::unique_ptr< QgsAbstract3DSymbol > create3DSymbolFrom2D (const QgsVectorLayer *vLayer, const QgsSymbol *symbol2D)
 Creates a 3D symbol from a 2D symbol.
static bool setVectorSymbolBaseColor (QgsAbstract3DSymbol *symbol, const QColor &baseColor)
 Sets the base color of the material settings associated with a 3D vector symbol.
static QColor vectorSymbolAverageColor (const QgsAbstract3DSymbol *symbol)
 Computes an approximate color from a 3D vector symbol.
static QIcon vectorSymbolPreviewIcon (const QgsAbstract3DSymbol *symbol, const QSize &size, const QgsScreenProperties &screen, int padding)
 Returns an icon preview for a 3D vector symbol.

Detailed Description

Miscellaneous utility functions used in 3D code for symbols.

Note
Not available in Python bindings
Since
QGIS 4.2

Definition at line 37 of file qgs3dsymbolutils.h.

Member Function Documentation

◆ copyVectorSymbolMaterial()

bool Qgs3DSymbolUtils::copyVectorSymbolMaterial ( const QgsAbstract3DSymbol * fromSymbol,
QgsAbstract3DSymbol * toSymbol )
static

Copies the material properties of a vector 3D symbol from one symbol to another.

Parameters
fromSymbolSource 3D symbol from which the material properties are copied.
toSymbolDestination 3D symbol to which the material properties are applied.
Returns
true if the material properties were successfully copied, false otherwise.

Definition at line 306 of file qgs3dsymbolutils.cpp.

◆ create3DSymbolFrom2D()

std::unique_ptr< QgsAbstract3DSymbol > Qgs3DSymbolUtils::create3DSymbolFrom2D ( const QgsVectorLayer * vLayer,
const QgsSymbol * symbol2D )
static

Creates a 3D symbol from a 2D symbol.

The generated 3D symbol attempts to preserve the common visual properties of the input 2D symbol:

  • base color
  • opacity
  • marker size and basic marker shapes for point layers
  • line width for line layers
  • polygon edge settings for polygon layers
Parameters
vLayerthe vector layer
symbol2Dthe input 2D symbol
Returns
a 3D symbol, or nullptr if creation failed
Since
QGIS 4.4

Definition at line 323 of file qgs3dsymbolutils.cpp.

◆ setVectorSymbolBaseColor()

bool Qgs3DSymbolUtils::setVectorSymbolBaseColor ( QgsAbstract3DSymbol * symbol,
const QColor & baseColor )
static

Sets the base color of the material settings associated with a 3D vector symbol.

Parameters
symbol3D symbol whose material settings will be modified.
baseColorBase color to apply to the symbol's material settings.
Returns
true if the material's base color was successfully set, false otherwise.

Definition at line 284 of file qgs3dsymbolutils.cpp.

◆ vectorSymbolAverageColor()

QColor Qgs3DSymbolUtils::vectorSymbolAverageColor ( const QgsAbstract3DSymbol * symbol)
static

Computes an approximate color from a 3D vector symbol.

Extracts a representative color from the symbol's material settings, accounting for its specific shading model (Phong, Gooch, etc.).

Parameters
symbolThe 3D symbol to extract the color from.
Returns
A QColor representing the symbol's average appearance, or a default color if the symbol type is not supported.

Definition at line 91 of file qgs3dsymbolutils.cpp.

◆ vectorSymbolPreviewIcon()

QIcon Qgs3DSymbolUtils::vectorSymbolPreviewIcon ( const QgsAbstract3DSymbol * symbol,
const QSize & size,
const QgsScreenProperties & screen,
int padding )
static

Returns an icon preview for a 3D vector symbol.

Parameters
symbol3D symbol to generate the preview for.
sizeTarget pixmap size.
screenDestination screen properties used to determine DPI and device pixel ratio.
paddingSpace between icon edge and symbol.
Returns
An icon containing a preview of the symbol.
Note
For line and circle symbols, the size of the drawn icon depends on the symbol's parameters.

Definition at line 113 of file qgs3dsymbolutils.cpp.


The documentation for this class was generated from the following files: