1 : /******************************************************************************
2 : * $Id: tigeroverunder.cpp 22961 2011-08-20 17:09:59Z rouault $
3 : *
4 : * Project: TIGER/Line Translator
5 : * Purpose: Implements TigerOverUnder, providing access to .RTU files.
6 : * Author: Mark Phillips, mbp@geomtech.com
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2002, Frank Warmerdam, Mark Phillips
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: tigeroverunder.cpp 22961 2011-08-20 17:09:59Z rouault $");
34 :
35 : #define FILE_CODE "U"
36 :
37 : static const TigerFieldInfo rtU_fields[] = {
38 : // fieldname fmt type OFTType beg end len bDefine bSet bWrite
39 : { "MODULE", ' ', ' ', OFTString, 0, 0, 8, 1, 0, 0 },
40 : { "FILE", 'L', 'N', OFTInteger, 6, 10, 5, 1, 1, 1 },
41 : { "TZID", 'R', 'N', OFTInteger, 11, 20, 10, 1, 1, 1 },
42 : { "RTSQ", 'R', 'N', OFTInteger, 21, 21, 1, 1, 1, 1 },
43 : { "TLIDOV1", 'R', 'N', OFTInteger, 22, 31, 10, 1, 1, 1 },
44 : { "TLIDOV2", 'R', 'N', OFTInteger, 32, 41, 10, 1, 1, 1 },
45 : { "TLIDUN1", 'R', 'N', OFTInteger, 42, 51, 10, 1, 1, 1 },
46 : { "TLIDUN2", 'R', 'N', OFTInteger, 52, 61, 10, 1, 1, 1 },
47 : { "FRLONG", 'R', 'N', OFTInteger, 62, 71, 10, 1, 1, 1 },
48 : { "FRLAT", 'R', 'N', OFTInteger, 72, 80, 9, 1, 1, 1 },
49 : };
50 : static const TigerRecordInfo rtU_info =
51 : {
52 : rtU_fields,
53 : sizeof(rtU_fields) / sizeof(TigerFieldInfo),
54 : 80
55 : };
56 :
57 :
58 : /************************************************************************/
59 : /* TigerOverUnder() */
60 : /************************************************************************/
61 :
62 7 : TigerOverUnder::TigerOverUnder( OGRTigerDataSource * poDSIn,
63 7 : const char * pszPrototypeModule ) : TigerPoint(TRUE, &rtU_info, FILE_CODE)
64 : {
65 7 : poDS = poDSIn;
66 7 : poFeatureDefn = new OGRFeatureDefn( "OverUnder" );
67 7 : poFeatureDefn->Reference();
68 7 : poFeatureDefn->SetGeomType( wkbNone );
69 :
70 7 : AddFieldDefns( psRTInfo, poFeatureDefn );
71 :
72 7 : }
73 :
74 0 : OGRFeature *TigerOverUnder::GetFeature( int nRecordId )
75 : {
76 : return TigerPoint::GetFeature( nRecordId,
77 : 62, 71,
78 0 : 72, 80 );
79 : }
80 :
81 0 : OGRErr TigerOverUnder::CreateFeature( OGRFeature *poFeature )
82 : {
83 : return TigerPoint::CreateFeature( poFeature,
84 0 : 62 );
85 : }
|