Exemplo n.º 1
0
QgsPaintEffect* QgsPaintEffectRegistry::defaultStack()
{
  QgsEffectStack* stack = new QgsEffectStack();
  QgsDropShadowEffect* dropShadow = new QgsDropShadowEffect();
  dropShadow->setEnabled( false );
  stack->appendEffect( dropShadow );
  QgsOuterGlowEffect* outerGlow = new QgsOuterGlowEffect();
  outerGlow->setEnabled( false );
  stack->appendEffect( outerGlow );
  stack->appendEffect( new QgsDrawSourceEffect() );
  QgsInnerShadowEffect* innerShadow = new QgsInnerShadowEffect();
  innerShadow->setEnabled( false );
  stack->appendEffect( innerShadow );
  QgsInnerGlowEffect* innerGlow = new QgsInnerGlowEffect();
  innerGlow->setEnabled( false );
  stack->appendEffect( innerGlow );
  return stack;
}
Exemplo n.º 2
0
QgsPaintEffect* QgsPaintEffectRegistry::defaultStack()
{
  //NOTE - also remember to update isDefaultStack below if making changes to this list
  QgsEffectStack* stack = new QgsEffectStack();
  QgsDropShadowEffect* dropShadow = new QgsDropShadowEffect();
  dropShadow->setEnabled( false );
  stack->appendEffect( dropShadow );
  QgsOuterGlowEffect* outerGlow = new QgsOuterGlowEffect();
  outerGlow->setEnabled( false );
  stack->appendEffect( outerGlow );
  stack->appendEffect( new QgsDrawSourceEffect() );
  QgsInnerShadowEffect* innerShadow = new QgsInnerShadowEffect();
  innerShadow->setEnabled( false );
  stack->appendEffect( innerShadow );
  QgsInnerGlowEffect* innerGlow = new QgsInnerGlowEffect();
  innerGlow->setEnabled( false );
  stack->appendEffect( innerGlow );
  return stack;
}
Exemplo n.º 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 );
}
Exemplo n.º 4
0
void TestQgsPaintEffectRegistry::defaultStack()
{
  QgsPaintEffectRegistry* registry = QgsApplication::paintEffectRegistry();
  QgsEffectStack* effect = static_cast<QgsEffectStack*>( registry->defaultStack() );
  QVERIFY( registry->isDefaultStack( effect ) );
  effect->effect( 1 )->setEnabled( true );
  QVERIFY( !registry->isDefaultStack( effect ) );
  effect->effect( 1 )->setEnabled( false );
  effect->effect( 2 )->setEnabled( false ); //third effect should be enabled by default
  QVERIFY( !registry->isDefaultStack( effect ) );
  effect->effect( 2 )->setEnabled( true );
  effect->appendEffect( new QgsEffectStack() );
  QVERIFY( !registry->isDefaultStack( effect ) );
  delete effect;
  QgsPaintEffect* effect2 = new DummyPaintEffect();
  QVERIFY( !registry->isDefaultStack( effect2 ) );
  delete effect2;
}