37 : mType( type ), mLayers( layers ), mAlpha( 1.0 ), mRenderHints( 0 )
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() )
220 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
221 ( *it )->startRender( symbolContext );
227 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
228 ( *it )->stopRender( symbolContext );
233 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
235 if ( !( *it )->isLocked() )
236 ( *it )->setColor( color );
242 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
245 if ( !( *it )->isLocked() )
246 return ( *it )->color();
248 return QColor( 0, 0, 0 );
255 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
264 QPolygonF poly = QRectF( QPointF( 0, 0 ), QPointF( size.width() - 1, size.height() - 1 ) );
270 ( *it )->drawPreviewIcon( symbolContext, size );
277 QImage preview( QSize( 100, 100 ), QImage::Format_ARGB32_Premultiplied );
280 QPainter p( &preview );
281 p.setRenderHint( QPainter::Antialiasing );
282 p.translate( 0.5, 0.5 );
286 p.setPen( QPen( Qt::gray ) );
287 p.drawLine( 0, 50, 100, 50 );
288 p.drawLine( 50, 0, 50, 100 );
297 poly << QPointF( 0, 50 ) << QPointF( 99, 50 );
298 static_cast<QgsLineSymbolV2*
>( this )->renderPolyline( poly, 0, context );
303 polygon << QPointF( 20, 20 ) << QPointF( 80, 20 ) << QPointF( 80, 80 ) << QPointF( 20, 80 ) << QPointF( 20, 20 );
304 static_cast<QgsFillSymbolV2*
>( this )->renderPolygon( polygon, NULL, 0, context );
308 static_cast<QgsMarkerSymbolV2*
>( this )->renderPoint( QPointF( 50, 50 ), 0, context );
324 default: Q_ASSERT( 0 &&
"unknown symbol type" );
328 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
337 props[
"alpha" ] = QString::number(
alpha() );
338 double scaleFactor = 1.0;
340 props[
"uomScale" ] = scaleFactor != 1 ? QString::number( scaleFactor ) :
"";
342 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
344 ( *it )->toSld( doc, element, props );
351 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
363 QSet<QString> attributes;
364 QgsSymbolLayerV2List::const_iterator sIt =
mLayers.constBegin();
365 for ( ; sIt !=
mLayers.constEnd(); ++sIt )
369 attributes.unite(( *sIt )->usedAttributes() );
379 : mRenderContext( c ), mOutputUnit( u ), mAlpha( alpha ), mSelected( selected ), mRenderHints( renderHints ), mFeature( f ), mLayer( 0 )
457 double origAngle =
angle();
458 double angleDiff = ang - origAngle;
459 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
468 QgsSymbolLayerV2List::const_iterator it =
mLayers.begin();
475 return layer->
angle();
480 double origSize =
size();
482 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
485 if ( layer->
size() == origSize )
500 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
503 double lsize = layer->
size();
504 if ( lsize > maxSize )
513 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
522 QgsSymbolLayerV2List::const_iterator it =
mLayers.begin();
537 if ( layer >= 0 && layer <
mLayers.count() )
542 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
569 double origWidth =
width();
571 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
574 if ( layer->
width() == origWidth )
581 if ( origWidth != 0 )
590 for ( QgsSymbolLayerV2List::const_iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
594 if ( width > maxWidth )
605 if ( layer >= 0 && layer <
mLayers.count() )
610 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
640 if ( layer >= 0 && layer <
mLayers.count() )
651 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )
677 for ( QgsSymbolLayerV2List::iterator it =
mLayers.begin(); it !=
mLayers.end(); ++it )