void QgsSymbolV2PropertiesDialog::lockLayer()
{
  QgsSymbolLayerV2* layer = currentLayer();
  if ( layer == NULL ) return;

  layer->setLocked( btnLock->isChecked() );
}
QgsSymbolLayerV2List QgsSymbolV2::cloneLayers() const
{
  QgsSymbolLayerV2List lst;
  for ( QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it )
  {
    QgsSymbolLayerV2* layer = ( *it )->clone();
    layer->setLocked(( *it )->isLocked() );
    layer->setRenderingPass(( *it )->renderingPass() );
    lst.append( layer );
  }
  return lst;
}
Exemple #3
0
Qgs25DRenderer::Qgs25DRenderer()
    : QgsFeatureRendererV2( "25dRenderer" )
{
  mSymbol.reset( new QgsFillSymbolV2() );

  mSymbol->deleteSymbolLayer( 0 ); // We never asked for the default layer

  QgsSymbolLayerV2* floor = QgsSimpleFillSymbolLayerV2::create();

  QgsStringMap wallProperties;
  wallProperties.insert( "geometryModifier", WALL_EXPRESSION );
  wallProperties.insert( "symbolType", "Fill" );
  QgsSymbolLayerV2* walls = QgsGeometryGeneratorSymbolLayerV2::create( wallProperties );

  QgsStringMap roofProperties;
  roofProperties.insert( "geometryModifier", ROOF_EXPRESSION );
  roofProperties.insert( "symbolType", "Fill" );
  QgsSymbolLayerV2* roof = QgsGeometryGeneratorSymbolLayerV2::create( roofProperties );

  floor->setLocked( true );

  mSymbol->appendSymbolLayer( floor );
  mSymbol->appendSymbolLayer( walls );
  mSymbol->appendSymbolLayer( roof );

  QgsEffectStack* effectStack = new QgsEffectStack();
  QgsOuterGlowEffect* glowEffect = new QgsOuterGlowEffect();
  glowEffect->setBlurLevel( 5 );
  glowEffect->setSpreadUnit( QgsSymbolV2::MapUnit );
  effectStack->appendEffect( glowEffect );
  floor->setPaintEffect( effectStack );

  // These methods must only be used after the above initialization!

  setRoofColor( QColor( "#b1a97c" ) );
  setWallColor( QColor( "#777777" ) );

  wallLayer()->setDataDefinedProperty( "color", new QgsDataDefined( QString( WALL_SHADING_EXPRESSION ) ) );

  setShadowSpread( 4 );
  setShadowColor( QColor( "#111111" ) );

  QgsFeatureRequest::OrderBy orderBy;
  orderBy << QgsFeatureRequest::OrderByClause(
    ORDER_BY_EXPRESSION,
    false );

  setOrderBy( orderBy );
  setOrderByEnabled( true );
}