[QGIS Commit] r11046 - branches/symbology-ng-branch/src/core/pal
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Sat Jul 11 18:10:42 EDT 2009
Author: wonder
Date: 2009-07-11 18:10:41 -0400 (Sat, 11 Jul 2009)
New Revision: 11046
Modified:
branches/symbology-ng-branch/src/core/pal/costcalculator.cpp
branches/symbology-ng-branch/src/core/pal/costcalculator.h
Log:
pal: fixed calculation of cost for polygon candidates when using features with lat/lon coordinates.
(distances smaller than 0.1 units were considered as numeric errors)
Modified: branches/symbology-ng-branch/src/core/pal/costcalculator.cpp
===================================================================
--- branches/symbology-ng-branch/src/core/pal/costcalculator.cpp 2009-07-11 20:05:59 UTC (rev 11045)
+++ branches/symbology-ng-branch/src/core/pal/costcalculator.cpp 2009-07-11 22:10:41 UTC (rev 11046)
@@ -206,9 +206,6 @@
px = ( lp->x[0] + lp->x[2] ) / 2.0;
py = ( lp->y[0] + lp->y[2] ) / 2.0;
- dLp[0] = lp->w / 2;
- dLp[1] = lp->h / 2;
- dLp[2] = dLp[0] / cos( M_PI / 4 );
/*
3 2 1
@@ -323,10 +320,18 @@
for ( i = 0;i < 8;i++ )
{
- dist[i] -= (( i % 2 ) ? dLp[2] : (( i == 0 || i == 4 ) ? dLp[0] : dLp[1] ) );
- if ( !ok[i] || dist[i] < 0.1 )
+ /*
+ if ( i == 0 || i == 4 ) // horizontal directions
+ dist[i] -= lp->w / 2;
+ else if (i == 2 || i == 6 ) // vertical directions
+ dist[i] -= lp->h / 2;
+ else // other directions
+ dist[i] -= ( lp->w / 2 ) / cos( M_PI / 4 );
+ */
+
+ if ( !ok[i] || dist[i] < EPSILON )
{
- dist[i] = 0.1;
+ dist[i] = EPSILON;
}
}
@@ -337,7 +342,8 @@
c = min( dist[2], dist[6] );
d = min( dist[3], dist[7] );
- //return (a+b+c+d);
+ //if (a!=EPSILON || b!=EPSILON || c!=EPSILON || d!=EPSILON)
+ // std::cout << "res " << (a*b*c*d) << " " << a << " " << b << " " << c << " " << d << std::endl;
return ( a*b*c*d );
}
Modified: branches/symbology-ng-branch/src/core/pal/costcalculator.h
===================================================================
--- branches/symbology-ng-branch/src/core/pal/costcalculator.h 2009-07-11 20:05:59 UTC (rev 11045)
+++ branches/symbology-ng-branch/src/core/pal/costcalculator.h 2009-07-11 22:10:41 UTC (rev 11046)
@@ -38,8 +38,6 @@
double rpy[8];
bool ok[8];
- double dLp[3];
-
void updatePoint( PointSet *pset );
double updateLinePoly( PointSet *pset );
public:
More information about the QGIS-commit
mailing list