Hey All,

I'm running in to an error that seems like a bug in
TABMAPHeaderBlock::Coordsys2Int.

I am using exclusivly lat/long coordinates (mostly in the US).  The default
m_nCoordOriginQuadrant (1) leads to a coordinate being converted with:

        dTempX = (double)((dX*m_XScale + m_XDispl)+0.5);

...

    nX = (GInt32) dTempX;

If the coordinate is <0 this leads it being increased by one in the least
significant digit.  This happens because it is adding .5 regardless of dX
being less than 0 and then the conversion to int truncates.

It seems to me that we need to make one of the following changes:

        dTempX = (double)((dX*m_XScale + m_XDispl)+(dX<0 ? -0.5 : 0.5));

or

    nX = (GInt32) floor(dTempX);

Am I crazy?  I was really surprised to find such a basic bug after using
this library for years.

Any ideas?

Ned.









------------------------ Yahoo! Groups Sponsor --------------------~--> 
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/mitab/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to