Skip to content
Permalink
Browse files

semi-automatic indentation update

git-svn-id: http://svn.osgeo.org/qgis/trunk@12177 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 18, 2009
1 parent 0d3681a commit 621ee62280ea8f261295d365d15da1c551a2c5e7
Showing with 13,794 additions and 13,349 deletions.
  1. +47 −47 src/core/pal/costcalculator.cpp
  2. +8 −8 src/core/pal/costcalculator.h
  3. +22 −22 src/core/pal/feature.cpp
  4. +38 −38 src/core/pal/geomfunction.cpp
  5. +6 −6 src/core/pal/geomfunction.h
  6. +206 −176 src/core/pal/hashtable.hpp
  7. +10 −10 src/core/pal/labelposition.cpp
  8. +8 −5 src/core/pal/labelposition.h
  9. +215 −190 src/core/pal/linkedlist.hpp
  10. +12 −12 src/core/pal/pal.cpp
  11. +7 −7 src/core/pal/pal.h
  12. +1 −1 src/core/pal/palstat.cpp
  13. +33 −33 src/core/pal/pointset.cpp
  14. +4 −4 src/core/pal/priorityqueue.cpp
  15. +69 −69 src/core/pal/problem.cpp
  16. +1,202 −1,005 src/core/pal/rtree.hpp
  17. +2 −2 src/core/pal/util.cpp
  18. +28 −28 src/core/pal/util.h
  19. +232 −212 src/plugins/grass/qtermwidget/BlockArray.cpp
  20. +83 −81 src/plugins/grass/qtermwidget/BlockArray.h
  21. +149 −149 src/plugins/grass/qtermwidget/Character.h
  22. +208 −208 src/plugins/grass/qtermwidget/CharacterColor.h
  23. +37 −37 src/plugins/grass/qtermwidget/ColorTables.h
  24. +205 −201 src/plugins/grass/qtermwidget/Emulation.cpp
  25. +403 −403 src/plugins/grass/qtermwidget/Emulation.h
  26. +296 −296 src/plugins/grass/qtermwidget/Filter.cpp
  27. +317 −317 src/plugins/grass/qtermwidget/Filter.h
  28. +229 −227 src/plugins/grass/qtermwidget/History.cpp
  29. +234 −234 src/plugins/grass/qtermwidget/History.h
  30. +621 −617 src/plugins/grass/qtermwidget/KeyboardTranslator.cpp
  31. +513 −513 src/plugins/grass/qtermwidget/KeyboardTranslator.h
  32. +18 −17 src/plugins/grass/qtermwidget/LineFont.h
  33. +125 −124 src/plugins/grass/qtermwidget/Pty.cpp
  34. +201 −200 src/plugins/grass/qtermwidget/Pty.h
  35. +645 −635 src/plugins/grass/qtermwidget/Screen.cpp
  36. +605 −605 src/plugins/grass/qtermwidget/Screen.h
  37. +132 −132 src/plugins/grass/qtermwidget/ScreenWindow.cpp
  38. +216 −216 src/plugins/grass/qtermwidget/ScreenWindow.h
  39. +457 −445 src/plugins/grass/qtermwidget/Session.cpp
  40. +524 −524 src/plugins/grass/qtermwidget/Session.h
  41. +101 −95 src/plugins/grass/qtermwidget/ShellCommand.cpp
  42. +59 −59 src/plugins/grass/qtermwidget/ShellCommand.h
  43. +142 −142 src/plugins/grass/qtermwidget/TerminalCharacterDecoder.cpp
  44. +104 −104 src/plugins/grass/qtermwidget/TerminalCharacterDecoder.h
  45. +1,473 −1,452 src/plugins/grass/qtermwidget/TerminalDisplay.cpp
  46. +659 −658 src/plugins/grass/qtermwidget/TerminalDisplay.h
  47. +621 −614 src/plugins/grass/qtermwidget/Vt102Emulation.cpp
  48. +136 −136 src/plugins/grass/qtermwidget/Vt102Emulation.h
  49. +492 −430 src/plugins/grass/qtermwidget/k3process.cpp
  50. +724 −721 src/plugins/grass/qtermwidget/k3process.h
  51. +69 −63 src/plugins/grass/qtermwidget/k3processcontroller.cpp
  52. +93 −93 src/plugins/grass/qtermwidget/k3processcontroller.h
  53. +35 −30 src/plugins/grass/qtermwidget/konsole_wcwidth.cpp
  54. +4 −4 src/plugins/grass/qtermwidget/konsole_wcwidth.h
  55. +239 −223 src/plugins/grass/qtermwidget/kpty.cpp
  56. +149 −148 src/plugins/grass/qtermwidget/kpty.h
  57. +9 −8 src/plugins/grass/qtermwidget/kpty_p.h
  58. +149 −146 src/plugins/grass/qtermwidget/qtermwidget.cpp
  59. +55 −54 src/plugins/grass/qtermwidget/qtermwidget.h
  60. +110 −110 src/providers/spatialite/qgsspatialiteprovider.cpp
  61. +3 −3 src/providers/spatialite/qgsspatialiteprovider.h
@@ -18,7 +18,7 @@
namespace pal
{

void CostCalculator::addObstacleCostPenalty(LabelPosition* lp, PointSet* feat)
void CostCalculator::addObstacleCostPenalty( LabelPosition* lp, PointSet* feat )
{
int n = 0;
double dist;
@@ -69,7 +69,7 @@ namespace pal
std::cout << "LabelPosition for feat: " << lPos[0]->feature->uid << std::endl;
#endif

for ( i = 0;i < nblp;i++ )
for ( i = 0; i < nblp; i++ )
setCandidateCostFromPolygon( lPos[i], obstacles, bbx, bby );

// lPos with big values came fisrts (value = min distance from label to Polygon's Perimeter)
@@ -94,7 +94,7 @@ namespace pal

// adjust cost => the best is 0.0001, the worst is 0.0021
// others are set proportionally between best and worst
for ( i = 0;i < max_p;i++ )
for ( i = 0; i < max_p; i++ )
{
#ifdef _DEBUG_
std::cout << " lpos[" << i << "] = " << lPos[i]->cost;
@@ -136,7 +136,7 @@ namespace pal

delete extent;

lp->feature->getBoundingBox(amin, amax);
lp->feature->getBoundingBox( amin, amax );

obstacles->Search( amin, amax, LabelPosition::polygonObstacleCallback, pCost );

@@ -146,53 +146,53 @@ namespace pal
}


int CostCalculator::finalizeCandidatesCosts( Feats* feat, int max_p, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] )
{
// If candidates list is smaller than expected
if ( max_p > feat->nblp )
max_p = feat->nblp;
//
// sort candidates list, best label to worst
sort(( void** ) feat->lPos, feat->nblp, LabelPosition::costGrow );

// try to exclude all conflitual labels (good ones have cost < 1 by pruning)
double discrim = 0.0;
int stop;
do
{
discrim += 1.0;
for ( stop = 0;stop < feat->nblp && feat->lPos[stop]->getCost() < discrim;stop++ );
}
while ( stop == 0 && discrim < feat->lPos[feat->nblp-1]->getCost() + 2.0 );
int CostCalculator::finalizeCandidatesCosts( Feats* feat, int max_p, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] )
{
// If candidates list is smaller than expected
if ( max_p > feat->nblp )
max_p = feat->nblp;
//
// sort candidates list, best label to worst
sort(( void** ) feat->lPos, feat->nblp, LabelPosition::costGrow );

// try to exclude all conflitual labels (good ones have cost < 1 by pruning)
double discrim = 0.0;
int stop;
do
{
discrim += 1.0;
for ( stop = 0; stop < feat->nblp && feat->lPos[stop]->getCost() < discrim; stop++ );
}
while ( stop == 0 && discrim < feat->lPos[feat->nblp-1]->getCost() + 2.0 );

if ( discrim > 1.5 )
{
int k;
for ( k = 0;k < stop;k++ )
feat->lPos[k]->setCost( 0.0021 );
}
if ( discrim > 1.5 )
{
int k;
for ( k = 0; k < stop; k++ )
feat->lPos[k]->setCost( 0.0021 );
}

if ( max_p > stop )
max_p = stop;
if ( max_p > stop )
max_p = stop;

#ifdef _DEBUG_FULL_
std::cout << "Nblabel kept for feat " << feat->feature->uid << "/" << feat->feature->layer->name << ": " << max_p << "/" << feat->nblp << std::endl;
std::cout << "Nblabel kept for feat " << feat->feature->uid << "/" << feat->feature->layer->name << ": " << max_p << "/" << feat->nblp << std::endl;
#endif

// Sets costs for candidates of polygon
// Sets costs for candidates of polygon

if ( feat->feature->getGeosType() == GEOS_POLYGON )
{
int arrangement = feat->feature->getLayer()->getArrangement();
if ( arrangement == P_FREE || arrangement == P_HORIZ )
setPolygonCandidatesCost( stop, (LabelPosition**) feat->lPos, max_p, obstacles, bbx, bby );
}
if ( feat->feature->getGeosType() == GEOS_POLYGON )
{
int arrangement = feat->feature->getLayer()->getArrangement();
if ( arrangement == P_FREE || arrangement == P_HORIZ )
setPolygonCandidatesCost( stop, ( LabelPosition** ) feat->lPos, max_p, obstacles, bbx, bby );
}

// add size penalty (small lines/polygons get higher cost)
feat->feature->addSizePenalty(max_p, feat->lPos, bbx, bby);
// add size penalty (small lines/polygons get higher cost)
feat->feature->addSizePenalty( max_p, feat->lPos, bbx, bby );

return max_p;
}
return max_p;
}



@@ -216,7 +216,7 @@ namespace pal
*/

double alpha = lp->getAlpha();
for ( i = 0;i < 8;i++, alpha += M_PI / 4 )
for ( i = 0; i < 8; i++, alpha += M_PI / 4 )
{
dist[i] = DBL_MAX;
ok[i] = false;
@@ -256,7 +256,7 @@ namespace pal

int i = ( int )( beta / a45 );

for ( int j = 0;j < 2;j++, i = ( i + 1 ) % 8 )
for ( int j = 0; j < 2; j++, i = ( i + 1 ) % 8 )
{
double rx, ry;
rx = px - rpy[i] + py;
@@ -284,11 +284,11 @@ namespace pal
int nbP = ( pset->type == GEOS_POLYGON ? pset->nbPoints : pset->nbPoints - 1 );
double min_dist = DBL_MAX;

for ( i = 0;i < nbP;i++ )
for ( i = 0; i < nbP; i++ )
{
j = ( i + 1 ) % pset->nbPoints;

for ( k = 0;k < 8;k++ )
for ( k = 0; k < 8; k++ )
{
double ix, iy;
if ( computeSegIntersection( px, py, rpx[k], rpy[k], pset->x[i], pset->y[i], pset->x[j], pset->y[j], &ix, &iy ) )
@@ -318,7 +318,7 @@ namespace pal
{
int i;

for ( i = 0;i < 8;i++ )
for ( i = 0; i < 8; i++ )
{
/*
if ( i == 0 || i == 4 ) // horizontal directions
@@ -9,17 +9,17 @@ namespace pal

class CostCalculator
{
public:
/** increase candidate's cost according to its collision with passed feature */
static void addObstacleCostPenalty(LabelPosition* lp, PointSet* feat);
public:
/** increase candidate's cost according to its collision with passed feature */
static void addObstacleCostPenalty( LabelPosition* lp, PointSet* feat );

static void setPolygonCandidatesCost( int nblp, LabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
static void setPolygonCandidatesCost( int nblp, LabelPosition **lPos, int max_p, RTree<PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );

/** Set cost to the smallest distance between lPos's centroid and a polygon stored in geoetry field */
static void setCandidateCostFromPolygon( LabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
/** Set cost to the smallest distance between lPos's centroid and a polygon stored in geoetry field */
static void setCandidateCostFromPolygon( LabelPosition* lp, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );

/** sort candidates by costs, skip the worse ones, evaluate polygon candidates */
static int finalizeCandidatesCosts( Feats* feat, int max_p, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
/** sort candidates by costs, skip the worse ones, evaluate polygon candidates */
static int finalizeCandidatesCosts( Feats* feat, int max_p, RTree <PointSet*, double, 2, double> *obstacles, double bbx[4], double bby[4] );
};

/**
@@ -84,7 +84,7 @@ namespace pal
extractCoords( geom );

holeOf = NULL;
for ( int i = 0;i < nbHoles;i++ )
for ( int i = 0; i < nbHoles; i++ )
{
holes[i]->holeOf = this;
}
@@ -97,7 +97,7 @@ namespace pal

if ( holes )
{
for ( int i = 0; i < nbHoles;i++ )
for ( int i = 0; i < nbHoles; i++ )
delete holes[i];
delete [] holes;
holes = NULL;
@@ -130,7 +130,7 @@ namespace pal
nbHoles = GEOSGetNumInteriorRings( geom );
holes = new PointSet*[nbHoles];

for ( i = 0;i < nbHoles;i++ )
for ( i = 0; i < nbHoles; i++ )
{
holes[i] = new PointSet();
holes[i]->holeOf = NULL;
@@ -145,7 +145,7 @@ namespace pal

coordSeq = GEOSGeom_getCoordSeq( interior );

for ( j = 0;j < holes[i]->nbPoints;j++ )
for ( j = 0; j < holes[i]->nbPoints; j++ )
{
GEOSCoordSeq_getX( coordSeq, j, &holes[i]->x[j] );
GEOSCoordSeq_getY( coordSeq, j, &holes[i]->y[j] );
@@ -182,7 +182,7 @@ namespace pal
x = new double[nbPoints];
y = new double[nbPoints];

for ( i = 0;i < nbPoints;i++ )
for ( i = 0; i < nbPoints; i++ )
{
GEOSCoordSeq_getX( coordSeq, i, &x[i] );
GEOSCoordSeq_getY( coordSeq, i, &y[i] );
@@ -202,7 +202,7 @@ namespace pal
bool *ok = new bool[new_nbPoints];
int i, j;

for ( i = 0;i < nbPoints;i++ )
for ( i = 0; i < nbPoints; i++ )
{
ok[i] = true;
j = ( i + 1 ) % nbPoints;
@@ -219,7 +219,7 @@ namespace pal
{
double *new_x = new double[new_nbPoints];
double *new_y = new double[new_nbPoints];
for ( i = 0, j = 0;i < nbPoints;i++ )
for ( i = 0, j = 0; i < nbPoints; i++ )
{
if ( ok[i] )
{
@@ -359,7 +359,7 @@ namespace pal

*lPos = new LabelPosition *[nbp];

for ( i = 0, alpha = M_PI / 4;i < nbp;i++, alpha += beta )
for ( i = 0, alpha = M_PI / 4; i < nbp; i++, alpha += beta )
{
lx = x;
ly = y;
@@ -508,7 +508,7 @@ namespace pal
ad = new double[nbPoints];

ll = 0.0; // line length
for ( i = 0;i < line->nbPoints - 1;i++ )
for ( i = 0; i < line->nbPoints - 1; i++ )
{
if ( i == 0 )
ad[i] = 0;
@@ -601,7 +601,7 @@ namespace pal
if (( !reversed && ( flags & FLAG_ABOVE_LINE ) ) || ( reversed && ( flags & FLAG_BELOW_LINE ) ) )
positions->push_back( new LabelPosition( i, bx + cos( beta ) *distlabel , by + sin( beta ) *distlabel, xrm, yrm, alpha, cost, this ) ); // Line
if (( !reversed && ( flags & FLAG_BELOW_LINE ) ) || ( reversed && ( flags & FLAG_ABOVE_LINE ) ) )
positions->push_back( new LabelPosition( i, bx - cos( beta ) * ( distlabel + yrm ) , by - sin( beta ) * ( distlabel + yrm ), xrm, yrm, alpha, cost, this ) ); // Line
positions->push_back( new LabelPosition( i, bx - cos( beta ) *( distlabel + yrm ) , by - sin( beta ) *( distlabel + yrm ), xrm, yrm, alpha, cost, this ) ); // Line
if ( flags & FLAG_ON_LINE )
positions->push_back( new LabelPosition( i, bx - yrm*cos( beta ) / 2, by - yrm*sin( beta ) / 2, xrm, yrm, alpha, cost, this ) ); // Line
}
@@ -1041,11 +1041,11 @@ namespace pal
int max_try = 10;
do
{
for ( bbid = 0;bbid < j;bbid++ )
for ( bbid = 0; bbid < j; bbid++ )
{
CHullBox *box = boxes[bbid];

if (( box->length * box->width ) > ( xmax - xmin ) * ( ymax - ymin ) *5 )
if (( box->length * box->width ) > ( xmax - xmin ) *( ymax - ymin ) *5 )
{
std::cout << "Very Large BBOX (should never occurs : bug-report please)" << std::endl;
std::cout << " Box size: " << box->length << "/" << box->width << std::endl;
@@ -1058,7 +1058,7 @@ namespace pal

#ifdef _DEBUG_FULL_
std::cout << "New BBox : " << bbid << std::endl;
for ( i = 0;i < 4;i++ )
for ( i = 0; i < 4; i++ )
{
std::cout << box->x[i] << "\t" << box->y[i] << std::endl;
}
@@ -1136,9 +1136,9 @@ namespace pal
px0 -= ceil( px0 / dx ) * dx;
py0 -= ceil( py0 / dy ) * dy;

for ( px = px0;px <= box->width;px += dx )
for ( px = px0; px <= box->width; px += dx )
{
for ( py = py0;py <= box->length;py += dy )
for ( py = py0; py <= box->length; py += dy )
{

rx = cos( box->alpha ) * px + cos( box->alpha - M_PI / 2 ) * py;
@@ -1170,12 +1170,12 @@ namespace pal
nbp = positions->size();

( *lPos ) = new LabelPosition*[nbp];
for ( i = 0;i < nbp;i++ )
for ( i = 0; i < nbp; i++ )
{
( *lPos )[i] = positions->pop_front();
}

for ( bbid = 0;bbid < j;bbid++ )
for ( bbid = 0; bbid < j; bbid++ )
{
delete boxes[bbid];
}
@@ -1203,13 +1203,13 @@ namespace pal
std::cout << "Type: " << type << std::endl;
if ( x && y )
{
for ( i = 0;i < nbPoints;i++ )
for ( i = 0; i < nbPoints; i++ )
std::cout << x[i] << ", " << y[i] << std::endl;
std::cout << "Obstacle: " << nbHoles << std::endl;
for ( i = 0;i < nbHoles;i++ )
for ( i = 0; i < nbHoles; i++ )
{
std::cout << " obs " << i << std::endl;
for ( j = 0;j < holes[i]->nbPoints;j++ )
for ( j = 0; j < holes[i]->nbPoints; j++ )
{
std::cout << holes[i]->x[j] << ";" << holes[i]->y[j] << std::endl;
}
@@ -1281,7 +1281,7 @@ namespace pal
int rnbp = nbp;

// purge candidates that are outside the bbox
for ( i = 0;i < nbp;i++ )
for ( i = 0; i < nbp; i++ )
{
if ( !( *lPos )[i]->isIn( bbox ) )
{
@@ -1296,7 +1296,7 @@ namespace pal

sort(( void** )( *lPos ), nbp, LabelPosition::costGrow );

for ( i = rnbp;i < nbp;i++ )
for ( i = rnbp; i < nbp; i++ )
{
delete( *lPos )[i];
}

0 comments on commit 621ee62

Please sign in to comment.