20
20
#include " qgscrscache.h"
21
21
#include " qgsfield.h"
22
22
#include " qgsgeometry.h"
23
+ #include " qgslegendrenderer.h"
23
24
#include " qgsmaplayer.h"
24
25
#include " qgsmaplayerregistry.h"
25
26
#include " qgsmaprenderer.h"
@@ -557,25 +558,15 @@ QImage* QgsWMSServer::getLegendGraphics()
557
558
return 0 ;
558
559
}
559
560
560
- // create first image (to find out dpi)
561
- QImage* theImage = createImage ( 10 , 10 );
562
- if ( !theImage )
563
- {
564
- return 0 ;
565
- }
566
- double mmToPixelFactor = theImage->dotsPerMeterX () / 1000.0 ;
567
- double maxTextWidth = 0 ;
568
- double maxSymbolWidth = 0 ;
569
- double fontOversamplingFactor = 10.0 ;
570
-
571
561
// get icon size, spaces between legend items and font from config parser
572
562
double boxSpace, layerSpace, layerTitleSpace, symbolSpace, iconLabelSpace, symbolWidth, symbolHeight;
573
563
QFont layerFont, itemFont;
574
564
QColor layerFontColor, itemFontColor;
575
- legendParameters ( mmToPixelFactor, fontOversamplingFactor, boxSpace, layerSpace, layerTitleSpace, symbolSpace,
565
+ legendParameters ( boxSpace, layerSpace, layerTitleSpace, symbolSpace,
576
566
iconLabelSpace, symbolWidth, symbolHeight, layerFont, itemFont, layerFontColor, itemFontColor );
577
567
578
568
QString rule;
569
+ int ruleSymbolWidth = 0 , ruleSymbolHeight = 0 ;
579
570
QMap<QString, QString>::const_iterator ruleIt = mParameters .find ( " RULE" );
580
571
if ( ruleIt != mParameters .constEnd () )
581
572
{
@@ -588,7 +579,7 @@ QImage* QgsWMSServer::getLegendGraphics()
588
579
double width = widthIt.value ().toDouble ( &conversionSuccess );
589
580
if ( conversionSuccess )
590
581
{
591
- symbolWidth = width;
582
+ ruleSymbolWidth = width;
592
583
}
593
584
}
594
585
@@ -599,7 +590,7 @@ QImage* QgsWMSServer::getLegendGraphics()
599
590
double width = heightIt.value ().toDouble ( &conversionSuccess );
600
591
if ( conversionSuccess )
601
592
{
602
- symbolHeight = width;
593
+ ruleSymbolHeight = width;
603
594
}
604
595
}
605
596
}
@@ -614,124 +605,110 @@ QImage* QgsWMSServer::getLegendGraphics()
614
605
return 0 ;
615
606
}
616
607
608
+ // find out DPI
609
+ QImage* tmpImage = createImage ( 1 , 1 );
610
+ if ( !tmpImage )
611
+ return 0 ;
612
+ qreal dpmm = tmpImage->dotsPerMeterX () / 1000.0 ;
613
+ delete tmpImage;
614
+
615
+ // setup legend configuration
616
+ QgsLegendSettings legendSettings;
617
+ legendSettings.setTitle ( QString () );
618
+ legendSettings.setBoxSpace ( boxSpace );
619
+ legendSettings.rstyle ( QgsComposerLegendStyle::Subgroup ).setMargin ( QgsComposerLegendStyle::Top, layerSpace );
620
+ // TODO: not available: layer title space
621
+ legendSettings.rstyle ( QgsComposerLegendStyle::Symbol ).setMargin ( QgsComposerLegendStyle::Top, symbolSpace );
622
+ legendSettings.rstyle ( QgsComposerLegendStyle::SymbolLabel ).setMargin ( QgsComposerLegendStyle::Left, iconLabelSpace );
623
+ legendSettings.setSymbolSize ( QSizeF ( symbolWidth, symbolHeight ) );
624
+ legendSettings.rstyle ( QgsComposerLegendStyle::Subgroup ).setFont ( layerFont );
625
+ legendSettings.rstyle ( QgsComposerLegendStyle::SymbolLabel ).setFont ( itemFont );
626
+ // TODO: not available: layer font color
627
+ legendSettings.setFontColor ( itemFontColor );
628
+
617
629
if ( !rule.isEmpty () )
618
630
{
619
631
// create second image with the right dimensions
620
- QImage* paintImage = createImage ( symbolWidth, symbolHeight );
632
+ QImage* paintImage = createImage ( ruleSymbolWidth, ruleSymbolHeight );
621
633
622
634
// go through the items a second time for painting
623
635
QPainter p ( paintImage );
624
636
p.setRenderHint ( QPainter::Antialiasing, true );
637
+ p.scale ( dpmm, dpmm );
625
638
626
- QgsComposerLegendItem * currentComposerItem = dynamic_cast <QgsComposerLegendItem *>( rootItem->child ( 0 )->child ( 0 ) );
639
+ QgsComposerBaseSymbolItem * currentComposerItem = dynamic_cast <QgsComposerBaseSymbolItem *>( rootItem->child ( 0 )->child ( 0 ) );
627
640
if ( currentComposerItem != NULL )
628
641
{
629
- QgsComposerLegendItem::ItemType type = currentComposerItem->itemType ();
630
- switch ( type )
631
- {
632
- case QgsComposerLegendItem::SymbologyV2Item:
633
- drawLegendSymbolV2 ( currentComposerItem, &p, 0 ., 0 ., symbolWidth, symbolHeight, 0 . );
634
- break ;
635
- case QgsComposerLegendItem::RasterSymbolItem:
636
- drawRasterSymbol ( currentComposerItem, &p, 0 ., 0 ., symbolWidth, symbolHeight, 0 . );
637
- break ;
638
- case QgsComposerLegendItem::GroupItem:
639
- // QgsDebugMsg( "GroupItem not handled" );
640
- break ;
641
- case QgsComposerLegendItem::LayerItem:
642
- // QgsDebugMsg( "GroupItem not handled" );
643
- break ;
644
- case QgsComposerLegendItem::StyleItem:
645
- // QgsDebugMsg( "StyleItem not handled" );
646
- break ;
647
- }
642
+ QgsComposerBaseSymbolItem::ItemContext ctx;
643
+ ctx.painter = &p;
644
+ ctx.labelXOffset = 0 ;
645
+ ctx.point = QPointF ();
646
+ double itemHeight = ruleSymbolHeight / dpmm;
647
+ currentComposerItem->drawSymbol ( legendSettings, &ctx, itemHeight );
648
648
}
649
649
650
650
QgsMapLayerRegistry::instance ()->removeAllMapLayers ();
651
- delete theImage;
652
651
return paintImage;
653
652
}
654
653
655
- double currentY = drawLegendGraphics ( 0 , fontOversamplingFactor, rootItem, boxSpace, layerSpace, layerTitleSpace, symbolSpace,
656
- iconLabelSpace, symbolWidth, symbolHeight, layerFont, itemFont, layerFontColor, itemFontColor, maxTextWidth,
657
- maxSymbolWidth );
654
+ for ( int i = 0 ; i < rootItem->rowCount (); ++i )
655
+ {
656
+ if ( QgsComposerLayerItem* lItem = dynamic_cast <QgsComposerLayerItem*>( rootItem->child ( i ) ) )
657
+ {
658
+ // layer titles - hidden or not
659
+ lItem->setStyle ( mDrawLegendLayerLabel ? QgsComposerLegendStyle::Subgroup : QgsComposerLegendStyle::Hidden );
658
660
659
- // create second image with the right dimensions
660
- QImage* paintImage = createImage ( maxTextWidth + maxSymbolWidth, ceil ( currentY ) );
661
+ // rule item titles
662
+ if ( !mDrawLegendItemLabel )
663
+ {
664
+ for ( int j = 0 ; j < lItem->rowCount (); ++j )
665
+ {
666
+ if ( QgsComposerBaseSymbolItem* sItem = dynamic_cast <QgsComposerBaseSymbolItem*>( lItem->child ( j ) ) )
667
+ sItem ->setUserText ( " " ); // empty string = no override, so let's use one space
668
+ }
669
+ }
670
+ }
671
+ }
672
+
673
+ QgsLegendRenderer legendRenderer ( &legendModel, legendSettings );
674
+ QSizeF minSize = legendRenderer.minimumSize ();
675
+ QSize s ( minSize.width () * dpmm, minSize.height () * dpmm );
676
+
677
+ QImage* paintImage = createImage ( s.width (), s.height () );
661
678
662
- // go through the items a second time for painting
663
679
QPainter p ( paintImage );
664
680
p.setRenderHint ( QPainter::Antialiasing, true );
681
+ p.scale ( dpmm, dpmm );
665
682
666
- drawLegendGraphics ( &p, fontOversamplingFactor, rootItem, boxSpace, layerSpace, layerTitleSpace, symbolSpace,
667
- iconLabelSpace, symbolWidth, symbolHeight, layerFont, itemFont, layerFontColor, itemFontColor, maxTextWidth,
668
- maxSymbolWidth );
683
+ legendRenderer. drawLegend ( &p );
684
+
685
+ p. end ( );
669
686
670
687
QgsMapLayerRegistry::instance ()->removeAllMapLayers ();
671
- delete theImage;
672
688
return paintImage;
673
689
}
674
690
675
- double QgsWMSServer::drawLegendGraphics ( QPainter* p, double fontOversamplingFactor, QStandardItem* rootItem, double boxSpace,
676
- double layerSpace, double layerTitleSpace, double symbolSpace, double iconLabelSpace,
677
- double symbolWidth, double symbolHeight, const QFont& layerFont, const QFont& itemFont,
678
- const QColor& layerFontColor, const QColor& itemFontColor, double & maxTextWidth, double & maxSymbolWidth )
679
- {
680
- if ( !rootItem )
681
- {
682
- return 0 ;
683
- }
684
-
685
- int numLayerItems = rootItem->rowCount ();
686
- if ( numLayerItems < 1 )
687
- {
688
- return 0 ;
689
- }
690
691
691
- double currentY = boxSpace;
692
- for ( int i = 0 ; i < numLayerItems; ++i )
693
- {
694
- QgsComposerLayerItem* layerItem = dynamic_cast <QgsComposerLayerItem*>( rootItem->child ( i ) );
695
- if ( layerItem )
696
- {
697
- if ( i > 0 )
698
- {
699
- currentY += layerSpace;
700
- }
701
- drawLegendLayerItem ( layerItem, p, maxTextWidth, maxSymbolWidth, currentY, layerFont, layerFontColor, itemFont, itemFontColor,
702
- boxSpace, layerSpace, layerTitleSpace, symbolSpace, iconLabelSpace, symbolWidth, symbolHeight, fontOversamplingFactor );
703
- }
704
- }
705
- currentY += boxSpace;
706
- return currentY;
707
- }
708
692
709
- void QgsWMSServer::legendParameters ( double mmToPixelFactor, double fontOversamplingFactor, double & boxSpace, double & layerSpace, double & layerTitleSpace,
693
+ void QgsWMSServer::legendParameters ( double & boxSpace, double & layerSpace, double & layerTitleSpace,
710
694
double & symbolSpace, double & iconLabelSpace, double & symbolWidth, double & symbolHeight,
711
695
QFont& layerFont, QFont& itemFont, QColor& layerFontColor, QColor& itemFontColor )
712
696
{
713
697
// spaces between legend elements
714
698
QMap<QString, QString>::const_iterator boxSpaceIt = mParameters .find ( " BOXSPACE" );
715
- boxSpace = ( boxSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendBoxSpace () * mmToPixelFactor :
716
- boxSpaceIt.value ().toDouble () * mmToPixelFactor;
699
+ boxSpace = ( boxSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendBoxSpace () : boxSpaceIt.value ().toDouble ();
717
700
QMap<QString, QString>::const_iterator layerSpaceIt = mParameters .find ( " LAYERSPACE" );
718
- layerSpace = ( layerSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendLayerSpace () * mmToPixelFactor :
719
- layerSpaceIt.value ().toDouble () * mmToPixelFactor;
701
+ layerSpace = ( layerSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendLayerSpace () : layerSpaceIt.value ().toDouble ();
720
702
QMap<QString, QString>::const_iterator layerTitleSpaceIt = mParameters .find ( " LAYERTITLESPACE" );
721
- layerTitleSpace = ( layerTitleSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendLayerTitleSpace () * mmToPixelFactor :
722
- layerTitleSpaceIt.value ().toDouble () * mmToPixelFactor;
703
+ layerTitleSpace = ( layerTitleSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendLayerTitleSpace () : layerTitleSpaceIt.value ().toDouble ();
723
704
QMap<QString, QString>::const_iterator symbolSpaceIt = mParameters .find ( " SYMBOLSPACE" );
724
- symbolSpace = ( symbolSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendSymbolSpace () * mmToPixelFactor :
725
- symbolSpaceIt.value ().toDouble () * mmToPixelFactor;
705
+ symbolSpace = ( symbolSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendSymbolSpace () : symbolSpaceIt.value ().toDouble ();
726
706
QMap<QString, QString>::const_iterator iconLabelSpaceIt = mParameters .find ( " ICONLABELSPACE" );
727
- iconLabelSpace = ( iconLabelSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendIconLabelSpace () * mmToPixelFactor :
728
- iconLabelSpaceIt.value ().toDouble () * mmToPixelFactor;
707
+ iconLabelSpace = ( iconLabelSpaceIt == mParameters .constEnd () ) ? mConfigParser ->legendIconLabelSpace () : iconLabelSpaceIt.value ().toDouble ();
729
708
QMap<QString, QString>::const_iterator symbolWidthIt = mParameters .find ( " SYMBOLWIDTH" );
730
- symbolWidth = ( symbolWidthIt == mParameters .constEnd () ) ? mConfigParser ->legendSymbolWidth () * mmToPixelFactor :
731
- symbolWidthIt.value ().toDouble () * mmToPixelFactor;
709
+ symbolWidth = ( symbolWidthIt == mParameters .constEnd () ) ? mConfigParser ->legendSymbolWidth () : symbolWidthIt.value ().toDouble ();
732
710
QMap<QString, QString>::const_iterator symbolHeightIt = mParameters .find ( " SYMBOLHEIGHT" );
733
- symbolHeight = ( symbolHeightIt == mParameters .constEnd () ) ? mConfigParser ->legendSymbolHeight () * mmToPixelFactor :
734
- symbolHeightIt.value ().toDouble () * mmToPixelFactor;
711
+ symbolHeight = ( symbolHeightIt == mParameters .constEnd () ) ? mConfigParser ->legendSymbolHeight () : symbolHeightIt.value ().toDouble ();
735
712
736
713
// font properties
737
714
layerFont = mConfigParser ->legendLayerFont ();
@@ -751,14 +728,7 @@ void QgsWMSServer::legendParameters( double mmToPixelFactor, double fontOversamp
751
728
layerFont.setItalic ( layerFontItalicIt.value ().compare ( " TRUE" , Qt::CaseInsensitive ) == 0 );
752
729
}
753
730
QMap<QString, QString>::const_iterator layerFontSizeIt = mParameters .find ( " LAYERFONTSIZE" );
754
- if ( layerFontSizeIt != mParameters .constEnd () )
755
- {
756
- layerFont.setPixelSize ( layerFontSizeIt.value ().toDouble () * 0.3528 * mmToPixelFactor * fontOversamplingFactor );
757
- }
758
- else
759
- {
760
- layerFont.setPixelSize ( layerFont.pointSizeF () * 0.3528 * mmToPixelFactor * fontOversamplingFactor );
761
- }
731
+ layerFont.setPointSizeF ( layerFontSizeIt != mParameters .constEnd () ? layerFontSizeIt.value ().toDouble () : layerFont.pointSizeF () );
762
732
QMap<QString, QString>::const_iterator layerFontColorIt = mParameters .find ( " LAYERFONTCOLOR" );
763
733
if ( layerFontColorIt != mParameters .constEnd () )
764
734
{
@@ -796,14 +766,7 @@ void QgsWMSServer::legendParameters( double mmToPixelFactor, double fontOversamp
796
766
itemFont.setItalic ( itemFontItalicIt.value ().compare ( " TRUE" , Qt::CaseInsensitive ) == 0 );
797
767
}
798
768
QMap<QString, QString>::const_iterator itemFontSizeIt = mParameters .find ( " ITEMFONTSIZE" );
799
- if ( itemFontSizeIt != mParameters .constEnd () )
800
- {
801
- itemFont.setPixelSize ( itemFontSizeIt.value ().toDouble () * 0.3528 * mmToPixelFactor * fontOversamplingFactor );
802
- }
803
- else
804
- {
805
- itemFont.setPixelSize ( itemFont.pointSizeF () * 0.3528 * mmToPixelFactor * fontOversamplingFactor );
806
- }
769
+ itemFont.setPointSizeF ( itemFontSizeIt != mParameters .constEnd () ? itemFontSizeIt.value ().toDouble () : itemFont.pointSizeF () );
807
770
QMap<QString, QString>::const_iterator itemFontColorIt = mParameters .find ( " ITEMFONTCOLOR" );
808
771
if ( itemFontColorIt != mParameters .constEnd () )
809
772
{
@@ -1984,186 +1947,6 @@ QStringList QgsWMSServer::layerSet( const QStringList &layersList,
1984
1947
return layerKeys;
1985
1948
}
1986
1949
1987
- void QgsWMSServer::drawLegendLayerItem ( QgsComposerLayerItem* item, QPainter* p, double & maxTextWidth, double & maxSymbolWidth, double & currentY, const QFont& layerFont,
1988
- const QColor& layerFontColor, const QFont& itemFont, const QColor& itemFontColor, double boxSpace, double layerSpace,
1989
- double layerTitleSpace, double symbolSpace, double iconLabelSpace, double symbolWidth, double symbolHeight, double fontOversamplingFactor ) const
1990
- {
1991
- Q_UNUSED ( layerSpace );
1992
- if ( !item )
1993
- {
1994
- return ;
1995
- }
1996
-
1997
- QFontMetricsF layerFontMetrics ( layerFont );
1998
- if ( mDrawLegendLayerLabel )
1999
- {
2000
- currentY += layerFontMetrics.ascent () / fontOversamplingFactor;
2001
- }
2002
-
2003
- // draw layer title first
2004
- if ( p )
2005
- {
2006
- if ( mDrawLegendLayerLabel )
2007
- {
2008
- p->save ();
2009
- p->scale ( 1.0 / fontOversamplingFactor, 1.0 / fontOversamplingFactor );
2010
- p->setPen ( layerFontColor );
2011
- p->setFont ( layerFont );
2012
- p->drawText ( boxSpace * fontOversamplingFactor, currentY * fontOversamplingFactor, item->text () );
2013
- p->restore ();
2014
- }
2015
- }
2016
- else
2017
- {
2018
- double layerItemWidth = layerFontMetrics.width ( item->text () ) / fontOversamplingFactor + boxSpace;
2019
- if ( layerItemWidth > maxTextWidth )
2020
- {
2021
- if ( mDrawLegendLayerLabel )
2022
- {
2023
- maxTextWidth = layerItemWidth;
2024
- }
2025
- }
2026
- }
2027
-
2028
- if ( mDrawLegendLayerLabel )
2029
- {
2030
- currentY += layerTitleSpace;
2031
- }
2032
-
2033
- // then draw all the children
2034
- QFontMetricsF itemFontMetrics ( itemFont );
2035
-
2036
- int nChildItems = item->rowCount ();
2037
- QgsComposerLegendItem* currentComposerItem = 0 ;
2038
-
2039
- for ( int i = 0 ; i < nChildItems; ++i )
2040
- {
2041
- currentComposerItem = dynamic_cast <QgsComposerLegendItem*>( item->child ( i ) );
2042
- if ( !currentComposerItem )
2043
- {
2044
- continue ;
2045
- }
2046
-
2047
- double currentSymbolHeight = symbolHeight;
2048
- double currentSymbolWidth = symbolWidth; // symbol width (without box space and icon/label space
2049
- double currentTextWidth = 0 ;
2050
-
2051
- // if the font is larger than the standard symbol size, try to draw the symbol centered (shifting towards the bottom)
2052
- double symbolDownShift = ( itemFontMetrics.ascent () / fontOversamplingFactor - symbolHeight ) / 2.0 ;
2053
- if ( symbolDownShift < 0 )
2054
- {
2055
- symbolDownShift = 0 ;
2056
- }
2057
-
2058
- QgsComposerLegendItem::ItemType type = currentComposerItem->itemType ();
2059
- switch ( type )
2060
- {
2061
- case QgsComposerLegendItem::SymbologyV2Item:
2062
- drawLegendSymbolV2 ( currentComposerItem, p, boxSpace, currentY, currentSymbolWidth, currentSymbolHeight, symbolDownShift );
2063
- break ;
2064
- case QgsComposerLegendItem::RasterSymbolItem:
2065
- drawRasterSymbol ( currentComposerItem, p, boxSpace, currentY, currentSymbolWidth, currentSymbolHeight, symbolDownShift );
2066
- break ;
2067
- case QgsComposerLegendItem::GroupItem:
2068
- // QgsDebugMsg( "GroupItem not handled" );
2069
- break ;
2070
- case QgsComposerLegendItem::LayerItem:
2071
- // QgsDebugMsg( "GroupItem not handled" );
2072
- break ;
2073
- case QgsComposerLegendItem::StyleItem:
2074
- // QgsDebugMsg( "StyleItem not handled" );
2075
- break ;
2076
- }
2077
-
2078
- if ( mDrawLegendItemLabel )
2079
- {
2080
- // finally draw text
2081
- currentTextWidth = itemFontMetrics.width ( currentComposerItem->text () ) / fontOversamplingFactor;
2082
- }
2083
- else
2084
- {
2085
- currentTextWidth = 0 ;
2086
- }
2087
- double symbolItemHeight = qMax ( itemFontMetrics.ascent () / fontOversamplingFactor, currentSymbolHeight );
2088
-
2089
- if ( p )
2090
- {
2091
- if ( mDrawLegendItemLabel )
2092
- {
2093
- p->save ();
2094
- p->scale ( 1.0 / fontOversamplingFactor, 1.0 / fontOversamplingFactor );
2095
- p->setPen ( itemFontColor );
2096
- p->setFont ( itemFont );
2097
- p->drawText ( maxSymbolWidth * fontOversamplingFactor,
2098
- ( currentY + symbolItemHeight / 2.0 ) * fontOversamplingFactor + itemFontMetrics.ascent () / 2.0 , currentComposerItem->text () );
2099
- p->restore ();
2100
- }
2101
- }
2102
- else
2103
- {
2104
- if ( currentTextWidth > maxTextWidth )
2105
- {
2106
- if ( mDrawLegendItemLabel )
2107
- {
2108
- maxTextWidth = currentTextWidth;
2109
- }
2110
- }
2111
- double symbolWidth = boxSpace + currentSymbolWidth + iconLabelSpace;
2112
- if ( symbolWidth > maxSymbolWidth )
2113
- {
2114
- maxSymbolWidth = symbolWidth;
2115
- }
2116
- }
2117
-
2118
- currentY += symbolItemHeight;
2119
- if ( i < ( nChildItems - 1 ) )
2120
- {
2121
- currentY += symbolSpace;
2122
- }
2123
- }
2124
- }
2125
-
2126
-
2127
- void QgsWMSServer::drawLegendSymbolV2 ( QgsComposerLegendItem* item, QPainter* p, double boxSpace, double currentY, double & symbolWidth,
2128
- double & symbolHeight, double yDownShift ) const
2129
- {
2130
- QgsComposerSymbolV2Item* symbolItem = dynamic_cast < QgsComposerSymbolV2Item* >( item );
2131
- if ( !symbolItem )
2132
- {
2133
- return ;
2134
- }
2135
- QgsSymbolV2* symbol = symbolItem->symbolV2 ();
2136
- if ( !symbol )
2137
- {
2138
- return ;
2139
- }
2140
-
2141
- if ( p )
2142
- {
2143
- p->save ();
2144
- p->translate ( boxSpace, currentY + yDownShift );
2145
- p->scale ( 1.0 , 1.0 );
2146
- symbol->drawPreviewIcon ( p, QSize ( symbolWidth, symbolHeight ) );
2147
- p->restore ();
2148
- }
2149
- }
2150
-
2151
- void QgsWMSServer::drawRasterSymbol ( QgsComposerLegendItem* item, QPainter* p, double boxSpace, double currentY, double symbolWidth, double symbolHeight, double yDownShift ) const
2152
- {
2153
- if ( !item || ! p )
2154
- {
2155
- return ;
2156
- }
2157
-
2158
- QgsComposerRasterSymbolItem* rasterItem = dynamic_cast < QgsComposerRasterSymbolItem* >( item );
2159
- if ( !rasterItem )
2160
- {
2161
- return ;
2162
- }
2163
-
2164
- p->setBrush ( QBrush ( rasterItem->color () ) );
2165
- p->drawRect ( QRectF ( boxSpace, currentY + yDownShift, symbolWidth, symbolHeight ) );
2166
- }
2167
1950
2168
1951
QMap<QString, QString> QgsWMSServer::applyRequestedLayerFilters ( const QStringList& layerList ) const
2169
1952
{
0 commit comments