mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Fix some warnings when building with clang and -Weverything
This commit is contained in:
parent
80de178d9e
commit
ec35dbee92
@ -220,7 +220,7 @@ inline DualEdgeTriangulation::DualEdgeTriangulation( int nop, Triangulation* dec
|
||||
|
||||
inline int DualEdgeTriangulation::getNumberOfPoints() const
|
||||
{
|
||||
return (( int )( mPointVector.count() ) );
|
||||
return mPointVector.count();
|
||||
}
|
||||
|
||||
inline Point3D* DualEdgeTriangulation::getPoint( unsigned int i ) const
|
||||
|
@ -137,7 +137,7 @@ class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand
|
||||
~QgsComposerMergeCommand();
|
||||
|
||||
bool mergeWith( const QUndoCommand * command ) override;
|
||||
int id() const override { return ( int )mContext; }
|
||||
int id() const override { return static_cast< int >( mContext ); }
|
||||
|
||||
private:
|
||||
Context mContext;
|
||||
|
@ -81,7 +81,7 @@ class CORE_EXPORT QgsComposerMultiFrameMergeCommand: public QgsComposerMultiFram
|
||||
~QgsComposerMultiFrameMergeCommand();
|
||||
|
||||
bool mergeWith( const QUndoCommand * command ) override;
|
||||
int id() const override { return ( int )mContext; }
|
||||
int id() const override { return static_cast< int >( mContext ); }
|
||||
|
||||
private:
|
||||
Context mContext;
|
||||
|
@ -117,7 +117,7 @@ class CORE_EXPORT QgsDxfExport
|
||||
* @param layerTitleAsName flag
|
||||
* @see addLayers
|
||||
*/
|
||||
void setLayerTitleAsName( bool layerTitleAsName ) { mLayerTitleAsName = layerTitleAsName; };
|
||||
void setLayerTitleAsName( bool layerTitleAsName ) { mLayerTitleAsName = layerTitleAsName; }
|
||||
|
||||
/**
|
||||
* Retrieve wether layer title (where set) instead of name shall be use
|
||||
|
@ -219,7 +219,7 @@ class CORE_EXPORT QgsImageOperation
|
||||
{
|
||||
for ( unsigned int y = block.beginLine; y < block.endLine; ++y )
|
||||
{
|
||||
QRgb* ref = ( QRgb* )block.image->scanLine( y );
|
||||
QRgb* ref = reinterpret_cast< QRgb* >( block.image->scanLine( y ) );
|
||||
for ( unsigned int x = 0; x < block.lineLength; ++x )
|
||||
{
|
||||
mOperation( ref[x], x, y );
|
||||
@ -249,7 +249,7 @@ class CORE_EXPORT QgsImageOperation
|
||||
{
|
||||
for ( unsigned int y = block.beginLine; y < block.endLine; ++y )
|
||||
{
|
||||
QRgb* ref = ( QRgb* )block.image->scanLine( y );
|
||||
QRgb* ref = reinterpret_cast< QRgb* >( block.image->scanLine( y ) );
|
||||
mOperation( ref, block.lineLength, bpl );
|
||||
}
|
||||
}
|
||||
@ -259,7 +259,7 @@ class CORE_EXPORT QgsImageOperation
|
||||
unsigned char* ref = block.image->scanLine( 0 ) + 4 * block.beginLine;
|
||||
for ( unsigned int x = block.beginLine; x < block.endLine; ++x, ref += 4 )
|
||||
{
|
||||
mOperation(( QRgb* )ref, block.lineLength, bpl );
|
||||
mOperation( reinterpret_cast< QRgb* >( ref ), block.lineLength, bpl );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ QGis::WkbType QgsGeometry::wkbType() const
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( QGis::WkbType )d->geometry->wkbType();
|
||||
return static_cast< QGis::WkbType >( d->geometry->wkbType() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ QGis::GeometryType QgsGeometry::type() const
|
||||
{
|
||||
return QGis::UnknownGeometry;
|
||||
}
|
||||
return ( QGis::GeometryType )( QgsWKBTypes::geometryType( d->geometry->wkbType() ) );
|
||||
return static_cast< QGis::GeometryType >( QgsWKBTypes::geometryType( d->geometry->wkbType() ) );
|
||||
}
|
||||
|
||||
bool QgsGeometry::isMultipart() const
|
||||
@ -1917,7 +1917,6 @@ QgsGeometry* QgsGeometry::smooth( const unsigned int iterations, const double of
|
||||
}
|
||||
return QgsGeometry::fromMultiPolygon( resultMultipoly );
|
||||
}
|
||||
break;
|
||||
|
||||
case QGis::WKBUnknown:
|
||||
default:
|
||||
@ -2303,7 +2302,7 @@ QgsGeometryEngine* QgsGeometry::createGeometryEngine( const QgsAbstractGeometryV
|
||||
|
||||
QDataStream& operator<<( QDataStream& out, const QgsGeometry& geometry )
|
||||
{
|
||||
QByteArray byteArray = QByteArray::fromRawData(( char * )geometry.asWkb(), geometry.wkbSize() ); // does not copy data and does not take ownership
|
||||
QByteArray byteArray = QByteArray::fromRawData( reinterpret_cast< const char * >( geometry.asWkb() ), geometry.wkbSize() ); // does not copy data and does not take ownership
|
||||
out << byteArray;
|
||||
return out;
|
||||
}
|
||||
@ -2320,6 +2319,6 @@ QDataStream& operator>>( QDataStream& in, QgsGeometry& geometry )
|
||||
|
||||
char *data = new char[byteArray.size()];
|
||||
memcpy( data, byteArray.data(), byteArray.size() );
|
||||
geometry.fromWkb(( unsigned char* )data, byteArray.size() );
|
||||
geometry.fromWkb( reinterpret_cast< unsigned char* >( data ), byteArray.size() );
|
||||
return in;
|
||||
}
|
||||
|
@ -149,7 +149,7 @@ bool QgsGeometryUtils::lineIntersection( const QgsPointV2& p1, const QgsVector&
|
||||
{
|
||||
double d = v.y() * w.x() - v.x() * w.y();
|
||||
|
||||
if ( d == 0 )
|
||||
if ( qgsDoubleNear( d, 0 ) )
|
||||
return false;
|
||||
|
||||
double dx = q1.x() - p1.x();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
QgsConstWkbPtr::QgsConstWkbPtr( const unsigned char *p ): mEndianSwap( false )
|
||||
{
|
||||
mP = ( unsigned char * ) p;
|
||||
mP = const_cast< unsigned char * >( p );
|
||||
}
|
||||
|
||||
QgsWKBTypes::Type QgsConstWkbPtr::readHeader() const
|
||||
|
@ -68,7 +68,7 @@ QgsWKBTypes::Type QgsWKBTypes::flatType( Type type )
|
||||
QgsWKBTypes::Type QgsWKBTypes::parseType( const QString &wktStr )
|
||||
{
|
||||
QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' );
|
||||
Q_FOREACH ( const Type& type, entries()->keys() )
|
||||
Q_FOREACH ( Type type, entries()->keys() )
|
||||
{
|
||||
QMap< Type, wkbEntry >::const_iterator it = entries()->constFind( type );
|
||||
if ( it != entries()->constEnd() && it.value().mName.compare( typestr, Qt::CaseInsensitive ) == 0 )
|
||||
@ -185,9 +185,9 @@ QgsWKBTypes::Type QgsWKBTypes::addZ( QgsWKBTypes::Type type )
|
||||
//upgrade with z dimension
|
||||
Type flat = flatType( type );
|
||||
if ( hasM( type ) )
|
||||
return ( QgsWKBTypes::Type )( flat + 3000 );
|
||||
return static_cast< QgsWKBTypes::Type >( flat + 3000 );
|
||||
else
|
||||
return ( QgsWKBTypes::Type )( flat + 1000 );
|
||||
return static_cast< QgsWKBTypes::Type >( flat + 1000 );
|
||||
}
|
||||
|
||||
QgsWKBTypes::Type QgsWKBTypes::addM( QgsWKBTypes::Type type )
|
||||
@ -209,9 +209,9 @@ QgsWKBTypes::Type QgsWKBTypes::addM( QgsWKBTypes::Type type )
|
||||
//upgrade with m dimension
|
||||
Type flat = flatType( type );
|
||||
if ( hasZ( type ) )
|
||||
return ( QgsWKBTypes::Type )( flat + 3000 );
|
||||
return static_cast< QgsWKBTypes::Type >( flat + 3000 );
|
||||
else
|
||||
return ( QgsWKBTypes::Type )( flat + 2000 );
|
||||
return static_cast< QgsWKBTypes::Type >( flat + 2000 );
|
||||
}
|
||||
|
||||
QgsWKBTypes::Type QgsWKBTypes::dropZ( QgsWKBTypes::Type type )
|
||||
|
@ -46,7 +46,7 @@ void QgsGpsdConnection::connected()
|
||||
|
||||
void QgsGpsdConnection::error( QAbstractSocket::SocketError socketError )
|
||||
{
|
||||
#if QGISDEBUG
|
||||
#ifdef QGISDEBUG
|
||||
QTcpSocket *socket = qobject_cast< QTcpSocket * >( mSource );
|
||||
QgsDebugMsg( QString( "error: %1 %2" ).arg( socketError ).arg( socket->errorString() ) );
|
||||
#else
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
|
||||
#if defined(_VERBOSE_) || (_DEBUG_)
|
||||
#if defined(_VERBOSE_) || defined(_DEBUG_)
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
|
@ -27,8 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include "pal.h"
|
||||
#include "layer.h"
|
||||
#include "palexception.h"
|
||||
|
@ -29,8 +29,6 @@
|
||||
|
||||
//#define _VERBOSE_
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include "qgsgeometry.h"
|
||||
#include "pal.h"
|
||||
#include "layer.h"
|
||||
@ -151,7 +149,7 @@ namespace pal
|
||||
bool extractFeatCallback( FeaturePart *ft_ptr, void *ctx )
|
||||
{
|
||||
double amin[2], amax[2];
|
||||
FeatCallBackCtx *context = ( FeatCallBackCtx* ) ctx;
|
||||
FeatCallBackCtx *context = reinterpret_cast< FeatCallBackCtx* >( ctx );
|
||||
|
||||
// Holes of the feature are obstacles
|
||||
for ( int i = 0; i < ft_ptr->getNumSelfObstacles(); i++ )
|
||||
@ -200,7 +198,7 @@ namespace pal
|
||||
bool extractObstaclesCallback( FeaturePart *ft_ptr, void *ctx )
|
||||
{
|
||||
double amin[2], amax[2];
|
||||
ObstacleCallBackCtx *context = ( ObstacleCallBackCtx* ) ctx;
|
||||
ObstacleCallBackCtx *context = reinterpret_cast< ObstacleCallBackCtx* >( ctx );
|
||||
|
||||
// insert into obstacles
|
||||
ft_ptr->getBoundingBox( amin, amax );
|
||||
@ -218,8 +216,8 @@ namespace pal
|
||||
bool filteringCallback( FeaturePart *featurePart, void *ctx )
|
||||
{
|
||||
|
||||
RTree<LabelPosition*, double, 2, double> *cdtsIndex = (( FilterContext* ) ctx )->cdtsIndex;
|
||||
Pal* pal = (( FilterContext* )ctx )->pal;
|
||||
RTree<LabelPosition*, double, 2, double> *cdtsIndex = ( reinterpret_cast< FilterContext* >( ctx ) )->cdtsIndex;
|
||||
Pal* pal = ( reinterpret_cast< FilterContext* >( ctx ) )->pal;
|
||||
|
||||
if ( pal->isCancelled() )
|
||||
return false; // do not continue searching
|
||||
@ -230,7 +228,7 @@ namespace pal
|
||||
LabelPosition::PruneCtx pruneContext;
|
||||
pruneContext.obstacle = featurePart;
|
||||
pruneContext.pal = pal;
|
||||
cdtsIndex->Search( amin, amax, LabelPosition::pruneCallback, ( void* ) &pruneContext );
|
||||
cdtsIndex->Search( amin, amax, LabelPosition::pruneCallback, static_cast< void* >( &pruneContext ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -306,9 +304,9 @@ namespace pal
|
||||
|
||||
// find features within bounding box and generate candidates list
|
||||
context.layer = layer;
|
||||
layer->mFeatureIndex->Search( amin, amax, extractFeatCallback, ( void* ) &context );
|
||||
layer->mFeatureIndex->Search( amin, amax, extractFeatCallback, static_cast< void* >( &context ) );
|
||||
// find obstacles within bounding box
|
||||
layer->mObstacleIndex->Search( amin, amax, extractObstaclesCallback, ( void* ) &obstacleContext );
|
||||
layer->mObstacleIndex->Search( amin, amax, extractObstaclesCallback, static_cast< void* >( &obstacleContext ) );
|
||||
|
||||
layer->mMutex.unlock();
|
||||
|
||||
@ -353,7 +351,7 @@ namespace pal
|
||||
FilterContext filterCtx;
|
||||
filterCtx.cdtsIndex = prob->candidates;
|
||||
filterCtx.pal = this;
|
||||
obstacles->Search( amin, amax, filteringCallback, ( void* ) &filterCtx );
|
||||
obstacles->Search( amin, amax, filteringCallback, static_cast< void* >( &filterCtx ) );
|
||||
|
||||
if ( isCancelled() )
|
||||
{
|
||||
@ -450,7 +448,7 @@ namespace pal
|
||||
lp->getBoundingBox( amin, amax );
|
||||
|
||||
// lookup for overlapping candidate
|
||||
prob->candidates->Search( amin, amax, LabelPosition::countOverlapCallback, ( void* ) lp );
|
||||
prob->candidates->Search( amin, amax, LabelPosition::countOverlapCallback, static_cast< void* >( lp ) );
|
||||
|
||||
nbOverlaps += lp->getNumOverlaps();
|
||||
}
|
||||
|
@ -27,10 +27,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef POINT_SET_H
|
||||
#define POINT_SET_H
|
||||
|
||||
#if defined(_VERBOSE_) || (_DEBUG_) || (_DEBUG_FULL_)
|
||||
#if defined(_VERBOSE_) || defined(_DEBUG_) || defined(_DEBUG_FULL_)
|
||||
#include <iostream>
|
||||
#endif
|
||||
|
||||
@ -1054,5 +1051,3 @@ namespace pal
|
||||
|
||||
|
||||
} // end namespace
|
||||
|
||||
#endif
|
||||
|
@ -27,8 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include "pal.h"
|
||||
#include "palstat.h"
|
||||
#include "layer.h"
|
||||
@ -453,7 +451,7 @@ namespace pal
|
||||
|
||||
SubPart *current = nullptr;
|
||||
|
||||
#if _VERBOSE_
|
||||
#ifdef _VERBOSE_
|
||||
int subPartTotalSize = 0;
|
||||
#endif
|
||||
|
||||
@ -472,7 +470,7 @@ namespace pal
|
||||
for ( i = 0; i < nbft; i++ )
|
||||
{
|
||||
parts[i] = subPart( r, i, isIn );
|
||||
#if _VERBOSE_
|
||||
#ifdef _VERBOSE_
|
||||
subPartTotalSize += parts[i]->subSize;
|
||||
#endif
|
||||
ok[i] = false;
|
||||
|
@ -417,28 +417,28 @@ namespace pal
|
||||
size_t Write( const TYPE& a_value )
|
||||
{
|
||||
ASSERT( m_file );
|
||||
return fwrite(( void* ) &a_value, sizeof( a_value ), 1, m_file );
|
||||
return fwrite( static_cast< void* >( &a_value ), sizeof( a_value ), 1, m_file );
|
||||
}
|
||||
|
||||
template< typename TYPE >
|
||||
size_t WriteArray( const TYPE* a_array, int a_count )
|
||||
{
|
||||
ASSERT( m_file );
|
||||
return fwrite(( void* ) a_array, sizeof( TYPE ) * a_count, 1, m_file );
|
||||
return fwrite( static_cast< void* >( a_array ), sizeof( TYPE ) * a_count, 1, m_file );
|
||||
}
|
||||
|
||||
template< typename TYPE >
|
||||
size_t Read( TYPE& a_value )
|
||||
{
|
||||
ASSERT( m_file );
|
||||
return fread(( void* ) &a_value, sizeof( a_value ), 1, m_file );
|
||||
return fread( static_cast< void* >( &a_value ), sizeof( a_value ), 1, m_file );
|
||||
}
|
||||
|
||||
template< typename TYPE >
|
||||
size_t ReadArray( TYPE* a_array, int a_count )
|
||||
{
|
||||
ASSERT( m_file );
|
||||
return fread(( void* ) a_array, sizeof( TYPE ) * a_count, 1, m_file );
|
||||
return fread( static_cast< void* >( a_array ), sizeof( TYPE ) * a_count, 1, m_file );
|
||||
}
|
||||
};
|
||||
|
||||
@ -468,7 +468,7 @@ namespace pal
|
||||
|
||||
m_root = AllocNode();
|
||||
m_root->m_level = 0;
|
||||
m_unitSphereVolume = ( ELEMTYPEREAL ) UNIT_SPHERE_VOLUMES[NUMDIMS];
|
||||
m_unitSphereVolume = static_cast< ELEMTYPEREAL >( UNIT_SPHERE_VOLUMES[NUMDIMS] );
|
||||
}
|
||||
|
||||
|
||||
@ -866,8 +866,8 @@ namespace pal
|
||||
{
|
||||
for ( int index = 0; index < NUMDIMS; ++index )
|
||||
{
|
||||
a_rect->m_min[index] = ( ELEMTYPE ) 0;
|
||||
a_rect->m_max[index] = ( ELEMTYPE ) 0;
|
||||
a_rect->m_min[index] = static_cast< ELEMTYPE >( 0 );
|
||||
a_rect->m_max[index] = static_cast< ELEMTYPE >( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
@ -910,7 +910,7 @@ namespace pal
|
||||
else if ( a_node->m_level == a_level ) // Have reached level for insertion. Add rect, split if necessary
|
||||
{
|
||||
branch.m_rect = *a_rect;
|
||||
branch.m_child = ( Node* ) a_id;
|
||||
branch.m_child = reinterpret_cast< Node* >( a_id );
|
||||
// Child field of leaves contains id of data record
|
||||
return AddBranch( &branch, a_node, a_newNode );
|
||||
}
|
||||
@ -1045,7 +1045,7 @@ namespace pal
|
||||
|
||||
bool firstTime = true;
|
||||
ELEMTYPEREAL increase;
|
||||
ELEMTYPEREAL bestIncr = ( ELEMTYPEREAL ) - 1;
|
||||
ELEMTYPEREAL bestIncr = static_cast< ELEMTYPEREAL >( -1 );
|
||||
ELEMTYPEREAL area;
|
||||
ELEMTYPEREAL bestArea = 0;
|
||||
int best = 0;
|
||||
@ -1064,7 +1064,7 @@ namespace pal
|
||||
bestIncr = increase;
|
||||
firstTime = false;
|
||||
}
|
||||
else if (( increase == bestIncr ) && ( area < bestArea ) )
|
||||
else if ( qgsDoubleNear( increase, bestIncr ) && ( area < bestArea ) )
|
||||
{
|
||||
best = index;
|
||||
bestArea = area;
|
||||
@ -1131,14 +1131,14 @@ namespace pal
|
||||
{
|
||||
ASSERT( a_rect );
|
||||
|
||||
ELEMTYPEREAL volume = ( ELEMTYPEREAL ) 1;
|
||||
ELEMTYPEREAL volume = static_cast< ELEMTYPEREAL >( 1 );
|
||||
|
||||
for ( int index = 0; index < NUMDIMS; ++index )
|
||||
{
|
||||
volume *= a_rect->m_max[index] - a_rect->m_min[index];
|
||||
}
|
||||
|
||||
ASSERT( volume >= ( ELEMTYPEREAL ) 0 );
|
||||
ASSERT( volume >= static_cast< ELEMTYPEREAL >( 0 ) );
|
||||
|
||||
return volume;
|
||||
}
|
||||
@ -1150,16 +1150,16 @@ namespace pal
|
||||
{
|
||||
ASSERT( a_rect );
|
||||
|
||||
ELEMTYPEREAL sumOfSquares = ( ELEMTYPEREAL ) 0;
|
||||
ELEMTYPEREAL sumOfSquares = static_cast< ELEMTYPEREAL >( 0 );
|
||||
ELEMTYPEREAL radius;
|
||||
|
||||
for ( int index = 0; index < NUMDIMS; ++index )
|
||||
{
|
||||
ELEMTYPEREAL halfExtent = (( ELEMTYPEREAL ) a_rect->m_max[index] - ( ELEMTYPEREAL ) a_rect->m_min[index] ) * 0.5f;
|
||||
ELEMTYPEREAL halfExtent = ( static_cast< ELEMTYPEREAL >( a_rect->m_max[index] ) - static_cast< ELEMTYPEREAL >( a_rect->m_min[index] ) ) * 0.5f;
|
||||
sumOfSquares += halfExtent * halfExtent;
|
||||
}
|
||||
|
||||
radius = ( ELEMTYPEREAL ) sqrt( sumOfSquares );
|
||||
radius = static_cast< ELEMTYPEREAL >( sqrt( sumOfSquares ) );
|
||||
|
||||
// Pow maybe slow, so test for common dims like 2,3 and just use x*x, x*x*x.
|
||||
if ( NUMDIMS == 3 )
|
||||
@ -1172,7 +1172,7 @@ namespace pal
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( ELEMTYPEREAL )( pow( radius, NUMDIMS ) * m_unitSphereVolume );
|
||||
return static_cast< ELEMTYPEREAL >( pow( radius, NUMDIMS ) * m_unitSphereVolume );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1245,7 +1245,7 @@ namespace pal
|
||||
&& ( a_parVars->m_count[0] < ( a_parVars->m_total - a_parVars->m_minFill ) )
|
||||
&& ( a_parVars->m_count[1] < ( a_parVars->m_total - a_parVars->m_minFill ) ) )
|
||||
{
|
||||
biggestDiff = ( ELEMTYPEREAL ) - 1;
|
||||
biggestDiff = static_cast< ELEMTYPEREAL >( -1 );
|
||||
for ( int index = 0; index < a_parVars->m_total; ++index )
|
||||
{
|
||||
if ( !a_parVars->m_taken[index] )
|
||||
@ -1272,7 +1272,7 @@ namespace pal
|
||||
chosen = index;
|
||||
betterGroup = group;
|
||||
}
|
||||
else if (( diff == biggestDiff ) && ( a_parVars->m_count[group] < a_parVars->m_count[betterGroup] ) )
|
||||
else if ( qgsDoubleNear( diff, biggestDiff ) && ( a_parVars->m_count[group] < a_parVars->m_count[betterGroup] ) )
|
||||
{
|
||||
chosen = index;
|
||||
betterGroup = group;
|
||||
@ -1339,7 +1339,7 @@ namespace pal
|
||||
ASSERT( a_parVars );
|
||||
|
||||
a_parVars->m_count[0] = a_parVars->m_count[1] = 0;
|
||||
a_parVars->m_area[0] = a_parVars->m_area[1] = ( ELEMTYPEREAL ) 0;
|
||||
a_parVars->m_area[0] = a_parVars->m_area[1] = static_cast< ELEMTYPEREAL >( 0 );
|
||||
a_parVars->m_total = a_maxRects;
|
||||
a_parVars->m_minFill = a_minFill;
|
||||
for ( int index = 0; index < a_maxRects; ++index )
|
||||
@ -1498,7 +1498,7 @@ namespace pal
|
||||
{
|
||||
for ( int index = 0; index < a_node->m_count; ++index )
|
||||
{
|
||||
if ( a_node->m_branch[index].m_child == ( Node* ) a_id )
|
||||
if ( a_node->m_branch[index].m_child == reinterpret_cast< Node* >( a_id ) )
|
||||
{
|
||||
DisconnectBranch( a_node, index ); // Must return after this call as count has changed
|
||||
return false;
|
||||
|
@ -47,10 +47,6 @@
|
||||
#define M_PI_2 1.57079632679489661923
|
||||
#endif
|
||||
|
||||
#ifndef M_SQRT_2
|
||||
#define M_SQRT_2 0.707106781186547524401
|
||||
#endif
|
||||
|
||||
#ifndef M_SQRT2
|
||||
#define M_SQRT2 1.41421356237309504880
|
||||
#endif
|
||||
|
@ -122,7 +122,7 @@ QgsWKBTypes::Type QGis::fromOldWkbType( QGis::WkbType type )
|
||||
}
|
||||
|
||||
QgsDebugMsg( QString( "unexpected old wkbType=%1" ).arg( type ) );
|
||||
return ( QgsWKBTypes::Type ) type;
|
||||
return static_cast< QgsWKBTypes::Type >( type );
|
||||
}
|
||||
|
||||
QGis::WkbType QGis::fromNewWkbType( QgsWKBTypes::Type type )
|
||||
@ -146,7 +146,7 @@ QGis::WkbType QGis::fromNewWkbType( QgsWKBTypes::Type type )
|
||||
}
|
||||
|
||||
QgsDebugMsg( QString( "unexpected new wkbType=%1" ).arg( type ) );
|
||||
return ( QGis::WkbType ) type;
|
||||
return static_cast< QGis::WkbType >( type );
|
||||
}
|
||||
|
||||
|
||||
|
@ -280,7 +280,7 @@ void QgsEditFormConfig::writeXml( QDomNode& node ) const
|
||||
{
|
||||
QDomElement tabsElem = doc.createElement( "attributeEditorForm" );
|
||||
|
||||
for ( QList< QgsAttributeEditorElement* >::const_iterator it = tabs().constBegin(); it != tabs().constEnd(); ++it )
|
||||
for ( QList< QgsAttributeEditorElement* >::const_iterator it = mAttributeEditorElements.constBegin(); it != mAttributeEditorElements.constEnd(); ++it )
|
||||
{
|
||||
QDomElement attributeEditorWidgetElem = ( *it )->toDomElement( doc );
|
||||
tabsElem.appendChild( attributeEditorWidgetElem );
|
||||
|
@ -208,8 +208,8 @@ class CORE_EXPORT QgsMapRenderer : public QObject
|
||||
void setScale( double scale ) {mScale = scale;}
|
||||
double mapUnitsPerPixel() const { return mMapUnitsPerPixel; }
|
||||
|
||||
int width() const { return ( int ) mSize.width(); }
|
||||
int height() const { return ( int ) mSize.height(); }
|
||||
int width() const { return static_cast< int >( mSize.width() ); }
|
||||
int height() const { return static_cast< int >( mSize.height() ); }
|
||||
|
||||
//! Recalculate the map scale
|
||||
void updateScale();
|
||||
|
@ -176,7 +176,7 @@ class CORE_EXPORT QgsMapToPixel
|
||||
* @deprecated in 2.8, use setParameters
|
||||
* @note this really sets the viewport height, not ymax
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setYMaximum( double yMax ) { mHeight = yMax; }
|
||||
Q_DECL_DEPRECATED void setYMaximum( double yMax ) { mHeight = static_cast< int >( yMax ); }
|
||||
|
||||
/**
|
||||
* Set minimum y value
|
||||
|
@ -70,11 +70,11 @@ class CORE_EXPORT QgsMapUnitScale
|
||||
{
|
||||
double mup = c.mapToPixel().mapUnitsPerPixel();
|
||||
double renderScale = c.rendererScale(); // Note: this value is 1 / scale
|
||||
if ( minScale != 0 )
|
||||
if ( !qgsDoubleNear( minScale, 0 ) )
|
||||
{
|
||||
mup = qMin( mup / ( minScale * renderScale ), mup );
|
||||
}
|
||||
if ( maxScale != 0 )
|
||||
if ( !qgsDoubleNear( maxScale, 0 ) )
|
||||
{
|
||||
mup = qMax( mup / ( maxScale * renderScale ), mup );
|
||||
}
|
||||
@ -83,11 +83,12 @@ class CORE_EXPORT QgsMapUnitScale
|
||||
|
||||
bool operator==( const QgsMapUnitScale& other ) const
|
||||
{
|
||||
return minScale == other.minScale && maxScale == other.maxScale
|
||||
return qgsDoubleNear( minScale, other.minScale )
|
||||
&& qgsDoubleNear( maxScale, other.maxScale )
|
||||
&& minSizeMMEnabled == other.minSizeMMEnabled
|
||||
&& minSizeMM == other.minSizeMM
|
||||
&& qgsDoubleNear( minSizeMM, other.minSizeMM )
|
||||
&& maxSizeMMEnabled == other.maxSizeMMEnabled
|
||||
&& maxSizeMM == other.maxSizeMM;
|
||||
&& qgsDoubleNear( maxSizeMM, other.maxSizeMM );
|
||||
}
|
||||
|
||||
bool operator!=( const QgsMapUnitScale& other ) const
|
||||
|
@ -236,7 +236,7 @@ class CORE_EXPORT QgsPoint
|
||||
|
||||
inline bool operator==( const QgsPoint &p1, const QgsPoint &p2 )
|
||||
{
|
||||
if (( p1.x() == p2.x() ) && ( p1.y() == p2.y() ) )
|
||||
if ( qgsDoubleNear( p1.x(), p2.x() ) && qgsDoubleNear( p1.y(), p2.y() ) )
|
||||
{ return true; }
|
||||
else
|
||||
{ return false; }
|
||||
@ -252,8 +252,8 @@ inline std::ostream& operator << ( std::ostream& os, const QgsPoint &p )
|
||||
inline uint qHash( const QgsPoint& p )
|
||||
{
|
||||
uint hash;
|
||||
uint h1 = qHash(( quint64 )p.m_x );
|
||||
uint h2 = qHash(( quint64 )p.m_y );
|
||||
uint h1 = qHash( static_cast< quint64 >( p.m_x ) );
|
||||
uint h2 = qHash( static_cast< quint64 >( p.m_y ) );
|
||||
hash = h1 ^( h2 << 1 );
|
||||
return hash;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class CORE_EXPORT QgsSqlExpressionCompiler
|
||||
* @param fields fields from provider
|
||||
* @param flags flags which control how expression is compiled
|
||||
*/
|
||||
explicit QgsSqlExpressionCompiler( const QgsFields& fields, const Flags& flags = ( Flags )nullptr );
|
||||
explicit QgsSqlExpressionCompiler( const QgsFields& fields, const Flags& flags = Flags() );
|
||||
virtual ~QgsSqlExpressionCompiler();
|
||||
|
||||
/** Compiles an expression and returns the result of the compilation.
|
||||
|
@ -183,7 +183,7 @@ bool QgsTransaction::rollback( QString& errorMsg )
|
||||
|
||||
void QgsTransaction::onLayersDeleted( const QStringList& layerids )
|
||||
{
|
||||
Q_FOREACH ( QString layerid, layerids )
|
||||
Q_FOREACH ( const QString& layerid, layerids )
|
||||
Q_FOREACH ( QgsVectorLayer* l, mLayers )
|
||||
if ( l->id() == layerid )
|
||||
mLayers.remove( l );
|
||||
|
@ -1331,13 +1331,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
* Get the active layout for the attribute editor for this layer
|
||||
* @deprecated Use `editFormConfig()->layout()` instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED EditorLayout editorLayout() { return ( EditorLayout )mEditFormConfig->layout(); }
|
||||
Q_DECL_DEPRECATED EditorLayout editorLayout() { return static_cast< EditorLayout >( mEditFormConfig->layout() ); }
|
||||
|
||||
/**
|
||||
* Set the active layout for the attribute editor for this layer
|
||||
* @deprecated Use `editFormConfig()->setLayout()` instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setEditorLayout( EditorLayout editorLayout ) { mEditFormConfig->setLayout(( QgsEditFormConfig::EditorLayout )editorLayout ); }
|
||||
Q_DECL_DEPRECATED void setEditorLayout( EditorLayout editorLayout ) { mEditFormConfig->setLayout( static_cast< QgsEditFormConfig::EditorLayout >( editorLayout ) ); }
|
||||
|
||||
/**
|
||||
* Set the editor widget type for a field
|
||||
@ -1414,13 +1414,13 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
* @note added in 2.1
|
||||
* @deprecated Use `editFormConfig()->suppress()` instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return ( FeatureFormSuppress )mEditFormConfig->suppress(); }
|
||||
Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { return static_cast< FeatureFormSuppress >( mEditFormConfig->suppress() ); }
|
||||
|
||||
/** Set type of feature form pop-up suppression after feature creation (overrides app setting)
|
||||
* @note added in 2.1
|
||||
* @deprecated Use `editFormConfig()->setSuppress()` instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mEditFormConfig->setSuppress(( QgsEditFormConfig::FeatureFormSuppress )s ); }
|
||||
Q_DECL_DEPRECATED void setFeatureFormSuppress( QgsVectorLayer::FeatureFormSuppress s ) { mEditFormConfig->setSuppress( static_cast< QgsEditFormConfig::FeatureFormSuppress >( s ) ); }
|
||||
|
||||
/** Get annotation form */
|
||||
QString annotationForm() const { return mAnnotationForm; }
|
||||
|
@ -166,7 +166,7 @@ bool QgsVectorLayerEditBuffer::deleteFeatures( QgsFeatureIds fids )
|
||||
if ( !( L->dataProvider()->capabilities() & QgsVectorDataProvider::DeleteFeatures ) )
|
||||
return false;
|
||||
|
||||
Q_FOREACH ( const QgsFeatureId& fid, fids )
|
||||
Q_FOREACH ( QgsFeatureId fid, fids )
|
||||
deleteFeature( fid );
|
||||
|
||||
return true;
|
||||
|
@ -58,7 +58,7 @@ bool QgsVectorLayerEditPassthrough::deleteFeatures( QgsFeatureIds fids )
|
||||
{
|
||||
if ( L->dataProvider()->deleteFeatures( fids ) )
|
||||
{
|
||||
Q_FOREACH ( const QgsFeatureId& fid, fids )
|
||||
Q_FOREACH ( QgsFeatureId fid, fids )
|
||||
emit featureDeleted( fid );
|
||||
|
||||
return true;
|
||||
|
@ -169,13 +169,13 @@ QUrl QgsVirtualLayerDefinition::toUrl() const
|
||||
foreach ( const QgsVirtualLayerDefinition::SourceLayer& l, sourceLayers() )
|
||||
{
|
||||
if ( l.isReferenced() )
|
||||
url.addQueryItem( "layer_ref", QString( "%1:%2" ).arg( l.reference() ).arg( l.name() ) );
|
||||
url.addQueryItem( "layer_ref", QString( "%1:%2" ).arg( l.reference(), l.name() ) );
|
||||
else
|
||||
url.addQueryItem( "layer", QString( "%1:%4:%2:%3" ) // the order is important, since the 4th argument may contain '%2' as well
|
||||
.arg( l.provider() )
|
||||
.arg( QString( QUrl::toPercentEncoding( l.name() ) ) )
|
||||
.arg( l.encoding() )
|
||||
.arg( QString( QUrl::toPercentEncoding( l.source() ) ) ) );
|
||||
.arg( l.provider(),
|
||||
QString( QUrl::toPercentEncoding( l.name() ) ),
|
||||
l.encoding(),
|
||||
QString( QUrl::toPercentEncoding( l.source() ) ) ) );
|
||||
}
|
||||
|
||||
if ( !query().isEmpty() )
|
||||
|
@ -41,13 +41,10 @@ QString QgsColorRampShader::colorRampTypeAsQString()
|
||||
{
|
||||
case INTERPOLATED:
|
||||
return QString( "INTERPOLATED" );
|
||||
break;
|
||||
case DISCRETE:
|
||||
return QString( "DISCRETE" );
|
||||
break;
|
||||
case EXACT:
|
||||
return QString( "EXACT" );
|
||||
break;
|
||||
}
|
||||
return QString( "Unknown" );
|
||||
}
|
||||
|
@ -95,37 +95,27 @@ double QgsContrastEnhancement::maximumValuePossible( QGis::DataType theDataType
|
||||
{
|
||||
case QGis::Byte:
|
||||
return std::numeric_limits<unsigned char>::max();
|
||||
break;
|
||||
case QGis::UInt16:
|
||||
return std::numeric_limits<unsigned short>::max();
|
||||
break;
|
||||
case QGis::Int16:
|
||||
return std::numeric_limits<short>::max();
|
||||
break;
|
||||
case QGis::UInt32:
|
||||
return std::numeric_limits<unsigned int>::max();
|
||||
break;
|
||||
case QGis::Int32:
|
||||
return std::numeric_limits<int>::max();
|
||||
break;
|
||||
case QGis::Float32:
|
||||
return std::numeric_limits<float>::max();
|
||||
break;
|
||||
case QGis::Float64:
|
||||
return std::numeric_limits<double>::max();
|
||||
break;
|
||||
case QGis::CInt16:
|
||||
return std::numeric_limits<short>::max();
|
||||
break;
|
||||
case QGis::CInt32:
|
||||
return std::numeric_limits<int>::max();
|
||||
break;
|
||||
case QGis::CFloat32:
|
||||
return std::numeric_limits<float>::max();
|
||||
break;
|
||||
case QGis::CFloat64:
|
||||
return std::numeric_limits<double>::max();
|
||||
break;
|
||||
case QGis::ARGB32:
|
||||
case QGis::ARGB32_Premultiplied:
|
||||
case QGis::UnknownDataType:
|
||||
@ -144,37 +134,26 @@ double QgsContrastEnhancement::minimumValuePossible( QGis::DataType theDataType
|
||||
{
|
||||
case QGis::Byte:
|
||||
return std::numeric_limits<unsigned char>::min();
|
||||
break;
|
||||
case QGis::UInt16:
|
||||
return std::numeric_limits<unsigned short>::min();
|
||||
break;
|
||||
case QGis::Int16:
|
||||
return std::numeric_limits<short>::min();
|
||||
break;
|
||||
case QGis::UInt32:
|
||||
return std::numeric_limits<unsigned int>::min();
|
||||
break;
|
||||
case QGis::Int32:
|
||||
return std::numeric_limits<int>::min();
|
||||
break;
|
||||
case QGis::Float32:
|
||||
return std::numeric_limits<float>::max() * -1.0;
|
||||
break;
|
||||
case QGis::Float64:
|
||||
return std::numeric_limits<double>::max() * -1.0;
|
||||
break;
|
||||
case QGis::CInt16:
|
||||
return std::numeric_limits<short>::min();
|
||||
break;
|
||||
case QGis::CInt32:
|
||||
return std::numeric_limits<int>::min();
|
||||
break;
|
||||
case QGis::CFloat32:
|
||||
return std::numeric_limits<float>::max() * -1.0;
|
||||
break;
|
||||
case QGis::CFloat64:
|
||||
return std::numeric_limits<double>::max() * -1.0;
|
||||
break;
|
||||
case QGis::ARGB32:
|
||||
case QGis::ARGB32_Premultiplied:
|
||||
case QGis::UnknownDataType:
|
||||
|
@ -23,13 +23,10 @@ QString QgsRaster::contrastEnhancementLimitsAsString( ContrastEnhancementLimits
|
||||
{
|
||||
case QgsRaster::ContrastEnhancementMinMax:
|
||||
return "MinMax";
|
||||
break;
|
||||
case QgsRaster::ContrastEnhancementStdDev:
|
||||
return "StdDev";
|
||||
break;
|
||||
case QgsRaster::ContrastEnhancementCumulativeCut:
|
||||
return "CumulativeCut";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -426,25 +426,25 @@ inline double QgsRasterBlock::readValue( void *data, QGis::DataType type, qgssiz
|
||||
switch ( type )
|
||||
{
|
||||
case QGis::Byte:
|
||||
return ( double )(( quint8 * )data )[index];
|
||||
return static_cast< double >(( static_cast< quint8 * >( data ) )[index] );
|
||||
break;
|
||||
case QGis::UInt16:
|
||||
return ( double )(( quint16 * )data )[index];
|
||||
return static_cast< double >(( static_cast< quint16 * >( data ) )[index] );
|
||||
break;
|
||||
case QGis::Int16:
|
||||
return ( double )(( qint16 * )data )[index];
|
||||
return static_cast< double >(( static_cast< qint16 * >( data ) )[index] );
|
||||
break;
|
||||
case QGis::UInt32:
|
||||
return ( double )(( quint32 * )data )[index];
|
||||
return static_cast< double >(( static_cast< quint32 * >( data ) )[index] );
|
||||
break;
|
||||
case QGis::Int32:
|
||||
return ( double )(( qint32 * )data )[index];
|
||||
return static_cast< double >(( static_cast< qint32 * >( data ) )[index] );
|
||||
break;
|
||||
case QGis::Float32:
|
||||
return ( double )(( float * )data )[index];
|
||||
return static_cast< double >(( static_cast< float * >( data ) )[index] );
|
||||
break;
|
||||
case QGis::Float64:
|
||||
return ( double )(( double * )data )[index];
|
||||
return static_cast< double >(( static_cast< double * >( data ) )[index] );
|
||||
break;
|
||||
default:
|
||||
QgsDebugMsg( QString( "Data type %1 is not supported" ).arg( type ) );
|
||||
@ -461,25 +461,25 @@ inline void QgsRasterBlock::writeValue( void *data, QGis::DataType type, qgssize
|
||||
switch ( type )
|
||||
{
|
||||
case QGis::Byte:
|
||||
(( quint8 * )data )[index] = ( quint8 ) value;
|
||||
( static_cast< quint8 * >( data ) )[index] = static_cast< quint8 >( value );
|
||||
break;
|
||||
case QGis::UInt16:
|
||||
(( quint16 * )data )[index] = ( quint16 ) value;
|
||||
( static_cast< quint16 * >( data ) )[index] = static_cast< quint16 >( value );
|
||||
break;
|
||||
case QGis::Int16:
|
||||
(( qint16 * )data )[index] = ( qint16 ) value;
|
||||
( static_cast< qint16 * >( data ) )[index] = static_cast< qint16 >( value );
|
||||
break;
|
||||
case QGis::UInt32:
|
||||
(( quint32 * )data )[index] = ( quint32 ) value;
|
||||
( static_cast< quint32 * >( data ) )[index] = static_cast< quint32 >( value );
|
||||
break;
|
||||
case QGis::Int32:
|
||||
(( qint32 * )data )[index] = ( qint32 ) value;
|
||||
( static_cast< qint32 * >( data ) )[index] = static_cast< qint32 >( value );
|
||||
break;
|
||||
case QGis::Float32:
|
||||
(( float * )data )[index] = ( float ) value;
|
||||
( static_cast< float * >( data ) )[index] = static_cast< float >( value );
|
||||
break;
|
||||
case QGis::Float64:
|
||||
(( double * )data )[index] = value;
|
||||
( static_cast< double * >( data ) )[index] = value;
|
||||
break;
|
||||
default:
|
||||
QgsDebugMsg( QString( "Data type %1 is not supported" ).arg( type ) );
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
#include <qmath.h>
|
||||
|
||||
#define ERRMSG(message) QGS_ERROR_MESSAGE(message, "Raster provider")
|
||||
#define ERR(message) QgsError(message, "Raster provider")
|
||||
|
||||
void QgsRasterDataProvider::setUseSrcNoDataValue( int bandNo, bool use )
|
||||
|
@ -51,8 +51,8 @@ class CORE_EXPORT QgsRasterHistogram
|
||||
return ( h.bandNumber == bandNumber &&
|
||||
h.binCount == binCount &&
|
||||
h.includeOutOfRange == includeOutOfRange &&
|
||||
h.maximum == maximum &&
|
||||
h.minimum == minimum &&
|
||||
qgsDoubleNear( h.maximum, maximum ) &&
|
||||
qgsDoubleNear( h.minimum, minimum ) &&
|
||||
h.extent == extent &&
|
||||
h.width == width &&
|
||||
h.height == height );
|
||||
|
@ -99,7 +99,7 @@ class CORE_EXPORT QgsRasterInterface
|
||||
/** \brief helper function to create zero padded band names */
|
||||
virtual QString generateBandName( int theBandNumber ) const
|
||||
{
|
||||
return tr( "Band" ) + QString( " %1" ) .arg( theBandNumber, 1 + ( int ) log10(( float ) bandCount() ), 10, QChar( '0' ) );
|
||||
return tr( "Band" ) + QString( " %1" ) .arg( theBandNumber, 1 + static_cast< int >( log10( static_cast< double >( bandCount() ) ) ), 10, QChar( '0' ) );
|
||||
}
|
||||
|
||||
/** Read block of data using given extent and size.
|
||||
|
@ -51,7 +51,7 @@ class CORE_EXPORT QgsRasterRange
|
||||
|
||||
inline bool operator==( const QgsRasterRange &o ) const
|
||||
{
|
||||
return mMin == o.mMin && mMax == o.mMax;
|
||||
return qgsDoubleNear( mMin, o.mMin ) && qgsDoubleNear( mMax, o.mMax );
|
||||
}
|
||||
|
||||
/** \brief Test if value is within the list of ranges
|
||||
|
@ -487,13 +487,13 @@ QgsSymbolLayerV2* QgsGradientFillSymbolLayerV2::create( const QgsStringMap& prop
|
||||
|
||||
//update gradient properties from props
|
||||
if ( props.contains( "type" ) )
|
||||
type = ( GradientType )props["type"].toInt();
|
||||
type = static_cast< GradientType >( props["type"].toInt() );
|
||||
if ( props.contains( "coordinate_mode" ) )
|
||||
coordinateMode = ( GradientCoordinateMode )props["coordinate_mode"].toInt();
|
||||
coordinateMode = static_cast< GradientCoordinateMode >( props["coordinate_mode"].toInt() );
|
||||
if ( props.contains( "spread" ) )
|
||||
gradientSpread = ( GradientSpread )props["spread"].toInt();
|
||||
gradientSpread = static_cast< GradientSpread >( props["spread"].toInt() );
|
||||
if ( props.contains( "color_type" ) )
|
||||
colorType = ( GradientColorType )props["color_type"].toInt();
|
||||
colorType = static_cast< GradientColorType >( props["color_type"].toInt() );
|
||||
if ( props.contains( "gradient_color" ) )
|
||||
{
|
||||
//pre 2.5 projects used "gradient_color"
|
||||
@ -760,8 +760,8 @@ void QgsGradientFillSymbolLayerV2::applyGradient( const QgsSymbolV2RenderContext
|
||||
fillColor2.setAlphaF( context.alpha() * fillColor2.alphaF() );
|
||||
|
||||
//rotate reference points
|
||||
QPointF rotatedReferencePoint1 = angle != 0 ? rotateReferencePoint( referencePoint1, angle ) : referencePoint1;
|
||||
QPointF rotatedReferencePoint2 = angle != 0 ? rotateReferencePoint( referencePoint2, angle ) : referencePoint2;
|
||||
QPointF rotatedReferencePoint1 = !qgsDoubleNear( angle, 0.0 ) ? rotateReferencePoint( referencePoint1, angle ) : referencePoint1;
|
||||
QPointF rotatedReferencePoint2 = !qgsDoubleNear( angle, 0.0 ) ? rotateReferencePoint( referencePoint2, angle ) : referencePoint2;
|
||||
|
||||
//create a QGradient with the desired properties
|
||||
QGradient gradient;
|
||||
@ -967,7 +967,7 @@ QgsSymbolLayerV2* QgsShapeburstFillSymbolLayerV2::create( const QgsStringMap& pr
|
||||
//update fill properties from props
|
||||
if ( props.contains( "color_type" ) )
|
||||
{
|
||||
colorType = ( ShapeburstColorType )props["color_type"].toInt();
|
||||
colorType = static_cast< ShapeburstColorType >( props["color_type"].toInt() );
|
||||
}
|
||||
if ( props.contains( "shapeburst_color" ) )
|
||||
{
|
||||
@ -1163,7 +1163,7 @@ void QgsShapeburstFillSymbolLayerV2::renderPolygon( const QPolygonF& points, QLi
|
||||
|
||||
//calculate max distance for shapeburst fill to extend from polygon boundary, in pixels
|
||||
int outputPixelMaxDist = 0;
|
||||
if ( !useWholeShape && maxDistance != 0 )
|
||||
if ( !useWholeShape && !qgsDoubleNear( maxDistance, 0.0 ) )
|
||||
{
|
||||
//convert max distance to pixels
|
||||
const QgsRenderContext& ctx = context.renderContext();
|
||||
@ -1367,7 +1367,7 @@ double * QgsShapeburstFillSymbolLayerV2::distanceTransform( QImage *im )
|
||||
int idx = 0;
|
||||
for ( int heightIndex = 0; heightIndex < height; ++heightIndex )
|
||||
{
|
||||
QRgb* scanLine = ( QRgb* )im->constScanLine( heightIndex );
|
||||
const QRgb* scanLine = reinterpret_cast< const QRgb* >( im->constScanLine( heightIndex ) );
|
||||
for ( int widthIndex = 0; widthIndex < width; ++widthIndex )
|
||||
{
|
||||
tmpRgb = scanLine[widthIndex];
|
||||
@ -1429,7 +1429,7 @@ void QgsShapeburstFillSymbolLayerV2::dtArrayToQImage( double * array, QImage *im
|
||||
|
||||
for ( int heightIndex = 0; heightIndex < height; ++heightIndex )
|
||||
{
|
||||
QRgb* scanLine = ( QRgb* )im->scanLine( heightIndex );
|
||||
QRgb* scanLine = reinterpret_cast< QRgb* >( im->scanLine( heightIndex ) );
|
||||
for ( int widthIndex = 0; widthIndex < width; ++widthIndex )
|
||||
{
|
||||
//result of distance transform
|
||||
@ -1918,7 +1918,7 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFileP
|
||||
mSvgPattern = nullptr;
|
||||
double size = patternWidth * QgsSymbolLayerV2Utils::pixelSizeScaleFactor( context.renderContext(), patternWidthUnit, patternWidthMapUnitScale );
|
||||
|
||||
if (( int )size < 1.0 || 10000.0 < size )
|
||||
if ( static_cast< int >( size ) < 1.0 || 10000.0 < size )
|
||||
{
|
||||
mSvgPattern = new QImage();
|
||||
brush.setTextureImage( *mSvgPattern );
|
||||
@ -1936,9 +1936,9 @@ void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFileP
|
||||
double hwRatio = 1.0;
|
||||
if ( patternPict.width() > 0 )
|
||||
{
|
||||
hwRatio = ( double )patternPict.height() / ( double )patternPict.width();
|
||||
hwRatio = static_cast< double >( patternPict.height() ) / static_cast< double >( patternPict.width() );
|
||||
}
|
||||
mSvgPattern = new QImage(( int )size, ( int )( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
|
||||
mSvgPattern = new QImage( static_cast< int >( size ), static_cast< int >( size * hwRatio ), QImage::Format_ARGB32_Premultiplied );
|
||||
mSvgPattern->fill( 0 ); // transparent background
|
||||
|
||||
QPainter p( mSvgPattern );
|
||||
@ -2087,7 +2087,7 @@ void QgsSVGFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &element, cons
|
||||
{
|
||||
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mAngle );
|
||||
}
|
||||
else if ( angle + mAngle != 0 )
|
||||
else if ( !qgsDoubleNear( angle + mAngle, 0.0 ) )
|
||||
{
|
||||
angleFunc = QString::number( angle + mAngle );
|
||||
}
|
||||
@ -2593,7 +2593,7 @@ void QgsLinePatternFillSymbolLayer::applyPattern( const QgsSymbolV2RenderContext
|
||||
width = outputPixelDist / sin( lineAngle * M_PI / 180 );
|
||||
|
||||
// recalculate real angle and distance after rounding to pixels
|
||||
lineAngle = 180 * atan2(( double ) height, ( double ) width ) / M_PI;
|
||||
lineAngle = 180 * atan2( static_cast< double >( height ), static_cast< double >( width ) ) / M_PI;
|
||||
if ( lineAngle < 0 )
|
||||
{
|
||||
lineAngle += 360.;
|
||||
@ -2869,7 +2869,7 @@ void QgsLinePatternFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &eleme
|
||||
{
|
||||
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mLineAngle );
|
||||
}
|
||||
else if ( angle + mLineAngle != 0 )
|
||||
else if ( !qgsDoubleNear( angle + mLineAngle, 0.0 ) )
|
||||
{
|
||||
angleFunc = QString::number( angle + mLineAngle );
|
||||
}
|
||||
@ -3556,7 +3556,7 @@ QgsSymbolLayerV2 *QgsRasterFillSymbolLayer::create( const QgsStringMap &properti
|
||||
}
|
||||
if ( properties.contains( "coordinate_mode" ) )
|
||||
{
|
||||
mode = ( FillCoordinateMode )properties["coordinate_mode"].toInt();
|
||||
mode = static_cast< FillCoordinateMode >( properties["coordinate_mode"].toInt() );
|
||||
}
|
||||
if ( properties.contains( "alpha" ) )
|
||||
{
|
||||
|
@ -74,7 +74,7 @@ bool QgsRendererRangeV2::operator<( const QgsRendererRangeV2 &other ) const
|
||||
{
|
||||
return
|
||||
lowerValue() < other.lowerValue() ||
|
||||
( lowerValue() == other.lowerValue() && upperValue() < other.upperValue() );
|
||||
( qgsDoubleNear( lowerValue(), other.lowerValue() ) && upperValue() < other.upperValue() );
|
||||
}
|
||||
|
||||
|
||||
@ -616,9 +616,9 @@ static QList<double> _calcQuantileBreaks( QList<double> values, int classes )
|
||||
{
|
||||
if ( n > 1 )
|
||||
{
|
||||
double q = i / ( double ) classes;
|
||||
double q = i / static_cast< double >( classes );
|
||||
double a = q * ( n - 1 );
|
||||
int aa = ( int )( a );
|
||||
int aa = static_cast< int >( a );
|
||||
|
||||
double r = a - aa;
|
||||
Xq = ( 1 - r ) * values[aa] + r * values[aa+1];
|
||||
@ -657,7 +657,7 @@ static QList<double> _calcStdDevBreaks( QList<double> values, int classes, QList
|
||||
minimum = qMin( values[i], minimum ); // could use precomputed max and min
|
||||
maximum = qMax( values[i], maximum ); // but have to go through entire list anyway
|
||||
}
|
||||
mean = mean / ( double ) n;
|
||||
mean = mean / static_cast< double >( n );
|
||||
|
||||
double sd = 0.0;
|
||||
for ( int i = 0; i < n; i++ )
|
||||
@ -776,7 +776,7 @@ static QList<double> _calcJenksBreaks( QList<double> values, int classes,
|
||||
s1 += val;
|
||||
w++;
|
||||
|
||||
v = s2 - ( s1 * s1 ) / ( double ) w;
|
||||
v = s2 - ( s1 * s1 ) / static_cast< double >( w );
|
||||
int i4 = i3 - 1;
|
||||
if ( i4 != 0 )
|
||||
{
|
||||
@ -1336,9 +1336,9 @@ void QgsGraduatedSymbolRendererV2::updateColorRamp( QgsVectorColorRampV2 *ramp,
|
||||
{
|
||||
double colorValue;
|
||||
if ( inverted )
|
||||
colorValue = ( mRanges.count() > 1 ? ( double )( mRanges.count() - i - 1 ) / ( mRanges.count() - 1 ) : 0 );
|
||||
colorValue = ( mRanges.count() > 1 ? static_cast< double >( mRanges.count() - i - 1 ) / ( mRanges.count() - 1 ) : 0 );
|
||||
else
|
||||
colorValue = ( mRanges.count() > 1 ? ( double ) i / ( mRanges.count() - 1 ) : 0 );
|
||||
colorValue = ( mRanges.count() > 1 ? static_cast< double >( i ) / ( mRanges.count() - 1 ) : 0 );
|
||||
symbol->setColor( mSourceColorRamp->color( colorValue ) );
|
||||
}
|
||||
updateRangeSymbol( i, symbol );
|
||||
|
@ -209,22 +209,22 @@ double QgsHeatmapRenderer::uniformKernel( const double distance, const int bandw
|
||||
|
||||
double QgsHeatmapRenderer::quarticKernel( const double distance, const int bandwidth ) const
|
||||
{
|
||||
return pow( 1. - pow( distance / ( double )bandwidth, 2 ), 2 );
|
||||
return pow( 1. - pow( distance / static_cast< double >( bandwidth ), 2 ), 2 );
|
||||
}
|
||||
|
||||
double QgsHeatmapRenderer::triweightKernel( const double distance, const int bandwidth ) const
|
||||
{
|
||||
return pow( 1. - pow( distance / ( double )bandwidth, 2 ), 3 );
|
||||
return pow( 1. - pow( distance / static_cast< double >( bandwidth ), 2 ), 3 );
|
||||
}
|
||||
|
||||
double QgsHeatmapRenderer::epanechnikovKernel( const double distance, const int bandwidth ) const
|
||||
{
|
||||
return ( 1. - pow( distance / ( double )bandwidth, 2 ) );
|
||||
return ( 1. - pow( distance / static_cast< double >( bandwidth ), 2 ) );
|
||||
}
|
||||
|
||||
double QgsHeatmapRenderer::triangularKernel( const double distance, const int bandwidth ) const
|
||||
{
|
||||
return ( 1. - ( distance / ( double )bandwidth ) );
|
||||
return ( 1. - ( distance / static_cast< double >( bandwidth ) ) );
|
||||
}
|
||||
|
||||
void QgsHeatmapRenderer::stopRender( QgsRenderContext& context )
|
||||
@ -252,7 +252,7 @@ void QgsHeatmapRenderer::renderImage( QgsRenderContext& context )
|
||||
QColor pixColor;
|
||||
for ( int heightIndex = 0; heightIndex < image.height(); ++heightIndex )
|
||||
{
|
||||
QRgb* scanLine = ( QRgb* )image.scanLine( heightIndex );
|
||||
QRgb* scanLine = reinterpret_cast< QRgb* >( image.scanLine( heightIndex ) );
|
||||
for ( int widthIndex = 0; widthIndex < image.width(); ++widthIndex )
|
||||
{
|
||||
//scale result to fit in the range [0, 1]
|
||||
@ -330,7 +330,7 @@ QgsFeatureRendererV2* QgsHeatmapRenderer::create( QDomElement& element )
|
||||
{
|
||||
QgsHeatmapRenderer* r = new QgsHeatmapRenderer();
|
||||
r->setRadius( element.attribute( "radius", "50.0" ).toFloat() );
|
||||
r->setRadiusUnit(( QgsSymbolV2::OutputUnit )element.attribute( "radius_unit", "0" ).toInt() );
|
||||
r->setRadiusUnit( static_cast< QgsSymbolV2::OutputUnit >( element.attribute( "radius_unit", "0" ).toInt() ) );
|
||||
r->setRadiusMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( element.attribute( "radius_map_unit_scale", QString() ) ) );
|
||||
r->setMaximumValue( element.attribute( "max_value", "0.0" ).toFloat() );
|
||||
r->setRenderQuality( element.attribute( "quality", "0" ).toInt() );
|
||||
|
@ -192,7 +192,7 @@ void QgsSimpleLineSymbolLayerV2::startRender( QgsSymbolV2RenderContext& context
|
||||
mPen.setColor( penColor );
|
||||
double scaledWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
|
||||
mPen.setWidthF( scaledWidth );
|
||||
if ( mUseCustomDashPattern && scaledWidth != 0 )
|
||||
if ( mUseCustomDashPattern && !qgsDoubleNear( scaledWidth, 0 ) )
|
||||
{
|
||||
mPen.setStyle( Qt::CustomDashLine );
|
||||
|
||||
@ -413,7 +413,7 @@ void QgsSimpleLineSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element,
|
||||
&mPenJoinStyle, &mPenCapStyle, &mCustomDashVector );
|
||||
|
||||
// <se:PerpendicularOffset>
|
||||
if ( mOffset != 0 )
|
||||
if ( !qgsDoubleNear( mOffset, 0.0 ) )
|
||||
{
|
||||
QDomElement perpOffsetElem = doc.createElement( "se:PerpendicularOffset" );
|
||||
perpOffsetElem.appendChild( doc.createTextNode( QString::number( mOffset ) ) );
|
||||
@ -661,7 +661,7 @@ class MyLine
|
||||
return; // invalid
|
||||
|
||||
// tangent and direction
|
||||
if ( p1.x() == p2.x() )
|
||||
if ( qgsDoubleNear( p1.x(), p2.x() ) )
|
||||
{
|
||||
// vertical line - tangent undefined
|
||||
mVertical = true;
|
||||
@ -877,7 +877,7 @@ void QgsMarkerLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
|
||||
}
|
||||
}
|
||||
|
||||
if ( offset == 0 )
|
||||
if ( qgsDoubleNear( offset, 0.0 ) )
|
||||
{
|
||||
if ( placement == Interval )
|
||||
renderPolylineInterval( points, context );
|
||||
@ -1031,13 +1031,13 @@ void QgsMarkerLineSymbolLayerV2::renderPolylineVertex( const QPolygonF& points,
|
||||
context.setOriginalValueVariable( mOffsetAlongLine );
|
||||
offsetAlongLine = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OFFSET_ALONG_LINE, context, mOffsetAlongLine ).toDouble();
|
||||
}
|
||||
if ( offsetAlongLine != 0 )
|
||||
if ( !qgsDoubleNear( offsetAlongLine, 0.0 ) )
|
||||
{
|
||||
//scale offset along line
|
||||
offsetAlongLine = QgsSymbolLayerV2Utils::convertToPainterUnits( rc, offsetAlongLine, mOffsetAlongLineUnit, mOffsetAlongLineMapUnitScale );
|
||||
}
|
||||
|
||||
if ( offsetAlongLine == 0 && context.renderContext().geometry()
|
||||
if ( qgsDoubleNear( offsetAlongLine, 0.0 ) && context.renderContext().geometry()
|
||||
&& context.renderContext().geometry()->hasCurvedSegments() && ( placement == Vertex || placement == CurvePoint ) )
|
||||
{
|
||||
const QgsCoordinateTransform* ct = context.renderContext().coordinateTransform();
|
||||
@ -1205,7 +1205,7 @@ void QgsMarkerLineSymbolLayerV2::renderOffsetVertexAlongLine( const QPolygonF &p
|
||||
|
||||
QgsRenderContext& rc = context.renderContext();
|
||||
double origAngle = mMarker->angle();
|
||||
if ( distance == 0 )
|
||||
if ( qgsDoubleNear( distance, 0.0 ) )
|
||||
{
|
||||
// rotate marker (if desired)
|
||||
if ( mRotateMarker )
|
||||
|
@ -41,8 +41,8 @@ static void _fixQPictureDPI( QPainter* p )
|
||||
// Then when being drawn, it scales the painter. The following call
|
||||
// negates the effect. There is no way of setting QPicture's DPI.
|
||||
// See QTBUG-20361
|
||||
p->scale(( double )qt_defaultDpiX() / p->device()->logicalDpiX(),
|
||||
( double )qt_defaultDpiY() / p->device()->logicalDpiY() );
|
||||
p->scale( static_cast< double >( qt_defaultDpiX() ) / p->device()->logicalDpiX(),
|
||||
static_cast< double >( qt_defaultDpiY() ) / p->device()->logicalDpiY() );
|
||||
}
|
||||
|
||||
//////
|
||||
@ -224,7 +224,7 @@ void QgsSimpleMarkerSymbolLayerV2::startRender( QgsSymbolV2RenderContext& contex
|
||||
}
|
||||
|
||||
// rotate if the rotation is not going to be changed during the rendering
|
||||
if ( !hasDataDefinedRotation && mAngle != 0 )
|
||||
if ( !hasDataDefinedRotation && !qgsDoubleNear( mAngle, 0.0 ) )
|
||||
{
|
||||
transform.rotate( mAngle );
|
||||
}
|
||||
@ -258,8 +258,8 @@ bool QgsSimpleMarkerSymbolLayerV2::prepareCache( QgsSymbolV2RenderContext& conte
|
||||
double scaledSize = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mSize, mSizeUnit, mSizeMapUnitScale );
|
||||
|
||||
// calculate necessary image size for the cache
|
||||
double pw = (( mPen.widthF() == 0 ? 1 : mPen.widthF() ) + 1 ) / 2 * 2; // make even (round up); handle cosmetic pen
|
||||
int imageSize = (( int ) scaledSize + pw ) / 2 * 2 + 1; // make image width, height odd; account for pen width
|
||||
double pw = (( qgsDoubleNear( mPen.widthF(), 0.0 ) ? 1 : mPen.widthF() ) + 1 ) / 2 * 2; // make even (round up); handle cosmetic pen
|
||||
int imageSize = ( static_cast< int >( scaledSize ) + pw ) / 2 * 2 + 1; // make image width, height odd; account for pen width
|
||||
double center = imageSize / 2.0;
|
||||
|
||||
if ( imageSize > mMaximumCacheWidth )
|
||||
@ -519,7 +519,7 @@ void QgsSimpleMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV
|
||||
transform.scale( half, half );
|
||||
}
|
||||
|
||||
if ( angle != 0 && ( hasDataDefinedRotation || createdNewPath ) )
|
||||
if ( !qgsDoubleNear( angle, 0.0 ) && ( hasDataDefinedRotation || createdNewPath ) )
|
||||
transform.rotate( angle );
|
||||
|
||||
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
|
||||
@ -707,7 +707,7 @@ void QgsSimpleMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElemen
|
||||
{
|
||||
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mAngle );
|
||||
}
|
||||
else if ( angle + mAngle != 0 )
|
||||
else if ( !qgsDoubleNear( angle + mAngle, 0.0 ) )
|
||||
{
|
||||
angleFunc = QString::number( angle + mAngle );
|
||||
}
|
||||
@ -937,7 +937,7 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
|
||||
QTransform t;
|
||||
t.translate( shift.x() + offsetX, shift.y() + offsetY );
|
||||
|
||||
if ( angle != 0 )
|
||||
if ( !qgsDoubleNear( angle, 0.0 ) )
|
||||
t.rotate( angle );
|
||||
|
||||
QPolygonF polygon;
|
||||
@ -1330,7 +1330,7 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
|
||||
double size = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), scaledSize, mSizeUnit, mSizeMapUnitScale );
|
||||
|
||||
//don't render symbols with size below one or above 10,000 pixels
|
||||
if (( int )size < 1 || 10000.0 < size )
|
||||
if ( static_cast< int >( size ) < 1 || 10000.0 < size )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1397,12 +1397,12 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
|
||||
QImage transparentImage = img.copy();
|
||||
QgsSymbolLayerV2Utils::multiplyImageOpacity( &transparentImage, context.alpha() );
|
||||
p->drawImage( -transparentImage.width() / 2.0, -transparentImage.height() / 2.0, transparentImage );
|
||||
hwRatio = ( double )transparentImage.height() / ( double )transparentImage.width();
|
||||
hwRatio = static_cast< double >( transparentImage.height() ) / static_cast< double >( transparentImage.width() );
|
||||
}
|
||||
else
|
||||
{
|
||||
p->drawImage( -img.width() / 2.0, -img.height() / 2.0, img );
|
||||
hwRatio = ( double )img.height() / ( double )img.width();
|
||||
hwRatio = static_cast< double >( img.height() ) / static_cast< double >( img.width() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1419,7 +1419,7 @@ void QgsSvgMarkerSymbolLayerV2::renderPoint( const QPointF& point, QgsSymbolV2Re
|
||||
_fixQPictureDPI( p );
|
||||
p->drawPicture( 0, 0, pct );
|
||||
p->restore();
|
||||
hwRatio = ( double )pct.height() / ( double )pct.width();
|
||||
hwRatio = static_cast< double >( pct.height() ) / static_cast< double >( pct.width() );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1602,7 +1602,7 @@ void QgsSvgMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement &
|
||||
{
|
||||
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mAngle );
|
||||
}
|
||||
else if ( angle + mAngle != 0 )
|
||||
else if ( !qgsDoubleNear( angle + mAngle, 0.0 ) )
|
||||
{
|
||||
angleFunc = QString::number( angle + mAngle );
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ QRectF QgsSvgMarkerSymbolLayerV2::bounds( const QPointF& point, QgsSymbolV2Rende
|
||||
scaledSize = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), scaledSize, mSizeUnit, mSizeMapUnitScale );
|
||||
|
||||
//don't render symbols with size below one or above 10,000 pixels
|
||||
if (( int )scaledSize < 1 || 10000.0 < scaledSize )
|
||||
if ( static_cast< int >( scaledSize ) < 1 || 10000.0 < scaledSize )
|
||||
{
|
||||
return QRectF();
|
||||
}
|
||||
@ -2148,7 +2148,7 @@ void QgsFontMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement
|
||||
{
|
||||
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mAngle );
|
||||
}
|
||||
else if ( angle + mAngle != 0 )
|
||||
else if ( !qgsDoubleNear( angle + mAngle, 0.0 ) )
|
||||
{
|
||||
angleFunc = QString::number( angle + mAngle );
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ const unsigned char* QgsFeatureRendererV2::_getPoint( QPointF& pt, QgsRenderCont
|
||||
unsigned int wkbType;
|
||||
wkbPtr >> wkbType >> pt.rx() >> pt.ry();
|
||||
|
||||
if (( QgsWKBTypes::Type )wkbType == QgsWKBTypes::Point25D || ( QgsWKBTypes::Type )wkbType == QgsWKBTypes::PointZ )
|
||||
if ( static_cast< QgsWKBTypes::Type >( wkbType ) == QgsWKBTypes::Point25D || static_cast< QgsWKBTypes::Type >( wkbType ) == QgsWKBTypes::PointZ )
|
||||
wkbPtr += sizeof( double );
|
||||
|
||||
if ( context.coordinateTransform() )
|
||||
@ -68,8 +68,8 @@ const unsigned char* QgsFeatureRendererV2::_getLineString( QPolygonF& pts, QgsRe
|
||||
unsigned int wkbType, nPoints;
|
||||
wkbPtr >> wkbType >> nPoints;
|
||||
|
||||
bool hasZValue = QgsWKBTypes::hasZ(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasMValue = QgsWKBTypes::hasM(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasZValue = QgsWKBTypes::hasZ( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
bool hasMValue = QgsWKBTypes::hasM( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
@ -126,8 +126,8 @@ const unsigned char* QgsFeatureRendererV2::_getPolygon( QPolygonF& pts, QList<QP
|
||||
if ( numRings == 0 ) // sanity check for zero rings in polygon
|
||||
return wkbPtr;
|
||||
|
||||
bool hasZValue = QgsWKBTypes::hasZ(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasMValue = QgsWKBTypes::hasM(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasZValue = QgsWKBTypes::hasZ( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
bool hasMValue = QgsWKBTypes::hasM( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
|
||||
double x, y;
|
||||
holes.clear();
|
||||
@ -196,7 +196,7 @@ void QgsFeatureRendererV2::setScaleMethodToSymbol( QgsSymbolV2* symbol, int scal
|
||||
QgsMarkerSymbolV2* ms = static_cast<QgsMarkerSymbolV2*>( symbol );
|
||||
if ( ms )
|
||||
{
|
||||
ms->setScaleMethod(( QgsSymbolV2::ScaleMethod )scaleMethod );
|
||||
ms->setScaleMethod( static_cast< QgsSymbolV2::ScaleMethod >( scaleMethod ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -524,7 +524,7 @@ bool QgsFeatureRendererV2::willRenderFeature( QgsFeature &feat, QgsRenderContext
|
||||
void QgsFeatureRendererV2::renderVertexMarker( const QPointF &pt, QgsRenderContext& context )
|
||||
{
|
||||
QgsVectorLayer::drawVertexMarker( pt.x(), pt.y(), *context.painter(),
|
||||
( QgsVectorLayer::VertexMarkerType ) mCurrentVertexMarkerType,
|
||||
static_cast< QgsVectorLayer::VertexMarkerType >( mCurrentVertexMarkerType ),
|
||||
mCurrentVertexMarkerSize );
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ QgsLegendSymbolList QgsRuleBasedRendererV2::Rule::legendSymbolItems( double scal
|
||||
|
||||
Q_FOREACH ( Rule* rule, mChildren )
|
||||
{
|
||||
if ( scaleDenominator == -1 || rule->isScaleOK( scaleDenominator ) )
|
||||
if ( qgsDoubleNear( scaleDenominator, -1 ) || rule->isScaleOK( scaleDenominator ) )
|
||||
{
|
||||
lst << rule->legendSymbolItems( scaleDenominator, ruleFilter );
|
||||
}
|
||||
@ -242,7 +242,7 @@ bool QgsRuleBasedRendererV2::Rule::isFilterOK( QgsFeature& f, QgsRenderContext*
|
||||
|
||||
bool QgsRuleBasedRendererV2::Rule::isScaleOK( double scale ) const
|
||||
{
|
||||
if ( scale == 0 ) // so that we can count features in classes without scale context
|
||||
if ( qgsDoubleNear( scale, 0.0 ) ) // so that we can count features in classes without scale context
|
||||
return true;
|
||||
if ( mScaleMinDenom == 0 && mScaleMaxDenom == 0 )
|
||||
return true;
|
||||
|
@ -114,7 +114,8 @@ int QgsSymbolLayerV2Utils::decodeSldFontWeight( const QString& str )
|
||||
{
|
||||
bool ok;
|
||||
int weight = str.toInt( &ok );
|
||||
if ( !ok ) return ( int ) QFont::Normal;
|
||||
if ( !ok )
|
||||
return static_cast< int >( QFont::Normal );
|
||||
|
||||
// CSS font-weight is between 100 and 900
|
||||
// QFont::Weight is between 0 and 99
|
||||
@ -621,7 +622,7 @@ QPixmap QgsSymbolLayerV2Utils::colorRampPreviewPixmap( QgsVectorColorRampV2* ram
|
||||
// painter.setRenderHint( QPainter::Antialiasing );
|
||||
for ( int i = 0; i < size.width(); i++ )
|
||||
{
|
||||
QPen pen( ramp->color(( double ) i / size.width() ) );
|
||||
QPen pen( ramp->color( static_cast< double >( i ) / size.width() ) );
|
||||
painter.setPen( pen );
|
||||
painter.drawLine( i, 0, i, size.height() - 1 );
|
||||
}
|
||||
@ -873,7 +874,7 @@ QList<QPolygonF> offsetLine( const QPolygonF& polyline, double dist )
|
||||
QGis::GeometryType geometryType = QGis::Point;
|
||||
int pointCount = polyline.count();
|
||||
|
||||
if ( pointCount > 3 && polyline[ 0 ].x() == polyline[ pointCount - 1 ].x() && polyline[ 0 ].y() == polyline[ pointCount - 1 ].y() )
|
||||
if ( pointCount > 3 && qgsDoubleNear( polyline[ 0 ].x(), polyline[ pointCount - 1 ].x() ) && qgsDoubleNear( polyline[ 0 ].y(), polyline[ pointCount - 1 ].y() ) )
|
||||
{
|
||||
geometryType = QGis::Polygon;
|
||||
}
|
||||
@ -1431,7 +1432,7 @@ bool QgsSymbolLayerV2Utils::needLinePatternFill( QDomElement &element )
|
||||
|
||||
bool ok;
|
||||
double angle = angleFunc.toDouble( &ok );
|
||||
if ( !ok || angle == 0 )
|
||||
if ( !ok || qgsDoubleNear( angle, 0.0 ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -3422,7 +3423,7 @@ void QgsSymbolLayerV2Utils::multiplyImageOpacity( QImage* image, qreal alpha )
|
||||
//change the alpha component of every pixel
|
||||
for ( int heightIndex = 0; heightIndex < image->height(); ++heightIndex )
|
||||
{
|
||||
QRgb* scanLine = ( QRgb* )image->scanLine( heightIndex );
|
||||
QRgb* scanLine = reinterpret_cast< QRgb* >( image->scanLine( heightIndex ) );
|
||||
for ( int widthIndex = 0; widthIndex < image->width(); ++widthIndex )
|
||||
{
|
||||
myRgb = scanLine[widthIndex];
|
||||
@ -3759,7 +3760,7 @@ QPointF QgsSymbolLayerV2Utils::polygonCentroid( const QPolygonF& points )
|
||||
cy += ( p1.y() + p2.y() ) * area;
|
||||
}
|
||||
sum *= 3.0;
|
||||
if ( sum == 0 )
|
||||
if ( qgsDoubleNear( sum, 0.0 ) )
|
||||
{
|
||||
// the linear ring is invalid - let's fall back to a solution that will still
|
||||
// allow us render at least something (instead of just returning point nan,nan)
|
||||
@ -3819,7 +3820,7 @@ bool QgsSymbolLayerV2Utils::pointInPolygon( const QPolygonF &points, const QPoin
|
||||
const QPointF& p1 = points[i];
|
||||
const QPointF& p2 = points[j];
|
||||
|
||||
if ( p1.x() == x && p1.y() == y )
|
||||
if ( qgsDoubleNear( p1.x(), x ) && qgsDoubleNear( p1.y(), y ) )
|
||||
return true;
|
||||
|
||||
if (( p1.y() < y && p2.y() >= y ) || ( p2.y() < y && p1.y() >= y ) )
|
||||
@ -3877,7 +3878,7 @@ QList<double> QgsSymbolLayerV2Utils::prettyBreaks( double minimum, double maximu
|
||||
return breaks;
|
||||
}
|
||||
|
||||
int minimumCount = ( int ) classes / 3;
|
||||
int minimumCount = static_cast< int >( classes ) / 3;
|
||||
double shrink = 0.75;
|
||||
double highBias = 1.5;
|
||||
double adjustBias = 0.5 + 1.5 * highBias;
|
||||
@ -3888,7 +3889,7 @@ QList<double> QgsSymbolLayerV2Utils::prettyBreaks( double minimum, double maximu
|
||||
bool small = false;
|
||||
double dx = maximum - minimum;
|
||||
|
||||
if ( dx == 0 && maximum == 0 )
|
||||
if ( qgsDoubleNear( dx, 0.0 ) && qgsDoubleNear( maximum, 0.0 ) )
|
||||
{
|
||||
cell = 1.0;
|
||||
small = true;
|
||||
|
@ -71,9 +71,9 @@ QgsDataDefined* scaleWholeSymbol( double scaleFactorX, double scaleFactorY, cons
|
||||
QgsDataDefined* scaledDD = new QgsDataDefined( dd );
|
||||
QString exprString = dd.useExpression() ? dd.expressionString() : dd.field();
|
||||
scaledDD->setExpressionString(
|
||||
( scaleFactorX ? "tostring(" + QString::number( scaleFactorX ) + "*(" + exprString + "))" : "'0'" ) +
|
||||
( !qgsDoubleNear( scaleFactorX, 0.0 ) ? "tostring(" + QString::number( scaleFactorX ) + "*(" + exprString + "))" : "'0'" ) +
|
||||
"|| ',' || " +
|
||||
( scaleFactorY ? "tostring(" + QString::number( scaleFactorY ) + "*(" + exprString + "))" : "'0'" ) );
|
||||
( !qgsDoubleNear( scaleFactorY, 0.0 ) ? "tostring(" + QString::number( scaleFactorY ) + "*(" + exprString + "))" : "'0'" ) );
|
||||
scaledDD->setUseExpression( true );
|
||||
return scaledDD;
|
||||
}
|
||||
@ -112,8 +112,8 @@ const unsigned char* QgsSymbolV2::_getLineString( QPolygonF& pts, QgsRenderConte
|
||||
unsigned int wkbType, nPoints;
|
||||
wkbPtr >> wkbType >> nPoints;
|
||||
|
||||
bool hasZValue = QgsWKBTypes::hasZ(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasMValue = QgsWKBTypes::hasM(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasZValue = QgsWKBTypes::hasZ( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
bool hasMValue = QgsWKBTypes::hasM( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
@ -170,8 +170,8 @@ const unsigned char* QgsSymbolV2::_getPolygon( QPolygonF& pts, QList<QPolygonF>&
|
||||
if ( numRings == 0 ) // sanity check for zero rings in polygon
|
||||
return wkbPtr;
|
||||
|
||||
bool hasZValue = QgsWKBTypes::hasZ(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasMValue = QgsWKBTypes::hasM(( QgsWKBTypes::Type )wkbType );
|
||||
bool hasZValue = QgsWKBTypes::hasZ( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
bool hasMValue = QgsWKBTypes::hasM( static_cast< QgsWKBTypes::Type >( wkbType ) );
|
||||
|
||||
double x, y;
|
||||
holes.clear();
|
||||
@ -589,7 +589,7 @@ void QgsSymbolV2::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap p
|
||||
props[ "alpha" ] = QString::number( alpha() );
|
||||
double scaleFactor = 1.0;
|
||||
props[ "uom" ] = QgsSymbolLayerV2Utils::encodeSldUom( outputUnit(), &scaleFactor );
|
||||
props[ "uomScale" ] = scaleFactor != 1 ? QString::number( scaleFactor ) : "";
|
||||
props[ "uomScale" ] = ( !qgsDoubleNear( scaleFactor, 1.0 ) ? QString::number( scaleFactor ) : "" );
|
||||
|
||||
for ( QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it )
|
||||
{
|
||||
@ -838,7 +838,7 @@ void QgsSymbolV2::renderFeature( const QgsFeature& feature, QgsRenderContext& co
|
||||
mapPoint.setX( x ); mapPoint.setY( y );
|
||||
mtp.transformInPlace( mapPoint.rx(), mapPoint.ry() );
|
||||
QgsVectorLayer::drawVertexMarker( mapPoint.x(), mapPoint.y(), *context.painter(),
|
||||
( QgsVectorLayer::VertexMarkerType ) currentVertexMarkerType,
|
||||
static_cast< QgsVectorLayer::VertexMarkerType >( currentVertexMarkerType ),
|
||||
currentVertexMarkerSize );
|
||||
}
|
||||
}
|
||||
@ -1012,7 +1012,7 @@ QgsDataDefined QgsMarkerSymbolV2::dataDefinedAngle() const
|
||||
if ( layer->type() != QgsSymbolV2::Marker )
|
||||
continue;
|
||||
const QgsMarkerSymbolLayerV2* markerLayer = static_cast<const QgsMarkerSymbolLayerV2*>( layer );
|
||||
if ( markerLayer->angle() == symbolRotation && markerLayer->getDataDefinedProperty( "angle" ) )
|
||||
if ( qgsDoubleNear( markerLayer->angle(), symbolRotation ) && markerLayer->getDataDefinedProperty( "angle" ) )
|
||||
{
|
||||
symbolDD = markerLayer->getDataDefinedProperty( "angle" );
|
||||
break;
|
||||
@ -1055,15 +1055,15 @@ void QgsMarkerSymbolV2::setSize( double s )
|
||||
if ( layer->type() != QgsSymbolV2::Marker )
|
||||
continue;
|
||||
QgsMarkerSymbolLayerV2* markerLayer = static_cast<QgsMarkerSymbolLayerV2*>( layer );
|
||||
if ( markerLayer->size() == origSize )
|
||||
if ( qgsDoubleNear( markerLayer->size(), origSize ) )
|
||||
markerLayer->setSize( s );
|
||||
else if ( origSize != 0 )
|
||||
else if ( !qgsDoubleNear( origSize, 0.0 ) )
|
||||
{
|
||||
// proportionally scale size
|
||||
markerLayer->setSize( markerLayer->size() * s / origSize );
|
||||
}
|
||||
// also scale offset to maintain relative position
|
||||
if ( origSize != 0 && ( markerLayer->offset().x() || markerLayer->offset().y() ) )
|
||||
if ( !qgsDoubleNear( origSize, 0.0 ) && ( !qgsDoubleNear( markerLayer->offset().x(), 0.0 ) || !qgsDoubleNear( markerLayer->offset().y(), 0.0 ) ) )
|
||||
markerLayer->setOffset( QPointF( markerLayer->offset().x() * s / origSize,
|
||||
markerLayer->offset().y() * s / origSize ) );
|
||||
}
|
||||
@ -1102,7 +1102,7 @@ void QgsMarkerSymbolV2::setDataDefinedSize( const QgsDataDefined &dd )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( symbolSize == 0 || qgsDoubleNear( markerLayer->size(), symbolSize ) )
|
||||
if ( qgsDoubleNear( symbolSize, 0.0 ) || qgsDoubleNear( markerLayer->size(), symbolSize ) )
|
||||
{
|
||||
markerLayer->setDataDefinedProperty( "size", new QgsDataDefined( dd ) );
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ void QgsMarkerSymbolV2::setDataDefinedSize( const QgsDataDefined &dd )
|
||||
markerLayer->setDataDefinedProperty( "size", scaleWholeSymbol( markerLayer->size() / symbolSize, dd ) );
|
||||
}
|
||||
|
||||
if ( markerLayer->offset().x() || markerLayer->offset().y() )
|
||||
if ( !qgsDoubleNear( markerLayer->offset().x(), 0.0 ) || !qgsDoubleNear( markerLayer->offset().y(), 0.0 ) )
|
||||
{
|
||||
markerLayer->setDataDefinedProperty( "offset", scaleWholeSymbol(
|
||||
markerLayer->offset().x() / symbolSize,
|
||||
@ -1133,7 +1133,7 @@ QgsDataDefined QgsMarkerSymbolV2::dataDefinedSize() const
|
||||
if ( layer->type() != QgsSymbolV2::Marker )
|
||||
continue;
|
||||
const QgsMarkerSymbolLayerV2* markerLayer = static_cast<const QgsMarkerSymbolLayerV2*>( layer );
|
||||
if ( markerLayer->size() == symbolSize && markerLayer->getDataDefinedProperty( "size" ) )
|
||||
if ( qgsDoubleNear( markerLayer->size(), symbolSize ) && markerLayer->getDataDefinedProperty( "size" ) )
|
||||
{
|
||||
symbolDD = markerLayer->getDataDefinedProperty( "size" );
|
||||
break;
|
||||
@ -1160,7 +1160,7 @@ QgsDataDefined QgsMarkerSymbolV2::dataDefinedSize() const
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( symbolSize == 0 )
|
||||
if ( qgsDoubleNear( symbolSize, 0.0 ) )
|
||||
return QgsDataDefined();
|
||||
|
||||
QScopedPointer< QgsDataDefined > scaledDD( scaleWholeSymbol( markerLayer->size() / symbolSize, *symbolDD ) );
|
||||
@ -1305,17 +1305,17 @@ void QgsLineSymbolV2::setWidth( double w )
|
||||
|
||||
if ( lineLayer )
|
||||
{
|
||||
if ( lineLayer->width() == origWidth )
|
||||
if ( qgsDoubleNear( lineLayer->width(), origWidth ) )
|
||||
{
|
||||
lineLayer->setWidth( w );
|
||||
}
|
||||
else if ( origWidth != 0 )
|
||||
else if ( !qgsDoubleNear( origWidth, 0.0 ) )
|
||||
{
|
||||
// proportionally scale the width
|
||||
lineLayer->setWidth( lineLayer->width() * w / origWidth );
|
||||
}
|
||||
// also scale offset to maintain relative position
|
||||
if ( origWidth != 0 && lineLayer->offset() )
|
||||
if ( !qgsDoubleNear( origWidth, 0.0 ) && !qgsDoubleNear( lineLayer->offset(), 0.0 ) )
|
||||
lineLayer->setOffset( lineLayer->offset() * w / origWidth );
|
||||
}
|
||||
}
|
||||
@ -1357,7 +1357,7 @@ void QgsLineSymbolV2::setDataDefinedWidth( const QgsDataDefined& dd )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( symbolWidth == 0 || qgsDoubleNear( lineLayer->width(), symbolWidth ) )
|
||||
if ( qgsDoubleNear( symbolWidth, 0.0 ) || qgsDoubleNear( lineLayer->width(), symbolWidth ) )
|
||||
{
|
||||
lineLayer->setDataDefinedProperty( "width", new QgsDataDefined( dd ) );
|
||||
}
|
||||
@ -1366,7 +1366,7 @@ void QgsLineSymbolV2::setDataDefinedWidth( const QgsDataDefined& dd )
|
||||
lineLayer->setDataDefinedProperty( "width", scaleWholeSymbol( lineLayer->width() / symbolWidth, dd ) );
|
||||
}
|
||||
|
||||
if ( lineLayer->offset() )
|
||||
if ( !qgsDoubleNear( lineLayer->offset(), 0.0 ) )
|
||||
{
|
||||
lineLayer->setDataDefinedProperty( "offset", scaleWholeSymbol( lineLayer->offset() / symbolWidth, dd ) );
|
||||
}
|
||||
@ -1385,7 +1385,7 @@ QgsDataDefined QgsLineSymbolV2::dataDefinedWidth() const
|
||||
for ( QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it )
|
||||
{
|
||||
const QgsLineSymbolLayerV2* layer = dynamic_cast<const QgsLineSymbolLayerV2*>( *it );
|
||||
if ( layer && layer->width() == symbolWidth && layer->getDataDefinedProperty( "width" ) )
|
||||
if ( layer && qgsDoubleNear( layer->width(), symbolWidth ) && layer->getDataDefinedProperty( "width" ) )
|
||||
{
|
||||
symbolDD = layer->getDataDefinedProperty( "width" );
|
||||
break;
|
||||
@ -1412,7 +1412,7 @@ QgsDataDefined QgsLineSymbolV2::dataDefinedWidth() const
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( symbolWidth == 0 )
|
||||
if ( qgsDoubleNear( symbolWidth, 0.0 ) )
|
||||
return QgsDataDefined();
|
||||
|
||||
QScopedPointer< QgsDataDefined > scaledDD( scaleWholeSymbol( lineLayer->width() / symbolWidth, *symbolDD ) );
|
||||
|
@ -31,10 +31,10 @@
|
||||
static QColor _interpolate( const QColor& c1, const QColor& c2, const double value )
|
||||
{
|
||||
if ( qIsNaN( value ) ) return c2;
|
||||
int r = ( int )( c1.red() + value * ( c2.red() - c1.red() ) );
|
||||
int g = ( int )( c1.green() + value * ( c2.green() - c1.green() ) );
|
||||
int b = ( int )( c1.blue() + value * ( c2.blue() - c1.blue() ) );
|
||||
int a = ( int )( c1.alpha() + value * ( c2.alpha() - c1.alpha() ) );
|
||||
int r = static_cast< int >( c1.red() + value * ( c2.red() - c1.red() ) );
|
||||
int g = static_cast< int >( c1.green() + value * ( c2.green() - c1.green() ) );
|
||||
int b = static_cast< int >( c1.blue() + value * ( c2.blue() - c1.blue() ) );
|
||||
int a = static_cast< int >( c1.alpha() + value * ( c2.alpha() - c1.alpha() ) );
|
||||
|
||||
return QColor::fromRgb( r, g, b, a );
|
||||
}
|
||||
@ -141,7 +141,7 @@ QColor QgsVectorGradientColorRampV2::color( double value ) const
|
||||
upper = it->offset;
|
||||
c2 = it->color;
|
||||
|
||||
return upper == lower ? c1 : _interpolate( c1, c2, ( value - lower ) / ( upper - lower ) );
|
||||
return qgsDoubleNear( upper, lower ) ? c1 : _interpolate( c1, c2, ( value - lower ) / ( upper - lower ) );
|
||||
}
|
||||
lower = it->offset;
|
||||
c1 = it->color;
|
||||
@ -152,7 +152,7 @@ QColor QgsVectorGradientColorRampV2::color( double value ) const
|
||||
|
||||
upper = 1;
|
||||
c2 = mColor2;
|
||||
return upper == lower ? c1 : _interpolate( c1, c2, ( value - lower ) / ( upper - lower ) );
|
||||
return qgsDoubleNear( upper, lower ) ? c1 : _interpolate( c1, c2, ( value - lower ) / ( upper - lower ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,13 +205,13 @@ void QgsVectorGradientColorRampV2::convertToDiscrete( bool discrete )
|
||||
for ( QgsGradientStopsList::const_iterator it = mStops.constBegin();
|
||||
it != mStops.constEnd(); ++it )
|
||||
{
|
||||
newStops.append( QgsGradientStop(( double ) i / numStops, it->color ) );
|
||||
newStops.append( QgsGradientStop( static_cast< double >( i ) / numStops, it->color ) );
|
||||
if ( i == numStops - 1 )
|
||||
break;
|
||||
i++;
|
||||
}
|
||||
// replicate last color
|
||||
newStops.append( QgsGradientStop(( double ) i / numStops, mColor2 ) );
|
||||
newStops.append( QgsGradientStop( static_cast< double >( i ) / numStops, mColor2 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,7 +221,7 @@ void QgsVectorGradientColorRampV2::convertToDiscrete( bool discrete )
|
||||
for ( QgsGradientStopsList::const_iterator it = mStops.constBegin();
|
||||
it != mStops.constEnd(); ++it )
|
||||
{
|
||||
newStops.append( QgsGradientStop(( double ) i / ( numStops - 2 ), it->color ) );
|
||||
newStops.append( QgsGradientStop( static_cast< double >( i ) / ( numStops - 2 ), it->color ) );
|
||||
if ( i == numStops - 3 )
|
||||
break;
|
||||
i++;
|
||||
@ -291,13 +291,13 @@ QgsVectorColorRampV2* QgsVectorRandomColorRampV2::create( const QgsStringMap& pr
|
||||
double QgsVectorRandomColorRampV2::value( int index ) const
|
||||
{
|
||||
if ( mColors.size() < 1 ) return 0;
|
||||
return ( double )index / ( mColors.size() - 1 );
|
||||
return static_cast< double >( index ) / ( mColors.size() - 1 );
|
||||
}
|
||||
|
||||
QColor QgsVectorRandomColorRampV2::color( double value ) const
|
||||
{
|
||||
int colorCnt = mColors.count();
|
||||
int colorIdx = ( int )( value * ( colorCnt - 1 ) );
|
||||
int colorIdx = static_cast< int >( value * ( colorCnt - 1 ) );
|
||||
|
||||
if ( colorIdx >= 0 && colorIdx < colorCnt )
|
||||
return mColors.at( colorIdx );
|
||||
@ -338,7 +338,7 @@ QList<QColor> QgsVectorRandomColorRampV2::randomColors( int count,
|
||||
int safeValMin = qMin( valMin, valMax );
|
||||
|
||||
//start hue at random angle
|
||||
double currentHueAngle = 360.0 * ( double )qrand() / RAND_MAX;
|
||||
double currentHueAngle = 360.0 * static_cast< double >( qrand() ) / RAND_MAX;
|
||||
|
||||
colors.reserve( count );
|
||||
for ( int i = 0; i < count; ++i )
|
||||
@ -398,7 +398,7 @@ QColor QgsRandomColorsV2::color( double value ) const
|
||||
}
|
||||
|
||||
//can't use precalculated hues, use a totally random hue
|
||||
int h = ( int )( 360.0 * qrand() / ( RAND_MAX + 1.0 ) );
|
||||
int h = static_cast< int >( 360.0 * qrand() / ( RAND_MAX + 1.0 ) );
|
||||
int s = ( qrand() % ( DEFAULT_RANDOM_SAT_MAX - DEFAULT_RANDOM_SAT_MIN + 1 ) ) + DEFAULT_RANDOM_SAT_MIN;
|
||||
int v = ( qrand() % ( maxVal - minVal + 1 ) ) + minVal;
|
||||
return QColor::fromHsv( h, s, v );
|
||||
@ -490,7 +490,7 @@ QList<int> QgsVectorColorBrewerColorRampV2::listSchemeVariants( const QString& s
|
||||
double QgsVectorColorBrewerColorRampV2::value( int index ) const
|
||||
{
|
||||
if ( mPalette.size() < 1 ) return 0;
|
||||
return ( double )index / ( mPalette.size() - 1 );
|
||||
return static_cast< double >( index ) / ( mPalette.size() - 1 );
|
||||
}
|
||||
|
||||
QColor QgsVectorColorBrewerColorRampV2::color( double value ) const
|
||||
@ -498,7 +498,7 @@ QColor QgsVectorColorBrewerColorRampV2::color( double value ) const
|
||||
if ( mPalette.isEmpty() || value < 0 || value > 1 )
|
||||
return QColor();
|
||||
|
||||
int paletteEntry = ( int )( value * mPalette.count() );
|
||||
int paletteEntry = static_cast< int >( value * mPalette.count() );
|
||||
if ( paletteEntry >= mPalette.count() )
|
||||
paletteEntry = mPalette.count() - 1;
|
||||
return mPalette.at( paletteEntry );
|
||||
|
@ -84,7 +84,7 @@ void QgsAttributeTableModel::featuresDeleted( const QgsFeatureIds& fids )
|
||||
{
|
||||
QList<int> rows;
|
||||
|
||||
Q_FOREACH ( const QgsFeatureId& fid, fids )
|
||||
Q_FOREACH ( QgsFeatureId fid, fids )
|
||||
{
|
||||
QgsDebugMsgLevel( QString( "(%2) fid: %1, size: %3" ).arg( fid ).arg( mFeatureRequest.filterType() ).arg( mIdRowMap.size() ), 4 );
|
||||
|
||||
|
@ -41,15 +41,12 @@ bool orderByLessThan( const QgsRelationReferenceWidget::ValueRelationItem& p1
|
||||
{
|
||||
case QVariant::String:
|
||||
return p1.first.toString() < p2.first.toString();
|
||||
break;
|
||||
|
||||
case QVariant::Double:
|
||||
return p1.first.toDouble() < p2.first.toDouble();
|
||||
break;
|
||||
|
||||
default:
|
||||
return p1.first.toInt() < p2.first.toInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -31,15 +31,12 @@ bool QgsValueRelationWidgetWrapper::orderByKeyLessThan( const QgsValueRelationWi
|
||||
{
|
||||
case QVariant::String:
|
||||
return p1.first.toString() < p2.first.toString();
|
||||
break;
|
||||
|
||||
case QVariant::Double:
|
||||
return p1.first.toDouble() < p2.first.toDouble();
|
||||
break;
|
||||
|
||||
default:
|
||||
return p1.first.toInt() < p2.first.toInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,7 +396,6 @@ QVariant QgsColorSchemeModel::headerData( int section, Qt::Orientation orientati
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case Qt::TextAlignmentRole:
|
||||
|
@ -290,13 +290,10 @@ QString QgsMultiBandColorRendererWidget::min( int index )
|
||||
{
|
||||
case 0:
|
||||
return mRedMinLineEdit->text();
|
||||
break;
|
||||
case 1:
|
||||
return mGreenMinLineEdit->text();
|
||||
break;
|
||||
case 2:
|
||||
return mBlueMinLineEdit->text();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -309,13 +306,10 @@ QString QgsMultiBandColorRendererWidget::max( int index )
|
||||
{
|
||||
case 0:
|
||||
return mRedMaxLineEdit->text();
|
||||
break;
|
||||
case 1:
|
||||
return mGreenMaxLineEdit->text();
|
||||
break;
|
||||
case 2:
|
||||
return mBlueMaxLineEdit->text();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -364,13 +358,10 @@ int QgsMultiBandColorRendererWidget::selectedBand( int index )
|
||||
{
|
||||
case 0:
|
||||
return mRedBandComboBox->currentIndex();
|
||||
break;
|
||||
case 1:
|
||||
return mGreenBandComboBox->currentIndex();
|
||||
break;
|
||||
case 2:
|
||||
return mBlueBandComboBox->currentIndex();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -181,7 +181,6 @@ bool QgsGraduatedSymbolRendererV2Model::setData( const QModelIndex & index, cons
|
||||
{
|
||||
case 1: // range
|
||||
return false; // range is edited in popup dialog
|
||||
break;
|
||||
case 2: // label
|
||||
mRenderer->updateRangeLabel( index.row(), value.toString() );
|
||||
break;
|
||||
|
@ -115,7 +115,7 @@ struct QgsPostgresLayerProperty
|
||||
return property;
|
||||
}
|
||||
|
||||
#if QGISDEBUG
|
||||
#ifdef QGISDEBUG
|
||||
QString toString() const
|
||||
{
|
||||
QString typeString;
|
||||
|
@ -534,7 +534,6 @@ bool QgsPostgresFeatureIterator::declareCursor( const QString& whereClause, long
|
||||
case pktUnknown:
|
||||
QgsDebugMsg( "Cannot declare cursor without primary key." );
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
|
||||
bool subsetOfAttributes = mRequest.flags() & QgsFeatureRequest::SubsetOfAttributes;
|
||||
|
@ -324,7 +324,6 @@ static bool operator<( const QVariant &a, const QVariant &b )
|
||||
else
|
||||
return al[i] < bl[i];
|
||||
}
|
||||
break;
|
||||
|
||||
case QVariant::StringList:
|
||||
{
|
||||
@ -340,7 +339,6 @@ static bool operator<( const QVariant &a, const QVariant &b )
|
||||
else
|
||||
return al[i] < bl[i];
|
||||
}
|
||||
break;
|
||||
|
||||
case QVariant::Date:
|
||||
return a.toDate() < b.toDate();
|
||||
@ -677,10 +675,8 @@ QString QgsPostgresProvider::endianString()
|
||||
{
|
||||
case QgsApplication::NDR:
|
||||
return QString( "NDR" );
|
||||
break;
|
||||
case QgsApplication::XDR:
|
||||
return QString( "XDR" );
|
||||
break;
|
||||
default :
|
||||
return QString( "Unknown" );
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
***************************************************************************/
|
||||
#include <typeinfo>
|
||||
|
||||
#define WCS_THRESHOLD 200 // time to wait for an answer without emitting dataChanged()
|
||||
#include "qgslogger.h"
|
||||
#include "qgswcscapabilities.h"
|
||||
#include "qgsowsconnection.h"
|
||||
|
@ -56,8 +56,6 @@
|
||||
#include "cpl_conv.h"
|
||||
#include "cpl_string.h"
|
||||
|
||||
#define TINY_VALUE std::numeric_limits<double>::epsilon() * 20
|
||||
|
||||
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
|
||||
#define TO8F(x) (x).toUtf8().constData()
|
||||
#define FROM8(x) QString::fromUtf8(x)
|
||||
|
@ -82,7 +82,7 @@ class DynamicTreeModel : public QAbstractItemModel
|
||||
QHash<qint64, QString> m_items;
|
||||
QHash<qint64, QList<QList<qint64> > > m_childItems;
|
||||
qint64 nextId;
|
||||
qint64 newId() { return nextId++; };
|
||||
qint64 newId() { return nextId++; }
|
||||
|
||||
QModelIndex m_nextParentIndex;
|
||||
// int m_nextRow;
|
||||
|
@ -177,7 +177,7 @@ class TestQgsServer(unittest.TestCase):
|
||||
header, body = [str(_v) for _v in self.server.handleRequest(query_string)]
|
||||
self.assert_headers(header, body)
|
||||
response = header + body
|
||||
f = open(self.testdata_path + 'wfs_'+ request.lower() + '.txt')
|
||||
f = open(self.testdata_path + 'wfs_' + request.lower() + '.txt')
|
||||
expected = f.read()
|
||||
f.close()
|
||||
# Store the output for debug or to regenerate the reference documents:
|
||||
@ -206,7 +206,7 @@ class TestQgsServer(unittest.TestCase):
|
||||
header, body = [str(_v) for _v in self.server.handleRequest(query_string)]
|
||||
self.assert_headers(header, body)
|
||||
response = header + body
|
||||
f = open(self.testdata_path + 'wfs_getfeature_'+ requestid + '.txt')
|
||||
f = open(self.testdata_path + 'wfs_getfeature_' + requestid + '.txt')
|
||||
expected = f.read()
|
||||
f.close()
|
||||
# Store the output for debug or to regenerate the reference documents:
|
||||
@ -236,11 +236,10 @@ class TestQgsServer(unittest.TestCase):
|
||||
|
||||
def assert_headers(self, header, body):
|
||||
headers = Message(StringIO(header))
|
||||
if headers.has_key('content-length'):
|
||||
if 'content-length' in headers:
|
||||
content_length = int(headers['content-length'])
|
||||
body_length = len(body)
|
||||
self.assertEqual(content_length, body_length, msg= "Header reported content-length: %d Actual body length was: %d" %(content_length, body_length) )
|
||||
|
||||
self.assertEqual(content_length, body_length, msg="Header reported content-length: %d Actual body length was: %d" % (content_length, body_length))
|
||||
|
||||
# The following code was used to test type conversion in python bindings
|
||||
# def test_qpair(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user