# %%%% date: 2003/05/12 16:09:13; state: Exp; lines: +22 -1 # dxf-import-critical-bugfixes # If the bounding box in header in empty, calculate it manually (Mapinfo 5 # writes DXF with empty bounding box - max and min vectors are 0s) - rather # than refusing to open such file. # # Unix specific: Use LC_NUMERIC = "C" when parsing file. Before this change, # all fractional parts of numbers were ingored on locales with "," as a # fraction seprator (e.g. Russian) - and all positions would be set to # integer ones (very funny to look at the result if all coordinates were # not greater 5 by modulus!). It's necessary to check whether similar fix is # required for Windows port. Index: oo/goodies/source/filter.vcl/idxf/dxfreprd.cxx diff -u oo/goodies/source/filter.vcl/idxf/dxfreprd.cxx:1.1 oo/goodies/source/filter.vcl/idxf/dxfreprd.cxx:1.2 --- oo/goodies/source/filter.vcl/idxf/dxfreprd.cxx:1.1 Mon Apr 28 21:41:55 2003 +++ oo/goodies/source/filter.vcl/idxf/dxfreprd.cxx Mon May 12 21:09:13 2003 @@ -62,6 +62,9 @@ #include #include +#ifdef UNX +#include +#endif //------------------DXFBoundingBox-------------------------------------------- @@ -185,6 +188,10 @@ DXFGroupReader * pDGR; BOOL bRes; +#ifdef UNX + char* localewas = setlocale(LC_NUMERIC,NULL); + setlocale(LC_NUMERIC,"C"); +#endif aTables.Clear(); aBlocks.Clear(); aEntities.Clear(); @@ -213,7 +220,9 @@ if (bRes==TRUE && aBoundingBox.bEmpty==TRUE) CalcBoundingBox(aEntities,aBoundingBox); - +#ifdef UNX + setlocale(LC_NUMERIC, localewas); +#endif return bRes; } @@ -238,7 +247,19 @@ aVector.fx=rDGR.GetF(10); aVector.fy=rDGR.GetF(20); aVector.fz=rDGR.GetF(30); + bool secondlim = 0; + if (aBoundingBox.fMinX==aBoundingBox.fMaxX && + aBoundingBox.fMinY==aBoundingBox.fMaxY && + aBoundingBox.fMinZ==aBoundingBox.fMaxZ && + !aBoundingBox.bEmpty) + { + secondlim = 1; + } aBoundingBox.Union(aVector); + if (secondlim && aBoundingBox.fMinX==aBoundingBox.fMaxX && + aBoundingBox.fMinY==aBoundingBox.fMaxY && + aBoundingBox.fMinZ==aBoundingBox.fMaxZ) + aBoundingBox.bEmpty = TRUE; } else rDGR.Read(); }