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 )
67 QgsSymbolLayerV2List::const_iterator it =
mLayers.constBegin();
68 for ( ; it !=
mLayers.constEnd(); ++it )
70 if ( it ==
mLayers.constBegin() )
72 unit = ( *it )->outputUnit();
76 if (( *it )->outputUnit() != unit )
88 QgsSymbolLayerV2List::iterator it =
mLayers.begin();
89 for ( ; it !=
mLayers.end(); ++it )
91 ( *it )->setOutputUnit( u );
112 default: defaultSymbol =
"";
break;
114 if ( defaultSymbol !=
"" )
125 default:
QgsDebugMsg(
"unknown layer's geometry type" );
return NULL;
133 if ( defaultSymbol ==
"" ||
136 s->
setColor( QColor::fromHsv( rand() % 360, 64 + rand() % 192, 128 + rand() % 128 ) );
144 if ( layer < 0 || layer >=
mLayers.count() )
163 if ( index < 0 || index >
mLayers.count() )
168 mLayers.insert( index, layer );
185 if ( index < 0 || index >=
mLayers.count() )
196 if ( index < 0 || index >=
mLayers.count() )
199 return mLayers.takeAt( index );
205 if ( index < 0 || index >=
mLayers.count() )
223 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
224 ( *it )->startRender( symbolContext );
232 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
233 ( *it )->stopRender( symbolContext );
240 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
242 if ( !( *it )->isLocked() )
243 ( *it )->setColor( color );
249 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
252 if ( !( *it )->isLocked() )
253 return ( *it )->color();
255 return QColor( 0, 0, 0 );
264 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
273 QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width() - 1, size.height() - 1 ) );
279 ( *it )->drawPreviewIcon( symbolContext, size );
286 QImage preview( QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied );
289 QPainter p( &preview );
290 p.setRenderHint( QPainter::Antialiasing );
291 p.translate( 0.5, 0.5 );
295 p.setPen( QPen( Qt::gray ) );
296 p.drawLine( 0, 50, 100, 50 );
297 p.drawLine( 50, 0, 50, 100 );
306 poly << QPointF( 0, 50 ) << QPointF( 99, 50 );
307 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( poly, 0, context );
312 polygon << QPointF( 20, 20 ) << QPointF( 80, 20 ) << QPointF( 80, 80 ) << QPointF( 20, 80 ) << QPointF( 20, 20 );
313 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( polygon, NULL, 0, context );
317 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( QPointF( 50, 50 ), 0, context );
333 default: Q_ASSERT( 0 &&
"unknown symbol type" );
337 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
346 props[
"alpha" ] = QString::number(
alpha() );
347 double scaleFactor = 1.0;
349 props[
"uomScale" ] = scaleFactor != 1 ? QString::number( scaleFactor ) :
"";
351 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
353 ( *it )->toSld( doc, element, props );
360 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
372 QSet<QString> attributes;
373 QgsSymbolLayerV2List::const_iterator sIt =
mLayers.constBegin();
374 for ( ; sIt !=
mLayers.constEnd(); ++sIt )
378 attributes.unite(( *sIt )->usedAttributes() );
388 : mRenderContext( c ), mOutputUnit( u ), mAlpha( alpha ), mSelected( selected ), mRenderHints( renderHints ), mFeature( f ), mLayer( 0 )
466 double origAngle =
angle();
467 double angleDiff = ang - origAngle;
468 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
477 QgsSymbolLayerV2List::const_iterator it =
mLayers.begin();
484 return layer->
angle();
489 double origSize =
size();
491 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
494 if ( layer->
size() == origSize )
509 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
512 double lsize = layer->
size();
513 if ( lsize > maxSize )
522 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
531 QgsSymbolLayerV2List::const_iterator it =
mLayers.begin();
548 if ( layer >= 0 && layer <
mLayers.count() )
553 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
580 double origWidth =
width();
582 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
585 if ( layer->
width() == origWidth )
592 if ( origWidth != 0 )
601 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
605 if ( width > maxWidth )
618 if ( layer >= 0 && layer <
mLayers.count() )
623 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
655 if ( layer >= 0 && layer <
mLayers.count() )
666 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
692 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )