29 name( theName ), visibleName( theVisibleName ), rendererCreateFunction( rendererFunction ),
30 widgetCreateFunction( widgetFunction )
70 if ( !
mEntries.contains( rendererName ) )
74 mEntries[rendererName].widgetCreateFunction = func;
79 QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it =
mEntries.find( rendererName );
95 QList< QgsRasterRendererRegistryEntry > result;
97 QHash< QString, QgsRasterRendererRegistryEntry >::const_iterator it =
mEntries.constBegin();
98 for ( ; it !=
mEntries.constEnd(); ++it )
100 result.push_back( it.value() );
107 if ( !provider || provider->
bandCount() < 1 )
114 switch ( theDrawingStyle )
119 QList<QgsColorRampShader::ColorRampItem> colorEntries = provider->
colorTable( grayBand );
122 int colorArraySize = 0;
123 QList<QgsColorRampShader::ColorRampItem>::const_iterator colorIt = colorEntries.constBegin();
124 for ( ; colorIt != colorEntries.constEnd(); ++colorIt )
126 if ( colorIt->value > colorArraySize )
128 colorArraySize = ( int )( colorIt->value );
133 QColor* colorArray =
new QColor[ colorArraySize ];
134 colorIt = colorEntries.constBegin();
135 QVector<QString> labels;
136 for ( ; colorIt != colorEntries.constEnd(); ++colorIt )
138 int idx = ( int )( colorIt->value );
139 colorArray[idx] = colorIt->color;
140 if ( !colorIt->label.isEmpty() )
142 if ( labels.size() <= idx ) labels.resize( idx + 1 );
143 labels[idx] = colorIt->label;
182 int redBand = s.value(
"/Raster/defaultRedBand", 1 ).toInt();
183 if ( redBand < 0 || redBand > provider->
bandCount() )
187 int greenBand = s.value(
"/Raster/defaultGreenBand", 2 ).toInt();
188 if ( greenBand < 0 || greenBand > provider->
bandCount() )
192 int blueBand = s.value(
"/Raster/defaultBlueBand", 3 ).toInt();
193 if ( blueBand < 0 || blueBand > provider->
bandCount() )
211 int bandCount = renderer->
usesBands().size();
212 if ( bandCount == 1 )
214 QList<QgsRasterTransparency::TransparentSingleValuePixel> transparentSingleList;
217 else if ( bandCount == 3 )
219 QList<QgsRasterTransparency::TransparentThreeValuePixel> transparentThreeValueList;
237 if ( s.value(
"/Raster/useStandardDeviation",
false ).toBool() )
241 double stdDevFactor = s.value(
"/Raster/defaultStandardDeviation", 2.0 ).toDouble();
242 double diff = stdDevFactor * stats.
stdDev;
243 minValue = stats.
mean - diff;
244 maxValue = stats.
mean + diff;