[gdal-dev] Is this correct??

Frank Warmerdam warmerdam at p...
Mon Apr 8 13:47:15 EDT 2002


Eric J. Peters wrote:
> While digging through some code to try to isolate a problem I'm
> having, I found the following code in ogrlinestring.cpp:
> 
> OGRBoolean OGRLineString::Equal( OGRGeometry * poOther )
> 
> {
> OGRLineString *poOLine = (OGRLineString *) poOther;
> 
> if( poOther == this )
> return TRUE;
> 
> if( poOther->getGeometryType() != getGeometryType() )
> return FALSE;
> 
> // we should eventually test the SRS.
> 
> if( getNumPoints() != poOLine->getNumPoints() )
> return FALSE;
> 
> for( int iPoint = 1; iPoint < getNumPoints(); iPoint++ )
> {
> if( getX(iPoint) != poOLine->getX(iPoint)
> || getY(iPoint) != poOLine->getY(iPoint) 
> || getZ(iPoint) != poOLine->getZ(iPoint) )
> return FALSE;
> }
> 
> return TRUE;
> }
> 
> 
> My question is regarding the loop at the end. iPoint goes from 1 to
> getNumPoints() -- shouldn't this be from 0 to getNumPoints()? Am I missing
> something, or is this a bug in the GDAL code?

Eric,

I believe you are correct. I have changed the code.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent






More information about the Gdal-dev mailing list