Skip to content
Permalink
Browse files

fix for svn compile problem

git-svn-id: http://svn.osgeo.org/qgis/trunk@5271 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Apr 12, 2006
1 parent 1615f2b commit e7cf5904fa27c708968b602b8ec7f1dcf3f7307b
Showing with 46 additions and 44 deletions.
  1. +46 −44 src/core/qgsgeometry.cpp
@@ -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:
{

0 comments on commit e7cf590

Please sign in to comment.
You can’t perform that action at this time.