void QgsPolygon3DSymbolWidget::setSymbol( const QgsPolygon3DSymbol &symbol, QgsVectorLayer *layer )
{
  spinHeight->setValue( symbol.height() );
  spinExtrusion->setValue( symbol.extrusionHeight() );
  cboAltClamping->setCurrentIndex( static_cast<int>( symbol.altitudeClamping() ) );
  cboAltBinding->setCurrentIndex( static_cast<int>( symbol.altitudeBinding() ) );
  cboCullingMode->setCurrentIndex( static_cast<int>( symbol.cullingMode() ) );
  chkAddBackFaces->setChecked( symbol.addBackFaces() );
  chkInvertNormals->setChecked( symbol.invertNormals() );
  widgetMaterial->setMaterial( symbol.material() );

  btnHeightDD->init( QgsAbstract3DSymbol::PropertyHeight, symbol.dataDefinedProperties(), QgsAbstract3DSymbol::propertyDefinitions(), layer, true );
  btnExtrusionDD->init( QgsAbstract3DSymbol::PropertyExtrusionHeight, symbol.dataDefinedProperties(), QgsAbstract3DSymbol::propertyDefinitions(), layer, true );
}
Esempio n. 2
0
static QSet<QString> _requiredAttributes( const QgsPolygon3DSymbol &symbol, QgsVectorLayer *layer )
{
  QgsExpressionContext ctx( _expressionContext3D() );
  ctx.setFields( layer->fields() );
  //symbol.dataDefinedProperties().prepare( ctx );
  return symbol.dataDefinedProperties().referencedFields( ctx );
}
QgsPolygon3DSymbol QgsPolygon3DSymbolWidget::symbol() const
{
  QgsPolygon3DSymbol sym;
  sym.setHeight( spinHeight->value() );
  sym.setExtrusionHeight( spinExtrusion->value() );
  sym.setAltitudeClamping( static_cast<Qgs3DTypes::AltitudeClamping>( cboAltClamping->currentIndex() ) );
  sym.setAltitudeBinding( static_cast<Qgs3DTypes::AltitudeBinding>( cboAltBinding->currentIndex() ) );
  sym.setCullingMode( static_cast<Qgs3DTypes::CullingMode>( cboCullingMode->currentIndex() ) );
  sym.setAddBackFaces( chkAddBackFaces->isChecked() );
  sym.setInvertNormals( chkInvertNormals->isChecked() );
  sym.setMaterial( widgetMaterial->material() );

  QgsPropertyCollection ddp;
  ddp.setProperty( QgsAbstract3DSymbol::PropertyHeight, btnHeightDD->toProperty() );
  ddp.setProperty( QgsAbstract3DSymbol::PropertyExtrusionHeight, btnExtrusionDD->toProperty() );
  sym.setDataDefinedProperties( ddp );

  return sym;
}