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 GByte *pabyData =
nullptr;
45 bool m_bAllowGetFileSize =
true;
50 explicit GDALJP2Box(
VSILFILE * =
nullptr);
53 void SetAllowGetFileSize(
bool b)
55 m_bAllowGetFileSize = b;
58 int SetOffset(
GIntBig nNewOffset);
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
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);
162 static CPLXMLNode *CreateGDALMultiDomainMetadataXML(GDALDataset *poSrcDS,
163 int bMainMDDomainOnly);
168 char **papszGMLMetadata;
170 bool m_bHaveGeoTransform{};
171 GDALGeoTransform m_gt{};
174 OGRSpatialReference m_oSRS{};
177 GDAL_GCP *pasGCPList;
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);
206 void SetSpatialRef(
const OGRSpatialReference *poSRS);
207 void SetGeoTransform(
const GDALGeoTransform >);
208 void SetGCPs(
int,
const GDAL_GCP *);
209 void SetRPCMD(
char **papszRPCMDIn);
211 GDALJP2Box *CreateJP2GeoTIFF();
212 GDALJP2Box *CreateGMLJP2(
int nXSize,
int nYSize);
213 GDALJP2Box *CreateGMLJP2V2(
int nXSize,
int nYSize,
214 const char *pszDefFilename,
215 GDALDataset *poSrcDS);
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);
226 static bool IsSRSCompatible(
const OGRSpatialReference *poSRS);
232const char CPL_DLL *GDALGetJPEG2000Reversibility(
const char *pszFilename,
Various convenience functions for CPL.
Definitions for CPL mini XML Parser/Serializer.
unsigned int GUInt32
Unsigned int32 type.
Definition cpl_port.h:167
#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:936
char ** CSLConstList
Type of a constant null-terminated list of nul terminated strings.
Definition cpl_port.h:1087
unsigned short GUInt16
Unsigned int16 type.
Definition cpl_port.h:173
unsigned char GByte
Unsigned byte type.
Definition cpl_port.h:175
long long GIntBig
Large signed integer type (generally 64-bit integer type).
Definition cpl_port.h:205
struct VSIVirtualHandle VSILFILE
Opaque type for a FILE that implements the VSIVirtualHandle API.
Definition cpl_vsi.h:141
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:2344
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