Skip to content

Commit

Permalink
don't measure empty geometries and also return success when exports g…
Browse files Browse the repository at this point in the history
…eos points to wkb

git-svn-id: http://svn.osgeo.org/qgis/trunk@12617 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 24, 2009
1 parent 8cc3c65 commit 9acd8b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -175,6 +175,9 @@ bool QgsDistanceArea::setEllipsoid( const QString& ellipsoid )

double QgsDistanceArea::measure( QgsGeometry* geometry )
{
if ( !geometry )
return 0.0;

unsigned char* wkb = geometry->asWkb();
unsigned char* ptr;
unsigned int wkbType;
Expand Down
7 changes: 4 additions & 3 deletions src/core/qgsgeometry.cpp
Expand Up @@ -1198,8 +1198,8 @@ bool QgsGeometry::insertVertex( double x, double y,
// Bounds checking
if ( beforeVertex < 0 )
{
( *new_sequence ) = 0;
return FALSE;
*new_sequence = 0;
return false;
}

unsigned int numPoints;
Expand Down Expand Up @@ -4335,7 +4335,8 @@ bool QgsGeometry::exportGeosToWkb()
memcpy( mGeometry + 5, &x, sizeof( double ) );
memcpy( mGeometry + 13, &y, sizeof( double ) );

break;
mDirtyWkb = false;
return true;
} // case GEOS_GEOM::GEOS_POINT

case GEOS_LINESTRING: // a linestring
Expand Down

0 comments on commit 9acd8b5

Please sign in to comment.