catch more GEOS exceptions, fixes #802

git-svn-id: http://svn.osgeo.org/qgis/trunk@7394 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2007-11-13 15:01:40 +00:00
parent 5732faeb2a
commit e61a03ccd1

View File

@ -2828,31 +2828,30 @@ bool QgsGeometry::intersects(const QgsRect& r)
bool QgsGeometry::intersects(QgsGeometry* geometry)
{
// ensure that both geometries have geos geometry
exportWkbToGeos();
geometry->exportWkbToGeos();
if (!mGeos || !geometry->mGeos)
{
QgsDebugMsg("GEOS geometry not available!");
return false;
}
try // geos might throw exception on error
{
return mGeos->intersects(geometry->mGeos);
// ensure that both geometries have geos geometry
exportWkbToGeos();
geometry->exportWkbToGeos();
if (!mGeos || !geometry->mGeos)
{
QgsDebugMsg("GEOS geometry not available!");
return false;
}
return mGeos->intersects(geometry->mGeos);
}
catch (GEOS_UTIL::TopologyException* e)
catch (GEOS_UTIL::GEOSException &e)
{
#if GEOS_VERSION_MAJOR < 3
QString error = e->toString().c_str();
QString error = e.toString().c_str();
#else
QString error = e->what();
QString error = e.what();
#endif
QgsLogger::warning("GEOS: " + error);
return false;
}
}