37 : mType( type ), mLayers( layers ), mAlpha( 1.0 ), mRenderHints( 0 ), mLayer( NULL )
41 for (
int i = 0; i <
mLayers.count(); i++ )
59 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
70 QgsSymbolLayerV2List::const_iterator it =
mLayers.constBegin();
74 for ( ; it !=
mLayers.constEnd(); ++it )
76 if (( *it )->outputUnit() != unit )
91 QgsSymbolLayerV2List::const_iterator it =
mLayers.constBegin();
98 for ( ; it !=
mLayers.constEnd(); ++it )
100 if (( *it )->mapUnitScale() != scale )
110 QgsSymbolLayerV2List::iterator it =
mLayers.begin();
111 for ( ; it !=
mLayers.end(); ++it )
113 ( *it )->setOutputUnit( u );
119 QgsSymbolLayerV2List::iterator it =
mLayers.begin();
120 for ( ; it !=
mLayers.end(); ++it )
122 ( *it )->setMapUnitScale( scale );
143 default: defaultSymbol =
"";
break;
145 if ( defaultSymbol !=
"" )
156 default:
QgsDebugMsg(
"unknown layer's geometry type" );
return NULL;
164 if ( defaultSymbol ==
"" ||
167 s->
setColor( QColor::fromHsv( qrand() % 360, 64 + qrand() % 192, 128 + qrand() % 128 ) );
175 if ( layer < 0 || layer >=
mLayers.count() )
194 if ( index < 0 || index >
mLayers.count() )
199 mLayers.insert( index, layer );
216 if ( index < 0 || index >=
mLayers.count() )
227 if ( index < 0 || index >=
mLayers.count() )
230 return mLayers.takeAt( index );
236 if ( index < 0 || index >=
mLayers.count() )
252 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
253 ( *it )->startRender( symbolContext );
260 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
261 ( *it )->stopRender( symbolContext );
268 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
270 if ( !( *it )->isLocked() )
271 ( *it )->setColor( color );
277 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
280 if ( !( *it )->isLocked() )
281 return ( *it )->color();
283 return QColor( 0, 0, 0 );
292 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
301 QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width() - 1, size.height() - 1 ) );
307 ( *it )->drawPreviewIcon( symbolContext, size );
313 QImage image( size, QImage::Format_ARGB32_Premultiplied );
316 QPainter p( &image );
317 p.setRenderHint( QPainter::Antialiasing );
327 QImage preview( QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied );
330 QPainter p( &preview );
331 p.setRenderHint( QPainter::Antialiasing );
332 p.translate( 0.5, 0.5 );
336 p.setPen( QPen( Qt::gray ) );
337 p.drawLine( 0, 50, 100, 50 );
338 p.drawLine( 50, 0, 50, 100 );
347 poly << QPointF( 0, 50 ) << QPointF( 99, 50 );
348 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( poly, 0, context );
353 polygon << QPointF( 20, 20 ) << QPointF( 80, 20 ) << QPointF( 80, 80 ) << QPointF( 20, 80 ) << QPointF( 20, 20 );
354 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( polygon, NULL, 0, context );
358 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( QPointF( 50, 50 ), 0, context );
374 default: Q_ASSERT( 0 &&
"unknown symbol type" );
378 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
387 props[
"alpha" ] = QString::number(
alpha() );
388 double scaleFactor = 1.0;
390 props[
"uomScale" ] = scaleFactor != 1 ? QString::number( scaleFactor ) :
"";
392 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
394 ( *it )->toSld( doc, element, props );
401 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
413 QSet<QString> attributes;
414 QgsSymbolLayerV2List::const_iterator sIt =
mLayers.constBegin();
415 for ( ; sIt !=
mLayers.constEnd(); ++sIt )
419 attributes.unite(( *sIt )->usedAttributes() );
429 : mRenderContext( c ), mOutputUnit( u ), mMapUnitScale( mapUnitScale ), mAlpha( alpha ), mSelected( selected ), mRenderHints( renderHints ), mFeature( f ), mFields( fields )
507 double origAngle =
angle();
508 double angleDiff = ang - origAngle;
509 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
518 QgsSymbolLayerV2List::const_iterator it =
mLayers.begin();
525 return layer->
angle();
530 double origSize =
size();
532 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
535 if ( layer->
size() == origSize )
550 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
553 double lsize = layer->
size();
554 if ( lsize > maxSize )
563 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
572 QgsSymbolLayerV2List::const_iterator it =
mLayers.begin();
588 if ( layer >= 0 && layer <
mLayers.count() )
593 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
621 double origWidth =
width();
623 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
626 if ( layer->
width() == origWidth )
633 if ( origWidth != 0 )
642 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
646 if ( width > maxWidth )
658 if ( layer >= 0 && layer <
mLayers.count() )
663 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
695 if ( layer >= 0 && layer <
mLayers.count() )
706 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
733 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )