1 /******************************************************************************
2  * $Id: rpftoclib.h b1c9c12ad373e40b955162b45d704070d4ebf7b0 2019-06-19 16:50:15 +0200 Even Rouault $
3  *
4  * Project:  RPF A.TOC read Library
5  * Purpose:  Main GDAL independent include file for RPF TOC support.
6  * Author:   Even Rouault, even.rouault at spatialys.com
7  *
8  **********************************************************************
9  * Copyright (c) 2007-2010, Even Rouault <even dot rouault at spatialys.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 #ifndef RPFTOCLIB_H_INCLUDED
31 #define RPFTOCLIB_H_INCLUDED
32 
33 #include "cpl_error.h"
34 #include "cpl_port.h"
35 
36 #include "nitflib.h"
37 
38 CPL_C_START
39 
40 typedef struct
41 {
42   int              exists;
43   int              fileExists;
44   unsigned short   frameRow;
45   unsigned short   frameCol;
46   char            *directory;
47   char             filename[12+1];
48   char             georef[6+1];
49   char            *fullFilePath;
50 } RPFTocFrameEntry;
51 
52 typedef struct
53 {
54     char          type[5+1];
55     char          compression[5+1];
56     char          scale[12+1];
57     char          zone[1+1];
58     char          producer[5+1];
59     double        nwLat;
60     double        nwLong;
61     double        swLat;
62     double        swLong;
63     double        neLat;
64     double        neLong;
65     double        seLat;
66     double        seLong;
67     double        vertResolution;
68     double        horizResolution;
69     double        vertInterval;
70     double        horizInterval;
71     unsigned int  nVertFrames;
72     unsigned int  nHorizFrames;
73 
74     int           boundaryId;
75     int           isOverviewOrLegend;
76 
77     const char*   seriesAbbreviation;  /* (may be NULL) eg "GNC" */
78     const char*   seriesName;          /* (may be NULL) eg "Global Navigation Chart" */
79 
80     RPFTocFrameEntry* frameEntries;
81 } RPFTocEntry;
82 
83 typedef struct
84 {
85     int            nEntries;
86     RPFTocEntry  *entries;
87 } RPFToc;
88 
89 /* -------------------------------------------------------------------- */
90 /*      TOC file API                                                    */
91 /* -------------------------------------------------------------------- */
92 
93 /** Get the TOC information from a NITF TOC file */
94 RPFToc     CPL_DLL *RPFTOCRead(const char* pszFilename, NITFFile* psFile);
95 
96 /** Get the TOC information from a NITF TOC file or a non NITF TOC file */
97 RPFToc     CPL_DLL *RPFTOCReadFromBuffer(const char* pszFilename, VSILFILE* fp, const char* tocHeader);
98 
99 void       CPL_DLL  RPFTOCFree(RPFToc*  nitfToc);
100 
101 CPL_C_END
102 
103 #endif /* ndef RPFTOCLIB_H_INCLUDED */
104