mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
More raw double arrays to vectors
This commit is contained in:
parent
fe9dcf1f33
commit
499f240ca7
@ -476,7 +476,7 @@ bool LabelPosition::countFullOverlapCallback( LabelPosition *lp, void *ctx )
|
||||
LabelPosition *lp2 = context->lp;
|
||||
double *cost = context->cost;
|
||||
int *nbOv = context->nbOv;
|
||||
double *inactiveCost = context->inactiveCost;
|
||||
std::vector< double > &inactiveCost = *context->inactiveCost;
|
||||
if ( lp2->isInConflict( lp ) )
|
||||
{
|
||||
( *nbOv ) ++;
|
||||
|
@ -281,8 +281,7 @@ namespace pal
|
||||
LabelPosition *lp = nullptr;
|
||||
int *nbOv = nullptr;
|
||||
double *cost = nullptr;
|
||||
double *inactiveCost = nullptr;
|
||||
//int *feat;
|
||||
std::vector< double > *inactiveCost = nullptr;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -325,9 +325,9 @@ std::unique_ptr<Problem> Pal::extract( const QgsRectangle &extent, const QgsGeom
|
||||
|
||||
prob->mFeatureCount = features.size();
|
||||
prob->mTotalCandidates = 0;
|
||||
prob->mFeatNbLp = new int [prob->mFeatureCount];
|
||||
prob->mFeatStartId = new int [prob->mFeatureCount];
|
||||
prob->mInactiveCost = new double[prob->mFeatureCount];
|
||||
prob->mFeatNbLp.resize( prob->mFeatureCount );
|
||||
prob->mFeatStartId.resize( prob->mFeatureCount );
|
||||
prob->mInactiveCost.resize( prob->mFeatureCount );
|
||||
|
||||
if ( !features.empty() )
|
||||
{
|
||||
|
@ -57,13 +57,7 @@ inline void delete_chain( Chain *chain )
|
||||
|
||||
Problem::Problem() = default;
|
||||
|
||||
Problem::~Problem()
|
||||
{
|
||||
delete[] mFeatStartId;
|
||||
delete[] mFeatNbLp;
|
||||
|
||||
delete[] mInactiveCost;
|
||||
}
|
||||
Problem::~Problem() = default;
|
||||
|
||||
void Problem::reduce()
|
||||
{
|
||||
@ -302,7 +296,7 @@ struct ChainContext
|
||||
QLinkedList<ElemTrans *> *currentChain;
|
||||
QLinkedList<int> *conflicts;
|
||||
double *delta_tmp = nullptr;
|
||||
double *inactiveCost = nullptr;
|
||||
std::vector< double > *inactiveCost = nullptr;
|
||||
|
||||
} ;
|
||||
|
||||
@ -346,7 +340,7 @@ bool chainCallback( LabelPosition *lp, void *context )
|
||||
if ( !ctx->conflicts->contains( feat ) )
|
||||
{
|
||||
ctx->conflicts->append( feat );
|
||||
*ctx->delta_tmp += lp->cost() + ctx->inactiveCost[rfeat];
|
||||
*ctx->delta_tmp += lp->cost() + ( * ctx->inactiveCost )[rfeat];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -386,7 +380,7 @@ inline Chain *Problem::chain( int seed )
|
||||
context.featWrap = nullptr;
|
||||
context.borderSize = 0;
|
||||
context.tmpsol = &tmpsol;
|
||||
context.inactiveCost = mInactiveCost;
|
||||
context.inactiveCost = &mInactiveCost;
|
||||
context.feat = nullptr;
|
||||
context.currentChain = ¤tChain;
|
||||
context.conflicts = &conflicts;
|
||||
@ -786,7 +780,7 @@ void Problem::solution_cost()
|
||||
int nbOv;
|
||||
|
||||
LabelPosition::CountContext context;
|
||||
context.inactiveCost = mInactiveCost;
|
||||
context.inactiveCost = &mInactiveCost;
|
||||
context.nbOv = &nbOv;
|
||||
context.cost = &mSol.totalCost;
|
||||
double amin[2];
|
||||
|
@ -183,10 +183,9 @@ namespace pal
|
||||
|
||||
std::vector< std::unique_ptr< LabelPosition > > mPositionsWithNoCandidates;
|
||||
|
||||
//int *feat; // [nblp]
|
||||
int *mFeatStartId = nullptr; // [nbft]
|
||||
int *mFeatNbLp = nullptr; // [nbft]
|
||||
double *mInactiveCost = nullptr; //
|
||||
std::vector< int > mFeatStartId;
|
||||
std::vector< int > mFeatNbLp;
|
||||
std::vector< double > mInactiveCost;
|
||||
|
||||
class Sol
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user