Skip to content

Commit

Permalink
[pal] Remove old ifdefed code
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 29, 2015
1 parent 5c88c75 commit e804a87
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 567 deletions.
6 changes: 0 additions & 6 deletions src/core/pal/costcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ namespace pal
int n = 0;
double dist;
double distlabel = lp->feature->getLabelDistance();
#if 0
unit_convert( double( lp->feature->distlabel ),
pal::PIXEL,
pal->map_unit,
pal->dpi, scale, 1 );
#endif

switch ( feat->getGeosType() )
{
Expand Down
21 changes: 0 additions & 21 deletions src/core/pal/feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
#include "geomfunction.h"
#include "labelposition.h"
#include "pointset.h"
#include "simplemutex.h"
#include "util.h"

#ifndef M_PI
Expand Down Expand Up @@ -414,17 +413,6 @@ namespace pal
double alpha;
double beta = 2 * M_PI / nbp; /* angle bw 2 pos */

// uncomment for Wolff 2 position model test on RailwayStation
//if (nbp==2)
// beta = M_PI/2;

#if 0
double distlabel = unit_convert( this->distlabel,
pal::PIXEL,
layer->pal->map_unit,
dpi, scale, delta_width );
#endif

double lx, ly; /* label pos */

/* various alpha */
Expand Down Expand Up @@ -577,15 +565,6 @@ namespace pal
f->layer->pal->map_unit,
dpi, scale, delta_width );


#if 0
double distlabel = unit_convert( this->distlabel,
pal::PIXEL,
layer->pal->map_unit,
dpi, scale, delta_width );
#endif


double *d; // segments lengths distance bw pt[i] && pt[i+1]
double *ad; // absolute distance bw pt[0] and pt[i] along the line
double ll; // line length
Expand Down
28 changes: 0 additions & 28 deletions src/core/pal/feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,25 +197,6 @@ namespace pal
*/
int setPositionForPolygon( double scale, LabelPosition ***lPos, PointSet *mapShape, double delta_width );

#if 0
/**
* \brief Feature against problem bbox
* \param bbox[0] problem x min
* \param bbox[1] problem x max
* \param bbox[2] problem y min
* \param bbox[3] problem y max
* return A set of feature which are in the bbox or null if the feature is in the bbox
*/
LinkedList<Feature*> *splitFeature( double bbox[4] );


/**
* \brief return the feature id
* \return the feature id
*/
int getId();
#endif

/**
* \brief return the feature
* \return the feature
Expand All @@ -234,15 +215,6 @@ namespace pal
*/
Layer * getLayer();

#if 0
/**
* \brief save the feature into file
* Called by Pal::save()
* \param file the file to write
*/
void save( std::ofstream *file );
#endif

/**
* \brief generic method to generate candidates
* This method will call either setPositionFromPoint(), setPositionFromLine or setPositionFromPolygon
Expand Down
1 change: 0 additions & 1 deletion src/core/pal/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include <pal/pal.h>
#include <pal/palgeometry.h>


namespace pal
{

Expand Down
125 changes: 0 additions & 125 deletions src/core/pal/pointset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -778,131 +778,6 @@ namespace pal
return finalBb;
}

#if 0
double PointSet::getDistInside( double px, double py )
{

double dist[8];
double rpx[8];
double rpy[8];
bool ok[8];

if ( !isPointInPolygon( nbPoints, x, y, px, py ) )
{
double d = getDist( px, py );
//std::cout << "Outside : " << d << std::endl;
if ( d < 0 )
{
d = -( d * d * d * d );
}
else
{
d = d * d * d * d;
}
return d;
}

int i;

double width = ( xmax - xmin ) * 2;
double height = ( ymax - ymin ) * 2;

/*
1 0 7
\ | /
2 --x -- 6
/ | \
3 4 5
*/

// Compute references points
for ( i = 0; i < 8; i++ )
{
dist[i] = DBL_MAX;
ok[i] = false;
rpx[i] = px;
rpy[i] = py;
}

rpx[0] += 0;
rpy[0] += height;

rpx[1] -= width;
rpy[1] += height;

rpx[2] -= width;
rpy[2] += 0;

rpx[3] -= width;
rpy[3] -= height;

rpx[4] += 0;
rpy[4] -= height;

rpx[5] += width;
rpy[5] -= height;

rpx[6] += width;
rpy[6] += 0;

rpx[7] += width;
rpy[7] += height;

int j, k;
for ( i = 0; i < nbPoints; i++ )
{
j = ( i + 1 ) % nbPoints;

for ( k = 0; k < 8; k++ )
{
double ix, iy;
if ( computeSegIntersection( px, py, rpx[k], rpy[k], x[i], y[i], x[j], y[j], &ix, &iy ) )
{
double d = dist_euc2d_sq( px, py, ix, iy );
if ( dist[k] > d )
{
dist[k] = d;
ok[k] = true;
//std::cout << "new dist for " << k << ": " << dist[k] << std::endl;
}
}
}
}

double a, b, c, d;


for ( i = 0; i < 8; i++ )
{
if ( !ok[i] )
{
std::cout << "ERROR!!!!!!!!!!!!!!!!!" << std::endl;
dist[i] = 0;
}
//std::cout << "dist[" << i << "]: " << dist[i] << std::endl;
}

a = min( dist[0], dist[4] );
b = min( dist[1], dist[5] );
c = min( dist[2], dist[6] );
d = min( dist[3], dist[7] );
/*
std::cout << "a: " << a << std::endl;
std::cout << "b: " << b << std::endl;
std::cout << "c: " << c << std::endl;
std::cout << "d: " << d << std::endl;
*/
//a = (a+b+c+d)/4.0;

//a = min(a,b);
//c = min(c,d);
//return min(a,c);


return ( a*b*c*d );
}
#endif

double PointSet::getDist( double px, double py, double *rx, double *ry )
{
if ( nbPoints == 1 || type == GEOS_POINT )
Expand Down
Loading

0 comments on commit e804a87

Please sign in to comment.