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