31 #ifndef GDAL_JP2READER_H_INCLUDED
32 #define GDAL_JP2READER_H_INCLUDED
46 class CPL_DLL GDALJP2Box
51 char szBoxType[5]{0, 0, 0, 0, 0};
58 GByte abyUUID[16]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
60 GByte *pabyData =
nullptr;
62 bool m_bAllowGetFileSize =
true;
67 explicit GDALJP2Box(
VSILFILE * =
nullptr);
70 void SetAllowGetFileSize(
bool b)
72 m_bAllowGetFileSize = b;
75 int SetOffset(
GIntBig nNewOffset);
81 int ReadFirstChild(GDALJP2Box *poSuperBox);
82 int ReadNextChild(GDALJP2Box *poSuperBox);
101 const char *GetType()
106 GByte *ReadBoxData();
110 int DumpReadable(FILE *,
int nIndentLevel = 0);
117 const GByte *GetUUID()
123 void SetType(
const char *);
124 void SetWritableData(
int nLength,
const GByte *pabyData);
125 void AppendWritableData(
int nLength,
const void *pabyDataIn);
126 void AppendUInt32(
GUInt32 nVal);
127 void AppendUInt16(
GUInt16 nVal);
128 void AppendUInt8(
GByte nVal);
130 const GByte *GetWritableData()
const
135 GByte *GetWritableBoxData()
const;
138 static GDALJP2Box *CreateSuperBox(
const char *pszType,
int nCount,
139 const GDALJP2Box *
const *papoBoxes);
140 static GDALJP2Box *CreateAsocBox(
int nCount,
141 const GDALJP2Box *
const *papoBoxes);
142 static GDALJP2Box *CreateLblBox(
const char *pszLabel);
143 static GDALJP2Box *CreateLabelledXMLAssoc(
const char *pszLabel,
145 static GDALJP2Box *CreateUUIDBox(
const GByte *pabyUUID,
int nDataSize,
146 const GByte *pabyData);
149 static GDALJP2Box *CreateJUMBFDescriptionBox(
const GByte *pabyUUIDType,
150 const char *pszLabel);
151 static GDALJP2Box *CreateJUMBFBox(
const GDALJP2Box *poJUMBFDescriptionBox,
153 const GDALJP2Box *
const *papoBoxes);
160 typedef struct _GDALJP2GeoTIFFBox GDALJP2GeoTIFFBox;
162 class CPL_DLL GDALJP2Metadata
166 void CollectGMLData(GDALJP2Box *);
167 int GMLSRSLookup(
const char *pszURN);
169 int nGeoTIFFBoxesCount;
170 GDALJP2GeoTIFFBox *pasGeoTIFFBoxes;
175 void GetGMLJP2GeoreferencingInfo(
int &nEPSGCode,
double adfOrigin[2],
176 double adfXVector[2],
double adfYVector[2],
177 const char *&pszComment,
178 CPLString &osDictBox,
bool &bNeedAxisFlip);
180 int bMainMDDomainOnly);
185 char **papszGMLMetadata;
187 bool bHaveGeoTransform;
188 double adfGeoTransform[6];
198 char **papszMetadata;
199 char *pszXMPMetadata;
200 char *pszGDALMultiDomainMetadata;
203 void ReadBox(
VSILFILE *fpVSIL, GDALJP2Box &oBox,
int &iBox);
211 int ParseJP2GeoTIFF();
213 int ParseGMLCoverageDesc();
215 int ReadAndParse(
VSILFILE *fpVSIL,
int nGEOJP2Index = 0,
216 int nGMLJP2Index = 1,
int nMSIGIndex = 2,
217 int *pnIndexUsed =
nullptr);
218 int ReadAndParse(
const char *pszFilename,
int nGEOJP2Index = 0,
219 int nGMLJP2Index = 1,
int nMSIGIndex = 2,
220 int nWorldFileIndex = 3,
int *pnIndexUsed =
nullptr);
224 void SetGeoTransform(
double *);
225 void SetGCPs(
int,
const GDAL_GCP *);
226 void SetRPCMD(
char **papszRPCMDIn);
228 GDALJP2Box *CreateJP2GeoTIFF();
229 GDALJP2Box *CreateGMLJP2(
int nXSize,
int nYSize);
230 GDALJP2Box *CreateGMLJP2V2(
int nXSize,
int nYSize,
231 const char *pszDefFilename,
235 CreateGDALMultiDomainMetadataXMLBox(
GDALDataset *poSrcDS,
236 int bMainMDDomainOnly);
237 static GDALJP2Box **CreateXMLBoxes(
GDALDataset *poSrcDS,
int *pnBoxes);
238 static GDALJP2Box *CreateXMPBox(
GDALDataset *poSrcDS);
239 static GDALJP2Box *CreateIPRBox(
GDALDataset *poSrcDS);
240 static int IsUUID_MSI(
const GByte *abyUUID);
241 static int IsUUID_XMP(
const GByte *abyUUID);
249 const char CPL_DLL *GDALGetJPEG2000Reversibility(
const char *pszFilename,
Convenient string class based on std::string.
Definition: cpl_string.h:320
A set of associated raster bands, usually from one file.
Definition: gdal_priv.h:503
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:169
Various convenience functions for CPL.
Definitions for CPL mini XML Parser/Serializer.
unsigned int GUInt32
Unsigned int32 type.
Definition: cpl_port.h:177
#define CPL_DISALLOW_COPY_ASSIGN(ClassName)
Helper to remove the copy and assignment constructors so that the compiler will not generate the defa...
Definition: cpl_port.h:1042
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition: cpl_port.h:1183
unsigned short GUInt16
Unsigned int16 type.
Definition: cpl_port.h:183
unsigned char GByte
Unsigned byte type.
Definition: cpl_port.h:185
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition: cpl_port.h:215
Public (C callable) GDAL entry points.
CPLXMLNode * GDALGetJPEG2000Structure(const char *pszFilename, CSLConstList papszOptions)
Dump the structure of a JPEG2000 file as a XML tree.
Definition: gdaljp2structure.cpp:2364
Document node structure.
Definition: cpl_minixml.h:71
Ground Control Point.
Definition: gdal.h:1075
Virtual file handle.
Definition: cpl_vsi_virtual.h:63