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/qgis@5271 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 12, 2006
1 parent 7db270a commit 444a5a8
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)
{
case QGis::WKBPoint:
// Points have no lines
return QgsPoint(0,0);

{
// Points have no lines
return QgsPoint(0,0);
}
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)
{
prevx = thisx;
prevy = thisy;
}

thisx = (double*) ptr;
ptr += sizeof(double);
thisy = (double*) ptr;

if (index > 0)
{
if (
(
testdist = distanceSquaredPointToSegment(point,
prevx, prevy,
thisx, thisy,
minDistPoint) // TODO: save minDistPoint into something meaningful.
)
< sqrDist )
{
closestSegmentIndex = 0;
unsigned char* ptr = mGeometry + 5;
int* npoints = (int*) ptr;
ptr += sizeof(int);
for (int index=0; index < *npoints; ++index)
{
if (index > 0)
{
prevx = thisx;
prevy = thisy;
}

thisx = (double*) ptr;
ptr += sizeof(double);
thisy = (double*) ptr;

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

ptr += sizeof(double);
closestSegmentIndex = index;
sqrDist = testdist;
}
}

ptr += sizeof(double);
}

beforeVertex.push_back(closestSegmentIndex);

break;
}

beforeVertex.push_back(closestSegmentIndex);

break;

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

0 comments on commit 444a5a8

Please sign in to comment.