~ubuntu-branches/debian/sid/gdal/sid

« back to all changes in this revision

Viewing changes to ogr/ogrsf_frmts/tiger/ogr_tiger.h

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2012-05-07 15:04:42 UTC
  • mfrom: (5.5.16 experimental)
  • Revision ID: package-import@ubuntu.com-20120507150442-2eks97loeh6rq005
Tags: 1.9.0-1
* Ready for sid, starting transition.
* All symfiles updated to latest builds.
* Added dh_numpy call in debian/rules to depend on numpy ABI.
* Policy bumped to 3.9.3, no changes required.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*-*-C++-*-*/
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 $
4
4
 *
5
5
 * Project:  TIGER/Line Translator
6
6
 * Purpose:  Main declarations for Tiger translator.
90
90
/*****************************************************************************/
91
91
 
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
100
100
 
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;
105
105
 
106
106
typedef struct TigerRecordInfo {
107
 
  TigerFieldInfo *pasFields;
108
 
  int             nFieldCount;
109
 
  int             nRecordLength;
 
107
  const TigerFieldInfo *pasFields;
 
108
  unsigned char        nFieldCount;
 
109
  unsigned char        nRecordLength;
110
110
} TigerRecordInfo;
111
111
 
112
112
// OGR_TIGER_RECBUF_LEN should be a number that is larger than the
150
150
  TigerVersion        nVersion;
151
151
 
152
152
public:
153
 
                      TigerFileBase();
 
153
                      TigerFileBase( const TigerRecordInfo *psRTInfoIn = NULL,
 
154
                                     const char            *m_pszFileCodeIn = NULL );
154
155
  virtual            ~TigerFileBase();
155
156
 
156
157
  TigerVersion        GetVersion() { return nVersion; }
158
159
 
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 * );
163
163
 
164
164
  virtual int         GetFeatureCount() { return nFeatures; }
165
 
  virtual OGRFeature *GetFeature( int ) = 0;
166
 
 
167
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature )
168
 
                                { return OGRERR_FAILURE; }
169
165
 
170
166
  OGRFeatureDefn     *GetFeatureDefn() { return poFeatureDefn; }
171
167
 
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 *,
174
170
                                int, int );
175
171
 
180
176
  int                 WritePoint( char *pachRecord, int nStart,
181
177
                                  double dfX, double dfY );
182
178
 
 
179
  virtual int         SetModule( const char * pszModule );
 
180
  virtual OGRFeature *GetFeature( int nRecordId );
 
181
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
 
182
 
183
183
 protected:
184
 
  void                WriteFields(TigerRecordInfo *psRTInfo,
 
184
  void                WriteFields(const TigerRecordInfo *psRTInfo,
185
185
                                  OGRFeature      *poFeature,
186
186
                                  char            *szRecord);
187
187
 
188
 
  void                AddFieldDefns(TigerRecordInfo *psRTInfo,
 
188
  void                AddFieldDefns(const TigerRecordInfo *psRTInfo,
189
189
                                    OGRFeatureDefn  *poFeatureDefn);
190
190
 
191
191
 
192
 
  void                SetFields(TigerRecordInfo *psRTInfo,
 
192
  void                SetFields(const TigerRecordInfo *psRTInfo,
193
193
                                OGRFeature      *poFeature,
194
194
                                char            *achRecord);
195
195
 
 
196
 
 
197
  const TigerRecordInfo *psRTInfo;
 
198
  const char            *m_pszFileCode;
196
199
};
197
200
 
198
201
/************************************************************************/
219
222
  OGRFeature         *GetFeature2002( int );
220
223
  void                AddFieldDefns2002();
221
224
 
222
 
  TigerRecordInfo    *psRT1Info;
223
 
  TigerRecordInfo    *psRT2Info;
224
 
  TigerRecordInfo    *psRT3Info;
 
225
  const TigerRecordInfo    *psRT1Info;
 
226
  const TigerRecordInfo    *psRT2Info;
 
227
  const TigerRecordInfo    *psRT3Info;
225
228
 
226
229
public:
227
230
                      TigerCompleteChain( OGRTigerDataSource *,
243
246
 
244
247
class TigerAltName : public TigerFileBase
245
248
{
246
 
 private:
247
 
  TigerRecordInfo    *psRT4Info;
248
 
 
249
249
 public:
250
250
                      TigerAltName( OGRTigerDataSource *,
251
251
                                          const char * );
252
 
  virtual            ~TigerAltName();
253
 
 
254
 
  virtual int         SetModule( const char * );
255
252
 
256
253
  virtual OGRFeature *GetFeature( int );
257
254
 
264
261
 
265
262
class TigerFeatureIds : public TigerFileBase
266
263
{
267
 
 private:
268
 
  TigerRecordInfo    *psRT5Info;
269
 
 
270
264
 public:
271
265
                      TigerFeatureIds( OGRTigerDataSource *,
272
266
                                       const char * );
273
 
  virtual            ~TigerFeatureIds();
274
 
 
275
 
  virtual int         SetModule( const char * );
276
 
 
277
 
  virtual OGRFeature *GetFeature( int );
278
 
 
279
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
280
267
};
281
268
 
282
269
/************************************************************************/
285
272
 
286
273
class TigerZipCodes : public TigerFileBase
287
274
{
288
 
 private:
289
 
  TigerRecordInfo    *psRT6Info;
290
 
 
291
275
public:
292
276
                      TigerZipCodes( OGRTigerDataSource *, const char * );
293
 
  virtual            ~TigerZipCodes();
294
 
 
295
 
  virtual int         SetModule( const char * );
296
 
 
297
 
  virtual OGRFeature *GetFeature( int );
298
 
 
299
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
300
277
};
301
278
 
302
279
/************************************************************************/
310
287
class TigerPoint : public TigerFileBase
311
288
{
312
289
 protected:
313
 
                      TigerPoint(int bRequireGeom);
 
290
                      TigerPoint(int bRequireGeom,
 
291
                                 const TigerRecordInfo *psRTInfoIn = NULL,
 
292
                                 const char            *m_pszFileCodeIn = NULL);
314
293
 
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.
320
299
 
321
 
  virtual             ~TigerPoint();
322
 
 
323
300
 private:
324
301
 int                  bRequireGeom;
325
302
 
326
303
 public:
327
 
  virtual int         SetModule( const char *,
328
 
                                 const char *pszFileCode );
329
 
 
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 );
334
308
 
335
309
 
336
 
  virtual OGRErr CreateFeature( OGRFeature      *poFeature,
337
 
                                TigerRecordInfo *psRTInfo,
338
 
                                int nIndex,
339
 
                                const char *pszFileCode );
 
310
  virtual OGRErr CreateFeature( OGRFeature      *poFeature) { return TigerFileBase::CreateFeature(poFeature); } /* to avoid -Woverloaded-virtual warnings */
 
311
  OGRErr CreateFeature( OGRFeature      *poFeature,
 
312
                                int nIndex );
340
313
 
341
314
};
342
315
 
346
319
 
347
320
class TigerLandmarks : public TigerPoint
348
321
{
349
 
 private:
350
 
  TigerRecordInfo    *psRT7Info;
351
 
 
352
322
 public:
353
323
                      TigerLandmarks( OGRTigerDataSource *, const char * );
354
 
  virtual            ~TigerLandmarks();
355
 
 
356
 
  virtual int         SetModule( const char * );
357
324
 
358
325
  virtual OGRFeature *GetFeature( int );
359
326
 
366
333
 
367
334
class TigerAreaLandmarks : public TigerFileBase
368
335
{
369
 
 private:
370
 
  TigerRecordInfo    *psRT8Info;
371
 
 
372
336
public:
373
337
                      TigerAreaLandmarks( OGRTigerDataSource *, const char * );
374
 
  virtual            ~TigerAreaLandmarks();
375
 
 
376
 
  virtual int         SetModule( const char * );
377
 
 
378
 
  virtual OGRFeature *GetFeature( int );
379
 
 
380
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
381
338
};
382
339
 
383
340
/************************************************************************/
386
343
 
387
344
class TigerKeyFeatures : public TigerFileBase
388
345
{
389
 
 private:
390
 
  TigerRecordInfo    *psRT9Info;
391
 
 
392
346
public:
393
347
                      TigerKeyFeatures( OGRTigerDataSource *, const char * );
394
 
  virtual            ~TigerKeyFeatures();
395
 
 
396
 
  virtual int         SetModule( const char * );
397
 
 
398
 
  virtual OGRFeature *GetFeature( int );
399
 
 
400
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
401
348
};
402
349
 
403
350
/************************************************************************/
407
354
class TigerPolygon : public TigerFileBase
408
355
{
409
356
 private:
410
 
  TigerRecordInfo    *psRTAInfo;
411
 
  TigerRecordInfo    *psRTSInfo;
 
357
  const TigerRecordInfo    *psRTAInfo;
 
358
  const TigerRecordInfo    *psRTSInfo;
412
359
 
413
360
  FILE               *fpRTS;
414
361
  int                 bUsingRTS;
432
379
 
433
380
class TigerPolygonCorrections : public TigerFileBase
434
381
{
435
 
 private:
436
 
  TigerRecordInfo    *psRTBInfo;
437
 
 
438
382
public:
439
383
                      TigerPolygonCorrections( OGRTigerDataSource *, const char * );
440
 
  virtual            ~TigerPolygonCorrections();
441
 
 
442
 
  virtual int         SetModule( const char * );
443
 
 
444
 
  virtual OGRFeature *GetFeature( int );
445
 
 
446
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
447
384
};
448
385
 
449
386
/************************************************************************/
452
389
 
453
390
class TigerEntityNames : public TigerFileBase
454
391
{
455
 
 private:
456
 
  TigerRecordInfo    *psRTCInfo;
457
 
 
458
392
public:
459
393
                      TigerEntityNames( OGRTigerDataSource *, const char * );
460
 
  virtual            ~TigerEntityNames();
461
 
 
462
 
  virtual int         SetModule( const char * );
463
 
 
464
 
  virtual OGRFeature *GetFeature( int );
465
 
 
466
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
467
394
};
468
395
 
469
396
/************************************************************************/
472
399
 
473
400
class TigerPolygonEconomic : public TigerFileBase
474
401
{
475
 
 private:
476
 
  TigerRecordInfo    *psRTEInfo;
477
 
 
478
402
public:
479
403
                      TigerPolygonEconomic( OGRTigerDataSource *, const char * );
480
 
  virtual            ~TigerPolygonEconomic();
481
 
 
482
 
  virtual int         SetModule( const char * );
483
 
 
484
 
  virtual OGRFeature *GetFeature( int );
485
 
 
486
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
 
404
 
487
405
};
488
406
 
489
407
/************************************************************************/
492
410
 
493
411
class TigerIDHistory : public TigerFileBase
494
412
{
495
 
 private:
496
 
  TigerRecordInfo    *psRTHInfo;
497
 
 
498
413
public:
499
414
                      TigerIDHistory( OGRTigerDataSource *, const char * );
500
 
  virtual            ~TigerIDHistory();
501
 
 
502
 
  virtual int         SetModule( const char * );
503
 
 
504
 
  virtual OGRFeature *GetFeature( int );
505
 
 
506
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
507
415
};
508
416
 
509
417
/************************************************************************/
512
420
 
513
421
class TigerPolyChainLink : public TigerFileBase
514
422
{
515
 
 private:
516
 
  TigerRecordInfo    *psRTIInfo;
517
 
 
518
423
public:
519
424
                      TigerPolyChainLink( OGRTigerDataSource *, const char * );
520
 
  virtual            ~TigerPolyChainLink();
521
 
 
522
 
  virtual int         SetModule( const char * );
523
 
 
524
 
  virtual OGRFeature *GetFeature( int );
525
 
 
526
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
527
425
};
528
426
 
529
427
/************************************************************************/
532
430
 
533
431
class TigerSpatialMetadata : public TigerFileBase
534
432
{
535
 
 private:
536
 
  TigerRecordInfo    *psRTMInfo;
537
 
 
538
433
public:
539
434
                      TigerSpatialMetadata( OGRTigerDataSource *, const char * );
540
 
  virtual            ~TigerSpatialMetadata();
541
 
 
542
 
  virtual int         SetModule( const char * );
543
 
 
544
 
  virtual OGRFeature *GetFeature( int );
545
 
 
546
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
547
435
};
548
436
 
549
437
/************************************************************************/
552
440
 
553
441
class TigerPIP : public TigerPoint
554
442
{
555
 
 private:
556
 
  TigerRecordInfo    *psRTPInfo;
557
 
 
558
443
public:
559
444
                      TigerPIP( OGRTigerDataSource *, const char * );
560
 
  virtual            ~TigerPIP();
561
 
 
562
 
  virtual int         SetModule( const char * );
563
445
 
564
446
  virtual OGRFeature *GetFeature( int );
565
447
 
572
454
 
573
455
class TigerTLIDRange : public TigerFileBase
574
456
{
575
 
 private:
576
 
  TigerRecordInfo    *psRTRInfo;
577
 
 
578
457
public:
579
458
                      TigerTLIDRange( OGRTigerDataSource *, const char * );
580
 
  virtual            ~TigerTLIDRange();
581
 
 
582
 
  virtual int         SetModule( const char * );
583
 
 
584
 
  virtual OGRFeature *GetFeature( int );
585
 
 
586
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
587
459
};
588
460
 
589
461
/************************************************************************/
592
464
 
593
465
class TigerZeroCellID : public TigerFileBase
594
466
{
595
 
 private:
596
 
  TigerRecordInfo    *psRTTInfo;
597
 
 
598
467
public:
599
468
                      TigerZeroCellID( OGRTigerDataSource *, const char * );
600
 
  virtual            ~TigerZeroCellID();
601
 
 
602
 
  virtual int         SetModule( const char * );
603
 
 
604
 
  virtual OGRFeature *GetFeature( int );
605
 
 
606
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
607
469
};
608
470
 
609
471
/************************************************************************/
612
474
 
613
475
class TigerOverUnder : public TigerPoint
614
476
{
615
 
 private:
616
 
  TigerRecordInfo    *psRTUInfo;
617
 
 
618
477
public:
619
478
                      TigerOverUnder( OGRTigerDataSource *, const char * );
620
 
  virtual            ~TigerOverUnder();
621
 
 
622
 
  virtual int         SetModule( const char * );
623
479
 
624
480
  virtual OGRFeature *GetFeature( int );
625
481
 
632
488
 
633
489
class TigerZipPlus4 : public TigerFileBase
634
490
{
635
 
 private:
636
 
  TigerRecordInfo    *psRTZInfo;
637
 
 
638
491
 public:
639
492
                      TigerZipPlus4( OGRTigerDataSource *, const char * );
640
 
  virtual            ~TigerZipPlus4();
641
 
 
642
 
  virtual int         SetModule( const char * );
643
 
 
644
 
  virtual OGRFeature *GetFeature( int );
645
 
 
646
 
  virtual OGRErr      CreateFeature( OGRFeature *poFeature );
647
493
};
648
494
 
649
495
/************************************************************************/