14#ifndef GDAL_JP2READER_H_INCLUDED
15#define GDAL_JP2READER_H_INCLUDED
29class CPL_DLL GDALJP2Box
34 char szBoxType[5]{0, 0, 0, 0, 0};
41 GByte abyUUID[16]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
43 std::vector<GByte> abyData{};
45 bool m_bAllowGetFileSize =
true;
50 explicit GDALJP2Box(
VSILFILE * =
nullptr);
53 void SetAllowGetFileSize(
bool b)
55 m_bAllowGetFileSize = b;
64 int ReadFirstChild(GDALJP2Box *poSuperBox);
65 int ReadNextChild(GDALJP2Box *poSuperBox);
93 int DumpReadable(FILE *,
int nIndentLevel = 0);
100 const GByte *GetUUID()
106 void SetType(
const char *);
107 void SetWritableData(
int nLength,
const GByte *pabyData);
108 void AppendWritableData(
int nLength,
const void *pabyDataIn);
109 void AppendUInt32(
GUInt32 nVal);
110 void AppendUInt16(
GUInt16 nVal);
111 void AppendUInt8(
GByte nVal);
113 const GByte *GetWritableData()
const
115 return abyData.data();
118 GByte *GetWritableBoxData()
const;
121 static GDALJP2Box *CreateSuperBox(
const char *pszType,
int nCount,
122 const GDALJP2Box *
const *papoBoxes);
123 static GDALJP2Box *CreateAsocBox(
int nCount,
124 const GDALJP2Box *
const *papoBoxes);
125 static GDALJP2Box *CreateLblBox(
const char *pszLabel);
126 static GDALJP2Box *CreateLabelledXMLAssoc(
const char *pszLabel,
128 static GDALJP2Box *CreateUUIDBox(
const GByte *pabyUUID,
int nDataSize,
129 const GByte *pabyData);
132 static GDALJP2Box *CreateJUMBFDescriptionBox(
const GByte *pabyUUIDType,
133 const char *pszLabel);
134 static GDALJP2Box *CreateJUMBFBox(
const GDALJP2Box *poJUMBFDescriptionBox,
136 const GDALJP2Box *
const *papoBoxes);
143typedef struct _GDALJP2GeoTIFFBox GDALJP2GeoTIFFBox;
145class CPL_DLL GDALJP2Metadata
149 void CollectGMLData(GDALJP2Box *);
150 int GMLSRSLookup(
const char *pszURN);
152 int nGeoTIFFBoxesCount;
153 GDALJP2GeoTIFFBox *pasGeoTIFFBoxes;
158 void GetGMLJP2GeoreferencingInfo(
int &nEPSGCode,
double adfOrigin[2],
159 double adfXVector[2],
double adfYVector[2],
160 const char *&pszComment,
161 CPLString &osDictBox,
bool &bNeedAxisFlip);
163 int bMainMDDomainOnly);
168 char **papszGMLMetadata;
170 bool m_bHaveGeoTransform{};
181 char **papszMetadata;
182 char *pszXMPMetadata;
183 char *pszGDALMultiDomainMetadata;
186 void ReadBox(
VSILFILE *fpVSIL, GDALJP2Box &oBox,
int &iBox);
194 int ParseJP2GeoTIFF();
196 int ParseGMLCoverageDesc();
198 int ReadAndParse(
VSILFILE *fpVSIL,
int nGEOJP2Index = 0,
199 int nGMLJP2Index = 1,
int nMSIGIndex = 2,
200 int *pnIndexUsed =
nullptr);
201 int ReadAndParse(
const char *pszFilename,
int nGEOJP2Index = 0,
202 int nGMLJP2Index = 1,
int nMSIGIndex = 2,
203 int nWorldFileIndex = 3,
int *pnIndexUsed =
nullptr);
208 void SetGCPs(
int,
const GDAL_GCP *);
211 GDALJP2Box *CreateJP2GeoTIFF();
212 GDALJP2Box *CreateGMLJP2(
int nXSize,
int nYSize);
213 GDALJP2Box *CreateGMLJP2V2(
int nXSize,
int nYSize,
214 const char *pszDefFilename,
218 CreateGDALMultiDomainMetadataXMLBox(
GDALDataset *poSrcDS,
219 int bMainMDDomainOnly);
220 static GDALJP2Box **CreateXMLBoxes(
GDALDataset *poSrcDS,
int *pnBoxes);
221 static GDALJP2Box *CreateXMPBox(
GDALDataset *poSrcDS);
222 static GDALJP2Box *CreateIPRBox(
GDALDataset *poSrcDS);
223 static int IsUUID_MSI(
const GByte *abyUUID);
224 static int IsUUID_XMP(
const GByte *abyUUID);
232const char CPL_DLL *GDALGetJPEG2000Reversibility(
const char *pszFilename,
Convenient string class based on std::string.
Definition cpl_string.h:338
A set of associated raster bands, usually from one file.
Definition gdal_dataset.h:77
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition ogr_spatialref.h:152
Various convenience functions for CPL.
Definitions for CPL mini XML Parser/Serializer.
unsigned int GUInt32
Unsigned int32 type.
Definition cpl_port.h:157
#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:1101
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1252
unsigned short GUInt16
Unsigned int16 type.
Definition cpl_port.h:163
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:165
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:195
GUIntBig vsi_l_offset
Type for a file offset.
Definition cpl_vsi.h:136
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:2352
This file is legacy since GDAL 3.12, but will be kept at least in the whole GDAL 3....
Document node structure.
Definition cpl_minixml.h:54
Ground Control Point.
Definition gdal.h:1261
Virtual file handle.
Definition cpl_vsi_virtual.h:48