mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Fix some more old style cast and float comparison warnings
This commit is contained in:
parent
566dd4bd43
commit
766bfa1a7f
@ -165,7 +165,7 @@ class QgsCoordinateTransform : QObject
|
||||
/** See if the transform short circuits because src and dest are equivalent
|
||||
* @return bool True if it short circuits
|
||||
*/
|
||||
bool isShortCircuited();
|
||||
bool isShortCircuited() const;
|
||||
|
||||
/** Change the destination coordinate system by passing it a qgis srsid
|
||||
* A QGIS srsid is a unique key value to an entry on the tbl_srs in the
|
||||
|
@ -211,7 +211,7 @@ static void dumpBacktrace( unsigned int depth )
|
||||
}
|
||||
|
||||
close( fd[1] ); // close writing end
|
||||
execl( "/usr/bin/c++filt", "c++filt", ( char * ) nullptr );
|
||||
execl( "/usr/bin/c++filt", "c++filt", static_cast< char * >( nullptr ) );
|
||||
perror( "could not start c++filt" );
|
||||
exit( 1 );
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ void QgsLabelingWidget::labelModeChanged( int index )
|
||||
if ( QgsLabelingGui* widgetSimple = qobject_cast<QgsLabelingGui*>( mWidget ) )
|
||||
{
|
||||
// lighter variant - just change the mode of existing widget
|
||||
widgetSimple->setLabelMode(( QgsLabelingGui::LabelMode ) index );
|
||||
widgetSimple->setLabelMode( static_cast< QgsLabelingGui::LabelMode >( index ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,7 @@ void QgsLabelingWidget::labelModeChanged( int index )
|
||||
else
|
||||
{
|
||||
QgsLabelingGui* w = new QgsLabelingGui( mLayer, mCanvas, nullptr, this );
|
||||
w->setLabelMode(( QgsLabelingGui::LabelMode ) index );
|
||||
w->setLabelMode( static_cast< QgsLabelingGui::LabelMode >( index ) );
|
||||
w->init();
|
||||
mWidget = w;
|
||||
}
|
||||
|
@ -872,7 +872,7 @@ void QgsVectorLayerProperties::saveStyleAsMenuTriggered( QAction *action )
|
||||
if ( index < 0 )
|
||||
return;
|
||||
|
||||
saveStyleAs(( StyleType ) index );
|
||||
saveStyleAs( static_cast< StyleType >( index ) );
|
||||
}
|
||||
|
||||
void QgsVectorLayerProperties::saveStyleAs( StyleType styleType )
|
||||
|
@ -420,7 +420,7 @@ void QgsDxfExport::writeGroup( const QColor& color, int exactMatchCode, int rgbC
|
||||
int minDistAt = -1;
|
||||
int minDist = INT_MAX;
|
||||
|
||||
for ( int i = 1; i < ( int )( sizeof( mDxfColors ) / sizeof( *mDxfColors ) ) && minDist > 0; ++i )
|
||||
for ( int i = 1; i < static_cast< int >( sizeof( mDxfColors ) / sizeof( *mDxfColors ) ) && minDist > 0; ++i )
|
||||
{
|
||||
int dist = color_distance( color.rgba(), i );
|
||||
if ( dist >= minDist )
|
||||
@ -3801,7 +3801,7 @@ int QgsDxfExport::closestColorMatch( QRgb pixel )
|
||||
{
|
||||
int idx = 0;
|
||||
int current_distance = INT_MAX;
|
||||
for ( int i = 1; i < ( int )( sizeof( mDxfColors ) / sizeof( *mDxfColors ) ); ++i )
|
||||
for ( int i = 1; i < static_cast< int >( sizeof( mDxfColors ) / sizeof( *mDxfColors ) ); ++i )
|
||||
{
|
||||
int dist = color_distance( pixel, i );
|
||||
if ( dist < current_distance )
|
||||
@ -4136,10 +4136,10 @@ QString QgsDxfExport::dxfEncoding( const QString &name )
|
||||
continue;
|
||||
|
||||
int i;
|
||||
for ( i = 0; i < ( int )( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) && name != mDxfEncodings[i][1]; ++i )
|
||||
for ( i = 0; i < static_cast< int >( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) && name != mDxfEncodings[i][1]; ++i )
|
||||
;
|
||||
|
||||
if ( i == ( int )( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) )
|
||||
if ( i == static_cast< int >( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) )
|
||||
continue;
|
||||
|
||||
return mDxfEncodings[i][0];
|
||||
@ -4154,10 +4154,10 @@ QStringList QgsDxfExport::encodings()
|
||||
Q_FOREACH ( QByteArray codec, QTextCodec::availableCodecs() )
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i < ( int )( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) && strcmp( codec.data(), mDxfEncodings[i][1] ) != 0; ++i )
|
||||
for ( i = 0; i < static_cast< int >( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) && strcmp( codec.data(), mDxfEncodings[i][1] ) != 0; ++i )
|
||||
;
|
||||
|
||||
if ( i < ( int )( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) )
|
||||
if ( i < static_cast< int >( sizeof( mDxfEncodings ) / sizeof( *mDxfEncodings ) ) )
|
||||
encodings << codec.data();
|
||||
}
|
||||
return encodings;
|
||||
|
@ -27,9 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
|
||||
#if defined(_VERBOSE_) || defined(_DEBUG_)
|
||||
#include <iostream>
|
||||
#endif
|
||||
@ -250,18 +247,18 @@ namespace pal
|
||||
double xdiff = -labelW / 2.0;
|
||||
double ydiff = -labelH / 2.0;
|
||||
|
||||
if ( mLF->quadOffset().x() != 0 )
|
||||
if ( !qgsDoubleNear( mLF->quadOffset().x(), 0.0 ) )
|
||||
{
|
||||
xdiff += labelW / 2.0 * mLF->quadOffset().x();
|
||||
}
|
||||
if ( mLF->quadOffset().y() != 0 )
|
||||
if ( !qgsDoubleNear( mLF->quadOffset().y(), 0.0 ) )
|
||||
{
|
||||
ydiff += labelH / 2.0 * mLF->quadOffset().y();
|
||||
}
|
||||
|
||||
if ( ! mLF->hasFixedPosition() )
|
||||
{
|
||||
if ( angle != 0 )
|
||||
if ( !qgsDoubleNear( angle, 0.0 ) )
|
||||
{
|
||||
double xd = xdiff * cos( angle ) - ydiff * sin( angle );
|
||||
double yd = xdiff * sin( angle ) + ydiff * cos( angle );
|
||||
@ -290,11 +287,11 @@ namespace pal
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mLF->positionOffset().x() != 0 )
|
||||
if ( !qgsDoubleNear( mLF->positionOffset().x(), 0.0 ) )
|
||||
{
|
||||
xdiff += mLF->positionOffset().x();
|
||||
}
|
||||
if ( mLF->positionOffset().y() != 0 )
|
||||
if ( !qgsDoubleNear( mLF->positionOffset().y(), 0.0 ) )
|
||||
{
|
||||
ydiff += mLF->positionOffset().y();
|
||||
}
|
||||
@ -359,7 +356,7 @@ namespace pal
|
||||
gamma2 = a90 / 3.0;
|
||||
|
||||
|
||||
if ( gamma1 == 0 || gamma2 == 0 )
|
||||
if ( qgsDoubleNear( gamma1, 0.0 ) || qgsDoubleNear( gamma2, 0.0 ) )
|
||||
{
|
||||
std::cout << "Oups... label size error..." << std::endl;
|
||||
}
|
||||
@ -538,7 +535,7 @@ namespace pal
|
||||
ad[line->nbPoints-1] = ll;
|
||||
|
||||
|
||||
nbls = ( int )( ll / xrm ); // ratio bw line length and label width
|
||||
nbls = static_cast< int >( ll / xrm ); // ratio bw line length and label width
|
||||
|
||||
#ifdef _DEBUG_FULL_
|
||||
std::cout << "line length :" << ll << std::endl;
|
||||
@ -707,7 +704,7 @@ namespace pal
|
||||
double dy = new_y - old_y;
|
||||
|
||||
double segment_length = path_distances[index];
|
||||
if ( segment_length == 0 )
|
||||
if ( qgsDoubleNear( segment_length, 0.0 ) )
|
||||
{
|
||||
// Not allowed to place across on 0 length segments or discontinuities
|
||||
return nullptr;
|
||||
@ -732,7 +729,7 @@ namespace pal
|
||||
LabelInfo::CharacterInfo& ci = ( orientation > 0 ? li->char_info[i] : li->char_info[li->char_num-i-1] );
|
||||
|
||||
// Coordinates this character will start at
|
||||
if ( segment_length == 0 )
|
||||
if ( qgsDoubleNear( segment_length, 0.0 ) )
|
||||
{
|
||||
// Not allowed to place across on 0 length segments or discontinuities
|
||||
delete slp;
|
||||
@ -895,7 +892,7 @@ namespace pal
|
||||
total_distance += path_distances[i];
|
||||
}
|
||||
|
||||
if ( total_distance == 0 )
|
||||
if ( qgsDoubleNear( total_distance, 0.0 ) )
|
||||
{
|
||||
delete[] path_distances;
|
||||
return 0;
|
||||
|
@ -165,7 +165,8 @@ namespace pal
|
||||
b2 = x3 - x4;
|
||||
c2 = x4 * y3 - x3 * y4;
|
||||
|
||||
if (( denom = a1 * b2 - a2 * b1 ) == 0 )
|
||||
denom = a1 * b2 - a2 * b1;
|
||||
if ( qgsDoubleNear( denom, 0.0 ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -376,7 +377,7 @@ namespace pal
|
||||
// Should never happen, No real solutions.
|
||||
return;
|
||||
|
||||
if ( det == 0 )
|
||||
if ( qgsDoubleNear( det, 0.0 ) )
|
||||
{
|
||||
// Could potentially happen.... One solution.
|
||||
double t = -B / ( 2 * A );
|
||||
|
@ -27,8 +27,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
#include "layer.h"
|
||||
#include "pal.h"
|
||||
#include "costcalculator.h"
|
||||
@ -395,19 +393,9 @@ namespace pal
|
||||
nextPart->setConflictsWithObstacle( conflicts );
|
||||
}
|
||||
|
||||
bool LabelPosition::costShrink( void *l, void *r )
|
||||
{
|
||||
return (( LabelPosition* ) l )->mCost < (( LabelPosition* ) r )->mCost;
|
||||
}
|
||||
|
||||
bool LabelPosition::costGrow( void *l, void *r )
|
||||
{
|
||||
return (( LabelPosition* ) l )->mCost > (( LabelPosition* ) r )->mCost;
|
||||
}
|
||||
|
||||
bool LabelPosition::polygonObstacleCallback( FeaturePart *obstacle, void *ctx )
|
||||
{
|
||||
PolygonCostCalculator *pCost = ( PolygonCostCalculator* ) ctx;
|
||||
PolygonCostCalculator *pCost = reinterpret_cast< PolygonCostCalculator* >( ctx );
|
||||
|
||||
LabelPosition *lp = pCost->getLabel();
|
||||
if (( obstacle == lp->feature ) || ( obstacle->getHoleOf() && obstacle->getHoleOf() != lp->feature ) )
|
||||
@ -443,7 +431,7 @@ namespace pal
|
||||
|
||||
bool LabelPosition::pruneCallback( LabelPosition *candidatePosition, void *ctx )
|
||||
{
|
||||
FeaturePart *obstaclePart = (( PruneCtx* ) ctx )->obstacle;
|
||||
FeaturePart *obstaclePart = ( reinterpret_cast< PruneCtx* >( ctx ) )->obstacle;
|
||||
|
||||
// test whether we should ignore this obstacle for the candidate. We do this if:
|
||||
// 1. it's not a hole, and the obstacle belongs to the same label feature as the candidate (eg
|
||||
@ -464,7 +452,7 @@ namespace pal
|
||||
|
||||
bool LabelPosition::countOverlapCallback( LabelPosition *lp, void *ctx )
|
||||
{
|
||||
LabelPosition *lp2 = ( LabelPosition* ) ctx;
|
||||
LabelPosition *lp2 = reinterpret_cast< LabelPosition* >( ctx );
|
||||
|
||||
//std::cerr << "checking " << lp2->getFeature()->getUID() << " x " << lp->getFeature()->getUID() << std::endl;
|
||||
if ( lp2->isInConflict( lp ) )
|
||||
@ -478,11 +466,12 @@ namespace pal
|
||||
|
||||
bool LabelPosition::countFullOverlapCallback( LabelPosition *lp, void *ctx )
|
||||
{
|
||||
LabelPosition *lp2 = (( CountContext* ) ctx )->lp;
|
||||
double *cost = (( CountContext* ) ctx )->cost;
|
||||
CountContext* context = reinterpret_cast< CountContext* >( ctx );
|
||||
LabelPosition *lp2 = context->lp;
|
||||
double *cost = context->cost;
|
||||
//int *feat = ((CountContext*)ctx)->feat;
|
||||
int *nbOv = (( CountContext* ) ctx )->nbOv;
|
||||
double *inactiveCost = (( CountContext* ) ctx )->inactiveCost;
|
||||
int *nbOv = context->nbOv;
|
||||
double *inactiveCost = context->inactiveCost;
|
||||
if ( lp2->isInConflict( lp ) )
|
||||
{
|
||||
#ifdef _DEBUG_FULL_
|
||||
@ -499,7 +488,7 @@ namespace pal
|
||||
|
||||
bool LabelPosition::removeOverlapCallback( LabelPosition *lp, void *ctx )
|
||||
{
|
||||
LabelPosition *lp2 = ( LabelPosition * ) ctx;
|
||||
LabelPosition *lp2 = reinterpret_cast< LabelPosition * >( ctx );
|
||||
|
||||
if ( lp2->isInConflict( lp ) )
|
||||
{
|
||||
|
@ -158,7 +158,7 @@ namespace pal
|
||||
*/
|
||||
FeaturePart * getFeaturePart();
|
||||
|
||||
double getNumOverlaps() const { return nbOverlap; }
|
||||
int getNumOverlaps() const { return nbOverlap; }
|
||||
void resetNumOverlaps() { nbOverlap = 0; } // called from problem.cpp, pal.cpp
|
||||
|
||||
int getProblemFeatureId() const { return probFeat; }
|
||||
@ -243,10 +243,6 @@ namespace pal
|
||||
/** Check whether the candidate in ctx overlap with obstacle feat */
|
||||
static bool pruneCallback( LabelPosition *candidatePosition, void *ctx );
|
||||
|
||||
// for sorting
|
||||
static bool costShrink( void *l, void *r );
|
||||
static bool costGrow( void *l, void *r );
|
||||
|
||||
// for counting number of overlaps
|
||||
typedef struct
|
||||
{
|
||||
|
@ -157,7 +157,7 @@ namespace pal
|
||||
GEOSContextHandle_t geosctxt = geosContext();
|
||||
|
||||
bool needClose = false;
|
||||
if ( type == GEOS_POLYGON && ( x[0] != x[ nbPoints - 1] || y[0] != y[ nbPoints - 1 ] ) )
|
||||
if ( type == GEOS_POLYGON && ( !qgsDoubleNear( x[0], x[ nbPoints - 1] ) || !qgsDoubleNear( y[0], y[ nbPoints - 1 ] ) ) )
|
||||
{
|
||||
needClose = true;
|
||||
}
|
||||
|
@ -122,29 +122,11 @@ namespace pal
|
||||
double nbOverlap;
|
||||
} Ft;
|
||||
|
||||
|
||||
inline bool borderSizeDec( void *l, void *r )
|
||||
{
|
||||
return (( SubPart* ) l )->borderSize < (( SubPart* ) r )->borderSize;
|
||||
}
|
||||
|
||||
inline bool borderSizeInc( void *l, void *r )
|
||||
{
|
||||
return (( SubPart* ) l )->borderSize > (( SubPart* ) r )->borderSize;
|
||||
return ( reinterpret_cast< SubPart* >( l ) )->borderSize > ( reinterpret_cast< SubPart* >( r ) )->borderSize;
|
||||
}
|
||||
|
||||
inline bool increaseImportance( void *l, void *r )
|
||||
{
|
||||
return (( Ft* ) l )->inactiveCost < (( Ft* ) r )->inactiveCost;
|
||||
}
|
||||
|
||||
inline bool increaseNbOverlap( void *l, void *r )
|
||||
{
|
||||
return (( Ft* ) l )->nbOverlap > (( Ft* ) r )->nbOverlap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Problem::reduce()
|
||||
{
|
||||
|
||||
@ -195,7 +177,7 @@ namespace pal
|
||||
lp2->getBoundingBox( amin, amax );
|
||||
|
||||
nbOverlap -= lp2->getNumOverlaps();
|
||||
candidates->Search( amin, amax, LabelPosition::removeOverlapCallback, ( void* ) lp2 );
|
||||
candidates->Search( amin, amax, LabelPosition::removeOverlapCallback, reinterpret_cast< void* >( lp2 ) );
|
||||
lp2->removeFromIndex( candidates );
|
||||
}
|
||||
|
||||
@ -245,10 +227,11 @@ namespace pal
|
||||
RTree <LabelPosition*, double, 2, double> *candidates;
|
||||
} FalpContext;
|
||||
|
||||
bool falpCallback2( LabelPosition *lp, void * ctx )
|
||||
bool falpCallback2( LabelPosition *lp, void* ctx )
|
||||
{
|
||||
LabelPosition *lp2 = (( FalpContext* ) ctx )->lp;
|
||||
PriorityQueue *list = (( FalpContext* ) ctx )->list;
|
||||
FalpContext* context = reinterpret_cast< FalpContext* >( ctx );
|
||||
LabelPosition *lp2 = context->lp;
|
||||
PriorityQueue *list = context->list;
|
||||
|
||||
if ( lp->getId() != lp2->getId() && list->isIn( lp->getId() ) && lp->isInConflict( lp2 ) )
|
||||
{
|
||||
@ -282,11 +265,12 @@ namespace pal
|
||||
}
|
||||
|
||||
|
||||
bool falpCallback1( LabelPosition *lp, void * ctx )
|
||||
bool falpCallback1( LabelPosition *lp, void* ctx )
|
||||
{
|
||||
LabelPosition *lp2 = (( FalpContext* ) ctx )->lp;
|
||||
PriorityQueue *list = (( FalpContext* ) ctx )->list;
|
||||
RTree <LabelPosition*, double, 2, double> *candidates = (( FalpContext* ) ctx )->candidates;
|
||||
FalpContext* context = reinterpret_cast< FalpContext* >( ctx );
|
||||
LabelPosition *lp2 = context->lp;
|
||||
PriorityQueue *list = context->list;
|
||||
RTree <LabelPosition*, double, 2, double> *candidates = context->candidates;
|
||||
|
||||
if ( lp2->isInConflict( lp ) )
|
||||
{
|
||||
@ -329,7 +313,7 @@ namespace pal
|
||||
label = featStartId[i] + j;
|
||||
try
|
||||
{
|
||||
list->insert( label, ( double ) mLabelPositions.at( label )->getNumOverlaps() );
|
||||
list->insert( label, mLabelPositions.at( label )->getNumOverlaps() );
|
||||
}
|
||||
catch ( pal::InternalException::Full )
|
||||
{
|
||||
@ -372,7 +356,7 @@ namespace pal
|
||||
lp->getBoundingBox( amin, amax );
|
||||
|
||||
context->lp = lp;
|
||||
candidates->Search( amin, amax, falpCallback1, ( void* ) context );
|
||||
candidates->Search( amin, amax, falpCallback1, reinterpret_cast< void* >( context ) );
|
||||
candidates_sol->Insert( amin, amax, lp );
|
||||
}
|
||||
|
||||
@ -407,7 +391,7 @@ namespace pal
|
||||
if ( lp->getNumOverlaps() < nbOverlap )
|
||||
{
|
||||
retainedLabel = lp;
|
||||
nbOverlap = static_cast<int>( lp->getNumOverlaps() );
|
||||
nbOverlap = lp->getNumOverlaps();
|
||||
}
|
||||
}
|
||||
sol->s[i] = retainedLabel->getId();
|
||||
@ -476,7 +460,7 @@ namespace pal
|
||||
ok[i] = false;
|
||||
}
|
||||
delete[] isIn;
|
||||
sort(( void** ) parts, nbft, borderSizeInc );
|
||||
sort( reinterpret_cast< void** >( parts ), nbft, borderSizeInc );
|
||||
//sort ((void**)parts, nbft, borderSizeDec);
|
||||
|
||||
#ifdef _VERBOSE_
|
||||
@ -645,12 +629,13 @@ namespace pal
|
||||
|
||||
bool subPartCallback( LabelPosition *lp, void *ctx )
|
||||
{
|
||||
int *isIn = (( SubPartContext* ) ctx )->isIn;
|
||||
QLinkedList<int> *queue = (( SubPartContext* ) ctx )->queue;
|
||||
SubPartContext* context = reinterpret_cast< SubPartContext* >( ctx );
|
||||
int *isIn = context->isIn;
|
||||
QLinkedList<int> *queue = context->queue;
|
||||
|
||||
|
||||
int id = lp->getProblemFeatureId();
|
||||
if ( !isIn[id] && lp->isInConflict((( SubPartContext* ) ctx )->lp ) )
|
||||
if ( !isIn[id] && lp->isInConflict( context->lp ) )
|
||||
{
|
||||
queue->append( id );
|
||||
isIn[id] = 1;
|
||||
@ -702,7 +687,7 @@ namespace pal
|
||||
lp->getBoundingBox( amin, amax );
|
||||
|
||||
context.lp = lp;
|
||||
candidates->Search( amin, amax, subPartCallback, ( void* ) &context );
|
||||
candidates->Search( amin, amax, subPartCallback, reinterpret_cast< void* >( &context ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,7 +749,7 @@ namespace pal
|
||||
lp->getBoundingBox( amin, amax );
|
||||
|
||||
context.lp = lp;
|
||||
candidates_subsol->Search( amin, amax, LabelPosition::countFullOverlapCallback, ( void* ) &context );
|
||||
candidates_subsol->Search( amin, amax, LabelPosition::countFullOverlapCallback, reinterpret_cast< void* >( &context ) );
|
||||
|
||||
cost += lp->cost();
|
||||
}
|
||||
@ -808,16 +793,9 @@ namespace pal
|
||||
|
||||
bool decreaseCost( void *tl, void *tr )
|
||||
{
|
||||
return (( Triple* ) tl )->cost < (( Triple* ) tr )->cost;
|
||||
return ( reinterpret_cast< Triple* >( tl ) )->cost < ( reinterpret_cast< Triple* >( tr ) )->cost;
|
||||
}
|
||||
|
||||
bool increaseCost( void *tl, void *tr )
|
||||
{
|
||||
return (( Triple* ) tl )->cost > (( Triple* ) tr )->cost;
|
||||
}
|
||||
|
||||
|
||||
|
||||
inline void actualizeTabuCandidateList( int m, int iteration, int nbOverlap, int *candidateListSize,
|
||||
double candidateBaseFactor, double *candidateFactor,
|
||||
int minCandidateListSize, double reductionFactor,
|
||||
@ -829,8 +807,8 @@ namespace pal
|
||||
|
||||
if ( iteration % m == 0 )
|
||||
{
|
||||
*tenure = minTabuTSize + ( int )( tabuFactor * nbOverlap );
|
||||
*candidateListSize = minCandidateListSize + ( int )( *candidateFactor * nbOverlap );
|
||||
*tenure = minTabuTSize + static_cast< int >( tabuFactor * nbOverlap );
|
||||
*candidateListSize = minCandidateListSize + static_cast< int >( *candidateFactor * nbOverlap );
|
||||
|
||||
if ( *candidateListSize > n )
|
||||
*candidateListSize = n;
|
||||
@ -847,7 +825,7 @@ namespace pal
|
||||
|
||||
if ( *candidateListSize < n )
|
||||
*candidateFactor = *candidateFactor * growingFactor;
|
||||
*candidateListSize = minCandidateListSize + ( int )( *candidateFactor * nbOverlap );
|
||||
*candidateListSize = minCandidateListSize + static_cast< int >( *candidateFactor * nbOverlap );
|
||||
|
||||
if ( *candidateListSize > n )
|
||||
*candidateListSize = n;
|
||||
@ -870,7 +848,7 @@ namespace pal
|
||||
|
||||
bool updateCandidatesCost( LabelPosition *lp, void *context )
|
||||
{
|
||||
UpdateContext *ctx = ( UpdateContext* ) context;
|
||||
UpdateContext *ctx = reinterpret_cast< UpdateContext* >( context );
|
||||
|
||||
if ( ctx->lp->isInConflict( lp ) )
|
||||
{
|
||||
@ -1030,7 +1008,7 @@ namespace pal
|
||||
}
|
||||
}
|
||||
|
||||
sort(( void** ) candidateList, probSize, decreaseCost );
|
||||
sort( reinterpret_cast< void** >( candidateList ), probSize, decreaseCost );
|
||||
|
||||
best_cost = cur_cost;
|
||||
initial_cost = cur_cost;
|
||||
@ -1219,7 +1197,7 @@ namespace pal
|
||||
lp->insertIntoIndex( candidates_subsol );
|
||||
}
|
||||
|
||||
sort(( void** ) candidateList, probSize, decreaseCost );
|
||||
sort( reinterpret_cast< void** >( candidateList ), probSize, decreaseCost );
|
||||
|
||||
if ( best_cost - cur_cost > EPSILON ) // new best sol
|
||||
{
|
||||
@ -1283,7 +1261,7 @@ namespace pal
|
||||
|
||||
bool chainCallback( LabelPosition *lp, void *context )
|
||||
{
|
||||
ChainContext *ctx = ( ChainContext* ) context;
|
||||
ChainContext *ctx = reinterpret_cast< ChainContext* >( context );
|
||||
|
||||
|
||||
#ifdef _DEBUG_FULL_
|
||||
@ -1448,7 +1426,7 @@ namespace pal
|
||||
std::cerr << "Conflicts not empty !!" << std::endl;
|
||||
|
||||
// search ative conflicts and count them
|
||||
candidates_subsol->Search( amin, amax, chainCallback, ( void* ) &context );
|
||||
candidates_subsol->Search( amin, amax, chainCallback, reinterpret_cast< void* >( &context ) );
|
||||
|
||||
#ifdef _DEBUG_FULL_
|
||||
std::cout << "Conflicts:" << conflicts->size() << std::endl;
|
||||
@ -1738,7 +1716,7 @@ namespace pal
|
||||
if ( conflicts->size() != 0 )
|
||||
std::cerr << "Conflicts not empty" << std::endl;
|
||||
|
||||
candidates_sol->Search( amin, amax, chainCallback, ( void* ) &context );
|
||||
candidates_sol->Search( amin, amax, chainCallback, reinterpret_cast< void* >( &context ) );
|
||||
|
||||
// no conflict -> end of chain
|
||||
if ( conflicts->isEmpty() )
|
||||
@ -2181,10 +2159,10 @@ namespace pal
|
||||
candidates[i]->cost = ( sol[i+borderSize] == -1 ? inactiveCost[i+borderSize] : mLabelPositions.at( sol[i+borderSize] )->cost() );
|
||||
}
|
||||
|
||||
sort(( void** ) candidates, probSize, decreaseCost );
|
||||
sort( reinterpret_cast< void** >( candidates ), probSize, decreaseCost );
|
||||
|
||||
int candidateListSize;
|
||||
candidateListSize = int ( pal->candListSize * ( double ) probSize + 0.5 );
|
||||
candidateListSize = int ( pal->candListSize * static_cast< double >( probSize ) + 0.5 );
|
||||
|
||||
if ( candidateListSize > probSize )
|
||||
candidateListSize = probSize;
|
||||
@ -2324,7 +2302,7 @@ namespace pal
|
||||
|
||||
stop_it = ( it + itwimp > maxit ? maxit : it + itwimp );
|
||||
}
|
||||
sort(( void** ) candidates, probSize, decreaseCost );
|
||||
sort( reinterpret_cast< void** >( candidates ), probSize, decreaseCost );
|
||||
|
||||
|
||||
}
|
||||
@ -2357,7 +2335,7 @@ namespace pal
|
||||
|
||||
bool checkCallback( LabelPosition *lp, void *ctx )
|
||||
{
|
||||
QLinkedList<LabelPosition*> *list = ( QLinkedList<LabelPosition*>* ) ctx;
|
||||
QLinkedList<LabelPosition*> *list = reinterpret_cast< QLinkedList<LabelPosition*>* >( ctx );
|
||||
list->append( lp );
|
||||
|
||||
return true;
|
||||
@ -2378,7 +2356,7 @@ namespace pal
|
||||
|
||||
QLinkedList<LabelPosition*> *list = new QLinkedList<LabelPosition*>;
|
||||
|
||||
candidates_sol->Search( amin, amax, checkCallback, ( void* ) list );
|
||||
candidates_sol->Search( amin, amax, checkCallback, reinterpret_cast< void* >( list ) );
|
||||
|
||||
std::cerr << "Check Solution" << std::endl;
|
||||
|
||||
@ -2431,10 +2409,10 @@ namespace pal
|
||||
|
||||
bool nokCallback( LabelPosition *lp, void *context )
|
||||
{
|
||||
|
||||
LabelPosition *lp2 = (( NokContext* ) context )->lp;
|
||||
bool *ok = (( NokContext* ) context )->ok;
|
||||
int *wrap = (( NokContext* ) context )->wrap;
|
||||
NokContext* ctx = reinterpret_cast< NokContext*>( context );
|
||||
LabelPosition *lp2 = ctx->lp;
|
||||
bool *ok = ctx->ok;
|
||||
int *wrap = ctx->wrap;
|
||||
|
||||
if ( lp2->isInConflict( lp ) )
|
||||
{
|
||||
|
@ -14,12 +14,6 @@
|
||||
* - 2008 Portability issues fixed by Maxence Laurent
|
||||
*/
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef RTREE_H
|
||||
#define RTREE_H
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace pal
|
||||
if ( N <= 0 )
|
||||
return;
|
||||
|
||||
unsigned int n = ( unsigned int ) N, i = n / 2, parent, child;
|
||||
unsigned int n = static_cast< unsigned int >( N ), i = n / 2, parent, child;
|
||||
|
||||
void *t = nullptr;
|
||||
|
||||
|
@ -196,12 +196,12 @@ class CORE_EXPORT QgsCoordinateTransform : public QObject
|
||||
* Flag to indicate whether the coordinate systems have been initialised
|
||||
* @return true if initialised, otherwise false
|
||||
*/
|
||||
bool isInitialised() const {return mInitialisedFlag;}
|
||||
bool isInitialised() const { return mInitialisedFlag; }
|
||||
|
||||
/** See if the transform short circuits because src and dest are equivalent
|
||||
* @return bool True if it short circuits
|
||||
*/
|
||||
bool isShortCircuited() {return mShortCircuit;}
|
||||
bool isShortCircuited() const { return mShortCircuit; }
|
||||
|
||||
/** Change the destination coordinate system by passing it a qgis srsid
|
||||
* A QGIS srsid is a unique key value to an entry on the tbl_srs in the
|
||||
|
@ -330,7 +330,7 @@ void QgsLegendRenderer::setColumns( QList<Atom>& atomList )
|
||||
{
|
||||
if ( QgsLayerTreeModelLegendNode* legendNode = qobject_cast<QgsLayerTreeModelLegendNode*>( atom.nucleons.at( j ).item ) )
|
||||
{
|
||||
QString key = QString( "%1-%2" ).arg(( qulonglong )legendNode->layerNode() ).arg( atom.column );
|
||||
QString key = QString( "%1-%2" ).arg( reinterpret_cast< qulonglong >( legendNode->layerNode() ) ).arg( atom.column );
|
||||
maxSymbolWidth[key] = qMax( atom.nucleons.at( j ).symbolSize.width(), maxSymbolWidth[key] );
|
||||
}
|
||||
}
|
||||
@ -342,7 +342,7 @@ void QgsLegendRenderer::setColumns( QList<Atom>& atomList )
|
||||
{
|
||||
if ( QgsLayerTreeModelLegendNode* legendNode = qobject_cast<QgsLayerTreeModelLegendNode*>( atom.nucleons.at( j ).item ) )
|
||||
{
|
||||
QString key = QString( "%1-%2" ).arg(( qulonglong )legendNode->layerNode() ).arg( atom.column );
|
||||
QString key = QString( "%1-%2" ).arg( reinterpret_cast< qulonglong >( legendNode->layerNode() ) ).arg( atom.column );
|
||||
double space = mSettings.style( QgsComposerLegendStyle::Symbol ).margin( QgsComposerLegendStyle::Right ) +
|
||||
mSettings.style( QgsComposerLegendStyle::SymbolLabel ).margin( QgsComposerLegendStyle::Left );
|
||||
atom.nucleons[j].labelXOffset = maxSymbolWidth[key] + space;
|
||||
@ -375,7 +375,7 @@ QSizeF QgsLegendRenderer::drawTitle( QPainter* painter, QPointF point, Qt::Align
|
||||
switch ( halignment )
|
||||
{
|
||||
case Qt::AlignHCenter:
|
||||
textBoxWidth = ( qMin(( double ) point.x(), legendWidth - point.x() ) - mSettings.boxSpace() ) * 2.0;
|
||||
textBoxWidth = ( qMin( static_cast< double >( point.x() ), legendWidth - point.x() ) - mSettings.boxSpace() ) * 2.0;
|
||||
textBoxLeft = point.x() - textBoxWidth / 2.;
|
||||
break;
|
||||
case Qt::AlignRight:
|
||||
@ -507,7 +507,7 @@ QgsLegendRenderer::Nucleon QgsLegendRenderer::drawSymbolItem( QgsLayerTreeModelL
|
||||
nucleon.symbolSize = im.symbolSize;
|
||||
nucleon.labelSize = im.labelSize;
|
||||
//QgsDebugMsg( QString( "symbol height = %1 label height = %2").arg( symbolSize.height()).arg( labelSize.height() ));
|
||||
double width = qMax(( double ) im.symbolSize.width(), labelXOffset ) + im.labelSize.width();
|
||||
double width = qMax( static_cast< double >( im.symbolSize.width() ), labelXOffset ) + im.labelSize.width();
|
||||
double height = qMax( im.symbolSize.height(), im.labelSize.height() );
|
||||
nucleon.size = QSizeF( width, height );
|
||||
return nucleon;
|
||||
|
@ -1092,7 +1092,7 @@ bool QgsMapLayer::loadNamedStyleFromDb( const QString &db, const QString &theURI
|
||||
if ( sqlite3_bind_text( myPreparedStatement, 1, param.data(), param.length(), SQLITE_STATIC ) == SQLITE_OK &&
|
||||
sqlite3_step( myPreparedStatement ) == SQLITE_ROW )
|
||||
{
|
||||
qml = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) );
|
||||
qml = QString::fromUtf8( reinterpret_cast< const char * >( sqlite3_column_text( myPreparedStatement, 0 ) ) );
|
||||
theResultFlag = true;
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@ bool QgsRuleBasedLabeling::Rule::isFilterOK( QgsFeature& f, QgsRenderContext& co
|
||||
|
||||
bool QgsRuleBasedLabeling::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;
|
||||
|
@ -43,8 +43,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() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ bool QgsVectorLayerRenderer::render()
|
||||
const QgsCoordinateTransform* ct = mContext.coordinateTransform();
|
||||
|
||||
// resize the tolerance using the change of size of an 1-BBOX from the source CoordinateSystem to the target CoordinateSystem
|
||||
if ( ct && !(( QgsCoordinateTransform* )ct )->isShortCircuited() )
|
||||
if ( ct && !( ct->isShortCircuited() ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -205,7 +205,7 @@ bool QgsVectorLayerRenderer::render()
|
||||
QgsDebugMsg( QString( "Simplify - SourceHypothenuse=%1" ).arg( sourceHypothenuse ) );
|
||||
QgsDebugMsg( QString( "Simplify - TargetHypothenuse=%1" ).arg( targetHypothenuse ) );
|
||||
|
||||
if ( targetHypothenuse != 0 )
|
||||
if ( !qgsDoubleNear( targetHypothenuse, 0.0 ) )
|
||||
map2pixelTol *= ( sourceHypothenuse / targetHypothenuse );
|
||||
}
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ QString QgsBench::serialize( const QMap<QString, QVariant>& theMap, int level )
|
||||
QMap<QString, QVariant>::const_iterator i = theMap.constBegin();
|
||||
while ( i != theMap.constEnd() )
|
||||
{
|
||||
switch (( QMetaType::Type )i.value().type() )
|
||||
switch ( static_cast< QMetaType::Type >( i.value().type() ) )
|
||||
{
|
||||
case QMetaType::Int:
|
||||
list.append( space2 + '\"' + i.key() + "\": " + QString( "%1" ).arg( i.value().toInt() ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user