[Qgis-developer] Revision 5269 - qgsgeometry.cpp Compilation Error
Peter Ersts
ersts at amnh.org
Wed Apr 12 11:06:51 EDT 2006
Got this error this morning (April 12) while trying a fresh build of
Revision 5269:
qgsgeometry.cpp: In member function 'QgsPoint QgsGeometry::closestSegmentWithContext(QgsPoint&, QgsGeometryVertexIndex&,double&)':
qgsgeometry.cpp:993: error: jump to case label
qgsgeometry.cpp:949: error: crosses initialization of 'int* npoints'
qgsgeometry.cpp:948: error: crosses initialization of 'unsigned char* ptr'
make[4]: *** [libqgis_core_la-qgsgeometry.lo] Error 1
It is easily fixed by placing {} around the case statements for the switch() that starts on line 940 of qgsgeometry.cpp.
switch()
{
case 1:
{
blah blah
}
case 2:
{
blah blah
}
}
I apologize for posting this to the list and not putting on trac but I am slowly working my way through all of the documentation for everything. Below is the a modification for the switch() statement starting on line 940 the compiled correctly for me.
switch (wkbType)
{
case QGis::WKBPoint:
{
// 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 )
{
#ifdef QGISDEBUG
// std::cout << "QgsGeometry::closestSegment: testDist "
// << testdist << ", sqrDist"
// << sqrDist
// << "." << std::endl;
#endif
closestSegmentIndex = index;
sqrDist = testdist;
}
}
ptr += sizeof(double);
}
beforeVertex.push_back(closestSegmentIndex);
break;
//todo: add wkb parsing
}
case QGis::WKBPolygon:
{
break;
}
} // switch (wkbType)
--
====================================
Peter J. Ersts, Project Specialist
American Museum of Natural History
Center for Biodiversity and Conservation
Central Park West at 79th Street
New York, New York 10024
Tel: (212)-496-3488 or (212)-769-5742
Fax: (212)-313-7295 or (212)-769-5292
Web: http://cbc.amnh.org
Visit the Indo-South Atlantic Consortium on Humpback Whales
Web: http://www.isach.org
More information about the Qgis-developer
mailing list