Skip to content

Commit

Permalink
fix for svn compile problem
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@5271 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 12, 2006
1 parent 1615f2b commit e7cf590
Showing 1 changed file with 46 additions and 44 deletions.
90 changes: 46 additions & 44 deletions src/core/qgsgeometry.cpp
Expand Up @@ -940,55 +940,57 @@ QgsPoint QgsGeometry::closestSegmentWithContext(QgsPoint& point,
switch (wkbType) switch (wkbType)
{ {
case QGis::WKBPoint: case QGis::WKBPoint:
// Points have no lines {
return QgsPoint(0,0); // Points have no lines

return QgsPoint(0,0);
}
case QGis::WKBLineString: case QGis::WKBLineString:
closestSegmentIndex = 0;
unsigned char* ptr = mGeometry + 5;
int* npoints = (int*) ptr;
ptr += sizeof(int);
for (int index=0; index < *npoints; ++index)
{ {
if (index > 0) closestSegmentIndex = 0;
{ unsigned char* ptr = mGeometry + 5;
prevx = thisx; int* npoints = (int*) ptr;
prevy = thisy; ptr += sizeof(int);
} for (int index=0; index < *npoints; ++index)

{
thisx = (double*) ptr; if (index > 0)
ptr += sizeof(double); {
thisy = (double*) ptr; prevx = thisx;

prevy = thisy;
if (index > 0) }
{
if ( thisx = (double*) ptr;
( ptr += sizeof(double);
testdist = distanceSquaredPointToSegment(point, thisy = (double*) ptr;
prevx, prevy,
thisx, thisy, if (index > 0)
minDistPoint) // TODO: save minDistPoint into something meaningful. {
) if (
< sqrDist ) (
{ testdist = distanceSquaredPointToSegment(point,
prevx, prevy,
thisx, thisy,
minDistPoint) // TODO: save minDistPoint into something meaningful.
)
< sqrDist )
{
#ifdef QGISDEBUG #ifdef QGISDEBUG
// std::cout << "QgsGeometry::closestSegment: testDist " // std::cout << "QgsGeometry::closestSegment: testDist "
// << testdist << ", sqrDist" // << testdist << ", sqrDist"
// << sqrDist // << sqrDist
// << "." << std::endl; // << "." << std::endl;
#endif #endif
closestSegmentIndex = index; closestSegmentIndex = index;
sqrDist = testdist; sqrDist = testdist;
} }
} }


ptr += sizeof(double); ptr += sizeof(double);
}

beforeVertex.push_back(closestSegmentIndex);

break;
} }

beforeVertex.push_back(closestSegmentIndex);

break;

//todo: add wkb parsing //todo: add wkb parsing
case QGis::WKBPolygon: case QGis::WKBPolygon:
{ {
Expand Down

0 comments on commit e7cf590

Please sign in to comment.