2
2
/******************************************************************************
3
* $Id: ogr_tiger.h 17224 2009-06-07 20:20:23Z rouault $
3
* $Id: ogr_tiger.h 23423 2011-11-26 18:40:30Z rouault $
5
5
* Project: TIGER/Line Translator
6
6
* Purpose: Main declarations for Tiger translator.
90
90
/*****************************************************************************/
92
92
typedef struct TigerFieldInfo {
93
const char *pszFieldName; // name of the field
93
char pszFieldName[11]; // name of the field
94
94
char cFmt; // format of the field ('L' or 'R')
95
95
char cType; // type of the field ('A' or 'N')
96
OGRFieldType OGRtype; // OFTType of the field (OFTInteger, OFTString, ...?)
97
int nBeg; // beginning column number for field
98
int nEnd; // ending column number for field
99
int nLen; // length of field
96
char OGRtype; // OFTType of the field (OFTInteger, OFTString, ...?)
97
unsigned char nBeg; // beginning column number for field
98
unsigned char nEnd; // ending column number for field
99
unsigned char nLen; // length of field
101
int bDefine; // whether to add this field to the FeatureDefn
102
int bSet; // whether to set this field in GetFeature()
103
int bWrite; // whether to write this field in CreateFeature()
101
int bDefine:1; // whether to add this field to the FeatureDefn
102
int bSet:1; // whether to set this field in GetFeature()
103
int bWrite:1; // whether to write this field in CreateFeature()
104
104
} TigerFieldInfo;
106
106
typedef struct TigerRecordInfo {
107
TigerFieldInfo *pasFields;
107
const TigerFieldInfo *pasFields;
108
unsigned char nFieldCount;
109
unsigned char nRecordLength;
110
110
} TigerRecordInfo;
112
112
// OGR_TIGER_RECBUF_LEN should be a number that is larger than the
150
150
TigerVersion nVersion;
153
TigerFileBase( const TigerRecordInfo *psRTInfoIn = NULL,
154
const char *m_pszFileCodeIn = NULL );
154
155
virtual ~TigerFileBase();
156
157
TigerVersion GetVersion() { return nVersion; }
159
160
virtual const char *GetShortModule() { return pszShortModule; }
160
161
virtual const char *GetModule() { return pszModule; }
161
virtual int SetModule( const char * ) = 0;
162
162
virtual int SetWriteModule( const char *, int, OGRFeature * );
164
164
virtual int GetFeatureCount() { return nFeatures; }
165
virtual OGRFeature *GetFeature( int ) = 0;
167
virtual OGRErr CreateFeature( OGRFeature *poFeature )
168
{ return OGRERR_FAILURE; }
170
166
OGRFeatureDefn *GetFeatureDefn() { return poFeatureDefn; }
172
static CPLString GetField( const char *, int, int );
168
static const char* GetField( const char *, int, int );
173
169
static void SetField( OGRFeature *, const char *, const char *,
180
176
int WritePoint( char *pachRecord, int nStart,
181
177
double dfX, double dfY );
179
virtual int SetModule( const char * pszModule );
180
virtual OGRFeature *GetFeature( int nRecordId );
181
virtual OGRErr CreateFeature( OGRFeature *poFeature );
184
void WriteFields(TigerRecordInfo *psRTInfo,
184
void WriteFields(const TigerRecordInfo *psRTInfo,
185
185
OGRFeature *poFeature,
188
void AddFieldDefns(TigerRecordInfo *psRTInfo,
188
void AddFieldDefns(const TigerRecordInfo *psRTInfo,
189
189
OGRFeatureDefn *poFeatureDefn);
192
void SetFields(TigerRecordInfo *psRTInfo,
192
void SetFields(const TigerRecordInfo *psRTInfo,
193
193
OGRFeature *poFeature,
194
194
char *achRecord);
197
const TigerRecordInfo *psRTInfo;
198
const char *m_pszFileCode;
198
201
/************************************************************************/
219
222
OGRFeature *GetFeature2002( int );
220
223
void AddFieldDefns2002();
222
TigerRecordInfo *psRT1Info;
223
TigerRecordInfo *psRT2Info;
224
TigerRecordInfo *psRT3Info;
225
const TigerRecordInfo *psRT1Info;
226
const TigerRecordInfo *psRT2Info;
227
const TigerRecordInfo *psRT3Info;
227
230
TigerCompleteChain( OGRTigerDataSource *,
244
247
class TigerAltName : public TigerFileBase
247
TigerRecordInfo *psRT4Info;
250
250
TigerAltName( OGRTigerDataSource *,
252
virtual ~TigerAltName();
254
virtual int SetModule( const char * );
256
253
virtual OGRFeature *GetFeature( int );
265
262
class TigerFeatureIds : public TigerFileBase
268
TigerRecordInfo *psRT5Info;
271
265
TigerFeatureIds( OGRTigerDataSource *,
273
virtual ~TigerFeatureIds();
275
virtual int SetModule( const char * );
277
virtual OGRFeature *GetFeature( int );
279
virtual OGRErr CreateFeature( OGRFeature *poFeature );
282
269
/************************************************************************/
286
273
class TigerZipCodes : public TigerFileBase
289
TigerRecordInfo *psRT6Info;
292
276
TigerZipCodes( OGRTigerDataSource *, const char * );
293
virtual ~TigerZipCodes();
295
virtual int SetModule( const char * );
297
virtual OGRFeature *GetFeature( int );
299
virtual OGRErr CreateFeature( OGRFeature *poFeature );
302
279
/************************************************************************/
310
287
class TigerPoint : public TigerFileBase
313
TigerPoint(int bRequireGeom);
290
TigerPoint(int bRequireGeom,
291
const TigerRecordInfo *psRTInfoIn = NULL,
292
const char *m_pszFileCodeIn = NULL);
315
294
// The boolean bRequireGeom indicates whether
316
295
// the layer requires each feature to actual
318
297
// decide whether to report an error when a
319
298
// missing geom is detected.
321
virtual ~TigerPoint();
324
301
int bRequireGeom;
327
virtual int SetModule( const char *,
328
const char *pszFileCode );
330
virtual OGRFeature *GetFeature( int nRecordId,
331
TigerRecordInfo *psRTInfo,
304
virtual OGRFeature *GetFeature( int nFID) { return TigerFileBase::GetFeature(nFID); } /* to avoid -Woverloaded-virtual warnings */
305
OGRFeature *GetFeature( int nRecordId,
332
306
int nX0, int nX1,
333
307
int nY0, int nY1 );
336
virtual OGRErr CreateFeature( OGRFeature *poFeature,
337
TigerRecordInfo *psRTInfo,
339
const char *pszFileCode );
310
virtual OGRErr CreateFeature( OGRFeature *poFeature) { return TigerFileBase::CreateFeature(poFeature); } /* to avoid -Woverloaded-virtual warnings */
311
OGRErr CreateFeature( OGRFeature *poFeature,
347
320
class TigerLandmarks : public TigerPoint
350
TigerRecordInfo *psRT7Info;
353
323
TigerLandmarks( OGRTigerDataSource *, const char * );
354
virtual ~TigerLandmarks();
356
virtual int SetModule( const char * );
358
325
virtual OGRFeature *GetFeature( int );
367
334
class TigerAreaLandmarks : public TigerFileBase
370
TigerRecordInfo *psRT8Info;
373
337
TigerAreaLandmarks( OGRTigerDataSource *, const char * );
374
virtual ~TigerAreaLandmarks();
376
virtual int SetModule( const char * );
378
virtual OGRFeature *GetFeature( int );
380
virtual OGRErr CreateFeature( OGRFeature *poFeature );
383
340
/************************************************************************/
387
344
class TigerKeyFeatures : public TigerFileBase
390
TigerRecordInfo *psRT9Info;
393
347
TigerKeyFeatures( OGRTigerDataSource *, const char * );
394
virtual ~TigerKeyFeatures();
396
virtual int SetModule( const char * );
398
virtual OGRFeature *GetFeature( int );
400
virtual OGRErr CreateFeature( OGRFeature *poFeature );
403
350
/************************************************************************/
407
354
class TigerPolygon : public TigerFileBase
410
TigerRecordInfo *psRTAInfo;
411
TigerRecordInfo *psRTSInfo;
357
const TigerRecordInfo *psRTAInfo;
358
const TigerRecordInfo *psRTSInfo;
433
380
class TigerPolygonCorrections : public TigerFileBase
436
TigerRecordInfo *psRTBInfo;
439
383
TigerPolygonCorrections( OGRTigerDataSource *, const char * );
440
virtual ~TigerPolygonCorrections();
442
virtual int SetModule( const char * );
444
virtual OGRFeature *GetFeature( int );
446
virtual OGRErr CreateFeature( OGRFeature *poFeature );
449
386
/************************************************************************/
453
390
class TigerEntityNames : public TigerFileBase
456
TigerRecordInfo *psRTCInfo;
459
393
TigerEntityNames( OGRTigerDataSource *, const char * );
460
virtual ~TigerEntityNames();
462
virtual int SetModule( const char * );
464
virtual OGRFeature *GetFeature( int );
466
virtual OGRErr CreateFeature( OGRFeature *poFeature );
469
396
/************************************************************************/
473
400
class TigerPolygonEconomic : public TigerFileBase
476
TigerRecordInfo *psRTEInfo;
479
403
TigerPolygonEconomic( OGRTigerDataSource *, const char * );
480
virtual ~TigerPolygonEconomic();
482
virtual int SetModule( const char * );
484
virtual OGRFeature *GetFeature( int );
486
virtual OGRErr CreateFeature( OGRFeature *poFeature );
489
407
/************************************************************************/
493
411
class TigerIDHistory : public TigerFileBase
496
TigerRecordInfo *psRTHInfo;
499
414
TigerIDHistory( OGRTigerDataSource *, const char * );
500
virtual ~TigerIDHistory();
502
virtual int SetModule( const char * );
504
virtual OGRFeature *GetFeature( int );
506
virtual OGRErr CreateFeature( OGRFeature *poFeature );
509
417
/************************************************************************/
513
421
class TigerPolyChainLink : public TigerFileBase
516
TigerRecordInfo *psRTIInfo;
519
424
TigerPolyChainLink( OGRTigerDataSource *, const char * );
520
virtual ~TigerPolyChainLink();
522
virtual int SetModule( const char * );
524
virtual OGRFeature *GetFeature( int );
526
virtual OGRErr CreateFeature( OGRFeature *poFeature );
529
427
/************************************************************************/
533
431
class TigerSpatialMetadata : public TigerFileBase
536
TigerRecordInfo *psRTMInfo;
539
434
TigerSpatialMetadata( OGRTigerDataSource *, const char * );
540
virtual ~TigerSpatialMetadata();
542
virtual int SetModule( const char * );
544
virtual OGRFeature *GetFeature( int );
546
virtual OGRErr CreateFeature( OGRFeature *poFeature );
549
437
/************************************************************************/
553
441
class TigerPIP : public TigerPoint
556
TigerRecordInfo *psRTPInfo;
559
444
TigerPIP( OGRTigerDataSource *, const char * );
562
virtual int SetModule( const char * );
564
446
virtual OGRFeature *GetFeature( int );
573
455
class TigerTLIDRange : public TigerFileBase
576
TigerRecordInfo *psRTRInfo;
579
458
TigerTLIDRange( OGRTigerDataSource *, const char * );
580
virtual ~TigerTLIDRange();
582
virtual int SetModule( const char * );
584
virtual OGRFeature *GetFeature( int );
586
virtual OGRErr CreateFeature( OGRFeature *poFeature );
589
461
/************************************************************************/
593
465
class TigerZeroCellID : public TigerFileBase
596
TigerRecordInfo *psRTTInfo;
599
468
TigerZeroCellID( OGRTigerDataSource *, const char * );
600
virtual ~TigerZeroCellID();
602
virtual int SetModule( const char * );
604
virtual OGRFeature *GetFeature( int );
606
virtual OGRErr CreateFeature( OGRFeature *poFeature );
609
471
/************************************************************************/
613
475
class TigerOverUnder : public TigerPoint
616
TigerRecordInfo *psRTUInfo;
619
478
TigerOverUnder( OGRTigerDataSource *, const char * );
620
virtual ~TigerOverUnder();
622
virtual int SetModule( const char * );
624
480
virtual OGRFeature *GetFeature( int );
633
489
class TigerZipPlus4 : public TigerFileBase
636
TigerRecordInfo *psRTZInfo;
639
492
TigerZipPlus4( OGRTigerDataSource *, const char * );
640
virtual ~TigerZipPlus4();
642
virtual int SetModule( const char * );
644
virtual OGRFeature *GetFeature( int );
646
virtual OGRErr CreateFeature( OGRFeature *poFeature );
649
495
/************************************************************************/