コード例 #1
0
QgsSymbol *QgsGraduatedSymbolRenderer::originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context )
{
  QVariant value = valueForFeature( feature, context );

  // Null values should not be categorized
  if ( value.isNull() )
    return nullptr;

  // find the right category
  return symbolForValue( value.toDouble() );
}
コード例 #2
0
QgsSymbolV2* QgsCategorizedSymbolRendererV2::originalSymbolForFeature( QgsFeature& feature, QgsRenderContext &context )
{
  QVariant value = valueForFeature( feature, context );

  // find the right symbol for the category
  QgsSymbolV2 *symbol = symbolForValue( value );
  if ( symbol == skipRender() )
    return nullptr;

  if ( !symbol )
  {
    // if no symbol found use default one
    return symbolForValue( QVariant( "" ) );
  }

  return symbol;
}