Skip to content

Commit e425372

Browse files
committedFeb 9, 2015
Coverity fixes
Including a notable bug causing "mean" to be missing from merge attributes dialog options.
1 parent a1b858b commit e425372

28 files changed

+144
-73
lines changed
 

‎src/analysis/interpolation/Bezier3D.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,22 @@ void Bezier3D::calcSecDer( float t, Vector3D* v )
8181
v->setY( 0 );
8282
v->setZ( 0 );
8383

84-
if ( mControlPoly->count() < 3 )
84+
int nodes = mControlPoly->count();
85+
if ( nodes < 3 )
8586
{
8687
return;
8788
}
8889

89-
for ( int n = 1; n <= int( mControlPoly->count() - 2 ); n++ )
90+
for ( int n = 1; n <= int( nodes - 2 ); n++ )
9091
{
91-
double bernst = MathUtils::calcBernsteinPoly( mControlPoly->count() - 3, n - 1, t );
92+
double bernst = MathUtils::calcBernsteinPoly( nodes - 3, n - 1, t );
9293
v->setX( v->getX() + (( *mControlPoly )[n+1]->getX() - 2*( *mControlPoly )[n]->getX() + ( *mControlPoly )[n-1]->getX() )*bernst );
9394
v->setY( v->getY() + (( *mControlPoly )[n+1]->getY() - 2*( *mControlPoly )[n]->getY() + ( *mControlPoly )[n-1]->getY() )*bernst );
9495
v->setZ( v->getZ() + (( *mControlPoly )[n+1]->getZ() - 2*( *mControlPoly )[n]->getZ() + ( *mControlPoly )[n-1]->getZ() )*bernst );
9596
}
96-
v->setX( v->getX()*MathUtils::faculty( mControlPoly->count() - 1 ) / MathUtils::faculty( mControlPoly->count() - 3 ) );
97-
v->setY( v->getY()*MathUtils::faculty( mControlPoly->count() - 1 ) / MathUtils::faculty( mControlPoly->count() - 3 ) );
98-
v->setZ( v->getZ()*MathUtils::faculty( mControlPoly->count() - 1 ) / MathUtils::faculty( mControlPoly->count() - 3 ) );
97+
v->setX( v->getX()*MathUtils::faculty( nodes - 1 ) / MathUtils::faculty( nodes - 3 ) );
98+
v->setY( v->getY()*MathUtils::faculty( nodes - 1 ) / MathUtils::faculty( nodes - 3 ) );
99+
v->setZ( v->getZ()*MathUtils::faculty( nodes - 1 ) / MathUtils::faculty( nodes - 3 ) );
99100
}
100101

101102
else

‎src/analysis/interpolation/CloughTocherInterpolator.cc

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,53 @@
1717
#include "CloughTocherInterpolator.h"
1818
#include "qgslogger.h"
1919

20-
#include <cmath>
20+
#include <qmath.h>
21+
22+
CloughTocherInterpolator::CloughTocherInterpolator()
23+
: mTIN( 0 )
24+
, mEdgeTolerance( 0.00001 )
25+
, der1X( 0.0 )
26+
, der1Y( 0.0 )
27+
, der2X( 0.0 )
28+
, der2Y( 0.0 )
29+
, der3X( 0.0 )
30+
, der3Y( 0.0 )
31+
{
32+
33+
}
34+
35+
CloughTocherInterpolator::CloughTocherInterpolator( NormVecDecorator* tin )
36+
: mTIN( tin )
37+
, mEdgeTolerance( 0.00001 )
38+
, der1X( 0.0 )
39+
, der1Y( 0.0 )
40+
, der2X( 0.0 )
41+
, der2Y( 0.0 )
42+
, der3X( 0.0 )
43+
, der3Y( 0.0 )
44+
{
45+
46+
}
47+
48+
CloughTocherInterpolator::~CloughTocherInterpolator()
49+
{
50+
//nothing to do
51+
}
52+
53+
void CloughTocherInterpolator::setTriangulation( NormVecDecorator* tin )
54+
{
55+
mTIN = tin;
56+
}
2157

2258
double CloughTocherInterpolator::calcBernsteinPoly( int n, int i, int j, int k, double u, double v, double w )
2359
{
24-
double result = MathUtils::faculty( n ) * MathUtils::power( u, i ) * MathUtils::power( v, j ) * MathUtils::power( w, k ) / ( MathUtils::faculty( i ) * MathUtils::faculty( j ) * MathUtils::faculty( k ) );
60+
if ( i < 0 || j < 0 || k < 0 )
61+
{
62+
QgsDebugMsg( "Invalid parameters for Bernstein poly calculation!" );
63+
return 0;
64+
}
65+
66+
double result = MathUtils::faculty( n ) * qPow( u, i ) * qPow( v, j ) * qPow( w, k ) / ( MathUtils::faculty( i ) * MathUtils::faculty( j ) * MathUtils::faculty( k ) );
2567
return result;
2668
}
2769

@@ -728,8 +770,3 @@ void CloughTocherInterpolator::init( double x, double y )//version which has uni
728770
#endif
729771

730772

731-
732-
733-
734-
735-

‎src/analysis/interpolation/CloughTocherInterpolator.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -91,27 +91,6 @@ class ANALYSIS_EXPORT CloughTocherInterpolator : public TriangleInterpolator
9191
virtual void setTriangulation( NormVecDecorator* tin );
9292
};
9393

94-
95-
inline CloughTocherInterpolator::CloughTocherInterpolator() : mTIN( 0 ), mEdgeTolerance( 0.00001 )
96-
{
97-
98-
}
99-
100-
inline CloughTocherInterpolator::CloughTocherInterpolator( NormVecDecorator* tin ) : mTIN( tin ), mEdgeTolerance( 0.00001 )
101-
{
102-
103-
}
104-
105-
inline CloughTocherInterpolator::~CloughTocherInterpolator()
106-
{
107-
//nothing to do
108-
}
109-
110-
inline void CloughTocherInterpolator::setTriangulation( NormVecDecorator* tin )
111-
{
112-
mTIN = tin;
113-
}
114-
11594
#endif
11695

11796

‎src/analysis/interpolation/MathUtils.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "MathUtils.h"
1818
#include "qgslogger.h"
19+
#include <qmath.h>
1920

2021
bool MathUtils::calcBarycentricCoordinates( double x, double y, Point3D* p1, Point3D* p2, Point3D* p3, Point3D* result )
2122
{
@@ -104,7 +105,7 @@ double MathUtils::calcBernsteinPoly( int n, int i, double t )
104105
return 0;
105106
}
106107

107-
return lower( n, i )*power( t, i )*power(( 1 - t ), ( n - i ) );
108+
return lower( n, i )*qPow( t, i )*qPow(( 1 - t ), ( n - i ) );
108109
}
109110

110111
double MathUtils::cFDerBernsteinPoly( int n, int i, double t )

‎src/analysis/interpolation/qgsgridfilewriter.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,23 @@
2323
#include <QProgressDialog>
2424

2525
QgsGridFileWriter::QgsGridFileWriter( QgsInterpolator* i, QString outputPath, QgsRectangle extent, int nCols, int nRows, double cellSizeX, double cellSizeY )
26-
: mInterpolator( i ), mOutputFilePath( outputPath ), mInterpolationExtent( extent ), mNumColumns( nCols ), mNumRows( nRows )
27-
, mCellSizeX( cellSizeX ), mCellSizeY( cellSizeY )
26+
: mInterpolator( i )
27+
, mOutputFilePath( outputPath )
28+
, mInterpolationExtent( extent )
29+
, mNumColumns( nCols )
30+
, mNumRows( nRows )
31+
, mCellSizeX( cellSizeX )
32+
, mCellSizeY( cellSizeY )
2833
{
2934

3035
}
3136

32-
QgsGridFileWriter::QgsGridFileWriter(): mInterpolator( 0 )
37+
QgsGridFileWriter::QgsGridFileWriter()
38+
: mInterpolator( 0 )
39+
, mNumColumns( 0 )
40+
, mNumRows( 0 )
41+
, mCellSizeX( 0 )
42+
, mCellSizeY( 0 )
3343
{
3444

3545
}

‎src/analysis/interpolation/qgsinterpolator.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
2020
#include "qgsvectorlayer.h"
2121
#include "qgsgeometry.h"
2222

23-
QgsInterpolator::QgsInterpolator( const QList<LayerData>& layerData ): mDataIsCached( false ), mLayerData( layerData )
23+
QgsInterpolator::QgsInterpolator( const QList<LayerData>& layerData )
24+
: mDataIsCached( false )
25+
, mLayerData( layerData )
2426
{
2527

2628
}
2729

2830
QgsInterpolator::QgsInterpolator()
31+
: mDataIsCached( false )
2932
{
3033

3134
}

‎src/analysis/network/qgsgraph.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ int QgsGraph::findVertex( const QgsPoint& pt ) const
8383
}
8484

8585
QgsGraphArc::QgsGraphArc()
86+
: mOut( 0 )
87+
, mIn( 0 )
8688
{
8789

8890
}

‎src/analysis/raster/qgsrastercalcnode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ QgsRasterCalcNode::QgsRasterCalcNode()
2020
, mLeft( 0 )
2121
, mRight( 0 )
2222
, mNumber( 0 )
23+
, mOperator( opPLUS ) //not used
2324
{
2425
}
2526

@@ -28,6 +29,7 @@ QgsRasterCalcNode::QgsRasterCalcNode( double number )
2829
, mLeft( 0 )
2930
, mRight( 0 )
3031
, mNumber( number )
32+
, mOperator( opPLUS ) //not used
3133
{
3234
}
3335

@@ -46,6 +48,7 @@ QgsRasterCalcNode::QgsRasterCalcNode( const QString& rasterName )
4648
, mRight( 0 )
4749
, mNumber( 0 )
4850
, mRasterName( rasterName )
51+
, mOperator( opPLUS ) //not used
4952
{
5053
}
5154

‎src/analysis/raster/qgsrastercalculator.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
250250
}
251251

252252
QgsRasterCalculator::QgsRasterCalculator()
253+
: mNumOutputColumns( 0 )
254+
, mNumOutputRows( 0 )
253255
{
254256
}
255257

‎src/analysis/raster/qgsrastermatrix.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020

2121
#include <cmath>
2222

23-
QgsRasterMatrix::QgsRasterMatrix(): mColumns( 0 ), mRows( 0 ), mData( 0 )
23+
QgsRasterMatrix::QgsRasterMatrix()
24+
: mColumns( 0 )
25+
, mRows( 0 )
26+
, mData( 0 )
27+
, mNodataValue( -1 )
2428
{
2529
}
2630

‎src/analysis/raster/qgsrelief.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@
3333
#define TO8F(x) QFile::encodeName( x ).constData()
3434
#endif
3535

36-
QgsRelief::QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \
37-
mInputFile( inputFile ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), mZFactor( 1.0 )
36+
QgsRelief::QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
37+
: mInputFile( inputFile )
38+
, mOutputFile( outputFile )
39+
, mOutputFormat( outputFormat )
40+
, mCellSizeX( 0.0 )
41+
, mCellSizeY( 0.0 )
42+
, mInputNodataValue( -1 )
43+
, mOutputNodataValue( -1 )
44+
, mZFactor( 1.0 )
3845
{
3946
mSlopeFilter = new QgsSlopeFilter( inputFile, outputFile, outputFormat );
4047
mAspectFilter = new QgsAspectFilter( inputFile, outputFile, outputFormat );

‎src/analysis/vector/qgstransectsample.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ int QgsTransectSample::createSample( QProgressDialog* pd )
146146
}
147147

148148
//find baseline for strata
149-
bool strataIdOk = true;
150149
QVariant strataId = fet.attribute( mStrataIdAttribute );
151-
QgsGeometry* baselineGeom = findBaselineGeometry( strataIdOk ? strataId : -1 );
150+
QgsGeometry* baselineGeom = findBaselineGeometry( strataId.isValid() ? strataId : -1 );
152151
if ( !baselineGeom )
153152
{
154153
continue;

‎src/analysis/vector/qgszonalstatistics.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ QgsZonalStatistics::QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QStr
4343
QgsZonalStatistics::QgsZonalStatistics()
4444
: mRasterBand( 0 )
4545
, mPolygonLayer( 0 )
46+
, mInputNodataValue( -1 )
4647
{
4748

4849
}

‎src/app/composer/qgscomposerpicturewidget.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ int QgsComposerPictureWidget::addDirectoryToPreview( const QString& path )
486486
QIcon icon( filePath );
487487
listItem->setIcon( icon );
488488
}
489-
else if ( fileIsPixel ) //for pixel formats: create icon from scaled pixmap
489+
else //for pixel formats: create icon from scaled pixmap
490490
{
491491
QPixmap iconPixmap( filePath );
492492
if ( iconPixmap.isNull() )
@@ -498,10 +498,6 @@ int QgsComposerPictureWidget::addDirectoryToPreview( const QString& path )
498498
QIcon icon( scaledPixmap );
499499
listItem->setIcon( icon );
500500
}
501-
else
502-
{
503-
++counter; continue;
504-
}
505501

506502
listItem->setText( "" );
507503
//store the absolute icon file path as user data

‎src/app/composer/qgscomposerscalebarwidget.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ void QgsComposerScaleBarWidget::refreshMapComboBox()
104104
mMapComboBox->addItem( tr( "Map %1" ).arg(( *mapItemIt )->id() ) );
105105
}
106106
}
107-
}
108107

109-
if ( saveCurrentComboText.isEmpty() && mComposerScaleBar->composerMap() )
110-
{
111-
//combo box was not initialised before
112-
mMapComboBox->setCurrentIndex( mMapComboBox->findText( tr( "Map %1" ).arg( mComposerScaleBar->composerMap()->id() ) ) );
108+
if ( saveCurrentComboText.isEmpty() && mComposerScaleBar->composerMap() )
109+
{
110+
//combo box was not initialised before
111+
mMapComboBox->setCurrentIndex( mMapComboBox->findText( tr( "Map %1" ).arg( mComposerScaleBar->composerMap()->id() ) ) );
112+
}
113113
}
114114
if ( mMapComboBox->findText( saveCurrentComboText ) == -1 )
115115
{

‎src/app/composer/qgscompositionwidget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,10 @@ void QgsCompositionWidget::on_mPageStyleButton_clicked()
527527
}
528528

529529
QgsFillSymbolV2* newSymbol = dynamic_cast<QgsFillSymbolV2*>( mComposition->pageStyleSymbol()->clone() );
530+
if ( !newSymbol )
531+
{
532+
newSymbol = new QgsFillSymbolV2();
533+
}
530534
QgsSymbolV2SelectorDialog d( newSymbol, QgsStyleV2::defaultStyle(), coverageLayer );
531535

532536
if ( d.exec() == QDialog::Accepted )

‎src/app/qgsdecorationgrid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ bool QgsDecorationGrid::getIntervalFromCurrentLayer( double* values )
828828
return false;
829829
}
830830
QgsRasterLayer* rlayer = dynamic_cast<QgsRasterLayer*>( layer );
831-
if ( !rlayer )
831+
if ( !rlayer || rlayer->width() == 0 || rlayer->height() == 0 )
832832
{
833833
QMessageBox::warning( 0, tr( "Error" ), tr( "Invalid raster layer" ) );
834834
return false;

‎src/app/qgslabelpreview.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ QgsLabelPreview::QgsLabelPreview( QWidget* parent )
2626

2727
// construct a device-based render context
2828
QgsMapToPixel newCoordXForm;
29-
newCoordXForm.setParameters( 0, 0, 0, 0 );
29+
newCoordXForm.setParameters( 1, 0, 0, 0 );
3030
mContext = new QgsRenderContext();
3131
mContext->setMapToPixel( newCoordXForm );
3232
}

‎src/app/qgsmergeattributesdialog.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,12 @@ QComboBox *QgsMergeAttributesDialog::createMergeComboBox( QVariant::Type columnT
159159
newComboBox->addItem( tr( "Maximum" ), "maximum" );
160160
newComboBox->addItem( tr( "Median" ), "median" );
161161
newComboBox->addItem( tr( "Sum" ), "sum" );
162+
newComboBox->addItem( tr( "Mean" ), "mean" );
162163
}
163164
else if ( columnType == QVariant::String )
164165
{
165166
newComboBox->addItem( tr( "Concatenation" ), "concat" );
166167
}
167-
else if ( columnType == QVariant::Double )
168-
{
169-
newComboBox->addItem( tr( "Mean" ), "mean" );
170-
}
171168

172169
newComboBox->addItem( tr( "Skip attribute" ), "skip" );
173170

‎src/core/composer/qgsaddremovemultiframecommand.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,20 @@
2121
#include "qgsproject.h"
2222

2323

24-
QgsAddRemoveMultiFrameCommand::QgsAddRemoveMultiFrameCommand( State s, QgsComposerMultiFrame* multiFrame, QgsComposition* c, const QString& text, QUndoCommand* parent ):
25-
QUndoCommand( text, parent ), mMultiFrame( multiFrame ), mComposition( c ), mState( s ), mFirstRun( true )
24+
QgsAddRemoveMultiFrameCommand::QgsAddRemoveMultiFrameCommand( State s, QgsComposerMultiFrame* multiFrame, QgsComposition* c, const QString& text, QUndoCommand* parent )
25+
: QUndoCommand( text, parent )
26+
, mMultiFrame( multiFrame )
27+
, mComposition( c )
28+
, mState( s )
29+
, mFirstRun( true )
2630
{
2731
}
2832

29-
QgsAddRemoveMultiFrameCommand::QgsAddRemoveMultiFrameCommand(): mMultiFrame( 0 ), mComposition( 0 )
33+
QgsAddRemoveMultiFrameCommand::QgsAddRemoveMultiFrameCommand()
34+
: mMultiFrame( 0 )
35+
, mComposition( 0 )
36+
, mState( Added )
37+
, mFirstRun( true )
3038
{
3139
}
3240

‎src/core/composer/qgscomposerhtml.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ QgsComposerHtml::QgsComposerHtml()
9797
, mExpressionFeature( 0 )
9898
, mExpressionLayer( 0 )
9999
, mDistanceArea( 0 )
100+
, mEnableUserStylesheet( false )
100101
, mFetcher( 0 )
101102
{
102103
mDistanceArea = new QgsDistanceArea();

‎src/core/composer/qgscomposerlegend.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ QgsComposerLegend::QgsComposerLegend()
5050
, mLegendModel2( 0 )
5151
, mCustomLayerTree( 0 )
5252
, mComposerMap( 0 )
53+
, mLegendFilterByMap( false )
5354
{
5455

5556
}

‎src/core/composer/qgscomposermap.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,10 @@ QPen QgsComposerMap::gridPen() const
16621662
if ( g->lineSymbol() )
16631663
{
16641664
QgsLineSymbolV2* line = dynamic_cast<QgsLineSymbolV2*>( g->lineSymbol()->clone() );
1665+
if ( !line )
1666+
{
1667+
return p;
1668+
}
16651669
p.setWidthF( line->width() );
16661670
p.setColor( line->color() );
16671671
p.setCapStyle( Qt::FlatCap );

‎src/core/composer/qgscomposermultiframe.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ QgsComposerMultiFrame::QgsComposerMultiFrame( QgsComposition* c, bool createUndo
2828
connect( mComposition, SIGNAL( nPagesChanged() ), this, SLOT( handlePageChange() ) );
2929
}
3030

31-
QgsComposerMultiFrame::QgsComposerMultiFrame():
32-
QgsComposerObject( 0 ),
33-
mResizeMode( UseExistingFrames ),
34-
mIsRecalculatingSize( false )
31+
QgsComposerMultiFrame::QgsComposerMultiFrame()
32+
: QgsComposerObject( 0 )
33+
, mResizeMode( UseExistingFrames )
34+
, mCreateUndoCommands( false )
35+
, mIsRecalculatingSize( false )
3536
{
3637
}
3738

‎src/core/composer/qgscomposertablev2.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ QgsComposerTableV2::QgsComposerTableV2( QgsComposition *composition, bool create
5353

5454
QgsComposerTableV2::QgsComposerTableV2()
5555
: QgsComposerMultiFrame( 0, false )
56+
, mCellMargin( 1.0 )
57+
, mEmptyTableMode( HeadersOnly )
58+
, mShowEmptyRows( false )
59+
, mHeaderFontColor( Qt::black )
60+
, mHeaderHAlignment( FollowColumn )
61+
, mHeaderMode( FirstFrame )
62+
, mContentFontColor( Qt::black )
63+
, mShowGrid( true )
64+
, mGridStrokeWidth( 0.5 )
65+
, mGridColor( Qt::black )
66+
, mBackgroundColor( Qt::white )
5667
{
5768

5869
}

‎src/core/qgsmaptopixel.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ QgsMapToPixel::QgsMapToPixel( double mapUnitsPerPixel,
3939
, xMin( xc - ( mWidth * mMapUnitsPerPixel / 2.0 ) )
4040
, yMin( yc - ( mHeight * mMapUnitsPerPixel / 2.0 ) )
4141
{
42+
Q_ASSERT( mapUnitsPerPixel > 0 );
4243
updateMatrix();
4344
}
4445

@@ -100,11 +101,9 @@ void QgsMapToPixel::updateMatrix()
100101
// center happens first, then scaling, then rotation
101102
// and finally translation to output viewport center
102103

103-
if ( ! rotation )
104+
if ( qgsDoubleNear( rotation, 0.0 ) )
104105
{
105-
// Returning a simplified matrix in hope it'll give expected
106-
// results from an existing test, see
107-
// https://travis-ci.org/qgis/QGIS/builds/42508945
106+
//no rotation, return a simplified matrix
108107
mMatrix = QTransform::fromScale( 1.0 / mMapUnitsPerPixel, -1.0 / mMapUnitsPerPixel )
109108
.translate( -xMin, - ( yMin + mHeight * mMapUnitsPerPixel ) );
110109
return;

‎src/gui/symbology-ng/qgscategorizedsymbolrendererv2widget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ bool QgsCategorizedSymbolRendererV2Model::dropMimeData( const QMimeData *data, Q
287287
QgsDebugMsg( QString( "move %1 to %2" ).arg( rows[i] ).arg( to ) );
288288
int t = to;
289289
// moveCategory first removes and then inserts
290-
if ( rows[i] < to ) t--;
290+
if ( rows[i] < t ) t--;
291291
mRenderer->moveCategory( rows[i], t );
292292
// current moved under another, shift its index up
293293
for ( int j = 0; j < i; j++ )

‎src/gui/symbology-ng/qgsgraduatedsymbolrendererv2widget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ bool QgsGraduatedSymbolRendererV2Model::dropMimeData( const QMimeData *data, Qt:
283283
QgsDebugMsg( QString( "move %1 to %2" ).arg( rows[i] ).arg( to ) );
284284
int t = to;
285285
// moveCategory first removes and then inserts
286-
if ( rows[i] < to ) t--;
286+
if ( rows[i] < t ) t--;
287287
mRenderer->moveClass( rows[i], t );
288288
// current moved under another, shift its index up
289289
for ( int j = 0; j < i; j++ )

0 commit comments

Comments
 (0)
Please sign in to comment.