mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fixed a crash occuring with identify tool which was caused by GEOS throwing TopologyException.
This exception might be thrown when GEOS has problems with calculating intersection. git-svn-id: http://svn.osgeo.org/qgis/trunk@6071 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
da8d308b1a
commit
60f7822a6e
@ -2076,9 +2076,17 @@ bool QgsGeometry::intersects(QgsRect* r) const
|
||||
rectwkt+="))";
|
||||
|
||||
geos::Geometry *geosRect = wktReader->read( qstrdup(rectwkt) );
|
||||
if(geosGeom->intersects(geosRect))
|
||||
try // geos might throw exception on error
|
||||
{
|
||||
returnval=true;
|
||||
if(geosGeom->intersects(geosRect))
|
||||
{
|
||||
returnval=true;
|
||||
}
|
||||
}
|
||||
catch (geos::TopologyException* e)
|
||||
{
|
||||
QString error = e->toString().c_str();
|
||||
QgsLogger::warning("GEOS: " + error);
|
||||
}
|
||||
|
||||
delete geosGeom;
|
||||
@ -2121,9 +2129,17 @@ bool QgsGeometry::fast_intersects(const QgsRect* r) const
|
||||
geos::WKTReader *wktReader = new geos::WKTReader(gf);
|
||||
geos::Geometry *geosRect = wktReader->read( qstrdup(rectwkt) );
|
||||
|
||||
if(geosGeom->intersects(geosRect))
|
||||
try // geos might throw exception on error
|
||||
{
|
||||
returnval=true;
|
||||
if(geosGeom->intersects(geosRect))
|
||||
{
|
||||
returnval=true;
|
||||
}
|
||||
}
|
||||
catch (geos::TopologyException* e)
|
||||
{
|
||||
QString error = e->toString().c_str();
|
||||
QgsLogger::warning("GEOS: " + error);
|
||||
}
|
||||
|
||||
delete geosGeom;
|
||||
|
@ -423,7 +423,20 @@ QgsFeature *QgsOgrProvider::getNextFeature(bool fetchAttributes)
|
||||
mSelectionRectangle->exportToWkt(&sWkt);
|
||||
geos::Geometry *geosRect = wktReader->read(sWkt);
|
||||
assert(geosRect != 0);
|
||||
if(geosGeom->intersects(geosRect))
|
||||
bool intersection = false;
|
||||
|
||||
try // geos might throw exception on error
|
||||
{
|
||||
if(geosGeom->intersects(geosRect))
|
||||
intersection = true;
|
||||
}
|
||||
catch (geos::TopologyException* e)
|
||||
{
|
||||
QString error = e->toString().c_str();
|
||||
QgsLogger::warning("GEOS: " + error);
|
||||
}
|
||||
|
||||
if (intersection)
|
||||
{
|
||||
QgsDebugMsg("intersection found");
|
||||
delete[] sWkt;
|
||||
|
Loading…
x
Reference in New Issue
Block a user