Skip to content

Commit 5f91848

Browse files
committed
draw histogram boxes for Int16/Int32 also
1 parent 2a2f4ce commit 5f91848

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/gui/raster/qgsrasterhistogramwidget.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ void QgsRasterHistogramWidget::refreshHistogram()
493493
#endif
494494

495495
// calculate first bin x value and bin step size if not Byte data
496-
if ( mRasterLayer->dataProvider()->srcDataType( myIteratorInt ) != QGis::Byte )
496+
QGis::DataType mySrcDataType = mRasterLayer->dataProvider()->srcDataType( myIteratorInt );
497+
if ( mySrcDataType != QGis::Byte )
497498
{
498499
myBinXStep = ( myHistogram.maximum - myHistogram.minimum ) / myHistogram.binCount;
499500
myBinX = myHistogram.minimum + myBinXStep / 2.0;
@@ -502,12 +503,16 @@ void QgsRasterHistogramWidget::refreshHistogram()
502503
{
503504
myBinXStep = 1;
504505
myBinX = 0;
506+
}
505507
#if defined(QWT_VERSION) && QWT_VERSION>=0x060000
506-
// TODO add support for Int16/Int32 types - this requires fixing the sampleSize and/or min/max
507-
if ( ! mHistoDrawLines )
508-
myDrawLines = false;
509-
#endif
508+
if ( ! mHistoDrawLines &&
509+
( mySrcDataType == QGis::Byte ||
510+
mySrcDataType == QGis::Int16 || mySrcDataType == QGis::Int32 ||
511+
mySrcDataType == QGis::UInt16 || mySrcDataType == QGis::UInt32 ) )
512+
{
513+
myDrawLines = false;
510514
}
515+
#endif
511516

512517
for ( int myBin = 0; myBin < myHistogram.binCount; myBin++ )
513518
{

0 commit comments

Comments
 (0)