1 /******************************************************************************
2  * $Id: tigerspatialmetadata.cpp 27745 2014-09-27 16:38:57Z goatbar $
3  *
4  * Project:  TIGER/Line Translator
5  * Purpose:  Implements TigerSpatialMetadata, providing access to .RTM files.
6  * Author:   Frank Warmerdam, warmerdam@pobox.com
7  *
8  ******************************************************************************
9  * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #include "ogr_tiger.h"
31 #include "cpl_conv.h"
32 
33 CPL_CVSID("$Id: tigerspatialmetadata.cpp 27745 2014-09-27 16:38:57Z goatbar $");
34 
35 #define FILE_CODE "M"
36 
37 static const TigerFieldInfo rtM_fields[] = {
38   // fieldname    fmt  type OFTType      beg  end  len  bDefine bSet bWrite
39   { "MODULE",     ' ', ' ', OFTString,     0,   0,   8,       1,   0,     0 },
40   { "TLID",       'R', 'N', OFTInteger,    6,  15,  10,       1,   1,     1 },
41   { "RTSQ",       'R', 'N', OFTInteger,   16,  18,   3,       1,   1,     1 },
42   { "SOURCEID",   'L', 'A', OFTString,    19,  28,  10,       1,   1,     1 },
43   { "ID",         'L', 'A', OFTString,    29,  46,  18,       1,   1,     1 },
44   { "IDFLAG",     'R', 'A', OFTString,    47,  47,   1,       1,   1,     1 },
45   { "RS-M1",      'L', 'A', OFTString,    48,  65,  18,       1,   1,     1 },
46   { "RS-M2",      'L', 'A', OFTString,    66,  67,   2,       1,   1,     1 },
47   { "RS-M3",      'L', 'A', OFTString,    68,  90,  23,       1,   1,     1 }
48 };
49 static const TigerRecordInfo rtM_info =
50   {
51     rtM_fields,
52     sizeof(rtM_fields) / sizeof(TigerFieldInfo),
53     90
54   };
55 
56 /************************************************************************/
57 /*                        TigerSpatialMetadata()                        */
58 /************************************************************************/
59 
TigerSpatialMetadata(OGRTigerDataSource * poDSIn,CPL_UNUSED const char * pszPrototypeModule)60 TigerSpatialMetadata::TigerSpatialMetadata( OGRTigerDataSource * poDSIn,
61                                             CPL_UNUSED const char * pszPrototypeModule ) :
62     TigerFileBase(&rtM_info, FILE_CODE)
63 
64 {
65     poDS = poDSIn;
66     poFeatureDefn = new OGRFeatureDefn( "SpatialMetadata" );
67     poFeatureDefn->Reference();
68     poFeatureDefn->SetGeomType( wkbNone );
69 
70     /* -------------------------------------------------------------------- */
71     /*      Fields from record type H                                       */
72     /* -------------------------------------------------------------------- */
73 
74     AddFieldDefns(psRTInfo, poFeatureDefn);
75 }
76