Changeset 12358
- Timestamp:
- 10/09/07 13:49:17 (1 year ago)
- Files:
-
- trunk/gdal/ogr/ogrsf_frmts/mitab/HISTORY.TXT (modified) (2 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab.h (modified) (18 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_datfile.cpp (modified) (7 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_feature.cpp (modified) (110 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_mapfile.cpp (modified) (5 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_mapobjectblock.cpp (modified) (5 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_miffile.cpp (modified) (4 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_priv.h (modified) (3 diffs)
- trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_tabfile.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/gdal/ogr/ogrsf_frmts/mitab/HISTORY.TXT
r11971 r12358 13 13 CHANGES - Current Version: 14 14 -------------------------- 15 16 Version 1.6.3-beta2 (2007-09-18) 17 -------------------------------- 18 19 - Fixed another issue related to splitting of object blocks with the 20 optimized spatial index. The compressed coordinate origin values were 21 not initialized properly before being written (bug 1732) 22 23 - Remove static variables that interfere with reentrancy. 24 http://trac.osgeo.org/gdal/ticket/1883 25 26 27 Version 1.6.3-beta1 (2007-09-14) 28 -------------------------------- 29 30 - Fixed the splitting of object blocks with the optimized spatial 31 index mode that was producing files with misaligned bytes that 32 confused MapInfo (bug 1732) 33 Note that even if this bug is (hopefully) fixed, the optimized spatial 34 index is still disabled by default in this release and we still use 35 the quick (i.e. traditional) spatial index mode by default. 36 37 - Fixed problem with MIF parser being confused by special attribute 38 names (bug 1795) 15 39 16 40 … … 813 837 814 838 ------------ 815 $Id: HISTORY.TXT,v 1.19 0 2007/07/31 21:06:51 dmorissetteExp $839 $Id: HISTORY.TXT,v 1.195 2007/10/09 17:43:16 fwarmerdam Exp $ 816 840 ------------ trunk/gdal/ogr/ogrsf_frmts/mitab/mitab.h
r11971 r12358 1 1 /********************************************************************** 2 * $Id: mitab.h,v 1. 97 2007/07/12 12:39:59dmorissette Exp $2 * $Id: mitab.h,v 1.102 2007/09/18 18:13:42 dmorissette Exp $ 3 3 * 4 4 * Name: mitab.h … … 31 31 * 32 32 * $Log: mitab.h,v $ 33 * Revision 1.102 2007/09/18 18:13:42 dmorissette 34 * Updated for 1.6.3-beta2 35 * 36 * Revision 1.101 2007/09/14 20:03:08 dmorissette 37 * Removed stray ReadGeometryFromMAPFile() declaration 38 * 39 * Revision 1.100 2007/09/14 19:42:39 dmorissette 40 * Updated for 1.6.3-beta1 41 * 42 * Revision 1.99 2007/09/14 18:30:18 dmorissette 43 * Fixed the splitting of object blocks with the optimized spatial 44 * index mode that was producing files with misaligned bytes that 45 * confused MapInfo (bug 1732) 46 * 47 * Revision 1.98 2007/09/12 20:22:31 dmorissette 48 * Added TABFeature::CreateFromMapInfoType() 49 * 33 50 * Revision 1.97 2007/07/12 12:39:59 dmorissette 34 51 * Set version to 1.6.2 … … 147 164 * Current version of the MITAB library... always useful! 148 165 *--------------------------------------------------------------------*/ 149 #define MITAB_VERSION "1.6. 2 (2007-07-12)"150 #define MITAB_VERSION_INT 100600 2/* version x.y.z -> xxxyyyzzz */166 #define MITAB_VERSION "1.6.3-beta2 (2007-09-18)" 167 #define MITAB_VERSION_INT 1006003 /* version x.y.z -> xxxyyyzzz */ 151 168 152 169 #ifndef PI … … 1060 1077 virtual ~TABFeature(); 1061 1078 1079 static TABFeature *CreateFromMapInfoType(int nMapInfoType, 1080 OGRFeatureDefn *poDefn); 1081 1062 1082 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *pNewDefn = NULL); 1063 1083 virtual TABFeatureClass GetFeatureClass() { return TABFCNoGeomFeature; }; … … 1074 1094 1075 1095 virtual int ReadRecordFromDATFile(TABDATFile *poDATFile); 1076 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1096 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1097 GBool bCoordDataOnly=FALSE, 1098 TABMAPCoordBlock **ppoCoordBlock=NULL); 1077 1099 1078 1100 virtual int WriteRecordToDATFile(TABDATFile *poDATFile, 1079 1101 TABINDFile *poINDFile, int *panIndexNo); 1080 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1102 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1103 GBool bCoordDataOnly=FALSE, 1104 TABMAPCoordBlock **ppoCoordBlock=NULL); 1081 1105 GBool ValidateCoordType(TABMAPFile * poMapFile); 1082 1106 void ForceCoordTypeAndOrigin(int nMapInfoType, GBool bCompr, … … 1105 1129 void GetMBR(double &dXMin, double &dYMin, 1106 1130 double &dXMax, double &dYMax); 1131 void SetIntMBR(GInt32 nXMin, GInt32 nYMin, 1132 GInt32 nXMax, GInt32 nYMax); 1107 1133 void GetIntMBR(GInt32 &nXMin, GInt32 &nYMin, 1108 1134 GInt32 &nXMax, GInt32 &nYMax); … … 1145 1171 double GetY(); 1146 1172 1147 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1148 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1173 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1174 GBool bCoordDataOnly=FALSE, 1175 TABMAPCoordBlock **ppoCoordBlock=NULL); 1176 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1177 GBool bCoordDataOnly=FALSE, 1178 TABMAPCoordBlock **ppoCoordBlock=NULL); 1149 1179 1150 1180 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1185 1215 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1186 1216 1187 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1188 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1217 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1218 GBool bCoordDataOnly=FALSE, 1219 TABMAPCoordBlock **ppoCoordBlock=NULL); 1220 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1221 GBool bCoordDataOnly=FALSE, 1222 TABMAPCoordBlock **ppoCoordBlock=NULL); 1189 1223 1190 1224 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1238 1272 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1239 1273 1240 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1241 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1274 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1275 GBool bCoordDataOnly=FALSE, 1276 TABMAPCoordBlock **ppoCoordBlock=NULL); 1277 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1278 GBool bCoordDataOnly=FALSE, 1279 TABMAPCoordBlock **ppoCoordBlock=NULL); 1242 1280 1243 1281 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1292 1330 OGRLineString *GetPartRef(int nPartIndex); 1293 1331 1294 int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *,1295 TABMAPCoordBlock **ppoCoordBlock);1296 1297 1332 GBool TwoPointLineAsPolyline(); 1298 1333 void TwoPointLineAsPolyline(GBool bTwoPointLineAsPolyline); 1299 1334 1300 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1301 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1335 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1336 GBool bCoordDataOnly=FALSE, 1337 TABMAPCoordBlock **ppoCoordBlock=NULL); 1338 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1339 GBool bCoordDataOnly=FALSE, 1340 TABMAPCoordBlock **ppoCoordBlock=NULL); 1302 1341 1303 1342 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1368 1407 GBool IsInteriorRing(int nRequestedRingIndex); 1369 1408 1370 int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1371 TABMAPCoordBlock **ppoCoordBlock); 1372 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1373 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1409 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1410 GBool bCoordDataOnly=FALSE, 1411 TABMAPCoordBlock **ppoCoordBlock=NULL); 1412 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1413 GBool bCoordDataOnly=FALSE, 1414 TABMAPCoordBlock **ppoCoordBlock=NULL); 1374 1415 1375 1416 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1417 1458 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1418 1459 1419 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1420 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1460 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1461 GBool bCoordDataOnly=FALSE, 1462 TABMAPCoordBlock **ppoCoordBlock=NULL); 1463 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1464 GBool bCoordDataOnly=FALSE, 1465 TABMAPCoordBlock **ppoCoordBlock=NULL); 1421 1466 1422 1467 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1474 1519 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1475 1520 1476 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1477 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1521 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1522 GBool bCoordDataOnly=FALSE, 1523 TABMAPCoordBlock **ppoCoordBlock=NULL); 1524 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1525 GBool bCoordDataOnly=FALSE, 1526 TABMAPCoordBlock **ppoCoordBlock=NULL); 1478 1527 1479 1528 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1532 1581 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1533 1582 1534 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1535 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1583 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1584 GBool bCoordDataOnly=FALSE, 1585 TABMAPCoordBlock **ppoCoordBlock=NULL); 1586 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1587 GBool bCoordDataOnly=FALSE, 1588 TABMAPCoordBlock **ppoCoordBlock=NULL); 1536 1589 1537 1590 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1605 1658 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1606 1659 1607 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1608 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1660 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1661 GBool bCoordDataOnly=FALSE, 1662 TABMAPCoordBlock **ppoCoordBlock=NULL); 1663 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1664 GBool bCoordDataOnly=FALSE, 1665 TABMAPCoordBlock **ppoCoordBlock=NULL); 1609 1666 1610 1667 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1687 1744 void SetCenter(double dX, double dY); 1688 1745 1689 int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1690 TABMAPCoordBlock **ppoCoordBlock); 1691 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1692 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1746 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1747 GBool bCoordDataOnly=FALSE, 1748 TABMAPCoordBlock **ppoCoordBlock=NULL); 1749 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1750 GBool bCoordDataOnly=FALSE, 1751 TABMAPCoordBlock **ppoCoordBlock=NULL); 1693 1752 1694 1753 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1757 1816 virtual TABFeature *CloneTABFeature(OGRFeatureDefn *poNewDefn = NULL ); 1758 1817 1759 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1760 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1818 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1819 GBool bCoordDataOnly=FALSE, 1820 TABMAPCoordBlock **ppoCoordBlock=NULL); 1821 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1822 GBool bCoordDataOnly=FALSE, 1823 TABMAPCoordBlock **ppoCoordBlock=NULL); 1761 1824 1762 1825 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); … … 1798 1861 virtual TABFeatureClass GetFeatureClass() { return TABFCDebugFeature; }; 1799 1862 1800 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1801 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *); 1863 virtual int ReadGeometryFromMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1864 GBool bCoordDataOnly=FALSE, 1865 TABMAPCoordBlock **ppoCoordBlock=NULL); 1866 virtual int WriteGeometryToMAPFile(TABMAPFile *poMapFile, TABMAPObjHdr *, 1867 GBool bCoordDataOnly=FALSE, 1868 TABMAPCoordBlock **ppoCoordBlock=NULL); 1802 1869 1803 1870 virtual int ReadGeometryFromMIFFile(MIDDATAFile *fp); trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_datfile.cpp
r6276 r12358 1 1 /********************************************************************** 2 * $Id: mitab_datfile.cpp,v 1.1 7 2004/06/30 20:29:03 dmorissetteExp $2 * $Id: mitab_datfile.cpp,v 1.18 2007/10/09 17:43:16 fwarmerdam Exp $ 3 3 * 4 4 * Name: mitab_datfile.cpp … … 32 32 * 33 33 * $Log: mitab_datfile.cpp,v $ 34 * Revision 1.18 2007/10/09 17:43:16 fwarmerdam 35 * Remove static variables that interfere with reentrancy. (GDAL #1883) 36 * 34 37 * Revision 1.17 2004/06/30 20:29:03 dmorissette 35 38 * Fixed refs to old address danmo@videotron.ca … … 820 823 const char *TABDATFile::ReadCharField(int nWidth) 821 824 { 822 // We know that character strings are limited to 254 chars in MapInfo823 static char szBuf[256];824 825 825 // If current record has been deleted, then return an acceptable 826 826 // default value. … … 842 842 } 843 843 844 if (m_poRecordBlock->ReadBytes(nWidth, (GByte*) szBuf) != 0)844 if (m_poRecordBlock->ReadBytes(nWidth, (GByte*)m_szBuffer) != 0) 845 845 return ""; 846 846 847 szBuf[nWidth] = '\0';847 m_szBuffer[nWidth] = '\0'; 848 848 849 849 // NATIVE tables are padded with '\0' chars, but DBF tables are padded … … 851 851 if (m_eTableType == TABTableDBF) 852 852 { 853 int nLen = strlen( szBuf)-1;854 while(nLen>=0 && szBuf[nLen] == ' ')855 szBuf[nLen--] = '\0';856 } 857 858 return szBuf;853 int nLen = strlen(m_szBuffer)-1; 854 while(nLen>=0 && m_szBuffer[nLen] == ' ') 855 m_szBuffer[nLen--] = '\0'; 856 } 857 858 return m_szBuffer; 859 859 } 860 860 … … 1012 1012 { 1013 1013 int nDay, nMonth, nYear; 1014 static char szBuf[20];1015 1014 1016 1015 // If current record has been deleted, then return an acceptable … … 1039 1038 return ""; 1040 1039 1041 sprintf( szBuf, "%4.4d%2.2d%2.2d", nYear, nMonth, nDay);1042 1043 return szBuf;1040 sprintf(m_szBuffer, "%4.4d%2.2d%2.2d", nYear, nMonth, nDay); 1041 1042 return m_szBuffer; 1044 1043 } 1045 1044 trunk/gdal/ogr/ogrsf_frmts/mitab/mitab_feature.cpp
r11728 r12358 1 1 /********************************************************************** 2 * $Id: mitab_feature.cpp,v 1.7 2 2007/06/12 14:17:16 dmorissette Exp $2 * $Id: mitab_feature.cpp,v 1.76 2007/09/18 17:43:56 dmorissette Exp $ 3 3 * 4 4 * Name: mitab_feature.cpp … … 31 31 * 32 32 * $Log: mitab_feature.cpp,v $ 33 * Revision 1.76 2007/09/18 17:43:56 dmorissette 34 * Fixed another index splitting issue: compr coordinates origin was not 35 * stored in the TABFeature in ReadGeometry... (bug 1732) 36 * 37 * Revision 1.75 2007/09/14 19:29:24 dmorissette 38 * Completed handling of bCoordBlockDataOnly arg to Read/WriteGeometry() 39 * functions to avoid screwing up pen/brush ref counters (bug 1732) 40 * 41 * Revision 1.74 2007/09/14 18:30:19 dmorissette 42 * Fixed the splitting of object blocks with the optimized spatial 43 * index mode that was producing files with misaligned bytes that 44 * confused MapInfo (bug 1732) 45 * 46 * Revision 1.73 2007/09/12 20:22:31 dmorissette 47 * Added TABFeature::CreateFromMapInfoType() 48 * 33 49 * Revision 1.72 2007/06/12 14:17:16 dmorissette 34 50 * Added TABFile::TwoPointLineAsPolyline() to allow writing two point lines … … 68 84 * geometry (GDAL bug 1059) 69 85 * 70 * Revision 1.62 2005/11/08 22:02:36 fwarmerdam71 * cast strstr() results as per email from Charles Savage for VC8.72 *73 * Revision 1.61 2005/10/12 19:13:30 jlacroix74 * bug1012 Make sure Style Units are set when seting a feature from StyleString75 *76 * Revision 1.60 2005/10/07 21:22:33 dmorissette77 * Clone region/pline/mpoint components in TABCollection::CloneTABFeature()78 *79 * Revision 1.59 2005/10/06 23:05:08 dmorissette80 * TABCollection: Added automated sync'ing of OGRFeature's geometry in81 * SetRegion/Pline/MpointDirectly() methods (bug 1126)82 *83 * Revision 1.58 2005/10/06 19:15:30 dmorissette84 * Collections: added support for reading/writing pen/brush/symbol ids and85 * for writing collection objects to .TAB/.MAP (bug 1126)86 *87 * Revision 1.57 2005/10/04 15:44:31 dmorissette88 * First round of support for Collection objects. Currently supports reading89 * from .TAB/.MAP and writing to .MIF. Still lacks symbol support and write90 * support. (Based in part on patch and docs from Jim Hope, bug 1126)91 *92 * Revision 1.56 2005/07/14 16:15:05 jlacroix93 * \n and \ are now unescaped internally.94 *95 * Revision 1.55 2005/05/19 15:26:59 jlacroix96 * Implement a method to set the StyleString of a TABFeature.97 * This is done via the ITABFeaturePen, Brush and Symbol classes.98 *99 * Revision 1.54 2004/12/01 18:25:03 dmorissette100 * Fixed potential memory leaks in error conditions (bug 881)101 *102 * Revision 1.53 2004/10/19 14:21:11 jlacroix103 * Support pen width bigger than 7 with GetStyleString. (Bug 683)104 *105 * Revision 1.52 2004/10/11 20:18:27 dmorissette106 * Do not output a BG color in style string for transparent brushes (bug 693)107 *108 * Revision 1.51 2004/06/30 20:29:03 dmorissette109 * Fixed refs to old address danmo@videotron.ca110 *111 * Revision 1.50 2003/12/19 08:30:10 fwarmerdam112 * write 3d geometries to tab in 2D113 *114 * Revision 1.49 2003/03/28 14:01:14 warmerda115 * use TRUE/FALSE in place of true/false116 *117 * Revision 1.48 2002/08/27 17:17:33 warmerda118 * handle errors better, auto-add FID column if there aren't any columns119 *120 * Revision 1.47 2002/06/17 15:00:30 julien121 * Add IsInteriorRing() function in TABRegion to validate if a ring is internal122 *123 * Revision 1.46 2002/03/26 03:17:13 daniel124 * Added Get/SetCenter() to MultiPoint125 *126 * Revision 1.45 2002/03/26 01:48:40 daniel127 * Added Multipoint object type (V650)128 *129 * Revision 1.44 2002/01/23 20:29:56 daniel130 * Fixed warning produced by CPLAssert() in non-DEBUG mode.131 *132 * Revision 1.43 2001/12/05 22:38:59 daniel133 * Fixed problems writing TAB_GEOM_LINE (bug 610, 633).134 *135 * Revision 1.42 2001/11/23 22:50:17 daniel136 * Fixed geometry type assertion in TABPolyline::WriteGeomToMAPFile (bug605)137 *138 * Revision 1.41 2001/11/17 21:54:06 daniel139 * Made several changes in order to support writing objects in 16 bits140 * coordinate format. New TABMAPObjHdr-derived classes are used to hold141 * object info in mem until block is full.142 *143 * Revision 1.40 2001/09/17 21:33:44 daniel144 * TABText: do not produce an error when reading 0-length text strings.145 *146 * Revision 1.39 2001/09/05 13:33:33 daniel147 * TABPolyline::ValidateMapInfoType(): return TAB_GEOM_NONE if numpoints < 2148 *149 * Revision 1.38 2001/07/03 03:14:52 daniel150 * GetLabelStyleString(): take line spacing and num. of lines into account151 * when calculating text height.152 *153 * Revision 1.37 2001/06/25 01:04:21 daniel154 * StyleString fixes: include font name in text style string, and placed155 * brush before pen in region style strings.156 *157 * Revision 1.36 2001/05/01 18:34:12 daniel158 * TABRegion: use outside/inside ring relationship to build geometry if159 * the information is available in the source file.160 *161 * Revision 1.35 2001/02/28 07:15:08 daniel162 * Added support for text label line end point163 *164 * Revision 1.34 2001/01/22 16:03:58 warmerda165 * expanded tabs166 *167 * Revision 1.33 2000/11/23 21:11:07 daniel168 * OOpps... VC++ didn't like the way TABPenDef, etc. were initialized169 *170 * Revision 1.32 2000/11/23 20:47:45 daniel171 * Use MI defaults for Pen, Brush, Font, Symbol instead of all zeros172 *173 * Revision 1.31 2000/10/18 03:23:37 warmerda174 * ensure TABText::m_dWidth is initialized in constructor175 *176 * Revision 1.30 2000/10/03 19:29:51 daniel177 * Include OGR StyleString stuff (implemented by Stephane)178 *179 * Revision 1.29 2000/09/19 17:23:52 daniel180 * Maintain and/or compute valid region and polyline center/label point181 *182 * Revision 1.28 2000/09/07 23:32:13 daniel183 * Added RecordDeletedFlag to TABFeature with get/set methods184 *185 * Revision 1.27 2000/07/10 14:56:25 daniel186 * Handle m_nOriginQuadrant==0 as quadrant 3 (reverse x and y axis)187 *188 * Revision 1.26 2000/04/21 12:39:05 daniel189 * Added TABPolyline::GetNumParts()/GetPartRef()190 *191 * Revision 1.25 2000/02/28 16:44:10 daniel192 * Added support for indexed, unique, and for new V450 object types193 *194 86 * ... 195 87 * … … 233 125 234 126 /********************************************************************** 127 * TABFeature::CreateFromMapInfoType() 128 * 129 * Factory that creates a TABFeature of the right class for the specified 130 * MapInfo Type 131 * 132 **********************************************************************/ 133 TABFeature *TABFeature::CreateFromMapInfoType(int nMapInfoType, 134 OGRFeatureDefn *poDefn) 135 { 136 TABFeature *poFeature = NULL; 137 138 /*----------------------------------------------------------------- 139 * Create new feature object of the right type 140 *----------------------------------------------------------------*/ 141 switch(nMapInfoType) 142 { 143 case TAB_GEOM_NONE: 144 poFeature = new TABFeature(poDefn); 145 break; 146 case TAB_GEOM_SYMBOL_C: 147 case TAB_GEOM_SYMBOL: 148 poFeature = new TABPoint(poDefn); 149 break; 150 case TAB_GEOM_FONTSYMBOL_C: 151 case TAB_GEOM_FONTSYMBOL: 152 poFeature = new TABFontPoint(poDefn); 153 break; 154 case TAB_GEOM_CUSTOMSYMBOL_C: 155 case TAB_GEOM_CUSTOMSYMBOL: 156 poFeature = new TABCustomPoint(poDefn); 157 break; 158 case TAB_GEOM_LINE_C: 159 case TAB_GEOM_LINE: 160 case TAB_GEOM_PLINE_C: 161 case TAB_GEOM_PLINE: 162 case TAB_GEOM_MULTIPLINE_C: 163 case TAB_GEOM_MULTIPLINE: 164 case TAB_GEOM_V450_MULTIPLINE_C: 165 case TAB_GEOM_V450_MULTIPLINE: 166 poFeature = new TABPolyline(poDefn); 167 break; 168 case TAB_GEOM_ARC_C: 169 case TAB_GEOM_ARC: 170 poFeature = new TABArc(poDefn); 171 break; 172 173 case TAB_GEOM_REGION_C: 174 case TAB_GEOM_REGION: 175 case TAB_GEOM_V450_REGION_C: 176 case TAB_GEOM_V450_REGION: 177 poFeature = new TABRegion(poDefn); 178 break; 179 case TAB_GEOM_RECT_C: 180 case TAB_GEOM_RECT: 181 case TAB_GEOM_ROUNDRECT_C: 182 case TAB_GEOM_ROUNDRECT: 183 poFeature = new TABRectangle(poDefn); 184 break; 185 case TAB_GEOM_ELLIPSE_C: 186 case TAB_GEOM_ELLIPSE: 187 poFeature = new TABEllipse(poDefn); 188 break; 189 case TAB_GEOM_TEXT_C: 190 case TAB_GEOM_TEXT: 191 poFeature = new TABText(poDefn); 192 break; 193 case TAB_GEOM_MULTIPOINT_C: 194 case TAB_GEOM_MULTIPOINT: 195 poFeature = new TABMultiPoint(poDefn); 196 break; 197 case TAB_GEOM_COLLECTION_C: 198 case TAB_GEOM_COLLECTION: 199 poFeature = new TABCollection(poDefn); 200 break; 201 default: 202 /*------------------------------------------------------------- 203 * Unsupported feature type... we still return a valid feature 204 * with NONE geometry after producing a Warning. 205 * Callers can trap that case by checking CPLGetLastErrorNo() 206 * against TAB_WarningFeatureTypeNotSupported 207 *------------------------------------------------------------*/ 208 // poFeature = new TABDebugFeature(poDefn); 209 poFeature = new TABFeature(poDefn); 210 211 CPLError(CE_Warning, TAB_WarningFeatureTypeNotSupported, 212 "Unsupported object type %d (0x%2.2x). Feature will be " 213 "returned with NONE geometry.", 214 nMapInfoType, nMapInfoType); 215 } 216 217 return poFeature; 218 } 219 220 221 /********************************************************************** 235 222 * TABFeature::CopyTABFeatureBase() 236 223 * … … 268 255 GetMBR(dXMin, dYMin, dXMax, dYMax); 269 256 poDestFeature->SetMBR(dXMin, dYMin, dXMax, dYMax); 257 258 GInt32 nXMin, nYMin, nXMax, nYMax; 259 GetIntMBR(nXMin, nYMin, nXMax, nYMax); 260 poDestFeature->SetIntMBR(nXMin, nYMin, nXMax, nYMax); 270 261 271 262 // m_nMapInfoType is not carried but it is not required anyways. … … 331 322 dXMax = m_dXMax; 332 323 dYMax = m_dYMax; 324 } 325 326 /********************************************************************** 327 * TABFeature::SetIntMBR() 328 * 329 * Set the integer coordinates values of the MBR of this feature. 330 **********************************************************************/ 331 void TABFeature::SetIntMBR(GInt32 nXMin, GInt32 nYMin, 332 GInt32 nXMax, GInt32 nYMax) 333 { 334 m_nXMin = nXMin; 335 m_nYMin = nYMin; 336 m_nXMax = nXMax; 337 m_nYMax = nYMax; 333 338 } 334 339 … … 506 511 * currently points to the beginning of a map object. 507 512 * 513 * bCoordBlockDataOnly=TRUE is used when this method is called to copy only 514 * the CoordBlock data during splitting of object blocks. In this case we 515 * need to process only the information related to the CoordBlock. One 516 * important thing to avoid is reading/writing pen/brush/symbol definitions 517 * as that would screw up their ref counters. 518 * 519 * ppoCoordBlock is used by TABCollection and by index splitting code 520 * to provide a CoordBlock to use instead of the one from the poMAPFile and 521 * return the current pointer at the end of the call. 522 * 508 523 * The current implementation does nothing since instances of TABFeature 509 524 * objects contain no geometry (i.e. TAB_GEOM_NONE). … … 513 528 **********************************************************************/ 514 529 int TABFeature::ReadGeometryFromMAPFile(TABMAPFile * /*poMapFile*/, 515 TABMAPObjHdr * /*poObjHdr*/) 530 TABMAPObjHdr * /*poObjHdr*/, 531 GBool /*bCoordBlockDataOnly=FALSE*/, 532 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 516 533 { 517 534 /*----------------------------------------------------------------- … … 643 660 * currently points to a valid map object. 644 661 * 662 * bCoordBlockDataOnly=TRUE is used when this method is called to copy only 663 * the CoordBlock data during splitting of object blocks. In this case we 664 * need to process only the information related to the CoordBlock. One 665 * important thing to avoid is reading/writing pen/brush/symbol definitions 666 * as that would screw up their ref counters. 667 * 668 * ppoCoordBlock is used by TABCollection and by index splitting code 669 * to provide a CoordBlock to use instead of the one from the poMAPFile and 670 * return the current pointer at the end of the call. 671 * 645 672 * The current implementation does nothing since instances of TABFeature 646 673 * objects contain no geometry (i.e. TAB_GEOM_NONE). … … 650 677 **********************************************************************/ 651 678 int TABFeature::WriteGeometryToMAPFile(TABMAPFile * /* poMapFile*/, 652 TABMAPObjHdr * /*poObjHdr*/) 679 TABMAPObjHdr * /*poObjHdr*/, 680 GBool /*bCoordBlockDataOnly=FALSE*/, 681 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 653 682 { 654 683 /*----------------------------------------------------------------- … … 818 847 **********************************************************************/ 819 848 int TABPoint::ReadGeometryFromMAPFile(TABMAPFile *poMapFile, 820 TABMAPObjHdr *poObjHdr) 849 TABMAPObjHdr *poObjHdr, 850 GBool bCoordBlockDataOnly /*=FALSE*/, 851 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 821 852 { 822 853 double dX, dY; 823 854 OGRGeometry *poGeometry; 824 855 856 /* Nothing to do for bCoordBlockDataOnly (used by index splitting) */ 857 if (bCoordBlockDataOnly) 858 return 0; 859 825 860 /*----------------------------------------------------------------- 826 861 * Fetch and validate geometry type 827 862 *----------------------------------------------------------------*/ 828 m_nMapInfoType = po MapFile->GetCurObjType();863 m_nMapInfoType = poObjHdr->m_nType; 829 864 830 865 if (m_nMapInfoType != TAB_GEOM_SYMBOL && … … 855 890 856 891 SetMBR(dX, dY, dX, dY); 892 SetIntMBR(poObjHdr->m_nMinX, poObjHdr->m_nMinY, 893 poObjHdr->m_nMaxX, poObjHdr->m_nMaxY); 857 894 858 895 return 0; … … 871 908 **********************************************************************/ 872 909 int TABPoint::WriteGeometryToMAPFile(TABMAPFile *poMapFile, 873 TABMAPObjHdr *poObjHdr) 910 TABMAPObjHdr *poObjHdr, 911 GBool bCoordBlockDataOnly /*=FALSE*/, 912 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 874 913 { 875 914 GInt32 nX, nY; 876 915 OGRGeometry *poGeom; 877 916 OGRPoint *poPoint; 917 918 /* Nothing to do for bCoordBlockDataOnly (used by index splitting) */ 919 if (bCoordBlockDataOnly) 920 return 0; 878 921 879 922 /*----------------------------------------------------------------- … … 1121 1164 **********************************************************************/ 1122 1165 int TABFontPoint::ReadGeometryFromMAPFile(TABMAPFile *poMapFile, 1123 TABMAPObjHdr *poObjHdr) 1166 TABMAPObjHdr *poObjHdr, 1167 GBool bCoordBlockDataOnly /*=FALSE*/, 1168 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 1124 1169 { 1125 1170 double dX, dY; 1126 1171 OGRGeometry *poGeometry; 1127 1172 1173 /* Nothing to do for bCoordBlockDataOnly (used by index splitting) */ 1174 if (bCoordBlockDataOnly) 1175 return 0; 1176 1128 1177 /*----------------------------------------------------------------- 1129 1178 * Fetch and validate geometry type 1130 1179 *----------------------------------------------------------------*/ 1131 m_nMapInfoType = po MapFile->GetCurObjType();1180 m_nMapInfoType = poObjHdr->m_nType; 1132 1181 1133 1182 if (m_nMapInfoType != TAB_GEOM_FONTSYMBOL && … … 1181 1230 1182 1231 SetMBR(dX, dY, dX, dY); 1232 SetIntMBR(poObjHdr->m_nMinX, poObjHdr->m_nMinY, 1233 poObjHdr->m_nMaxX, poObjHdr->m_nMaxY); 1183 1234 1184 1235 return 0; … … 1197 1248 **********************************************************************/ 1198 1249 int TABFontPoint::WriteGeometryToMAPFile(TABMAPFile *poMapFile, 1199 TABMAPObjHdr *poObjHdr) 1250 TABMAPObjHdr *poObjHdr, 1251 GBool bCoordBlockDataOnly /*=FALSE*/, 1252 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 1200 1253 { 1201 1254 GInt32 nX, nY; 1202 1255 OGRGeometry *poGeom; 1203 1256 OGRPoint *poPoint; 1257 1258 /* Nothing to do for bCoordBlockDataOnly (used by index splitting) */ 1259 if (bCoordBlockDataOnly) 1260 return 0; 1204 1261 1205 1262 /*----------------------------------------------------------------- … … 1414 1471 **********************************************************************/ 1415 1472 int TABCustomPoint::ReadGeometryFromMAPFile(TABMAPFile *poMapFile, 1416 TABMAPObjHdr *poObjHdr) 1473 TABMAPObjHdr *poObjHdr, 1474 GBool bCoordBlockDataOnly /*=FALSE*/, 1475 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 1417 1476 { 1418 1477 double dX, dY; 1419 1478 OGRGeometry *poGeometry; 1420 1479 1480 /* Nothing to do for bCoordBlockDataOnly (used by index splitting) */ 1481 if (bCoordBlockDataOnly) 1482 return 0; 1483 1421 1484 /*----------------------------------------------------------------- 1422 1485 * Fetch and validate geometry type 1423 1486 *----------------------------------------------------------------*/ 1424 m_nMapInfoType = po MapFile->GetCurObjType();1487 m_nMapInfoType = poObjHdr->m_nType; 1425 1488 1426 1489 if (m_nMapInfoType != TAB_GEOM_CUSTOMSYMBOL && … … 1457 1520 1458 1521 SetMBR(dX, dY, dX, dY); 1522 SetIntMBR(poObjHdr->m_nMinX, poObjHdr->m_nMinY, 1523 poObjHdr->m_nMaxX, poObjHdr->m_nMaxY); 1459 1524 1460 1525 return 0; … … 1473 1538 **********************************************************************/ 1474 1539 int TABCustomPoint::WriteGeometryToMAPFile(TABMAPFile *poMapFile, 1475 TABMAPObjHdr *poObjHdr) 1540 TABMAPObjHdr *poObjHdr, 1541 GBool bCoordBlockDataOnly /*=FALSE*/, 1542 TABMAPCoordBlock ** /*ppoCoordBlock=NULL*/) 1476 1543 { 1477 1544 GInt32 nX, nY; 1478 1545 OGRGeometry *poGeom; 1479 1546 OGRPoint *poPoint; 1547 1548 /* Nothing to do for bCoordBlockDataOnly (used by index splitting) */ 1549 if (bCoordBlockDataOnly) 1550 return 0; 1480 1551 1481 1552 /*----------------------------------------------------------------- … … 1795 1866 **********************************************************************/ 1796 1867 int TABPolyline::ReadGeometryFromMAPFile(TABMAPFile *poMapFile, 1797 TABMAPObjHdr *poObjHdr)1798 {1799 return ReadGeometryFromMAPFile(poMapFile, poObjHdr, NULL);1800 }1801 1802 int TABPolyline::ReadGeometryFromMAPFile(TABMAPFile *poMapFile,1803 1868 TABMAPObjHdr *poObjHdr, 1804 TABMAPCoordBlock **ppoCoordBlock) 1869 GBool bCoordBlockDataOnly /*=FALSE*/, 1870 TABMAPCoordBlock **ppoCoordBlock/*=NULL*/) 1805 1871 { 1806 1872 GInt32 nX, nY; … … 1837 1903 poLine->setPoint(1, dXMax, dYMax); 1838 1904 1839 m_nPenDefIndex = poLineHdr->m_nPenId; // Pen index 1840 poMapFile->ReadPenDef(m_nPenDefIndex, &m_sPenDef); 1905 if (!bCoordBlockDataOnly) 1906 { 1907 m_nPenDefIndex = poLineHdr->m_nPenId; // Pen index 1908 poMapFile->ReadPenDef(m_nPenDefIndex, &m_sPenDef); 1909 } 1841 1910 } 1842 1911 else if (m_nMapInfoType == TAB_GEOM_PLINE || … … 1848 1917 int i, numPoints, nStatus; 1849 1918 GUInt32 nCoordDataSize; 1850 GInt32 nCoordBlockPtr , nCenterX, nCenterY;1919 GInt32 nCoordBlockPtr; 1851 1920 1852 1921 /*------------------------------------------------------------- … … 1866 1935 1867 1936 // Compressed coordinate origin (useful only in compressed case!) 1868 nCenterX = poPLineHdr->m_nComprOrgX;1869 nCenterY = poPLineHdr->m_nComprOrgY;1937 m_nComprOrgX = poPLineHdr->m_nComprOrgX; 1938 m_nComprOrgY = poPLineHdr->m_nComprOrgY; 1870 1939 1871 1940 // MBR … … 1875 1944 dXMax, dYMax); 1876 1945 1877 m_nPenDefIndex = poPLineHdr->m_nPenId; // Pen index 1878 poMapFile->ReadPenDef(m_nPenDefIndex, &m_sPenDef); 1946 if (!bCoordBlockDataOnly) 1947 { 1948 m_nPenDefIndex = poPLineHdr->m_nPenId; // Pen index 1949 poMapFile->ReadPenDef(m_nPenDefIndex, &m_sPenDef); 1950 } 1879 1951 1880 1952 /*------------------------------------------------------------- … … 1883 1955 numPoints = nCoordDataSize/(bComprCoord?4:8); 1884 1956 1885 poCoordBlock = poMapFile->GetCoordBlock(nCoordBlockPtr); 1957 if (ppoCoordBlock != NULL && *ppoCoordBlock != NULL) 1958 poCoordBlock = *ppoCoordBlock; 1959 else
